Lecture 5: Church Encodings
In this lecture, we introduce the following concepts:
- Compilers and what it means for them to be “correct”
- the compiler correctness square
-
compile
source ~~~~~> target
|| || interpreters
vv vv
v_s ~~~~~~~~> v_t
- Encoding data in untyped lambda calculus
- Booleans
true = \x.\y.x
false = \x.\y.y
- not, or, if-then-else
- Plait implementation to test
- Numbers
- Peano numbers (unary natural numbers, zero and successor)
- Church numerals
- Encoding +1
- Encoding addition
- Notion of “equals” for the concept of compiler correctness