Answers to Self-Study Questions
Test Yourself #1
We have these defintiions:
0 == λx.TRUE
TRUE == λx.λy.x
SUCC == λL.CONS x L
CONS == λh.λt.(λs. s h t)
So succ(0) is represented by this lambda expression:
After 1 beta reduction (replacing L with (λx.TRUE) we get
Replacing CONS with its definition we get:
(λh.λt.(λs. s h t)) x (λx.TRUE)
After reducing the outermost redex (replacing h with x):
(λt.(λs. s x t)) (λx.TRUE)
After another reduction (replacing t with (λx.TRUE):
We've now reached a normal form.
Do we have the lambda expression that represents 1?
That expression is:
And since NIL is defined to be
we do have the lambda expression that represents 1.