0 =
f.
x.x
1 =
f.
x.f x
2 =
f.
x.(f (f x))
n =
f.
x.(f(f(f(f ..ntimes.. x))))
succ =
n.(
f.
x.f(n f x))
add =
n.
m.
f.
x.n f (m f x)
mult =
n.
m.
f.n(m f)
false =
x.
y.y
true =
x.
y.x
We now extend the syntax to allow E to be a constant, and we have additional computation rules for replacing constants in expressions.
example:
plus 3 2 -> 5
(x.times x x)(plus 3 2)
->
(
x.times x x) 5