On the type structure of standard ML

Standard ML is a useful programming language with a polymorphic type system and a flexible module facility. One notable feature of the core expression language of ML is that it is implicdy typed: no explicit type information need be supplied by the programmer. In contrast, the module language of ML is explicitly typed; in particular, the types of parameters in parametric modules must be supplied by the programmer. We study the type structure of Standard ML by giving an explicitly-typed, polymorphic function calculus that captures many of the essential aspects of both the core and module language. In this setting, implicitly-typed core language expressions are regarded as a convenient short-hand for an explicitly-typed counterpart in our function calculus. In contrast to the Girard-Reynolds polymorphic calculus, our function calculus is predzcatiw: the type system may be built up by induction on type levels. We show that, in a precise sense, the language becomes inconsistent if restrictions imposed by type levels are relaxed. More specifically, we prove that the important programming features of ML cannot be added to any impredicative language, such as the Girard-Reynolds calculus, without implicitly assuming a type of all types.

[1]  Furio Honsell,et al.  A framework for defining logics , 1993, JACM.

[2]  Richard Statman,et al.  Logical Relations and the Typed lambda-Calculus , 1985, Inf. Control..

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

[4]  Douglas J. Howe The Computational Behaviour of Girard's Paradox , 1987, LICS.

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

[6]  Kim B. Bruce,et al.  The Semantics of Second Order Polymorphic Lambda Calculus , 1984, Semantics of Data Types.

[7]  F. Dick A survey of the project Automath , 1980 .

[8]  Daniel Leivant,et al.  Polymorphic type inference , 1983, POPL '83.

[9]  Gordon D. Plotkin,et al.  An ideal model for recursive polymorphic types , 1984, Inf. Control..

[10]  R. Seely,et al.  Locally cartesian closed categories and type theory , 1984, Mathematical Proceedings of the Cambridge Philosophical Society.

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

[12]  Harry G. Mairson,et al.  Unification and ML-Type Reconstruction , 1991, Computational Logic - Essays in Honor of Alan Robinson.

[13]  John C. Mitchell,et al.  Kripke-Style Models for Typed lambda Calculus , 1991, Ann. Pure Appl. Log..

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

[15]  David B. MacQueen Modules for standard ML , 1984, LFP '84.

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

[17]  Alley Stoughton,et al.  Fully abstract models of programming languages , 1986, Research Notes in Theoretical Computer Science.

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

[19]  John C. Reynolds,et al.  Polymorphism is not Set-Theoretic , 1984, Semantics of Data Types.

[20]  Douglas J. Howe,et al.  Impredicative Strong Existential Equivalent to Type:Type , 1986 .

[21]  Albert R. Meyer,et al.  "Type" is not a type , 1986, POPL '86.

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

[23]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[24]  HarperRobert,et al.  On the type structure of standard ML , 1993 .

[25]  Nancy Jean Mccracken,et al.  An investigation of a programming language with a polymorphic type structure. , 1979 .

[26]  P. Martin-Löf Constructive mathematics and computer programming , 1984 .

[27]  E. Ford,et al.  POLYMORPHISM , 1945, Encyclopedic Dictionary of Archaeology.

[28]  Robin Milner,et al.  A Type Discipline for Program Modules , 1987, TAPSOFT, Vol.2.

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

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

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

[32]  Richard Statman,et al.  Empty types in polymorphic lambda calculus , 1987, POPL '87.

[33]  Jerzy Tiuryn,et al.  ML Typability is DEXTIME-Complete , 1990, CAAP.

[34]  William A. Howard,et al.  The formulae-as-types notion of construction , 1969 .

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

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

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

[38]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

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

[40]  Mitchell Wand,et al.  A types-as-sets semantics for milner-style polymorphism , 1984, POPL.

[41]  P. Martin-Löf An Intuitionistic Theory of Types: Predicative Part , 1975 .

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

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

[44]  Atsushi Ohori,et al.  A simple semantics for ML polymorphism , 1989, FPCA.

[45]  John C. Mitchell,et al.  Type Systems for Programming Languages , 1991, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[46]  John C. Mitchell,et al.  Higher-order modules and the phase distinction , 1989, POPL '90.

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

[48]  F. Honsell,et al.  A Framework for De ning LogicsRobert Harper , 1987 .

[49]  Thierry Coquand,et al.  An Analysis of Girard's Paradox , 1986, LICS.

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

[51]  G.D. Plotkin,et al.  LCF Considered as a Programming Language , 1977, Theor. Comput. Sci..

[52]  Rance Cleaveland,et al.  Implementing mathematics with the Nuprl proof development system , 1986 .

[53]  John C. Mitchell,et al.  Second-Order Logical Relations (Extended Abstract) , 1985, Logic of Programs.

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

[55]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[56]  Eugenio Moggi,et al.  A category-theoretic account of program modules , 1989, Mathematical Structures in Computer Science.

[57]  Robin Milner,et al.  Commentary on standard ML , 1990 .

[58]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .

[59]  David B. MacQueen Using dependent types to express modular structure , 1986, POPL '86.

[60]  de Ng Dick Bruijn,et al.  A survey of the project Automath , 1980 .

[61]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[62]  Per Martin-Löf,et al.  Constructive mathematics and computer programming , 1984 .

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