I'm studying Types and Programming Languages, and have some trouble getting my head around the concepts of the 5th chapter, The Untyped Lambda Calculus.
Specifically, redex, reduction and the various evaluation strategies are doing my head in. The following is what I understand put into my own words, in an attempt to explain things to myself and get more knowledgeable people to correct my mistakes / imprecisions. I am honestly unsure as to whether this is an acceptable format for stackexchange, and am open to suggestions to make this a better fit.
Note that others have tried to answer a very similar question, but have still left me confused:
If my understanding is correct, a redex is a reducible expression, that is, the application of a lambda term to a lambda abstraction.
Or, more concretely, a redex is always of the form .
Reducing is done by replacing all free occurrences of in by . For example:
The process of reducing a lambda expression to its normal form is driven by an evaluation strategy: an algorithm for picking which redex to reduce first. In order to describe these however, we need some more vocabulary.
Leftmost and rightmost
- the leftmost redex is the one whose abstraction is textually to the left of all other redexes.
- the rightmost redex is the one whose abstraction is textually to the right of all other redexes.
So, for example, in , we have:
- leftmost redex:
- rightmost redex:
There can only be one leftmost and one rightmost redex in a given expression. I'm assuming that in an expression composed of a single redex, that redex is both the leftmost and the rightmost.
Innermost and outermost
- an innermost redex is one that contains no other redex.
- an outermost redex is one that is contained within no other redex.
So, for example, in , we have:
- innermost: , as it contains no other redex.
- outermost: , as it isn't contained in any other redex.
I'm assuming that in an expression composed of a single redex, that redex is both outermost and innermost.
Having defined this, we can talk about the two evaluation strategies that I'm struggling with: call by name and call by value.
Call by name
In call by name, the leftmost outermost redex is always picked for reduction. Additionally, no reduction can occur within a lambda abstraction. The example given by Types and Programming Languages is:
I do not understand the need for the definition of the strategy to include no reduction can occur within a lambda abstraction: is that not implied by the fact that only outermost redexes are eligible for reduction?
Call by value
In call by value the rightmost outermost redex is always picked for reduction. The example given by Types and Programming Languages is:
Title: (Leftmost-Outermost) Beta Reduction is Invariant, Indeed
Authors:Beniamino Accattoli (INRIA), Ugo Dal Lago (University of Bologna & INRIA)
(Submitted on 6 Jan 2016 (v1), last revised 8 Mar 2016 (this version, v2))
Abstract: 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.
Submission historyFrom: Beniamino Accattoli [view email]
[v1] Wed, 6 Jan 2016 16:31:48 GMT (78kb)
[v2] Tue, 8 Mar 2016 13:45:53 GMT (88kb)
Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?)