Professional Documents
Culture Documents
CS 6371advanced Programming Languages: Homework 2 Solutions
CS 6371advanced Programming Languages: Homework 2 Solutions
Homework 2 Solutions
Problem 1
Given the definitions of the combinators S,K and I in class show that:
a. KKK = K
b. SKKK = K
a.
S xyz. xz (yz)
K xy. x
I x. x
KKK = (xy.x)( xy.x)( xy.x)
= (y. xy. x)( xy.x)
= (xy.x)
=K
b.
SKKK = (xyz. xz ( yz))( xy.x)( xy.x)( xy.x)
= (yz. (xy.x)z (yz))( xy.x)( xy.x)
= (yz. (y.z)(yz))( xy.x)( xy.x)
= (yz. z)( xy.x)( xy.x)
= (z. z)( xy.x)
= (xy.x)
=K
Problem 2
a. Simplify the following lambda expressions to their normal forms.
i.((x. (x y))( z. z))
(z. z)y
y
ii.((x. ((y. (x y))x))( z. w))
(y. (((z. w) y) (z. w)))