Type inference with inequalities

  • Michael I. Schwartzbach
CAAP Colloquium On Trees In Algebra And Programming
Part of the Lecture Notes in Computer Science book series (LNCS, volume 493)


Type inference can be phrased as constraint-solving over types. We consider an implicitly typed language equipped with recursive types, multiple inheritance, 1st order parametric polymorphism, and assignments. Type correctness is expressed as satisfiability of a possibly infinite collection of (monotonic) inequalities on the types of variables and expressions. A general result about systems of inequalities over semilattices yields a solvable form. We distinguish between deciding typability (the existence of solutions) and type inference (the computation of a minimal solution). In our case, both can be solved by means of nondeterministic finite automata; unusually, the two problems have different complexities: polynomial vs. exponential time.


  1. [1]
    Barendregt, H. “Types in Lambda Calculi and Programming Languages” in Proceedings of ESOP'90, LNCS Vol 432, Springer-Verlag, 1990.Google Scholar
  2. [2]
    Cardelli, L. & Mitchell, J. “Operations on Records” in Proceedings of MFPS'90, LNCS Vol 442, Springer-Verlag, 1990.Google Scholar
  3. [3]
    Courcelle, B. “Infinite Trees in Normal Form and Recursive Equations Having a Unique Solution” in Mathematical Systems Theory 13, 131–180. Springer-Verlag 1979.Google Scholar
  4. [4]
    Courcelle, B. “Fundamental Properties of Infinite Trees” in Theoretical Computer Science Vol 25 No 1, North-Holland 1983.Google Scholar
  5. [5]
    Mairson, H.G. “Decidability of ML Typing is Complete for Deterministic Exponential Time” in Proceedings of POPL'90, ACM 1990.Google Scholar
  6. [6]
    Milner, R. “A Theory of Type Polymorphism in Programming Languages” in Journal of Computer and Systems Sciences 17, 1978.Google Scholar
  7. [7]
    Reynolds, J.C. “Three approaches to type structure” in Mathematical Foundations of Software Development, LNCS Vol 185, Springer-Verlag, 1985.Google Scholar
  8. [8]
    Schmidt, E.M. & Schwartzbach, M.I. “An Imperative Type Hierarchy with Partial Products” in Proceedings of MFCS'89, LNCS Vol 379, Springer-Verlag, 1989.Google Scholar
  9. [9]
    Schwartzbach, M.I. “Infinite Values in Hierarchical Imperative Types” in Proceedings of CAAP'90, LNCS Vol 431, Springer-Verlag, 1990.Google Scholar
  10. [10]
    Schwartzbach, M.I. “Static Correctness of Hierarchical Procedures” in Proc. of ICALP'90, LNCS Vol 443, Springer-Verlag, 1990.Google Scholar
  11. [11]
    Schwartzbach, M.I. & Schmidt, E.M. “Types and Automata”. PB-316, Department of Computer Science, Aarhus University, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Michael I. Schwartzbach
    • 1
  1. 1.Computer Science DepartmentAarhus UniversityÅrhus CDenmark

Personalised recommendations