A Direct Algorithm for Type Inference in the Rank 2 Fragment of the Second-Order -Calculus

We study the problem of type inference for a family of polymorphic type disciplines containing the power of Core-ML. This family comprises all levels of the strati cation of the second-order lambda-calculus by \rank" of types. We show that typability is an undecidable problem at every rank k 3 of this strati cation. While it was already known that typability is decidable at rank 2, no direct and easy-to-implement algorithm was available. To design such an algorithm, we develop a new notion of reduction and show how to use it to reduce the problem of typability at rank 2 to the problem of acyclic semi-uni cation. A by-product of our analysis is the publication of a simple solution procedure for acyclic semi-uni cation. This work is partly supported by NSF grant CCR{9113196.

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

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

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

[4]  Fritz Henglein,et al.  Type inference and semi-unification , 1988, LISP and Functional Programming.

[5]  Jerzy Tiuryn,et al.  Type Inference Problems: A Survey , 1990, MFCS.

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

[7]  Robin Milner The standard ML core language , 1984 .

[8]  Robin Milner,et al.  Edinburgh LCF , 1979, Lecture Notes in Computer Science.

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

[10]  Jerzy Tiuryn,et al.  An analysis of ML typability , 1994, JACM.

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

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

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