Abstract
This paper presents the first machine-checked verification of Milner's type inference algorithm W for computing the most general type of an untyped λ-term enriched with let-expressions. This term language is the core of most typed functional programming languages and is also known as Mini-ML. We show how to model all the concepts involved, in particular types and type schemes, substitutions, and the thorny issue of “new” variables. Only a few key proofs are discussed in detail. The theories and proofs are developed in Isabelle/HOL, the HOL instantiation of the generic theorem prover Isabelle.
Similar content being viewed by others
References
Boutin, S.: Preuve de correction de la compilation de mini-ml en code cam dans le système d'aide à la démonstration coq, Technical Report 2536, INRIA, Apr. 1995.
Burstall, R., MacQueen, D. and Sannella, D.: Hope: An experimental applicative language, in Proc. 1980 LISP Conference, 1980, pp. 136-143.
Clément, D., Despeyroux, J., Despeyroux, T. and Kahn, G.: A simple applicative language: Mini-ML, in Proc. ACM Conf. Lisp and Functional Programming, 1986, pp. 13-27.
Damas, L. and Milner, R.: Principal type schemes for functional programs, in Proc. 9th ACM Symp. Principles of Programming Languages, 1982, pp. 207-212.
Damas, L. M. M.: Type Assignment in Programming Languages, PhD Thesis, Department of Computer Science, University of Edinburgh, 1985.
de Bruijn, N. G.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem, Indag. Math. 34 (1972), 381-392.
Despeyroux, J., Pfenning, F. and Schürmann, C.: Primitive recursion for higher order abstract syntax, Technical Report CMU-CS-96-172, School of Computer Science, Carnegie Mellon University, 1996.
Dubois, C. and Ménissier-Morain, V.: Certification of a type inference tool for ML: Damas-Milner within Coq, J. Automated Reasoning, this issue.
Gordon, M. and Melham, T.: Introduction to HOL: A Theorem-Proving Environment for Higher Order Logic, Cambridge Univ. Press, Cambridge, 1993.
Hannan, J. and Pfenning, F.: Compiler verification in LF, in 7th IEEE Symp. Logic in Computer Science, IEEE Computer Society Press, 1992, pp. 407-418.
Hindley, J. R.: The principal type-scheme of an object in combinatory logic, Trans. AMS 146 (1969), 29-60.
Hudak, P., Jones, S. P. and Wadler, P.: Report on the programming language Haskell: A nonstrict, purely functional language, ACM SIGPLAN Notices 27(5) (May 1992). Version 1.2.
Jouannaud, J.-P. and Kirchner, C.: Solving equations in abstract algebras: A rule-based survey of unification, in J.-L. Lassez and G. Plotkin (eds.), Computational Logic: Essays in Honor of Alan Robinson, MIT Press, 1991, pp. 257-321.
Lassez, J.-L., Maher, M. and Mariott, K.: Unification revisited, in J. Minker (ed.), Foundations of Deductive Databases and Logic Programming, Morgan Kaufman, 1987, pp. 587-625.
McKinna, J. and Pollack, R.: Pure type systems formalized, in M. Bezem and J. Groote (eds.), Typed Lambda Calculi and Applications, LNCS 664, Springer-Verlag, 1993, pp. 289-305.
Milner, R.: A theory of type polymorphism in programming, J. Comput. System Sci. 17 (1978) 348-375.
Milner, R., Tofte, M. and Harper, R.: The Definition of Standard ML, MIT Press, 1990.
Naraschewski, W. and Nipkow, T.: Type inference verified: Algorithm W in Isabelle/HOL, in E. Giménez and C. Paulin-Mohring (eds.), Types for Proofs and Programs: Intl. Workshop TYPES '96, LNCS 1512, Springer-Verlag, 1998, pp. 317-332.
Nazareth, D. and Nipkow, T.: Formal verification of algorithm W: The monomorphic case, in J. von Wright, J. Grundy, and J. Harrison (eds.), Theorem Proving in Higher Order Logics, LNCS 1125, Springer-Verlag, 1996, pp. 331-346.
Nipkow, T.: Functional unification of higher-order patterns, in 8th IEEE Symp. Logic in Computer Science, IEEE Computer Society Press, 1993, pp. 64-74.
Nipkow, T. and Prehofer, C.: Type reconstruction for type classes, J. Functional Programming 5(2) (1995), 201-224.
Paulson, L. C.: Verifying the unification algorithm in LCF, Sci. of Computer Programming 5 (1985), 143-169.
Paulson, L. C.: Isabelle: A Generic Theorem Prover, LNCS 828, Springer-Verlag, 1994.
Paulson, L. C.: Generic automatic proof tools, in R. Veroff (ed.), Automated Reasoning and Its Applications, MIT Press, 1997. Also Report 396, Computer Laboratory, University of Cambridge.
Pfenning, F.: A proof of the Church-Rosser theorem and its representation in a logical framework, J. Automated Reasoning, to appear.
Tofte, M.: Type inference for polymorphic references, Inform. and Comput. 89 (1990), 1-34.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Naraschewski, W., Nipkow, T. Type Inference Verified: Algorithm W in Isabelle/HOL. Journal of Automated Reasoning 23, 299–318 (1999). https://doi.org/10.1023/A:1006277616879
Issue Date:
DOI: https://doi.org/10.1023/A:1006277616879