The Essence of Principal Typings

Let S be some type system. A typing in S for a typable term M is the collection of all of the information other than M which appears in the final judgement of a proof derivation showing that M is typable. For example, suppose there is a derivation in S ending with the judgement A ? M : ? meaning that M has result type ? when assuming the types of free variables are given by A. Then (A, ?) is a typing for M. A principal typing in S for a term M is a typing for M which somehow represents all other possible typings in S for M. It is important not to confuse this with a weaker notion in connection with the Hindley/Milner type system often called"principal types". Previous definitions of principal typings for specific type systems have involvedv arious syntactic operations on typings such as substitution of types for type variables, expansion, lifting, etc.This paper presents a new general definition of principal typings which does not depend on the details of any particular type system. This paper shows that the new general definition correctly generalizes previous system-dependent definitions. This paper explains why the new definition is the right one. Furthermore, the new definition is used to prove that certain polymorphic type systems using ?-quantifiers, namely System F and the Hindley/Milner system, do not have principal typings.All proofs can be foundin a longer version available at the author's home page.

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

[2]  Aleksy Schubert Second-Order Unification and Type Inference for Church-Style Polymorphism , 1998, POPL.

[3]  Thomas P. Jensen,et al.  Inference of polymorphic and conditional strictness properties , 1998, POPL '98.

[4]  Trevor Jim What are principal typings and what are they good for? , 1996, POPL '96.

[5]  Max Dauchet Trees in Algebra and Programming (Editorial) , 2000, Theor. Comput. Sci..

[6]  J. B. Wells Typability and type checking in the second-order Λ-calculus are equivalent and undecidable (Preliminary Draft) , 1993 .

[7]  J. B. Wells Typability is Undecidable for F+Eta , 1996 .

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

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

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

[11]  R. Varga,et al.  Proof of Theorem 4 , 1983 .

[12]  Peter G. Harrison,et al.  Functional Programming , 1988 .

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

[14]  Anindya Banerjee A modular, polyvariant and type-based closure analysis , 1997, ICFP '97.

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

[16]  Assaf J. Kfoury,et al.  Principality and decidable type inference for finite-rank intersection types , 1999, POPL '99.

[17]  Benjamin C. Pierce,et al.  Bounded quantification is undecidable , 1992, POPL '92.

[18]  Ines Margaria,et al.  Filter Models with Polymorphic Types , 1992, Theor. Comput. Sci..

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

[20]  Pierre Jouvelot,et al.  Algebraic reconstruction of types and effects , 1991, POPL '91.

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

[22]  A. J. Kfoury,et al.  A Direct Algorithm for Type Inference in the Rank 2 Fragment of the Second-Order -Calculus , 1993 .

[23]  Steffen van Bakel,et al.  Intersection Type Assignment Systems , 1995, Theor. Comput. Sci..

[24]  S. V. Bakel,et al.  Intersection type disciplines in Lambda Calculus and applicative term rewriting systems , 1993 .

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

[26]  James H. Morris,et al.  Lambda-calculus models of programming languages. , 1969 .

[27]  J. Roger Hindley,et al.  To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus, and Formalism , 1980 .

[28]  Pawel Urzyczyn,et al.  Type reconstruction in Fω , 1997, Mathematical Structures in Computer Science.

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

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

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

[32]  Assaf J. Kfoury,et al.  Type inference for system f with and without the eta rule , 1996 .

[33]  Joe B. Wells,et al.  Typability and Type Checking in System F are Equivalent and Undecidable , 1999, Ann. Pure Appl. Log..

[34]  Pierre Jouvelot,et al.  The Type and Effect Discipline , 1994, Inf. Comput..

[35]  J. B. Wells,et al.  Typability and type checking in the second-order /spl lambda/-calculus are equivalent and undecidable , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[36]  Harry G. Mairson,et al.  Relating typability and expressiveness in finite-rank intersection type systems (extended abstract) , 1999, ICFP '99.

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

[38]  J. V. Tucker,et al.  Basic Simple Type Theory , 1997 .

[39]  Paola Giannini,et al.  A Complete Type Inference Algorithm for Simple Intersection Types , 1992, CAAP.