We analyse the computational complexity of type inference for untyped X,-terms in the secondorder polymorphic typed X-calculus (F 2 ) invented by Girard and Reynolds, as well as higherorder extensions F 3 ,F 4 , ...,/^ proposed by Girard. We prove that recognising the i^-typable terms requires exponential time, and for F a the problem is non-elementary. We show as well a sequence of lower bounds on recognising the i^-typable terms, where the bound for F k+1 is exponentially larger than that for F k .The lower bounds are based on generic simulation of Turing Machines, where computation is simulated at the expression and type level simultaneously. Non-accepting computations are mapped to non-normalising reduction sequences, and hence non-typable terms. The accepting computations are mapped to typable terms, where higher-order types encode reduction sequences, and first-order types encode the entire computation as a circuit, based on a unification simulation of Boolean logic. A primary technical tool in this reduction is the composition of polymorphic functions having different domains and ranges.These results are the first nontrivial lower bounds on type inference for the Girard/Reynolds system as well as its higher-order extensions. We hope that the analysis provides important combinatorial insights which will prove useful in the ultimate resolution of the complexity of the type inference problem.
Capsule reviewThe polymorphic X-calculi F 2 ,F 3 , ...,F W form a useful foundation for the study of modern programming languages. Since the utility of a language's type system depends heavily on being able to ensure type correctness at compile time, the study of the complexity of type inference for F 2 , F 3 , ...,i^ is well motivated. This paper takes a significant step forward by establishing interesting lower bounds for type inference for this class of languages. Although the f A preliminary version of this work appeared in the