New Generation Computing, 22(2004)1-36
Ohmsha, Ltd. and Springer-Verlag

Proofs of a Set of Hybrid Let-Polymorphic Type Inference Algorithms*1)

Hyunjun EO and Oukseh LEE
Research on Program Analysis System*2)
Department of Computer Science
Korea Advanced Institute of Science and Technology
373-1 Guseong-dong, Yuseong-gu, Daejeon 305-701, Korea

Kwangkeun YI
School of Computer Science and Engineering*3)
Seoul National University
San 56-1, Shilim-dong, Gwanak-gu, Seoul 151-742, Korea

{poisson,cookcu,kwang}@ropas.kaist.ac.kr

Received 30 September 2002
Revised manuscript received 28 November 2002

Abstract

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 algorithm W and the top-down algorithm M) but also other hybrid algorithms which are used in real compilers. Such instances' soundness 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.

Keywords:Type System, Type Inference Algorithm, Let-Polymorphism, Generalization.

(Footnote)
*1) This work is supported by Creative Research Initiatives of the Korean Ministry of Science and Technology
*2) National Creative Research Institute Center, http://ropas.kaist.ac.kr
*3) Work done while the third author was associated with Korea Advanced Institute of Science and Technology

[Back]