Boolean values and logical operators are a breeze in lambda calculus! We can even use them to simulate if and else statements.
Booleans
Name | Lambda Calculus | Defunct |
---|---|---|
true |
T ≡ λyx.y
|
def true [y x.y]
|
false |
F ≡ λyx.x
|
def false [y x.x]
|
True takes in two parameters and returns the first one.
False takes in two parameters and returns the second one.
If Statements
<condition> <then> <else>
Lambda Calculus | Defunct |
---|---|
T(λa.a)(λb.b) |
true [a.a] [b.b] |
F(λa.a)(λb.b) |
false [a.a] [b.b] |