Relating typability and expressiveness in finite-rank intersection type systems (extended abstract)

We investigate finite-rank intersection type systems, analyzing the complexity of their type inference problems and their relation to the problem of recognizing semantically equivalent terms. Intersection types allow something of type &tau;<inf>1</inf> &Lambda; &tau;<inf>2</inf> to be used in some places at type &tau;<inf>1</inf> and in other places at type &tau;<inf>2</inf>. A <i>finite-rank</i> intersection type system bounds how deeply the &Lambda; can appear in type expressions. Such type systems enjoy strong normalization, subject reduction, and computable type inference, and they support a pragmatics for implementing parametric polymorphism. As a consequence, they provide a conceptually simple and tractable alternative to the impredicative polymorphism of System F and its extensions, while typing many more programs than the Hindley-Milner type system found in ML and Haskell.While type inference is computable at every rank, we show that its complexity grows exponentially as rank increases. Let <b>K</b>(0, <i>n</i>) = <i>n</i> and <b>K</b>(<i>t</i> + 1, <i>n</i>) = 2<sup><b>K</b>(<i>t,n</i>)</sup>; we prove that recognizing the pure &lambda;-terms of size <i>n</i> that are typable at rank <i>k</i> is complete for <sc>DTIME</sc>[<b>K</b>(<i>k</i>&minus;1, <i>n</i>)]. We then consider the problem of deciding whether two &lambda;-terms typable at rank <i>k</i> have the same normal form, generalizing a well-known result of Statman from simple types to finite-rank intersection types. We show that the equivalence problem is <sc>DTIME</sc>[<b>K</b>(<b>K</b>(<i>k</i> &minus; 1, <i>n</i>), 2)]-complete. This relationship between the complexity of typability and expressiveness is identical in wellknown decidable type systems such as simple types and Hindley-Milner types, but seems to fail for System F and its generalizations. The correspondence gives rise to a conjecture that if &Tau; is a predicative type system where typability has complexity <i>t</i>(<i>n</i>) and expressiveness has complexity <i>e</i>(<i>n</i>), then <i>t</i>(<i>n</i>) = &Omega;(log* <i>e</i>(<i>n</i>)).

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

[2]  Harry G. Mairson,et al.  Parallel beta reduction is not elementary recursive , 1998, POPL '98.

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

[4]  A. J. Kfoury,et al.  A Direct Algorithm for Type Inference in the Rank 2 Fragment of the Second-Order -Calculus , 1993 .

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

[6]  Harry G. Mairson,et al.  The Complexity of Type Inference for Higher-Order Typed lambda Calculi , 1994, J. Funct. Program..

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

[8]  Harry G. Mairson,et al.  An Analysis of the Core-ML Language: Expressive Power and Type Reconstruction , 1994, ICALP.

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

[10]  Jerzy Tiuryn,et al.  Type Reconstruction in Finite Rank Fragments of the Second-Order lambda-Calculus , 1992, Inf. Comput..

[11]  Fairouz Kamareddine,et al.  A reduction relation for which postponement of K-contractions, Conservation and Preservation of Stro , 1996 .

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

[13]  Helmat Schwichtenberg,et al.  Complexity of Normalization in the Pure Typed Lambda – Calculus , 1982 .

[14]  Assaf J. Kfoury,et al.  Addendum to ``New Notions of Reduction and Non-Semantic Proofs of Beta Strong Normalization in Typed Lambda Calculi'''' , 1995 .

[15]  Fairouz Kamareddine,et al.  Calculi of Generalized beta-Reduction and Explicit Substitutions: The Type-Free and Simply Typed Versions , 1998, J. Funct. Log. Program..

[16]  Joe B. Wells,et al.  A Typed Intermediate Language for Flow-Directed Compilation , 1997, TAPSOFT.

[17]  Richard Statman,et al.  The Typed lambda-Calculus is not Elementary Recursive , 1979, Theor. Comput. Sci..

[18]  Harry G. Mairson A Simple Proof of a Theorem of Statman , 1992, Theor. Comput. Sci..

[19]  Harry G. Mairson,et al.  The complexity of type inference for higher-order lambda calculi , 1991, POPL '91.

[20]  John C. Mitchell,et al.  Foundations for programming languages , 1996, Foundation of computing series.

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

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

[23]  Albert R. Meyer The inherent computational complexity of theories of ordered sets , 1974 .