Proofs of a set of hybrid let-polymorphic type inference algorithms

We present a generalized let-polymorphic type inference algorithm, prove that any of its instances is sound and complete with respect to the Hindley/Milner let-polymorphic type system, and find a condition on two instance algorithms so that one algorithm should find type errors earlier than the other.By instantiating the generalized algorithm with different parameters, we can obtain not only the two opposite algorithms (the bottom-up standard algorithmW and the top-down algorithmM) but also other hybrid algorithms which are used in real compilers. Such instances’ soudness and completeness follow automatically, and their relative earliness in detecting type-errors is determined by checking a simple condition. The set of instances of the generalized algorithm is a superset of those used in the two most popular ML compilers: SML/NJ and OCaml.

[1]  Satish R. Thatte,et al.  Type Inference with Partial Types , 1988, Theor. Comput. Sci..

[2]  Martin Sulzmann A General Type Inference Framework for Hindley/Milner Style Systems , 2001, FLOPS.

[3]  Olaf Chitil,et al.  Compositional explanation of types and algorithmic debugging of type errors , 2001, ICFP '01.

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

[5]  Michael Maher Diagnosing Non-Well-Moded Concurrent Logic Programs , 1996 .

[6]  Xavier Leroy The objective caml system release 3 , 2001 .

[7]  Jun Yang Explaining Type Errors by Finding the Source of a Type Conflict , 1999, Scottish Functional Programming Workshop.

[8]  Bruce James McAdam On the unification of substitutions in type inference , 1999 .

[9]  Dominic Duggan,et al.  Explaining Type Inference , 1996, Sci. Comput. Program..

[10]  Laurence Rideau,et al.  Interactive Programming Environment for ML , 1997 .

[11]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[12]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[13]  Bruce J. McAdam Generalising Techniques for Type Debugging , 1999, Scottish Functional Programming Workshop.

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

[15]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[16]  Mitchell Wand Finding the source of type errors , 1986, POPL '86.

[17]  Ryan Stansifer,et al.  Explaining type errors in polymorphic languages , 1993, LOPL.

[18]  Kwangkeun Yi,et al.  Proofs about a folklore let-polymorphic type inference algorithm , 1998, TOPL.

[19]  Martin Sulzmann,et al.  Hindley/Milner style type systems in constraint form , 1999 .

[20]  Fritz Henglein,et al.  Type inference with polymorphic recursion , 1993, TOPL.

[21]  Eugene W. Stark,et al.  Debugging Type Errors (Full version) , 1995 .