A well known but incorrect piece of functional programming folklore is that ML expressions can be efficiently typed in polynomial time. In probing the truth of that folklore, various researchers, including Wand, Buneman, Kanellakis, and Mitchell, constructed simple counterexamples consisting of typable ML programs having length n, with principal types having R(2e") distinct type variables and length Q(2"'").When the types associated with these ML constructions were represented as directed acyclic graphs, their sizes grew as Q(2"').The folklore was even more strongly contradicted by the recent result of Kanellakis and Mitchell that simply deciding whether or not an ML expression is typable is PSPACE-hard.We improve the latter result, showing that deciding ML typability is DEXPTIME-hard. As Kanellakis and Mitchell have shown containment in DEXPTIME, the problem is DEXPTIME-complete.The proof of DEXPTIME-hardness is carried out via a generic reduction: it consists of a very straightforward simulation of any deterministic one-tape Turing machine M with input t running in O(cl'l) time by a polynomialsized ML formula CPM,=, such that M accepts x iff @M,= is typable. The simulation of the transition function 6 of the Turing Machine is realized uniquely through terms in the lambda calculus zoilhovl the use of the polymorphic let construct. We use let for two purposes only: to generate an exponential amount of blank tape for the Turing Machine simulation to begin, and to compose an exponential number of applications of the ML formula simulating state transition. ML [Mi78][HMM86] is a well known functional programming language incorporating a variety of novel features, and prominent in its contributions to programming language design is its polymorphic typing system. A strongly typed language like Pascal is completely type checked at compile time, obviating the need for runtime type checking; the penalty is that code which has been written in a largely "type independent" style (stacks, trees, or even the identity function) must be repeated with only changes in type declarations. On the other hand, a naive Lisp compiler will do no compile time type checking, allowing Lisp code to be freely reused on different data types, but the Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. 0 1990 ACM 089791-3434/90/0001/0382 $1.50 382It is purely the expressive power of ML polymorphism to succinctly express function composition which results in a proof of DEXPTIME-hardness.We conjecture that lower bounds on deciding typability for extensions to the typed lambda calculus can be regarded precisely in terms of this expressive capacity for succinct function composition.To further underst...
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
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
customersupport@researchsolutions.com
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.