Simplifying Subtyping Constraints: A Theory

This paper offers a theoretical study of constraint simplification, a fundamental issue for the designer of a practical type inference system with subtyping. In the simpler case where constraints are equations, a simple isomorphism between constrained type schemes and finite state automata yields a complete constraint simplification method. Using it as a guide for the intuition, we move on to the case of subtyping, and describe several simplification algorithms. Although no longer complete, they are conceptually simple, efficient, and very effective in practice. Overall, this paper gives a concise theoretical account of the techniques found at the core of our type inference system. Our study is restricted to the case where constraints are interpreted in a non-structural lattice of regular terms. Nevertheless, we highlight a small number of general ideas, which explain our algorithms at a high level and may be applicable to a variety of other systems.

[1]  Alexander Aiken,et al.  Solving systems of set constraints , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[2]  François Pottier,et al.  A 3-Part Type Inference Engine , 2000, ESOP.

[3]  Thomas W. Reps,et al.  Interconvertibility of a class of set constraints and context-free-language reachability , 2000, Theor. Comput. Sci..

[4]  François Pottier,et al.  A framework for type inference with subtyping , 1998, ICFP '98.

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

[6]  François Pottier Synthese de types en presence de sous-typage : de la theorie a la pratique , 1998 .

[7]  J. Palsberg Efficient Inference of Object Types , 1996 .

[8]  Alexander Aiken,et al.  Soft typing with conditional types , 1994, POPL '94.

[9]  B. Courcelle Fundamental properties of infinite trees , 1983 .

[10]  Martín Abadi,et al.  A Theory of Primitive Objects - Untyped and First-Order Systems , 1994, TACS.

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

[12]  Joachim Niehren,et al.  Non-structural subtype entailment in automata theory , 2003, Inf. Comput..

[13]  Martín Abadi,et al.  A Theory of Primitive Objects: Second-Order Systems , 1995, Sci. Comput. Program..

[14]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[15]  Matthias Felleisen,et al.  Componential set-based analysis , 1997, TOPL.

[16]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[17]  François Pottier,et al.  Type Inference in the Presence of Subtyping: from Theory to Practice , 1998 .

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

[19]  Luca Cardelli,et al.  Subtyping recursive types , 1993 .

[20]  Jens Palsberg,et al.  Optimal Representations of Polymorphic Types with Subtyping , 1999, High. Order Symb. Comput..

[21]  Fritz Henglein,et al.  Constraint Automata and the Complexity of Recursive Subtype Entailment , 1998, ICALP.

[22]  Alexander Aiken,et al.  A Toolkit for Constructing Type- and Constraint-Based Program Analyses , 1998, Types in Compilation.

[23]  Alexander Aiken,et al.  Partial online cycle elimination in inclusion constraint graphs , 1998, PLDI.

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

[25]  Gordon D. Plotkin,et al.  An Ideal Model for Recursive Polymorphic Types , 1986, Inf. Control..

[26]  Joachim Niehren,et al.  Inclusion Constraints over Non-empty Sets of Trees , 1997, TAPSOFT.

[27]  Fritz Henglein,et al.  Breaking Through the n3 Barrier: Faster Object Type Inference , 1999, Theory Pract. Object Syst..

[28]  Claude Kirchner,et al.  Solving Equations in Abstract Algebras: A Rule-Based Survey of Unification , 1991, Computational Logic - Essays in Honor of Alan Robinson.

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

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

[31]  Alexandre Frey Satisfying Subtype Inequalities in Polynomial Space , 1997, SAS.

[32]  Manuel Fähndrich,et al.  Bane: a library for scalable constraint-based program analysis , 1999 .

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

[34]  Stephan Merz,et al.  Type checking higher-order polymorphic multi-methods , 1997, POPL '97.

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

[36]  Making Set-Constraint Program Analyses Scale , 1996 .

[37]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Information and Computation.

[38]  François Pottier,et al.  Simplifying subtyping constraints , 1996, ICFP '96.

[39]  Manuel Fähndrich,et al.  Making Set-Constraint Based Program Analyses Scale , 1996 .

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