Inheritance as Implicit Coercion

Abstract We present a method for providing semantic interpretations for languages with a type system featuring inheritance polymorphism. Our approach is illustrated on an extension of the language Fun of Cardelli and Wegner, which we interpret via a translation into an extended polymorphic lambda calculus. Our goal is to interpret inheritances in Fun via coercion functions which are definable in the target of the translation. Existing techniques in the theory of semantic domains can be then used to interpret the extended polymorphic lambda calculus, thus providing many models for the original language. This technique makes it possible to model a rich type discipline which includes parametric polymorphism and recursive types as well as inheritance. A central difficulty in providing interpretations for explicit type disciplines featuring inheritance in the sense discussed in this paper arises from the fact that programs can type-check in more than one way. Since interpretations follow the type-checking derivations, coherence theorems are required: that is, one must prove that the meaning of a program does not depend on the way it was type-checked. Proofs of such theorems for our proposed interpretation are the basic technical results of this paper. Interestingly, proving coherence in the presence of recursive types, variants, and abstract types forced us to reexamine fundamental equational properties that arise in proof theory (in the form of commutative reductions) and domain theory (in the form of strict vs. non-strict functions).

[1]  Mario Coppo,et al.  Type inference and logical relations , 1986, LICS.

[2]  Luca Cardelli,et al.  Typeful Programming , 1989, Formal Description of Programming Concepts.

[3]  Peter Hilton,et al.  Category Theory, Homology Theory and their Applications II , 1969 .

[4]  Luca Cardelli. Amber Combinators and Functional Programming Languages , 1985, Lecture Notes in Computer Science.

[5]  Ryan Stansifer,et al.  Type inference with subtypes , 1988, POPL '88.

[6]  Peter Buneman,et al.  Type inference in a database programming language , 1988, LISP and Functional Programming.

[7]  Thierry Coquand,et al.  INHERITANCE AND EXPLICIT COERCION (Preliminary Report) , 1989, LICS 1989.

[8]  John C. Reynolds,et al.  Using category theory to design implicit conversions and generic operators , 1980, Semantics-Directed Compiler Generation.

[9]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[10]  M. Nivat Fiftieth volume of theoretical computer science , 1988 .

[11]  Thierry Coquand,et al.  The Calculus of Constructions , 1988, Inf. Comput..

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

[13]  John C. Mitchell,et al.  ML with extended pattern matching and subtypes , 1988, LISP and Functional Programming.

[14]  William R. Cook,et al.  Inheritance is not subtyping , 1989, POPL '90.

[15]  Robert Cartwright,et al.  Types as intervals , 1985, POPL.

[16]  Val Tannen,et al.  Computing with coercions , 1990, LISP and Functional Programming.

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

[18]  Jean-Pierre Jouannaud,et al.  Operational Semantics for Order-Sorted Algebra , 1985, ICALP.

[19]  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.

[20]  Patrick Lincoln,et al.  Linear logic , 1992, SIGA.

[21]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Information and Computation.

[22]  Peter J. Freyd,et al.  Recursive types reduced to inductive types , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[23]  Saunders MacLane,et al.  Coherence for bicategories and indexed categories , 1985 .

[24]  Axel Poigné,et al.  A Note on Inconsistencies Caused by Fixpoints in a Cartesian Closed Category , 1990, Theor. Comput. Sci..

[25]  Andrew M. Pitts,et al.  The theory of constructions: Categorical semantics and topos-theoretic models , 1987 .

[26]  Kim B. Bruce,et al.  An Algebraic Model of Subtype and Inheritance , 1990, DBPL.

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

[28]  G. M. Kelly,et al.  Coherence in closed categories , 1971 .

[29]  A. Jung,et al.  Coherence and consistency in domains , 1990, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[30]  Luca Cardelli,et al.  Structural subtyping and the notion of power type , 1988, POPL '88.

[31]  Thierry Coquand,et al.  Extensional Models for Polymorphism , 1987, Theor. Comput. Sci..

[32]  Felice Cardone,et al.  Relational Semantics for Recursive Types and Bounded Quantification , 1989, ICALP.

[33]  Thierry Coquand,et al.  Categories of embeddings , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[34]  Thomas Ehrhard,et al.  An Equational Presentation of Higher Order Logic , 1987, Category Theory and Computer Science.

[35]  Christiaan Peter Jozef Koymans,et al.  Models of the Lambda Calculus , 1982, Inf. Control..

[36]  John C. Mitchell Toward a typed foundation for method specialization and inheritance , 1989, POPL '90.

[37]  F. W. Lawvere,et al.  Diagonal arguments and cartesian closed categories , 1969 .

[38]  Kim B. Bruce,et al.  The Finitary Projection Model for Second Order Lambda Calculus and Solutions to Higher Order Domain Equations , 1986, LICS.

[39]  Albert R. Meyer,et al.  What is a Model of the Lambda Calculus? , 1982, Inf. Control..

[40]  Jean-Yves Girard,et al.  The System F of Variable Types, Fifteen Years Later , 1986, Theor. Comput. Sci..

[41]  Val Tannen,et al.  Denotational Semantics for Subtyping Between Recursive Types , 1989 .

[42]  A. Troelstra Metamathematical investigation of intuitionistic arithmetic and analysis , 1973 .

[43]  Jean-Yves Girard,et al.  Normal functors, power series and λ-calculus , 1988, Ann. Pure Appl. Log..

[44]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[45]  Mitchell Wand,et al.  Complete Type Inference for Simple Objects , 1987, LICS.

[46]  J. Girard,et al.  Proofs and types , 1989 .

[47]  José Meseguer,et al.  Order-Sorted Algebra I: Equational Deduction for Multiple Inheritance, Overloading, Exceptions and Partial Operations , 1992, Theor. Comput. Sci..

[48]  Giuseppe Rosolini,et al.  Extensional PERs , 1992, Inf. Comput..

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

[50]  Glynn Winskel,et al.  DI-Domains as a Model of Polymorphism , 1987, MFPS.

[51]  Carl A. Gunter,et al.  Coherence and Consistency in Domains (Extended Outline) , 1988, LICS.

[52]  Glynn Winskel,et al.  Domain Theoretic Models of Polymorphism , 1989, Inf. Comput..

[53]  Mario Coppo,et al.  A Completeness Theorem for Recursively Defined Types , 1985, ICALP.

[54]  Thomas Streicher,et al.  Correctness and completeness of a categorical semantics of the calculus of constructions , 1989 .

[55]  Giorgio Ghelli,et al.  Coherence of Subsumption , 1990, CAAP.

[56]  Simon Martini Bounded quantifiers have interval models , 1988, LFP '88.