z (\x (x y))
-**Dot notation** Dot means "assume a left paren here, and the matching right
-paren as far to the right as possible without creating unbalanced
-parentheses". So:
+**Dot notation** Dot means "Insert a left parenthesis here, and the matching right parenthesis as far to the right as possible without creating unbalanced parentheses---so long as doing so would enclose an application or abstract not already wrapped in parentheses." Thus:
\x (\y (x y))
((\x (\y (x y))) x)
The outermost parentheses were added because we have an application. `(\x. \y.
-...)` became `(\x (\y. ...))` because of the rule for dots. We didn't have to
+...)` became `(\x (\y. ...))` because of the rule for dots. We didn't
insert any parentheses around the inner body of `\y. (x y)` because they were
already there. That is, in expressions of the form `\y. (...)`, the dot abbreviates
nothing. It's harmless to write such a dot, though, and it can be conceptually
-helpful especially in light of the next convention...
+helpful especially in light of the next convention.
+
+Similarly, we permit `\x. x`, which is shorthand for `\x x`, not for `\x (x)`, which
+our syntax forbids. (The [[lambda evaluator|/code/lambda_evaluator]] however tolerates such expressions.)
**Merging lambdas** An expression of the form `(\x (\y M))`, or equivalently, `(\x. \y. M)`, can be abbreviated as:
a set of ordered pairs. This set is called the **graph** of the
function. If the ordered pair `(a, b)` is a member of the graph of `f`,
that means that `f` maps the argument `a` to the value `b`. In
-symbols, `f: a` ↦ `b`, or `f (a) == b`.
+symbols, `f: a` ↦ `b`, or `f (a) == b`.
In order to count as a *function* (rather
than as merely a more general *relation*), we require that the graph not contain two
elements is all that it takes to simulate the behavior of a general
word processing program. That means that if we had a big enough
lambda term, it could take a representation of *Emma* as input and
-produce *Hamlet* as a result.
+produce *Hamlet* as a result.
Some of these functions are so useful that we'll give them special
names. In particular, we'll call the identity function `(\x x)`
## The analogy with `let` ##
In our basic functional programming language, we used `let`
-expressions to assign values to variables. For instance,
+expressions to assign values to variables. For instance,
let x match 2
- in (x, x)
+ in (x, x)
-evaluates to the ordered pair (2, 2). It may be helpful to think of
+evaluates to the ordered pair `(2, 2)`. It may be helpful to think of
a redex in the lambda calculus as a particular sort of `let`
construction.
is analogous to
- let x match ARG
+ let x match ARG
in BODY
This analogy should be treated with caution. For one thing, our `letrec`