week2 tweak
[lambda.git] / week2.mdwn
index b944f5c..f978678 100644 (file)
@@ -17,7 +17,7 @@ One can't just rename variables freely. (a) and (b) are different than what's ex
 </OL>
 
 
-Substituting `y` into the body of `(\x. \z. z x)` is unproblematic:
+Substituting `y` into the body of (a) `(\x. \z. z x)` is unproblematic:
 
        (\x. \z. z x) y ~~> \z. z y
 
@@ -27,28 +27,30 @@ To reduce (b), then, we need to be careful to that no free variables in what we'
 
 In practical terms, you'd just replace (b) with (a) and do the unproblematic substitution into (a).
 
-What attitude should we have to this?
+How should we think about the explanation and justification for that practical procedure?
 
-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."
+One way to think about things here 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 have an explicit rule permitting us to do the kind of variable-renaming that takes us from (a) to (b) (or vice versa). This kind of renaming is called "alpha-conversion." Look in the standard treatments of the lambda calculus for detailed discussion of this.
 
-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.
+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:
 
 <pre><code>
-       &lambda; ... ___ ...
-       ^      |
-       |______|
+       (&lambda;. &lambda;. _ _) y
+     ^  ^  | |
+     |  |__| |
+     |_______|
 </code></pre>
 
 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."
+It doesn't seem to 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.)
+(Linguistic trivia: however, some linguistic discussions do suppose that alphabetic variance has important linguistic consequences; see Ivan Sag's dissertation.)
 
+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
@@ -59,17 +61,6 @@ Define T to be `(\x. x y) z`. Then T and `(\x. x y) z` are syntactically equal,
 <pre><code>T &equiv; (\x. x y) z &equiv; (\z. z y) z
 </code></pre>
 
-[Fussy note: the justification for counting `(\x. x y) z` as
-equivalent to `(\z. z y) z` is that when a lambda binds a set of
-occurrences, it doesn't matter which variable serves to carry out the
-binding.  Either way, the function does the same thing and means the
-same thing.  
-Linguistic trivia: some linguistic discussions suppose that alphabetic variance 
-has important linguistic consequences (notably Ivan Sag's dissertation).
-Look in the standard treatments for discussions of alpha
-equivalence for more detail.  Also, as mentioned below, one of the intriguing 
-properties of Combinatory Logic is that alpha equivalence is not an issue.]
-
 This:
 
        T ~~> z y
@@ -321,6 +312,14 @@ This question highlights that there are different choices to make about how eval
 
 With regard to Q3, it should be intuitively clear that `\x. M x` and `M` will behave the same with respect to any arguments they are given. It can also be proven that no other functions can behave differently with respect to them. However, the logical system you get when eta-reduction is added to the proof theory is importantly different from the one where only beta-reduction is permitted.
 
+If we answer Q2 by permitting reduction inside abstracts, and we also permit eta-reduction, then where none of <code>y<sub>1</sub>, ..., y<sub>n</sub></code> occur free in M, this:
+
+<pre><code>\x y<sub>1</sub>... y<sub>n</sub>. M y<sub>1</sub>... y<sub>n</sub></code></pre>
+
+will eta-reduce by n steps to:
+
+       \x. M
+
 The logical system you get when eta-reduction is added to the proof system has the following property:
 
 >      if `M`, `N` are normal forms with no free variables, then <code>M &equiv; N</code> iff `M` and `N` behave the same with respect to every possible sequence of arguments.
@@ -336,14 +335,6 @@ That is, closed normal forms that are not just beta-reduced but also fully eta-r
 So the proof theory with eta-reduction added is called "extensional," because its notion of normal form makes syntactic identity of closed normal forms coincide with extensional equivalence.
 
 
-If we answer Q2 by permitting reduction inside abstracts, and we also permit eta-reduction, then where neither `y` nor `z` occur in M, this:
-
-       \x y z. M y z
-
-will eta-reduce by two steps to:
-
-       \x. M
-
 The evaluation strategy which answers Q1 by saying "reduce arguments first" is known as **call-by-value**. The evaluation strategy which answers Q1 by saying "substitute arguments in unreduced" is known as **call-by-name** or **call-by-need** (the difference between these has to do with efficiency, not semantics).
 
 When one has a call-by-value strategy that also permits reduction to continue inside unapplied abstracts, that's known as "applicative order" reduction. When one has a call-by-name strategy that permits reduction inside abstracts, that's known as "normal order" reduction. Consider an expression of the form: