Using the mapping specified in this week's notes, translate the following lambda terms into combinatory logic:
-
-Let's say that for any lambda term T, [T] is the equivalent Combinatory Logic term. Then we define the [.] mapping as follows.
-
- 1. [a] = a
- 2. [(\aX)] = @a[X]
- 3. [(XY)] = ([X][Y])
-
-Wait, what is that @a ... business? Well, that's another operation on (a variable and) a CL expression, that we can define like this:
-
- 4. @aa = I
- 5. @aX = KX if a is not in X
- 6. @a(Xa) = X if a is not in X
- 7. @a(XY) = S(@aX)(@aY)
-
-
-
-
<ol start=19>
<li><code>[\x x] = @x x = I</code>
<li><code>[\x y. x] = @x [\y. x] = @x. (@y x) = @x (Kx) = S (@x K) (@x x) = S (KK) I</code>; in general expressions of this form <code>S(K<i>M</i>)I</code> will behave just like <code><i>M</i></code> for any expression <code><i>M</i></code>
25. For each of the above translations, how many `I`s are there? Give a rule for describing what each `I` corresponds to in the original lambda term.
+ This generalization depends on you omitting the translation rule:
+
+ 6. @a(Xa) = X if a is not in X
+
+ > With that shortcut rule omitted, then there turn out to be one `I` in the result corresponding to each occurrence of a bound variable in the original term.
+
Evaluation strategies in Combinatory Logic
------------------------------------------
<OL start=30>
<LI><code>(\x. x (\y. y x)) (v w) ~~> v w (\y. y (v w))</code>
<LI><code>(\x. x (\x. y x)) (v w) ~~> v w (\x. y x)</code>
-<LI><code>(\x. x (\y. y x)) (v x) ~~> v w (\y. y (v x))</code>
-<LI><code>(\x. x (\y. y x)) (v y) ~~> v w (\u. u (v y))</code>
+<LI><code>(\x. x (\y. y x)) (v x) ~~> v x (\y. y (v x))</code>
+<LI><code>(\x. x (\y. y x)) (v y) ~~> v y (\u. u (v y))</code>
<LI><code>(\x y. x y y) u v ~~> u v v</code>
<LI><code>(\x y. y x) (u v) z w ~~> z (u v) w</code>