From 1b911b52c1885ce930c310f13700188b09d9b840 Mon Sep 17 00:00:00 2001
From: barker
Date: Sat, 18 Sep 2010 15:26:52 0400
Subject: [PATCH]

week2.mdwn  34 +++++++++++++++++++
1 file changed, 19 insertions(+), 15 deletions()
diff git a/week2.mdwn b/week2.mdwn
index 68080c04..a42ec6bf 100644
 a/week2.mdwn
+++ b/week2.mdwn
@@ 1,3 +1,6 @@
+[[!toc]]
+
+
Syntactic equality, reduction, convertibility
=============================================
@@ 118,21 +121,22 @@ We've already established that the behavior of combinatory terms can be perfectl
Assume that for any lambda term T, [T] is the equivalent combinatory logic term. The we can define the [.] mapping as follows:
 lambda term equivalent SKI term condition
   
 1. [\x.x] I
 2. [\x.M] K[M] x does not occur free in M
 3. [\x.(M N)] S[\x.M][\x.N]
 4. [\x\y.M] [\x[\y.M]]
 5. [M N] [M][N]

It's easy to understand these rules based on what S, K and I do. The first rule is obvious.
The second rule says that if a lambda abstract contains no occurrences of the variable targeted by lambda,
what the function expressed by that lambda term does it throw away its argument and returns whatever M
computes: it's the constant function K[M].
The third and fourth rules say what happens when there are occurrences of the bound variable in the body.

Finally, the fifth rule says what to do for an application (divide and conquer).
+ 1. [a] a
+ 2. [(M N)] ([M][N])
+ 3. [\a.a] I
+ 4. [\a.b] Kb assumption: a and b are different
+ 5. [\a.(M N)] S[\a.M][\a.N]
+ 6. [\a\b.M] [\a[\b.M]]
+
+It's easy to understand these rules based on what S, K and I do. The first rule says
+that variables are mapped to themselves.
+The second rule says that the way to translate an application is to translate the
+first element and the second element separately.
+The third rule should be obvious.
+The fourth rule should also be fairly selfevident: since what a lambda term such as `\x.y` does it throw away its first argument and return `y`, that's exactly what the combinatory logic translation should do. And indeed, `Ky` is a function that throws away its argument and returns `y`.
+The fifth rule breaks down an abstract whose body is an application. The S combinator takes its next argument and copies it, feeding one copy to the translation of \a.M, and the other copy to the translation of \a.N. Finally, the last rule says that if the body of an abstract is itself an abstract, translate the inner abstract first, and then do the outermost. (Since the translation of [\b.M] will not have any lambda in it, we can be sure that we won't end up applying rule 6 again in an infinite loop.)
+
+[Fussy notes: if the original lambda term has free variables in it, so will the combinatory logic translation. Feel free to worry about this, though you should be confident that it makes sense. You should also convince yourself that if the original lambda term contains no free variablesi.e., is a combinatorthen the translation will consist only of S, K, and I (plus parentheses). One other detail: this translation algorithm builds expressions that combine lambdas with combinators. For instance, the translation of `\x.\y.y` is `[\x[\y.y]] = [\x.I] = KI`. In that intermediate stage, we have `\x.I`. It's possible to avoid this, but it takes some careful thought. See, e.g., Barendregt 1984, page 156.]
These systems are Turing complete. In other words: every computation we know how to describe can be represented in a logical system consisting of only a single primitive operation!

2.11.0