Abstract
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.
Chapter PDF
References
Appel, A.W., MacQueen, D.B.: Standard ML of New Jersey. In: Małuszyński, J., Wirsing, M. (eds.) PLILP 1991. LNCS, vol. 528, pp. 1–13. Springer, Heidelberg (1991)
Beaven, M., Stansifer, R.: Explaining type errors in polymorphic languages. ACM Letters on Programming Languages and Systems 2(1-4), 17–30 (1993)
Bravenboer, M., et al.: Stratego/XT Tutorial, Examples, and Reference Manual for Stratego/XT 0.16. Department of Information and Computing Sciences, Universiteit Utrecht, Utrecht, The Netherlands (November 2005)
Cardelli, L.: Basic polymorphic typechecking. Science of Computer Programming 8(2), 147–172 (1987)
Cousot, P.: Types as abstract interpretations. In: POPL ’97: Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 316–331. ACM Press, New York (1997)
Curry, H.B.: Modified basic functionality in combinatory logic. Dialectica 23, 83–92 (1969)
Damas, L.: unpublished note (1982)
Danvy, O., Nielsen, L.R.: Refocusing in reduction semantics. Technical Report BRICS RS-04-26, Department of Computer Science, University of Aarhus, Aarhus, Denmark (2004), http://citeseer.ist.psu.edu/danvy04refocusing.html
Duggan, D., Bent, F.: Explaining type inference. Science of Computer Programming 27, 37–83 (1996)
Felleisen, M., Flatt, M.: Programming languages and lambda calculi. Revision of 1989 edition (2003)
Felleisen, M., Hieb, R.: A revised report on the syntactic theories of sequential control and state. Theoretical Computer Science 103(2), 235–271 (1992)
Haack, C., Wells, J.B.: Type error slicing in implicitly typed higher-order languages. Sci. Comput. Program. 50(1-3), 189–224 (2004)
Heeren, B., Hage, J., Swierstra, S.D.: Scripting the type inference process. In: ICFP ’03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programming, pp. 3–13. ACM Press, New York (2003)
Hindley, J.R.: The principal type scheme of an object in combinatory logic. Transactions of the American Mathematical Society 146, 29–40 (1969)
Kahrs, S.: Polymorphic type checking by interpretation of code. Technical Report ECS-LFCS-92-238, University of Edinburgh (1992)
Kuan, G.: A rewriting semantics for type inference. Technical Report TR-2007-01, University of Chicago (2007)
Lee, O., Yi, K.: Proofs about a folklore let-polymorphic type inference algorithm. ACM Transanctions on Programming Languages and Systems 20(4), 707–723 (1998)
Lerner, B., Grossman, D., Chambers, C.: Seminal: searching for ML type-error messages. In: ML ’06: Proceedings of the 2006 Workshop on ML, pp. 63–73. ACM Press, New York (2006)
Leroy, X.: Programmation du système Unix en Caml Light. Technical report 147, INRIA (1992)
Martelli, A., Montanari, U.: An efficient unification algorithm. ACM Trans. Program. Lang. Syst. 4(2), 258–282 (1982)
Matthews, J., et al.: A visual environment for developing context-sensitive term rewriting systems. In: Rewriting Techniques and Applications (2004)
McAdam, B.: How to repair type errors automatically. In: Trends in functional programming, pp. 87–98 (2002)
McAllester, D.: A logical algorithm for ML type inference. In: Rewriting Techniques and Applications (2003)
Milner, R.: A theory of type polymorphism in programming. JCSS 17, 348–375 (1978)
Neubauer, M., Thiemann, P.: Discriminative sum types locate the source of type errors. In: ICFP ’03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programming, pp. 15–26. ACM Press, New York (2003)
Pašalić, E., Siek, J.G., Taha, W.: Concoqtion: Mixing indexed types and Hindley-Milner type inference. In: POPL ’07: Conference record of the 34th ACM SIGPLAN-SIGACT symposium on Principles of programming languages (2007)
Rémy, D.: Extending ML type system with a sorted equational theory. Research Report 1766, Institut National de Recherche en Informatique et Automatisme, Rocquencourt, Le Chesnay, France (1992)
Robinson, J.A.: A machine-oriented logic based on the resolution principle. J. ACM 12(1), 23–41 (1965)
Soosaipillai, H.: An explanation based polymorphic type checker for Standard ML. Master’s Thesis (1990)
Wand, M.: Finding the source of type errors. In: POPL ’86: Proceedings of the 13th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pp. 38–43. ACM Press, New York (1986)
Wand, M.: A simple algorithm and proof for type inference. Fundamenta Infomaticae 10, 115–122 (1987)
Yang, J.: Explaining type errors by finding the source of a type conflict. In: SFP ’99: Selected papers from the 1st Scottish Functional Programming Workshop (SFP99), Exeter, UK, pp. 59–67. Intellect Books, Oxford (2000)
Yang, J.: Improving Polymorphic Type Explanations. PhD thesis, Heriot-Watt University (2001)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer Berlin Heidelberg
About this paper
Cite this paper
Kuan, G., MacQueen, D., Findler, R.B. (2007). A Rewriting Semantics for Type Inference. In: De Nicola, R. (eds) Programming Languages and Systems. ESOP 2007. Lecture Notes in Computer Science, vol 4421. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71316-6_29
Download citation
DOI: https://doi.org/10.1007/978-3-540-71316-6_29
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-71314-2
Online ISBN: 978-3-540-71316-6
eBook Packages: Computer ScienceComputer Science (R0)
