(Leftmost-Outermost) Beta Reduction is Invariant, Indeed

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 modeled after linear logic 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. The main technical contribution of the paper is indeed the definition of useful reductions and the thorough analysis of their properties.

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

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

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

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

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

[6]  Ugo Dal Lago,et al.  Beta Reduction is Invariant, Indeed (Long Version) , 2014, ArXiv.

[7]  Daniel de Carvalho,et al.  Execution time of λ-terms via denotational semantics and intersection types , 2009, Mathematical Structures in Computer Science.

[8]  Damiano Mazza Simple Parsimonious Types and Logarithmic Space , 2015, CSL.

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

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

[11]  Neil D. Jones,et al.  What Not to Do When Writing an Interpreter for Specialisation , 1996, Dagstuhl Seminar on Partial Evaluation.

[12]  Jean-Jacques Lévy,et al.  An abstract standardisation theorem , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

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

[14]  Giulio Manzonetto,et al.  Weighted Relational Models of Typed Lambda-Calculi , 2013, 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science.

[15]  Guy E. Blelloch,et al.  Parallelism in sequential functional languages , 1995, FPCA '95.

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

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

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

[19]  Didier Rémy,et al.  Full Reduction in the Face of Absurdity , 2015, ESOP.

[20]  Marco Gaboardi,et al.  A Soft Type Assignment System for lambda -Calculus , 2007, CSL.

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

[22]  Dan R. Ghica,et al.  Slot games: a quantitative model of computation , 2005, POPL '05.

[23]  Benjamin Grégoire,et al.  A compiled implementation of strong reduction , 2002, ICFP '02.

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

[25]  David A. Schmidt,et al.  The essence of computation: complexity, analysis, transformation , 2002 .

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

[27]  Stéphane Lengrand,et al.  Non-idempotent intersection types and strong normalisation , 2013, Log. Methods Comput. Sci..

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

[29]  Claudio Sacerdoti Coen,et al.  On the Relative Usefulness of Fireballs , 2015, 2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science.

[30]  Michele Pagani,et al.  A semantic measure of the execution time in linear logic , 2011, Theor. Comput. Sci..

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

[32]  Pierre Clairambault Bounding Skeletons, Locally Scoped Terms and Exact Bounds for Linear Head Reduction , 2013, TLCA.

[33]  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.

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

[35]  Clemens Grabmayer,et al.  Maximal sharing in the Lambda calculus with letrec , 2014, ICFP.

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

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

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

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

[40]  Beniamino Accattoli,et al.  Jumping Boxes , 2009, CSL.

[41]  Ugo Dal Lago,et al.  (Leftmost-Outermost) Beta Reduction is Invariant, Indeed , 2016, Log. Methods Comput. Sci..

[42]  Ugo Dal Lago,et al.  Quantitative Game Semantics for Linear Logic , 2008, CSL.

[43]  G. Frandsen What is an Efficient Implementation of the λ-calculus ? , 1991 .

[44]  Vincent Danos,et al.  Head Linear Reduction , 2004 .