Beta Reduction is Invariant, Indeed (Long Version)

Slot and van Emde Boas' weak invariance thesis states that reasonable machines can simulate each other within a polynomially overhead in time. Is $\lambda$-calculus a reasonable machine? Is there a way to measure the computational complexity of a $\lambda$-term? This paper presents the first complete positive answer to this long-standing problem. Moreover, our answer is completely machine-independent and based over a standard notion in the theory of $\lambda$-calculus: the length of a leftmost-outermost derivation to normal form is an invariant cost model. Such a theorem cannot be proved by directly relating $\lambda$-calculus with Turing machines or random access machines, because of the size explosion problem: there are terms that in a linear number of steps produce an exponentially long output. The first step towards the solution is to shift to a notion of evaluation for which the length and the size of the output are linearly related. This is done by adopting the linear substitution calculus (LSC), a calculus of explicit substitutions modelled after linear logic and proof-nets and admitting a decomposition of leftmost-outermost derivations with the desired property. Thus, the LSC is invariant with respect to, say, random access machines. The second step is to show that LSC is invariant with respect to the $\lambda$-calculus. The size explosion problem seems to imply that this is not possible: having the same notions of normal form, evaluation in the LSC is exponentially longer than in the $\lambda$-calculus. We solve such an impasse by introducing a new form of shared normal form and shared reduction, deemed useful. Useful evaluation avoids those steps that only unshare the output without contributing to $\beta$-redexes, i.e., the steps that cause the blow-up in size.

[1]  Ugo Dal Lago,et al.  The weak lambda calculus as a reasonable machine , 2008, Theor. Comput. Sci..

[2]  Damiano Mazza,et al.  Distilling abstract machines , 2014, ICFP.

[3]  Marco Gaboardi,et al.  A logical account of pspace , 2008, POPL '08.

[4]  Claudio Sacerdoti Coen,et al.  On the Value of Variables , 2014, WoLLIC.

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

[6]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[7]  Rp Rob Nederpelt The fine-structure of lambda calculus , 1992 .

[8]  Ugo Dal Lago,et al.  On the Invariance of the Unitary Cost Model for Head Reduction (Long Version) , 2012, RTA.

[9]  Beniamino Accattoli,et al.  An Abstract Factorization Theorem for Explicit Substitutions , 2012, RTA.

[10]  Ugo Dal Lago,et al.  On Constructor Rewrite Systems and the Lambda-Calculus , 2009, ICALP.

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

[12]  Ugo Dal Lago,et al.  Functional Programming in Sublinear Space , 2010, ESOP.

[13]  Ulrich Schöpp,et al.  Stratified Bounded Affine Logic for Logarithmic Space , 2007, 22nd Annual IEEE Symposium on Logic in Computer Science (LICS 2007).

[14]  de Ng Dick Bruijn Generalizing Automath by means of a lambda-typed lambda calculus , 1987 .

[15]  Georg Moser,et al.  Closing the Gap Between Runtime Complexity and Polytime Computability , 2010, RTA.

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

[17]  Delia Kesner,et al.  A nonstandard standardization theorem , 2014, POPL.

[18]  Ugo Dal Lago,et al.  Light Logics and the Call-by-Value Lambda Calculus , 2008, Log. Methods Comput. Sci..

[19]  Peter van Emde Boas,et al.  On tape versus core an application of space efficient perfect hash functions to the invariance of space , 1984, STOC '84.

[20]  Kazushige Terui,et al.  Light types for polynomial time computation in lambda calculus , 2009, Inf. Comput..

[21]  Harry G. Mairson,et al.  Optimality and inefficiency: what isn't a cost model of the lambda calculus? , 1996, ICFP '96.

[22]  Robin Milner,et al.  Local Bigraphs and Confluence: Two Conjectures: (Extended Abstract) , 2007, EXPRESS.