From: Jim Pryor Date: Sun, 19 Sep 2010 17:46:47 +0000 (-0400) Subject: week2: comments about alpha-conversion, de Bruijn X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=b7d91eac8927d07994f585d0c03a1fe1f729f6c5 week2: comments about alpha-conversion, de Bruijn Signed-off-by: Jim Pryor --- diff --git a/week2.mdwn b/week2.mdwn index 53e86eeb..2a17a8b0 100644 --- a/week2.mdwn +++ b/week2.mdwn @@ -1,5 +1,54 @@ [[!toc]] +Substitution and Alpha-Conversion +================================= + +Intuitively, (a) and (b) express the application of the same function to the argument `y`: + +
    +
  1. (\x. \z. z x) y +
  2. (\x. \y. y x) y +
+ +One can't just rename variables freely. (a) and (b) are different than what's expressed by: + +
    +
  1. (\z. (\z. z z) y +
+ + +Substituting `y` into the body of `(\x. \z. z x)` is unproblematic: + + (\x. \z. z x) y ~~> \z. z y + +However, with (b) we have to be more careful. If we just substituted blindly, then we might take the result to be `\y. y y`. But this is the self-application function, not the function which accepts an arbitrary argument and applies that argument to the free variable `y`. In fact, the self-application function is what (c) reduces to. So if we took (b) to reduce to `\y. y y`, we'd wrongly be counting (b) to be equivalent to (c), instead of (a). + +To reduce (b), then, we need to be careful to that no free variables in what we're substituting in get captured by binding λs that they shouldn't be captured by. + +In practical terms, you'd just replace (b) with (a) and do the unproblematic substitution into (a). + +What attitude should we have to this? + +One way to think of it is to identify expressions of the lambda calculus with particular alphabetic sequences. Then (a) and (b) would be distinct expressions, and we'd have to explicitly articulate a rule permitting you to do the kind of variable-renaming that would take you from (a) to (b) (or vice versa). This kind of renaming is called "alpha-conversion." + +Another way to think of it is to identify expressions not with particular alphabetic sequences, but rather with classes of alphabetic sequences, which stand to each other in the way that (a) and (b) do. That's the way we'll talk. We say that (a) and (b) are just typographically different notations for a *single* lambda formula. As we'll say, the lambda formula written with (a) and the lambda formula written with (b) are literally syntactically identical. + +A third way to think is to identify the lambda formula not with classes of alphabetic sequences, but rather with abstract structures that we might draw like this: + +
λ ... `___` ...
+^      |
+|`______`|
+
+ +Here there are no bound variables, but there are *bound positions*. We can regard formula like (a) and (b) as just helpfully readable ways to designate these abstract structures. + +A version of this last approach is known as **de Bruijn notation** for the lambda calculus. + +It doesn't matter which of these approaches one takes; the logical properties of the systems are exactly the same. It just affects the particulars of how one states the rules for substitution, and so on. And whether one talks about expressions being literally "syntactically identical," or whether one instead counts them as "equivalent modulu alpha-conversion." + +(In a bit, we'll discuss other systems that lack variables. Those systems will not just lack variables in the sense that de Bruijn notation does; they will furthermore lack any notion of a bound position.) + + Syntactic equality, reduction, convertibility =============================================