Rank 2 intersection types for local definitions and conditional expressions

We propose a rank 2 intersection type system with new typing rules for local definitions (let-expressions and letrec-expressions) and conditional expressions (if-expressions and match-expressions). This is a further step towards the use of intersection types in "real" programming languages.The technique for typing local definitions relies entirely on the principal typing property (i.e. it does not depend on particulars of rank 2 intersection), so it can be applied to any system with principal typings. The technique for typing conditional expressions, which is based on the idea of introducing metrics on types to "limit the use" of the intersection type constructor in the types assigned to the branches of the conditionals, is instead tailored to rank 2 intersection. However, the underlying idea might also be useful for other type systems.

[1]  Rishiyur S. Nikhil,et al.  Incremental Polymorphism , 1991, FPCA.

[2]  T. Jim Rank 2 Type Systems and Recursive Definitions , 1995 .

[3]  Mariangiola Dezani-Ciancaglini,et al.  An extension of the basic functionality theory for the λ-calculus , 1980, Notre Dame J. Formal Log..

[4]  Paola Giannini,et al.  Principal Types and Unification for a Simple Intersection Type System , 1995, Inf. Comput..

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

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

[7]  Paola Giannini,et al.  A Decidable Intersection Type System based on Relevance , 1994, TACS.

[8]  Andrew W. Appel,et al.  Smartest recompilation , 1993, POPL '93.

[9]  Ferruccio Damiani Typing Local Definitions and Conditional Expressions with Rank 2 Intersection , 2000, FoSSaCS.

[10]  Pawel Urzyczyn,et al.  Type reconstruction in Fω , 1997, Mathematical Structures in Computer Science.

[11]  Maribel Fernández,et al.  Polymorphic Intersection Type Assignment for Rewrite Systems with Abstractions and beta-Rule , 1999, TYPES.

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

[13]  Trevor Jim What are principal typings and what are they good for? , 1996, POPL '96.

[14]  J. V. Tucker,et al.  Basic Simple Type Theory , 1997 .

[15]  Ines Margaria,et al.  Principal Typing in a forall-and-Discipline , 1995, J. Log. Comput..

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

[17]  Simona Ronchi Della Rocca,et al.  Principal Type Schemes for an Extended Type Theory , 1984, Theor. Comput. Sci..

[18]  J. B. Wells,et al.  Typability and type checking in the second-order /spl lambda/-calculus are equivalent and undecidable , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[19]  Mario Coppo,et al.  Principal type-schemes and lambda-calculus semantics , 1980 .

[20]  Lambert G. L. T. Meertens,et al.  Incremental polymorphic type checking in B , 1983, POPL '83.

[21]  Luís Damas Type assignment in programming languages , 1984 .

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

[23]  Robin Milner,et al.  Definition of standard ML , 1990 .

[24]  Assaf J. Kfoury,et al.  Principality and decidable type inference for finite-rank intersection types , 1999, POPL '99.

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

[26]  Trevor Jim,et al.  A Polar Type System , 2000, ICALP Satellite Workshops.

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

[28]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[29]  Mariangiola Dezani-Ciancaglini,et al.  Functional Characters of Solvable Terms , 1981, Math. Log. Q..

[30]  Mariangiola Dezani-Ciancaglini,et al.  A filter lambda model and the completeness of type assignment , 1983, Journal of Symbolic Logic.

[31]  Mario Coppo,et al.  An Extended Polymorphic Type System for Applicative Languages , 1980, MFCS.

[32]  Simona Ronchi Della Rocca,et al.  Principal Type Scheme and Unification for Intersection Type Discipline , 1988, Theor. Comput. Sci..

[33]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

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