A Rewriting Semantics for Type Inference

When students first learn programming, they often rely on a simple operational model of a program's behavior to explain how particular features work. Because such models build on their earlier training in algebra, students find them intuitive, even obvious. Students learning type systems, however, have to confront an entirely different notation with a different semantics that many find difficult to understand. In this work, we begin to build the theoretical underpinnings for treating type checking in a manner like the operational semantics of execution. Intuitively, each term is incrementally rewritten to its type. For example, each basic constant rewrites directly to its type and each lambda expression rewrites to an arrow type whose domain is the type of the lambda's formal parameter and whose range is the body of the lambda expression which, in turn, rewrites to the range type.

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

[2]  Andrew W. Appel,et al.  Standard ML of New Jersey , 1991, PLILP.

[3]  Patrick Cousot,et al.  Types as abstract interpretations , 1997, POPL '97.

[4]  Peter Thiemann,et al.  Discriminative sum types locate the source of type errors , 2003, ICFP '03.

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

[6]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

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

[8]  Walid Taha,et al.  Concoqtion: Mixing Indexed Types and Hindley-Milner Type Inference , 2006 .

[9]  Murray Cole,et al.  SFP '99 Selected Papers from the 1st Scottish Functional Programming Workshop (SFP99) , 2000 .

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

[11]  Robert Hieb,et al.  The Revised Report on the Syntactic Theories of Sequential Control and State , 1992, Theor. Comput. Sci..

[12]  Luca Cardelli,et al.  Basic Polymorphic Typechecking , 1987, Sci. Comput. Program..

[13]  Matthias Felleisen,et al.  Programming languages and lambda calculi , 1989 .

[14]  Dan Grossman,et al.  Seminal: searching for ML type-error messages , 2006, ML '06.

[15]  Pierre Deransart,et al.  Programming Languages Implementation and Logic Programming , 1989, Lecture Notes in Computer Science.

[16]  Bruce J. McAdam How to Repair Type Errors Automatically , 2001, Scottish Functional Programming Workshop.

[17]  Luís Damas,et al.  Type assignment in programming languages , 1984 .

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

[19]  Xavier Leroy Programmation du systeme Unix en Caml Light , 1993 .

[20]  Francois Pottier A modern eye on ML type inference - Old techniques and recent developments - , 2005 .

[21]  Jun Yang Improving polymorphic type explanations , 2001 .

[22]  H. B. Curry Modified basic functionality in combinatory logic , 1969 .

[23]  David McAllester A logical algorithm for ML type inference , 2003 .

[24]  Christian Haack,et al.  Type error slicing in implicitly typed higher-order languages , 2003, Sci. Comput. Program..

[25]  Emmanuel Beffara,et al.  ICFP '03 Proceedings of the eighth ACM SIGPLAN international conference on Functional programming , 2003 .

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

[27]  Lasse R. Nielsen,et al.  Refocusing in Reduction Semantics , 2004 .

[28]  Alberto Martelli,et al.  An Efficient Unification Algorithm , 1982, TOPL.

[29]  Jurriaan Hage,et al.  Scripting the type inference process , 2003, ACM SIGPLAN Notices.

[30]  Matthias Felleisen,et al.  A Visual Environment for Developing Context-Sensitive Term Rewriting Systems , 2004, RTA.

[31]  Stefan Kahrs Polymorphic Type Checking by Interpretation of Code , 1992 .

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

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