Deciding ML typability is complete for deterministic exponential time

  • Authors:
  • Harry G. Mairson

  • Affiliations:
  • Department of Computer Science, Brandeis University, Waltham, Massachusetts

  • Venue:
  • POPL '90 Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
  • Year:
  • 1989

Quantified Score

Hi-index 0.00

Visualization

Abstract

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 &OHgr;(2cn) distinct type variables and length &OHgr;(22cn). When the types associated with these ML constructions were represented as directed acyclic graphs, their sizes grew as &OHgr;(2cn). 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 &khgr; running in &Ogr;(c|&khgr;|) time by a polynomial-sized ML formula &PHgr;M,&khgr;, such that M accepts &khgr; iff &PHgr;M,&khgr; is typable. The simulation of the transition function &dgr; of the Turing Machine is realized uniquely through terms in the lambda calculus without 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.It 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 understand this lower bound, we relate it to the problem of proving equality of type variables in a system of type equations generated from an ML expression with let-polymorphism. We show that given an oracle for solving this problem, deciding typability would be in PSPACE, as would be the actual computation of the principal type of the expression, were it indeed typable.