Defunct
← PreviousAll Posts // Defunct

series LC part 2

Logical Expressions

Boolean values and logical operators are a breeze in lambda calculus! We can even use them to simulate if and else statements.

Booleans

NameLambda CalculusDefunct
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 CalculusDefunct
T(λa.a)(λb.b)
= (λyx.y)(λa.a)(λb.b)
= (λx.(λa.a))(λb.b)
= (λa.a)
true [a.a] [b.b]
= [y x.y][a.a][b.b]
= [x.[a.a]][b.b]
= [a.a]
F(λa.a)(λb.b)
= (λyx.x)(λa.a)(λb.b)
= (λx.x)(λb.b)
= (λb.b)
false [a.a] [b.b]
= [y x.x][a.a][b.b]
= [x.x][b.b]
= [b.b]

← PreviousAll Posts // Defunct