Book chapters will be unavailable on Saturday 24th August between 8am-12pm BST. This is for essential maintenance which will provide improved performance going forwards. Please accept our apologies for any inconvenience caused.
The Milner-Damas typing algorithm W is one of the classic algorithms in computer science. In this paper we describe a formalized soundness and completeness proof for this algorithm. Our formalization is based on names for both term and type variables, and is carried out in Isabelle/HOL using the Nominal Datatype Package. It turns out that in our formalization we have to deal with a number of issues that are often overlooked in informal presentations of W.
“Alpha-conversion always bites you when you least expect it.”
A remark made by Xavier Leroy when discussing with us the informal proof about W in his PhD thesis.
Milner's polymorphic type system for ML is probably the most influential programming language type system. The second author learned about it from a paper by Clément et al. He was immediately taken by their view that type inference can be viewed as Prolog execution, in particular because the Isabelle system, which he had started to work on, was based on a similar paradigm as the Typol language developed by Kahn and his coworkers. Milner himself had provided the explicit type inference algorithm W and proved its soundness. Completeness was later shown by Damas and Milner. Neither soundness nor completeness of W are trivial because of the presence of the Let-construct (which is not expanded during type inference).