Typability and Type Checking in System F are Equivalent and Undecidable

Abstract Girard and Reynolds independently invented System F (a.k.a. the second-order polymorphically typed lambda calculus) to handle problems in logic and computer programming language design, respectively. Viewing F in the Curry style, which associates types with untyped lambda terms, raises the questions of typability and type checking. Typability asks for a term whether there exists some type it can be given. Type checking asks, for a particular term and type, whether the term can be given that type. The decidability of these problems has been settled for restrictions and extensions of F and related systems and complexity lower-bounds have been determined for typability in F, but this report is the first to resolve whether these problems are decidable for System F. This report proves that type checking in F is undecidable, by a reduction from semi-unification, and that typability in F is undecidable, by a reduction from type checking. Because there is an easy reduction from typability to type checking, the two problems are equivalent. The reduction from type checking to typability uses a novel method of constructing lambda terms that simulate arbitrarily chosen type environments. All of the results also hold for the λI-calculus.

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

[2]  Frank Pfenning,et al.  On the Undecidability of Partial Polymorphic Type Reconstruction , 1993, Fundam. Informaticae.

[3]  Peter Lee,et al.  LEAP: A Language with Eval And Polymorphism , 1989, TAPSOFT, Vol.2.

[4]  D. Prawitz Natural Deduction: A Proof-Theoretical Study , 1965 .

[5]  Daniel Leivant,et al.  Finitely Stratified Polymorphism , 1991, Inf. Comput..

[6]  Jerzy Tiuryn,et al.  Type Reconstruction in Finite Rank Fragments of the Second-Order lambda-Calculus , 1992, Inf. Comput..

[7]  Erich J. Neuhold,et al.  Formal description of programming concepts , 1991 .

[8]  Pawel Urzyczyn Type reconstruction in F-omega is undecidable , 1993, TLCA.

[9]  Pavel Pudlák,et al.  On a unification problem related to Kreisel's conjecture , 1988 .

[10]  Pawel Urzyczyn The Emptiness Problem for Intersection Types , 1999, J. Symb. Log..

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

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

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

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

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

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

[17]  Philip K. Hooper The undecidability of the Turing machine immortality problem , 1966, Journal of Symbolic Logic.

[18]  Paola Giannini,et al.  Type Inference: Some Results, Some Problems , 1993, Fundamenta Informaticae.

[19]  Hans-Juergen Boehm Partial Polymorphic Type Inference Is Undecidable , 1985, FOCS.

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

[21]  Nancy McCracken,et al.  The Typechecking of Programs with Implicit Type Structure , 1984, Semantics of Data Types.

[22]  M. Minsky Recursive Unsolvability of Post's Problem of "Tag" and other Topics in Theory of Turing Machines , 1961 .

[23]  Warren D. Goldfarb,et al.  The Undecidability of the Second-Order Unification Problem , 1981, Theor. Comput. Sci..

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

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

[26]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[27]  Jerzy Tiuryn,et al.  The Undecidability of the Semi-unification Problem , 1993, Inf. Comput..

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

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

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

[31]  Paola Giannini,et al.  Type Inference in Polymorphic Type Discipline , 1991, TACS.

[32]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[33]  Assaf J. Kfoury,et al.  A direct algorithm for type inference in the rank-2 fragment of the second-order λ-calculus , 1994, LFP '94.

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

[35]  Ravi Sethi,et al.  A semantic model of types for applicative languages , 1982, LFP '82.