Type inference in systems of recursive types with subtyping

We present general methods for performing type inference and deciding subtyping in languages with recursive types. Our type inference algorithm generalizes a common idea of previous work: type inference is reduced to a constraint satisfaction problem, whose satisfiability can be decided by a process of closure and consistency checking. We prove a general correctness theorem for this style of type inference. We define subtyping co-inductively, and we prove by co-induction that a closed and consistent constraint set has a solution. Our theorem makes it easier to find new type inference algorithms. For example, we provide definitions of closure and consistency for recursive types with a greatest type, but not a least type; we show that the definitions satisfy the conditions of our theorem; and the theorem immediately provides a type inference algorithm, thereby solving an open problem.

[1]  Robin Milner,et al.  A Calculus of Communicating Systems , 1980, Lecture Notes in Computer Science.

[2]  David Park,et al.  Concurrency and Automata on Infinite Sequences , 1981, Theoretical Computer Science.

[3]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[4]  Gordon D. Plotkin,et al.  An ideal model for recursive polymorphic types , 1984, Inf. Control..

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

[6]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[7]  Satish R. Thatte,et al.  Type Inference with Partial Types , 1988, Theor. Comput. Sci..

[8]  Robin Milner,et al.  Communication and concurrency , 1989, PHI Series in computer science.

[9]  Satish R. Thatte Quasi-static typing , 1989, POPL '90.

[10]  Bjarne Stroustrup,et al.  The Annotated C++ Reference Manual , 1990 .

[11]  F. Cardone,et al.  Two extensions of Curry's type inference system , 1990 .

[12]  Mario Coppo,et al.  Type Inference with Recursive Types: Syntax and Semantics , 1991, Inf. Comput..

[13]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

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

[15]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[16]  Mitchell Wand,et al.  Type Inference for Partial Types is Decidable , 1992, ESOP.

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

[18]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[19]  Jens Palsbergypalsberg,et al.  Eecient Recursive Subtyping , 1993 .

[20]  Davide Sangiorgi,et al.  Typing and subtyping for mobile processes , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[21]  Jerzy Tiuryn,et al.  Type Reconstruction with Recursive Types and Atomic Subtyping , 1993, TAPSOFT.

[22]  Jens Palsberg,et al.  Efficient recursive subtyping , 1992, POPL '93.

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

[24]  Jens Palsberg,et al.  Efficient inference of partial types , 1992, Proceedings., 33rd Annual Symposium on Foundations of Computer Science.

[25]  Geoffrey Smith,et al.  Principal Type Schemes for Functional Programs with Overloading and Subtyping , 1994, Sci. Comput. Program..

[26]  D. Kozen,et al.  Ecien t Inference of Partial Types , 1994 .

[27]  Jens Palsberg,et al.  A type system equivalent to flow analysis , 1995, TOPL.

[28]  John C. Mitchell,et al.  Lower bounds on type inference with subtypes , 1995, POPL '95.

[29]  Scott F. Smith,et al.  Sound polymorphic type inference for objects , 1995, OOPSLA.

[30]  A type system equivalent to flow analysis , 1995, TOPL.

[31]  Scott F. Smith,et al.  Type inference for recursively constrained types and its application to OOP , 1995, MFPS.

[32]  Scott F. Smith,et al.  Subtyping Constrained Types , 1996, SAS.

[33]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[34]  Jens Palsberg,et al.  Constrained types and their expressiveness , 1996, TOPL.

[35]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[36]  Fritz Henglein,et al.  Coinductive Axiomatization of Recursive Type Equality and Subtyping , 1998, Fundam. Informaticae.

[37]  Liwu Li,et al.  The Java Language , 1998 .