Type Inference with Subtypes

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.