Type Inference with Inequalities

Michael I. Schwartzbach
1990 DAIMI Report Series  
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
more » ... 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.
doi:10.7146/dpb.v19i336.6566 fatcat:enqhb3lyznaclpqiwqiylfc6r4