Programming with intersection types and bounded polymorphism

This thesis unifies and extends prior work on intersection types and bounded quantification, previously studied only in isolation, by investigating theoretical and practical aspects of a typed $\lambda$-calculus incorporating both. The practical utility of this calculus, called $F\sb{\wedge}$, is established by examples showing, for instance, that it allows a rich form of "coherent overloading" and supports an analog of abstract interpretation during typechecking. More familiar programming examples are presented in terms of an extension of Forsythe, demonstrating how parametric polymorphism can be used to simplify and generalize Forsythe's design. We discuss the novel programming and debugging styles that arise in $F\sb{\wedge}$. We prove the correctness of a simple semi-decision procedure for the subtype relation and the partial correctness of an algorithm for synthesizing minimal types of $F\sb{\wedge}$ terms. Our main tool in this analysis is a notion of "canonical types," which allow proofs to be factored so that intersections are handled separately from the other type constructors. A pair of negative results illustrates some subtle complexities of $F\sb{\wedge}$. First, the subtype relation of $F\sb{\wedge}$ is shown to be undecidable. Second, the failure of an important technical property of the subtype relation--the existence of least upper bounds--indicates that typed semantic models of $F\sb{\wedge}$ will be more difficult to construct and analyze than the known typed models of intersection types. We study the semantics of $F\sb{\wedge}$ from several points of view. An untyped model based on partial equivalence relations demonstrates the consistency of the typing rules and provides a simple interpretation for programs, where "$\sigma$ is a subtype of $\tau$" is read as "$\sigma$ is a subset of $\tau$." More refined models can be obtained using a translation from $F\sb{\wedge}$ into the pure polymorphic $\lambda$-calculus; in these models, "$\sigma$ is a subtype of $\tau$" is interpreted by an explicit coercion function from $\sigma$ to $\tau$. The nonexistence of least upper bounds shows up here in the failure of known techniques for proving the coherence of the translation semantics. Finally, an equational theory of equivalences between $F\sb{\wedge}$ terms is presented and its soundness for both styles of model is verified. (Abstract shortened with permission of author.)

[1]  Alonzo Church,et al.  A formulation of the simple theory of types , 1940, Journal of Symbolic Logic.

[2]  A. Church The calculi of lambda-conversion , 1941 .

[3]  H. B. Curry,et al.  Combinatory Logic, Volume I. , 1961 .

[4]  Revised report on the algorithmic language ALGOL 60 , 1963, Comput. J..

[5]  Friedrich L. Bauer,et al.  Revised report on the algorithm language ALGOL 60 , 1963, CACM.

[6]  Kristen Nygaard,et al.  SIMULA: an ALGOL-based simulation language , 1966, CACM.

[7]  S. Lane Categories for the Working Mathematician , 1971 .

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

[9]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

[10]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[11]  Dana S. Scott,et al.  Data Types as Lattices , 1976, SIAM J. Comput..

[12]  P. Sallé Une extension de la theorie des types en λ-calcul , 1978 .

[13]  Mariangiola Dezani-Ciancaglini,et al.  A new type assignment for λ-terms , 1978, Arch. Math. Log..

[14]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[15]  O. J. Dahl,et al.  Simula Begin , 1979 .

[16]  M. Coppo,et al.  Functional Characterization of Some Semantic Equalities inside Lambda-Calculus , 1979, ICALP.

[17]  Jeffrey D. Ullman,et al.  Introduction to Automata Theory, Languages and Computation , 1979 .

[18]  G. Pottinger,et al.  A type assignment for the strongly normalizable |?-terms , 1980 .

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

[20]  Mariangiola Dezani-Ciancaglini,et al.  An extension of the basic functionality theory for the λ-calculus , 1980, Notre Dame J. Formal Log..

[21]  Mario Coppo,et al.  Principal type-schemes and lambda-calculus semantics , 1980 .

[22]  Mariangiola Dezani-Ciancaglini,et al.  Functional Characters of Solvable Terms , 1981, Math. Log. Q..

[23]  J. Roger Hindley,et al.  The simple semantics for Coppe-Dezani-Sallé types , 1982, Symposium on Programming.

[24]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[25]  Mariangiola Dezani-Ciancaglini,et al.  A filter lambda model and the completeness of type assignment , 1983, Journal of Symbolic Logic.

[26]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

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

[28]  Mariangiola Dezani-Ciancaglini,et al.  F-Semantics for Intersection Type Discipline , 1984, Semantics of Data Types.

[29]  M. Dezani-Ciancaglini,et al.  Extended Type Structures and Filter Lambda Models , 1984 .

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

[31]  Simona Ronchi Della Rocca,et al.  Principal Type Schemes for an Extended Type Theory , 1984, Theor. Comput. Sci..

[32]  John C. Reynolds,et al.  Three Approaches to Type Structure , 1985, TAPSOFT, Vol.1.

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

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

[35]  T. Coquand Une théorie des constructions , 1985 .

[36]  Corrado Böhm,et al.  Automatic Synthesis of Typed Lambda-Programs on Term Algebras , 1985, Theor. Comput. Sci..

[37]  Luca Cardelli,et al.  Typechecking Dependent Types and Subtypes , 1986, Foundations of Logic and Functional Programming.

[38]  John C. Mitchell A type-inference approach to reduction properties and semantics of polymorphic expressions (summary) , 1986, LFP '86.

[39]  Mariangiola Dezani-Ciancaglini,et al.  A Characterization of F-Complete Type Assignments , 1986, Theor. Comput. Sci..

[40]  Bernard Robinet,et al.  Combinators and Functional Programming Languages , 1986 .

[41]  Chris Hankin,et al.  Strictness Analysis for Higher-Order Functions , 1986, Sci. Comput. Program..

[42]  Daniel Leivant,et al.  Typing and Computational Properties of Lambda Expressions , 1986, Theor. Comput. Sci..

[43]  R. A. G. Seely,et al.  Categorical semantics for higher order polymorphic lambda calculus , 1987, Journal of Symbolic Logic.

[44]  M. Coppo Type theories, normal forms, and D?-lambda-models*1 , 1987 .

[45]  Mariangiola Dezani-Ciancaglini,et al.  Type Theories, Normal Forms and D_\infty-Lambda-Models , 1987, Inf. Comput..

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

[47]  Simona Ronchi Della Rocca,et al.  Principal Type Scheme and Unification for Intersection Type Discipline , 1988, Theor. Comput. Sci..

[48]  Paola Giannini,et al.  Characterization of typings in polymorphic type discipline , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[49]  John C. Reynolds,et al.  Preliminary design of the programming language Forsythe , 1988 .

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

[51]  John C. Mitchell,et al.  Abstract types have existential type , 1988, TOPL.

[52]  M. Wand,et al.  Corrigendum: complete type interference for simple objects , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[53]  John C. Mitchell,et al.  The essence of ML , 1988, POPL '88.

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

[55]  Frank Pfenning,et al.  Partial polymorphic type inference and higher-order unification , 1988, LISP and Functional Programming.

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

[57]  Harold T. Hodes,et al.  The | lambda-Calculus. , 1988 .

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

[59]  Uday S. Reddy,et al.  Objects as closures: abstract semantics of object-oriented languages , 1988, LISP and Functional Programming.

[60]  John C. Mitchell,et al.  Polymorphic Type Inference and Containment , 1988, Inf. Comput..

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

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

[63]  Luca Cardelli,et al.  Operations on Records (Summary) , 1989 .

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

[65]  Luca Cardelli,et al.  The Modula–3 type system , 1989, POPL '89.

[66]  William R. Cook,et al.  Interfaces for strongly-typed object-oriented programming , 1989, OOPSLA '89.

[67]  Tsung-Min Kuo,et al.  Strictness analysis: a new perspective based on type inference , 1989, FPCA.

[68]  Didier Rémy,et al.  Type checking records and variants in a natural extension of ML , 1989, POPL '89.

[69]  Benjamin C. Pierce,et al.  A decision procedure for the subtype relation on intersection types with bounded variables , 1989 .

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

[71]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

[72]  Frank Pfenning,et al.  Inductively Defined Types in the Calculus of Constructions , 1989, Mathematical Foundations of Programming Semantics.

[73]  Peter Buneman,et al.  Static type inference for parametric classes , 1989, OOPSLA '89.

[74]  Peter Buneman,et al.  Static type inference for parametric classes , 1989, OOPSLA 1989.

[75]  John C. Mitchell,et al.  F-bounded quantification for object-oriented programming , 1989 .

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

[77]  Benjamin C. Pierce,et al.  Programming in higher-order typed lambda-calculi , 1989 .

[78]  Hans-Juergen Boehm Type inference in the presence of type abstraction , 1989, PLDI '89.

[79]  J. Gallier On Girard's "Candidats de Reductibilité" , 1989 .

[80]  Michael Barr,et al.  Category theory for computing science , 1995, Prentice Hall International Series in Computer Science.

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

[82]  Gérard Huet,et al.  Logical Foundations of Functional Programming , 1990 .

[83]  Daniel Leivant Discrete polymorphism , 1990, LISP and Functional Programming.

[84]  Robin Milner,et al.  Definition of standard ML , 1990 .

[85]  Piergiorgio Odifreddi,et al.  Logic and computer science , 1990 .

[86]  Robert Harper,et al.  Extensible records without subsumption , 1990 .

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

[88]  Pavel Curtis Constrained qualification in polymorphic type analysis , 1990 .

[89]  Benjamin C. Pierce,et al.  Preliminary Investigation of a Calculus with Intersection and Union Types , 1990 .

[90]  John C. Mitchell,et al.  The Semantics of Second-Order Lambda Calculus , 1990, Inf. Comput..

[91]  Jerzy Tiuryn,et al.  Type reconstruction in finite-rank fragments of the polymorphic lambda -calculus , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[92]  D. Rémy Algebres touffues. Application au typage polymorphe des objets enregistrements dans les langages fonctionnels , 1990 .

[93]  F. Cardone,et al.  Two extensions of Curry's type inference system , 1990 .

[94]  Benjamin C. Pierce,et al.  Basic category theory for computer scientists , 1991, Foundations of computing.

[95]  Roberto Di Cosmo,et al.  A Concluent Reduction for the Lambda-Calculus with Surjective Pairing and Terminal Object , 1991, ICALP.

[96]  Giorgio Ghelli,et al.  A static type system for message passing , 1991, OOPSLA '91.

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

[98]  John C. Mitchell,et al.  An extension of standard ML modules with subtyping and inheritance , 1991, POPL '91.

[99]  Benjamin C. Pierce,et al.  A record calculus based on symmetric concatenation , 1991, POPL '91.

[100]  B. Pierce Programming with intersection types, union types, and polymorphism , 1991 .

[101]  Mariangiola Dezani-Ciancaglini,et al.  Intersection and Union Types , 1991, TACS.

[102]  Mitchell Wand,et al.  Type inference for record concatenation and multiple inheritance , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[103]  Kim B. Bruce The Equivalence of Two Semantic Definitions for Inheritance in Object-Oriented Languages , 1991, MFPS.

[104]  Giorgio Ghelli,et al.  Subtyping + Extensionality: Confluence of beta-eta-top reduction in F<= , 1991, TACS.

[105]  John C. Reynolds,et al.  The Coherence of Languages with Intersection Types , 1991, TACS.

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

[107]  Harry G. Mairson,et al.  The complexity of type inference for higher-order lambda calculi , 1991, POPL '91.

[108]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

[109]  Giuseppe Longo,et al.  Categories, types and structures - an introduction to category theory for the working computer scientist , 1991, Foundations of computing.

[110]  Greg Nelson,et al.  Systems programming in modula-3 , 1991 .

[111]  Frank Pfenning,et al.  Refinement types for ML , 1991, PLDI '91.

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

[113]  Thomas P. Jensen,et al.  Strictness Analysis in Logical Form , 1991, FPCA.

[114]  Mike Fagan,et al.  Soft typing: an approach to type checking for dynamically typed languages , 1992 .

[115]  Didier Rémy,et al.  Typing record concatenation for free , 1992, POPL '92.

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

[117]  Steffen van Bakel,et al.  Complete Restrictions of the Intersection Type Discipline , 1992, Theor. Comput. Sci..

[118]  QingMing Ma,et al.  Parametricity as subtyping , 1992, POPL '92.

[119]  John C. Mitchell,et al.  PER models of subtyping, recursive types and higher-order polymorphism , 1992, POPL '92.

[120]  John C. Mitchell,et al.  On the type structure of standard ML , 1993, TOPL.

[121]  Luca Cardelli,et al.  Subtyping recursive types , 1993 .

[122]  Steffen van Bakel,et al.  Principal Type Schemes for the Strict Type Assignment System , 1993, J. Log. Comput..

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

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

[125]  Harry G. Mairson,et al.  The Complexity of Type Inference for Higher-Order Typed lambda Calculi , 1994, J. Funct. Program..

[126]  Susumu Hayashi Singleton, Union and Intersection Types for Program Extraction , 1994, Inf. Comput..