Rank 2 Type Systems and Recursive Definitions

We demonstrate an equivalence between the rank 2 fragments of the polymorphic lambda calculus (System F) and the intersection type discipline: exactly the same terms are typable in each system. An immediate consequence is that typability in the rank 2 intersection system is DEXPTIME-complete. We introduce a rank 2 system combining intersections and polymorphism, and prove that it types exactly the same terms as the other rank 2 systems. The combined system suggests a new rule for typing recursive deenitions. The result is a rank 2 type system with decidable type inference that can type some interesting examples of polymorphic recursion. Finally, we discuss some applications of the type system in data representation optimizations such as unboxing and overloading.

[1]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .

[2]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[3]  P. Sallé Une extension de la theorie des types en λ-calcul , 1978 .

[4]  Coppo Mario,et al.  A new type assignment for lambda-terms , 1978 .

[5]  Daniel Leivant,et al.  Polymorphic type inference , 1983, POPL '83.

[6]  Alan Mycroft,et al.  Polymorphic Type Schemes and Recursive Definitions , 1984, Symposium on Programming.

[7]  Nancy McCracken,et al.  The Typechecking of Programs with Implicit Type Structure , 1984, Semantics of Data Types.

[8]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[9]  Dominique Clément,et al.  A simple applicative language: mini-ML , 1986, LFP '86.

[10]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[11]  Jerzy Tiuryn,et al.  A proper extension of ML with an effective type-assignment , 1988, POPL '88.

[12]  Harry G. Mairson Deciding ML typability is complete for deterministic exponential time , 1989, POPL '90.

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

[14]  Wayne Snyder,et al.  Designing Unification Procedures Using Transformations: A Survey , 1992 .

[15]  Jerzy Tiuryn,et al.  Type reconstruction in the presence of polymorphic recursion , 1993, TOPL.

[16]  J. B. Wells Typability and type checking in the second-order Λ-calculus are equivalent and undecidable (Preliminary Draft) , 1993 .

[17]  Fritz Henglein,et al.  Type inference with polymorphic recursion , 1993, TOPL.

[18]  S. V. Bakel,et al.  Intersection type disciplines in Lambda Calculus and applicative term rewriting systems , 1993 .

[19]  Simon Peyton Jones,et al.  Unboxing using Specialisation , 1994, Functional Programming.

[20]  Assaf J. Kfoury,et al.  A direct algorithm for type inference in the rank-2 fragment of the second-order λ-calculus , 1994, LFP '94.

[21]  Jerzy Tiuryn,et al.  An analysis of ML typability , 1994, JACM.

[22]  Nikolaj Skallerud Bjjrner,et al.  Minimal Typing Derivations , 1994 .

[23]  Hirofumi Yokouchi,et al.  Embedding a Second Order Type System into an Intersection Type System , 1995, Inf. Comput..