Lower bounds on type inference with subtypes

We investigate type inference for programming languages with subtypes. As described in previous work, there are several type inference problems for any given expression language, depending on the form of the subtype partial order and the ability to define new subtypes in programs. Our first main result is that for any specific subtype partial order, the problem of determining whether a lambda term is typable is algorithmically (polynomial-time) equivalent to a form of satisfiability problem over the same partial order. This gives the first exact characterization of the problem that is independent of the syntax of expressions. In addition, since this form of satisfiability problem is PSPACE-hard over certain partial orders, this equivalence strengthens the previous lower bound of NP-hard to PSPACE-hard. Our second main result is a lower bound on the length of most general types when the subtype hierarchy may change as a result of additional type declarations within the program. More specifically, given any input expression, a type inference algorithm tries to find a most general (or principal) typing. The property of a most general typing is that it has all other possible typings as instances. However, there are several sound notions of instance in the presence of subtyping. Our lower bound is that no sound definition of instance would allow the set of additional subtyping hypotheses about a term to grow less than linearly in the size of the term.

[1]  WadlerPhilip,et al.  Report on the programming language Haskell , 1992 .

[2]  John C. Mitchell,et al.  Type inference with simple subtypes , 1991, Journal of Functional Programming.

[3]  John C. Mitchell,et al.  Coercion and type inference , 1984, POPL.

[4]  Marcin Benke Efficient Type Reconstruction in the Presence of Inheritance , 1993, MFCS.

[5]  John C. Mitchell,et al.  Algorithmic aspects of type inference with subtypes , 1992, POPL '92.

[6]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[7]  Jerzy Tiuryn Subtype inequalities , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[8]  Mitchell Wand,et al.  On the complexity of type inference with coercion , 1989, FPCA.

[9]  Paul Hudak,et al.  A gentle introduction to Haskell , 1992, SIGP.

[10]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[11]  Simon L. Peyton Jones,et al.  Report on the programming language Haskell: a non-strict, purely functional language version 1.2 , 1992, SIGP.

[12]  Prateek Mishra,et al.  Type Inference with Subtypes , 1990, Theor. Comput. Sci..

[13]  Christiane Floyd,et al.  Theory and Practice of Software Development: Stages in a Debate , 1995, TAPSOFT.

[14]  Prateek Mishra,et al.  Polymorphic Subtype Inference: Closing the Theory-Practice Gap , 1989, TAPSOFT, Vol.2.