Type inference with subtypes

  • You-Chin Fuh
  • Prateek Mishra
3. Algebraic Specification And Type Concepts
Part of the Lecture Notes in Computer Science book series (LNCS, volume 300)


We extend polymorphic type inference to include subtypes. This paper describes the following results:
  • •We prove the existence of (i) principal type property and (ii) syntactic completeness of the type checker, for type inference with subtypes. This result is developed with only minimal assumptions on the underlying theory of subtypes.

  • •For a particular “structured” theory of subtypes, those engendered by coercions between type constants only, we prove that principal types are compactly expressible. This suggests that a practical type checker for the structured theory of subtypes is feasible.

  • •We develop efficient algorithms for such a type checker. There are two main algorithms: MATCH and CONSISTENT. The first can be thought of as an extension to the unification algorithm. The second, which has no analogue in conventional type inference, determines whether a set of coercions is consistent.

Thus, an extension of polymorphic type inference that incorporates the “structured” theory of subtypes is practical and yields greater polymorphic flexibility. We have begun work on an implementation.


  1. [Car84]
    L Cardelli. A semantics of multiple inheritance. In Semantics of Data Types: LNCS 173, 1984.Google Scholar
  2. [Car85]
    L Cardelli. Basic polymorphic typechecking. 1985. Manuscript.Google Scholar
  3. [DM82]
    L Damas and R. Milner. Principal type schemes for functional programs. In POPL IX, 1982.Google Scholar
  4. [Lei83]
    D Leivant. Polymorphic type inference. In POPL X, 1983.Google Scholar
  5. [Mal87]
    J Malhotra. Implementation Issues for Standard ML. Master's thesis, SUNY at Stony Brook, August 1987.Google Scholar
  6. [Mit84a]
    J. C. Mitchell. Coercion and type inference. In POPL XI, 1984.Google Scholar
  7. [Mit84b]
    J. C. Mitchell. Type inference and type containment. In Semantics of Data Types: LNCS 173, 1984.Google Scholar
  8. [MM82]
    A Martelli and U Montanari. An efficient unification algorithm. TOPLAS, 4(2), 1982.Google Scholar
  9. [MR85]
    P Mishra and U.S Reddy. Declaration-free type inference. In POPL XII, 1985.Google Scholar
  10. [Rey70]
    J. C. Reynolds. Transformational systems and the algebraic structure of atomic formulas. In Machine Intelligence 5, 1970.Google Scholar
  11. [Rey80]
    J. C. Reynolds. Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation: LNCS 94, 1980.Google Scholar
  12. [Rey85]
    J. C. Reynolds. Three approaches to type structure. In TAPSOFT 1985: LNCS 186, 1985.Google Scholar
  13. [Wan87a]
    M. Wand. Complete type inference for simple objects. In LICS II, 1987.Google Scholar
  14. [Wan87b]
    M Wand. A simple algorithm and proof for type inference. 1987. Manuscript.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • You-Chin Fuh
    • 1
  • Prateek Mishra
    • 1
  1. 1.Department of Computer ScienceThe State University of New York at Stony BrookStony Brook

Personalised recommendations