## The Complexity of Type Inference for Higher-Order Typed Lambda Calculi (1991)

Venue: | J. Funct. Programming |

Citations: | 28 - 11 self |

### BibTeX

@INPROCEEDINGS{Henglein91thecomplexity,

author = {Fritz Henglein and Harry G. Mairson},

title = {The Complexity of Type Inference for Higher-Order Typed Lambda Calculi},

booktitle = {J. Funct. Programming},

year = {1991},

pages = {119--130}

}

### Years of Citing Articles

### OpenURL

### Abstract

We analyze the computational complexity of type inference for untyped -terms in the second-order polymorphic typed -calculus (F 2 ) invented by Girard and Reynolds, as well as higher-order extensions F 3 ; F 4 ; : : : ; F ! proposed by Girard. We prove that recognizing the F 2 - typable terms requires exponential time, and for F ! the problem is nonelementary. We show as well a sequence of lower bounds on recognizing the F k -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-normalizing 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. ...

### Citations

10922 |
Computers and Intractability: A Guide to the Theory of NP-Completeness
- Garey, Johnson
- 1979
(Show Context)
Citation Context ...ropositional variables, asking instead whether there exists a substitution for which the formula is true, we get the satisfiability problem, complete for nondeterministic polynomial time (Cook, 1971; =-=Garey and Johnson, 1979-=-). By alternating existential and universal quantifiers, we derive the polynomial time hierarchy, and in the limit, the problem of quantified boolean formulas, complete for polynomial space (Stockmeye... |

3836 |
J.D.: Introduction to automata theory, languages, and computation
- Hopcroft, Motwani, et al.
(Show Context)
Citation Context ...encode as rapidly increasing an fin) as possible, while constraining the transducer reducing M and x to *?'M x to run in logarithmic space. By the time hierarchy theorem (Hartmanis and Stearns, 1965; =-=Hopcroft and Ullman, 1979-=-), these complexity-class relativised hardness bounds translate (via diagonalisation arguments) to non-relativised bounds. For instance, the DTIME[2"]-hardness bound for typability in F2 implies a fi(... |

936 | A theory of type polymorphism in progra.mming
- Milner
- 1978
(Show Context)
Citation Context ...benefits of static typing. He gave an algorithm which, presented with an untyped program, could construct the most general type information (known as the principal type [Hin69, DM82]) for the program =-=[Mil78]-=-. These insights are implemented in the ML programming language [HMT90] as well as a variety 1 In his 1977 Turing Award lecture, as well as his Foreward to Joseph Stoy's book on denotational semantics... |

775 | The complexity of theorem-proving procedures
- Cook
- 1971
(Show Context)
Citation Context ...y over the propositional variables, asking instead whether there exists a substitution for which the formula is true, we get the satisfiability problem, complete for nondeterministic polynomial time (=-=Cook, 1971-=-; Garey and Johnson, 1979). By alternating existential and universal quantifiers, we derive the polynomial time hierarchy, and in the limit, the problem of quantified boolean formulas, complete for po... |

473 |
Denotational Semantics: the Scott-Strachey Approach to Programming Languages Theory
- Stoy
- 1977
(Show Context)
Citation Context ...is way that has come to our notice was in a verbal communication from Roger Penrose to [me] in about 1958. At the time this suggestion fell on stony ground and had virtually no influence." (p. xx=-=iii) [Sto77]-=- of other functional languages [HW88, Tur85]. The principal type of an ML program provides an important functional specification of the program, describing how it can be used by other programs; as suc... |

364 |
Towards a theory of type structure
- Reynolds
- 1974
(Show Context)
Citation Context ...n problems in programming language theory and type theory is the decidability of type inference for the second order polymorphic typed -calculus invented by Jean-Yves Girard [Gir72] and John Reynolds =-=[Rey74]-=-. More precisely, does there exist an effective procedure which, given an untyped -term, can decide whether the term is typable in the Girard/Reynolds system? If so, and the term is typable, can the a... |

352 |
Proofs and Types
- Girard, Lafont, et al.
- 1989
(Show Context)
Citation Context ...ugmentation of the ML proof, we derive a DTIME[2"*]hardness bound on the recognition of /"2-typable terms. We make essential and powerful use of the strong normalisation theorem for F2 (Girard, 1972; =-=Girard et al., 1989-=-; Gallier, 1990), using the coded Boolean answer A to the question 'Did machine M reject its input of length n in 2"* steps?' to choose between a trivial terminating computation and a clearly nontermi... |

302 |
Word Problems Requiring Exponential Time (Preliminary Report
- Stockmeyer, Meyer
- 1973
(Show Context)
Citation Context ...son, 1979). By alternating existential and universal quantifiers, we derive the polynomial time hierarchy, and in the limit, the problem of quantified boolean formulas, complete for polynomial space (=-=Stockmeyer and Meyer, 1973-=-; Garey and Johnson, 1979). Finally, if we allow quantification over functions of Booleans, functions of functions of Booleans, etc., we get a problem complete for nonelementary time (Meyer, 1974; Sta... |

285 |
Interpre'tation fonctionelle et e'limination des coupures duns l'arithme'tique d'ordre supe'rieure
- Girard
- 1972
(Show Context)
Citation Context ...One of the outstanding open problems in programming language theory and type theory is the decidability of type inference for the second order polymorphic typed -calculus invented by Jean-Yves Girard =-=[Gir72]-=- and John Reynolds [Rey74]. More precisely, does there exist an effective procedure which, given an untyped -term, can decide whether the term is typable in the Girard/Reynolds system? If so, and the ... |

238 |
Interprétation fonctionnelle et elimination des coupures de l’arithmétique d’ordre supérieur. Thèse d’état, Université de Paris 7
- Girard
- 1972
(Show Context)
Citation Context ... by a slight augmentation of the ML proof, we derive a DTIME[2"*]hardness bound on the recognition of /"2-typable terms. We make essential and powerful use of the strong normalisation theorem for F2 (=-=Girard, 1972-=-; Girard et al., 1989; Gallier, 1990), using the coded Boolean answer A to the question 'Did machine M reject its input of length n in 2"* steps?' to choose between a trivial terminating computation a... |

233 |
Principal type schemes for functional programs
- Damas, Milner
- 1982
(Show Context)
Citation Context ... retaining the benefits of static typing. He gave an algorithm which, presented with an untyped program, could construct the most general type information, known as the principal type (Hindley, 1969; =-=Damas and Milner, 1982-=-) for the program (Milner 1978). These insights are implemented in the ML programming language (Harper et al., 1990) as well as a variety of the other functional languages (Hudak and Wadler, 1988; Tur... |

213 |
Intensional Interpretations of Functionals of Finite Type
- Tait
- 1967
(Show Context)
Citation Context ...atly enlarging the size of the proofs. A proof of this cut elimination theorem appears in the appendix of [KMM91]; a different and much cleaner proof inspired by the Tait strong normalization theorem =-=[Tai67]-=- is found in [Mai92a]. The added combinatorial insight comes from that fact that type inference can be completely reduced to first-order unification. The second observation, due to Paris Kanellakis an... |

190 |
On the computational complexity of algorithms
- Hartmanis, Stearns
- 1965
(Show Context)
Citation Context ...gh the "chain reaction" of subsequent unifications with separate copies of TM circuitry. Since E reduces to (2 m ffi)ID 0 , the result follows from the so-called subject reduction theorem (s=-=ee, e.g., [HS65]-=-), the -calculus interpretation of cut elimination: namely, if a term has a particular type, then any reduct of that term has the same type. We remark that the rank 2 typing refers to the fact that ra... |

179 |
The next 700 programming languages
- Landin
- 1966
(Show Context)
Citation Context ...ve useful in the ultimate resolution of the complexity of the type inference problem. The problem of type inference is one of both theoretical and practical interest. Following the insights of Landin =-=[Lan66]-=-, Strachey [Str73], Penrose 1 , and others, the untyped -calculus has long been recognized as not merely Turing-complete, but a syntactically natural foundation for the design of programming languages... |

167 |
A machine oriented logic based on the resolution principle
- Robinson
- 1965
(Show Context)
Citation Context ... a syntax-directed algorithm is given that transforms an untyped X-term into a linear sized set of type equations of the form X=Y and X= Y->Z, such that the solution of the equations via unification (=-=Robinson, 1965-=-; Paterson and Wegman 1978) determines the principal type of the term. In progressing from this language to ML, it is necessary to understand the effect of quantification over type variables on the co... |

160 | A non-strict functional language with polymorphic types - Miranda - 1985 |

147 |
Linear Unification
- Paterson, Wegman
- 1978
(Show Context)
Citation Context ...ed algorithm is given that transforms an untyped X-term into a linear sized set of type equations of the form X=Y and X= Y->Z, such that the solution of the equations via unification (Robinson, 1965; =-=Paterson and Wegman 1978-=-) determines the principal type of the term. In progressing from this language to ML, it is necessary to understand the effect of quantification over type variables on the complexity of type inference... |

143 |
Miranda: a non-strict functional language with polymorphic types
- Turner
- 1985
(Show Context)
Citation Context ...982) for the program (Milner 1978). These insights are implemented in the ML programming language (Harper et al., 1990) as well as a variety of the other functional languages (Hudak and Wadler, 1988; =-=Turner, 1985-=-). The principal type of an ML program provides an important functional specification of the program, describing how it can be used by other programs; as such, types are useful as specifications, and ... |

141 | Type systems for programming languages - Mitchell - 1990 |

111 | Continuation-passing, closure-passing style - Appel, Jim - 1989 |

108 |
The principal type scheme of an object in combinatory logic
- Hindley
- 1969
(Show Context)
Citation Context ...de reuse, while retaining the benefits of static typing. He gave an algorithm which, presented with an untyped program, could construct the most general type information, known as the principal type (=-=Hindley, 1969-=-; Damas and Milner, 1982) for the program (Milner 1978). These insights are implemented in the ML programming language (Harper et al., 1990) as well as a variety of the other functional languages (Hud... |

94 |
Type Assignment in Programming Languages
- Damas
- 1984
(Show Context)
Citation Context ...bservations. The first, given in [Mit90] 7 , is that the following inference rule for 7 In this survey, the rule is attributed to Albert Meyer. However, it appears as well in the thesis of Luis Damas =-=[Dam85]-=-, and in fact a question about it can be found in the 1985 postgraduate examination in computing at Edinburgh University [San88]. let preserves exactly the type judgements for closed terms usually der... |

81 | Partial polymorphic type inference and higher-order unification
- Pfenning
- 1988
(Show Context)
Citation Context ... be solved is partial type inference, where the programmer supplies constraints in the form of type information for certain fragments of the program. In view of the undecidability results of Pfenning =-=[Pf88]-=-, from a theoretical perspective, it is clear that partial type inference is not easier than pure type inference; in fact, pure type inference might be decidable. Because no progress on (pure) type in... |

77 |
A simple algorithm and proof for type inference
- Wand
- 1987
(Show Context)
Citation Context ...from ML It has been known for some time that type inference for the simply-typed (first-order) -calculus can be solved in polynomial time. A simple and elegant exposition of this fact can be found in =-=[Wan87]-=-, where a syntax-directed algorithm is given that transforms an untyped -term into a linear sized set of type equations of the form X = Y and X = Y ! Z, such that the solution of the equations (via un... |

72 | Compilation by Program Transformation - Kelsey - 1989 |

70 |
Introduction to Combinators and the Lambda-Calculus
- Hindley, Seldin
- 1986
(Show Context)
Citation Context ... to anyone desiring a readable introduction to programming in higher-order typed -calculi. 3 Observe that these type systems preserve typings under fi-reduction, the so-called subject reduction lemma =-=[HS86]-=-. 2 The second order polymorphic typed -calculus (F 2 ) F 2 is best introduced by a canonical example: the identity function. In F 2 , we write the typed polymorphic identity function 4 as Id j ff: :x... |

61 |
On the sequential nature of unification
- Dwork, Kanellakis, et al.
- 1984
(Show Context)
Citation Context ...ognizing typable ML programs, as well as an utterly transparent proof that first-order unification is PTIME-complete. The latter is especially perspicuous in that it replaces the ingenious gadgets of =-=[DKM84]-=- with classical combinators from the -calculus, and shows how the theorem might have been proved by merely writing a simple, let-free ML program. In Section 4, we provide a description of the systems ... |

61 |
The circuit value problem is log space complete for P
- Ladner
- 1975
(Show Context)
Citation Context ...entially, that the circuit value problem (given a Boolean circuit with inputs, what is its output?) could be reduced to unification. The circuit value problem is logspace complete for polynomial time =-=[Lad75], since an-=-y polynomial time TM computation can be described by a polynomial sized circuit, where the input to the circuit is the initial tape contents, and polynomial "layers" of circuitry implement e... |

49 | Deciding ML typability is complete for deterministic exponential time - Mairson - 1990 |

45 |
The definition of Standard ML
- Harper, Milner, et al.
- 1990
(Show Context)
Citation Context ...n untyped program, could construct the most general type information (known as the principal type [Hin69, DM82]) for the program [Mil78]. These insights are implemented in the ML programming language =-=[HMT90]-=- as well as a variety 1 In his 1977 Turing Award lecture, as well as his Foreward to Joseph Stoy's book on denotational semantics, Dana Scott mentions that it was physicist Roger Penrose who pointed S... |

42 | Unification and ML type reconstruction
- KANELLAKIS, MAIRSON, et al.
- 1991
(Show Context)
Citation Context ...ound for some constant c ? 1. 2 As a consequence, ML is in practice augmented with a set of typed fixpoint operators. The structure of \Psi M;x is basically a consequence of the following proposition =-=[KMM91]-=-: Proposition 1.1 Given any strongly normalizing -term E, the problem of determining whether the normal form of E is first-order typable is DTIME[f(n)]-hard, for any total recursive function f(n). Pro... |

29 | Programming in higher-order typed lambda calculi
- Pierce, Dietzen, et al.
- 1989
(Show Context)
Citation Context ...lementary lower bound on typability for F ! , and show the connections between this bound and related lower bounds for the F k . Our tutorial material was in many ways inspired by the presentation of =-=[PDM89]-=-, which we enthusiastically recommend to anyone desiring a readable introduction to programming in higher-order typed -calculi. 3 Observe that these type systems preserve typings under fi-reduction, t... |

27 |
A Language with Eval and Polymorphism
- Pfenning, Lee
- 1989
(Show Context)
Citation Context ...s been proposed as the mathematical foundation for a new generation of typed functional programming languages, for example Cardelli's language Quest [Car89], and the language LEAP of Pfenning and Lee =-=[PL89]-=-. The practical use of such languages, however, is considerably hampered by the absence of any type inference algorithm, forcing the programmer into detail and debugging of types as well as of the pro... |

27 |
The varieties of programming language
- Strachey
- 1972
(Show Context)
Citation Context ...ltimate resolution of the complexity of the type inference problem. The problem of type inference is one of both theoretical and practical interest. Following the insights of Landin [Lan66], Strachey =-=[Str73]-=-, Penrose 1 , and others, the untyped -calculus has long been recognized as not merely Turing-complete, but a syntactically natural foundation for the design of programming languages. The process of f... |

26 | On Girard's "candidats de reductibilit'es - Gallier - 1990 |

26 |
The typed ^.-calculus is not elementary recursive
- Statman
- 1979
(Show Context)
Citation Context ...n theorem of Statman: the theorem states that if we have two kterms typable in the first order typed lambda calculus, deciding whether the terms have the same normal form requires nonelementary time (=-=Statman, 1979-=-; Mairson 1992b). The proof of Statman's theorem is a reduction from deciding the truth of expressions in higher-order logic, where quantification is allowed not only over Boolean values, but over hig... |

20 |
The inherent computational complexity of theories of ordered sets
- Meyer
- 1974
(Show Context)
Citation Context ...tman's theorem is a reduction from deciding the truth of expressions in higher-order logic, where quantification is allowed not only over Boolean values, but over higher-order functions over Booleans =-=[Mey74]. Every fo-=-rmula in higher-order logic is transformed, using the reduction, into a -term that fi-reduces to the standard term t: oe:f : oe:t coding "true" if and only if the formula is true, and otherw... |

19 | Type reconstruction in finite rank fragments of secondorder lambda calculus - Kfoury, Tiuryn - 1992 |

15 |
Characterization of typings in polymorphic type discipline
- Giannini, Rocca, et al.
- 1988
(Show Context)
Citation Context ...ification are simply too weak. Proving that strongly normalizing terms are not F 2 -typable is very difficult: as evidence, we point merely to the tremendous effort of Giannini and Ronchi della Rocca =-=[GR88]-=- in their identifying a single, simple, strongly normalizing term which is not F 2 -typable. The Giannini-Ronchi results are an indication that F 2 type inference might in fact be decidable, since the... |

15 |
ML typability is DEXPTIME-complete
- Kfoury, Tiuryn, et al.
- 1990
(Show Context)
Citation Context ... E containing \Psi ID 0 as a subterm, where the type of E necessarily codes whether M rejected x. 8 An alternate proof, based on the analysis of a problem called acyclic seminunification, is found in =-=[KTU90]-=-. Using the methods of [DKM84] for coding Boolean logic, the simulation codes the Boolean values true and false as: 9 true j x:y:z:K z (Eq x y) 2 \Deltaa: :\Deltab: :a ! a ! b ! b false j x:y:z:z 2 \D... |

12 |
Complexity of normalization in the pure typed lambda-calculus
- Schwichtenberg
- 1982
(Show Context)
Citation Context ...lier, the first-order typed -calculus with a single type constant (). The "duality" approach forces reductions at the expression level to match those at the type level, and a result of Schwi=-=chtenberg [Sch82]-=- indicates that our construction is using the type language at its maximum capacity. Encouraged and excited as we are to have made progress on these open questions in programming language theory, the ... |

11 |
Type systems for programming languages, Handbook of theoretical computer science
- Mitchell
- 1990
(Show Context)
Citation Context ...turally, this insight is also crucial in the case of F 2 . The progress in understanding ML quantification and type inference is primarily due to two straightforward observations. The first, given in =-=[Mit90]-=- 7 , is that the following inference rule for 7 In this survey, the rule is attributed to Albert Meyer. However, it appears as well in the thesis of Luis Damas [Dam85], and in fact a question about it... |

9 | A simple algorithm and proof for type inference. Fundamenta Informaticae 10 - Wand - 1989 |

8 |
Logic and programming languages
- Scott
- 1977
(Show Context)
Citation Context ...notational semantics, Dana Scott mentions that it was physicist Roger Penrose who pointed Strachey in the direction of the X-calculus as a useful device for describing programming language semantics (=-=Scott, 1977-=-; Stoy, 1977). Scott quotes Strachey as having written, 'The X-calculus has been widely used as an aid in examining the semantics of programming languages precisely because it brings out very clearly ... |

5 |
Report on the functional programming language
- Hudak, Wadler
- 1988
(Show Context)
Citation Context ...969; Damas and Milner, 1982) for the program (Milner 1978). These insights are implemented in the ML programming language (Harper et al., 1990) as well as a variety of the other functional languages (=-=Hudak and Wadler, 1988-=-; Turner, 1985). The principal type of an ML program provides an important functional specification of the program, describing how it can be used by other programs; as such, types are useful as specif... |

4 | Quantifier elimination and parametric polymorphism in programming languages
- Mairson
- 1992
(Show Context)
Citation Context ...ize of the proofs. A proof of this cut elimination theorem appears in the appendix of [KMM91]; a different and much cleaner proof inspired by the Tait strong normalization theorem [Tai67] is found in =-=[Mai92a]-=-. The added combinatorial insight comes from that fact that type inference can be completely reduced to first-order unification. The second observation, due to Paris Kanellakis and John Mitchell, is t... |

4 | A Simple Proof of a Theorem of Statman. Theoretical Computer Science 103:2 - Mairson - 1992 |

2 |
Polymorphic unification and ML typing. Brown University
- Kanellakis, Mitchell
- 1989
(Show Context)
Citation Context ...t-order unification. The second observation, due to Paris Kanellakis and John Mitchell, is that let can be used to compose functions an exponential number of times with a polynomial-length expression =-=[KM89]-=-: Example 3.1 \Psi j let x 0 = ffi in let x 1 = y:x 0 (x 0 y) in let x 2 = y:x 1 (x 1 y) in : : : let x t = y:x t\Gamma1 (x t\Gamma1 y) in x t The above expression let-reduces to y:ffi 2 t y, where th... |

2 |
On Girard's 'Candidats de Reducibilite
- Gallier
- 1990
(Show Context)
Citation Context ... proof, we derive a DTIME[2"*]hardness bound on the recognition of /"2-typable terms. We make essential and powerful use of the strong normalisation theorem for F2 (Girard, 1972; Girard et al., 1989; =-=Gallier, 1990-=-), using the coded Boolean answer A to the question 'Did machine M reject its input of length n in 2"* steps?' to choose between a trivial terminating computation and a clearly nonterminating one: ¥ =... |

2 |
On the computational complexity of algorithms. Trans
- Hartmanis, Stearns
- 1965
(Show Context)
Citation Context ... bounds, the challenge is to encode as rapidly increasing an fin) as possible, while constraining the transducer reducing M and x to *?'M x to run in logarithmic space. By the time hierarchy theorem (=-=Hartmanis and Stearns, 1965-=-; Hopcroft and Ullman, 1979), these complexity-class relativised hardness bounds translate (via diagonalisation arguments) to non-relativised bounds. For instance, the DTIME[2"]-hardness bound for typ... |