Positive subtyping

The statement <italic>S</italic>≤<italic>T</italic> in a λ-calculus with subtyping is traditionally interpreted by a semantic coercion function of type [[<italic>S</italic>]]→[[<italic>T</italic>]] that extracts the “<italic>T</italic> part” of an element of <italic>S</italic>. If the subtyping relation is restricted to covariant positions, this interpretation may be enriched to include both the implicit coercion and an overwriting function <italic>put</italic>[<italic>S,T</italic>] <inline-equation> <f>∈</f> <?pub Caret> </inline-equation> [[<italic>S</italic>]]→[[<italic>T</italic>]]→[[<italic>S</italic>]] that updates the <italic>T</italic> part of an element of <italic>S</italic>. We give a realizability model and a sound equational theory for a second-order calculus of positive subtyping. Though weaker than familiar calculi of bounded quantification, positive subtyping retains sufficient power to model objects, encapsulation, and message passing. Moreover, inheritance may be implemented very straightforwardly in this setting, using the <italic>put</italic> functions arising from ordinary subtyping of records in place of the sophisticated systems of record extension and update often used for this purpose. The equational laws relating the behavior of coercions and <italic>put</italic> functions can be used to prove simple properties of the resulting classes in such a way that proofs for superclasses are “inherited” by subclasses.

[1]  Samuel N. Kamin,et al.  Two semantic models of object-oriented languages , 1994 .

[2]  Luca Cardelli,et al.  Operations on records , 1989, Mathematical Structures in Computer Science.

[3]  Kim B. Bruce Safe type checking in a statically-typed object-oriented programming language , 1993, POPL '93.

[4]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[5]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

[6]  Roberto M. Amadio,et al.  Recursion over Realizability Structures , 1991, Inf. Comput..

[7]  Giorgio Ghelli,et al.  Coherence of Subsumption, Minimum Typing and Type-Checking in F<= , 1992, Math. Struct. Comput. Sci..

[8]  de Ng Dick Bruijn,et al.  Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem , 1972 .

[9]  Benjamin C. Pierce,et al.  Object-oriented programming without recursive types , 1993, POPL '93.

[10]  Gary T. Leavens,et al.  Inheritance of interface specifications (extended abstract) , 1994, IDL '94.

[11]  John C. Mitchell,et al.  Notes on Typed Object-Oriented Programming , 1994, TACS.

[12]  William R. Cook,et al.  A denotational semantics of inheritance , 1989 .

[13]  Kim B. Bruce,et al.  A Modest Model of Records, Inheritance and Bounded Quantification , 1990, Inf. Comput..

[14]  John C. Mitchell,et al.  Theoretical aspects of object-oriented programming: types, semantics, and language design , 1994, Choice Reviews Online.

[15]  Benjamin C. Pierce,et al.  Bounded Quantification is Undecidable , 1994, Inf. Comput..

[16]  Carl A. Gunter Semantics of programming languages: structures and techniques , 1993, Choice Reviews Online.

[17]  Frank J. Oles,et al.  Type Algebras, Functor Categories, and Block Structure , 1986 .

[18]  Martín Abadi,et al.  A PER model of polymorphism and recursive types , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[19]  Thierry Coquand,et al.  Inheritance as Implicit Coercion , 1991, Inf. Comput..

[20]  Benjamin C. Pierce,et al.  Higher-Order Subtyping , 1994, Theor. Comput. Sci..

[21]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[22]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Inf. Comput..

[23]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1994, Inf. Comput..

[24]  Luca Cardelli,et al.  Extensible records in a pure calculus of subtyping , 1994 .

[25]  Kim B. Bruce,et al.  A modest model of records, inheritance and bounded quantification , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[26]  Adriana B. Compagnoni,et al.  Decidability of Higher-Order Subtyping with Intersection Types , 1994, CSL.

[27]  Andrew Donald Gordon,et al.  Functional programming and input/output , 1995 .

[28]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[29]  Gary T. Leavens Inheritance of interface specifications (extended abstract) , 1994 .

[30]  Luca Cardelli,et al.  A semantic basis for quest , 1990, Journal of Functional Programming.

[31]  Kim B. Bruce A paradigmatic object-oriented programming language: Design, static typing and semantics , 1994, Journal of Functional Programming.

[32]  Martín Abadi,et al.  A Theory of Primitive Objects - Untyped and First-Order Systems , 1994, TACS.