Lambda Calculus is a set of rules for manipulating symbols. They can be given meanings that map well to computation.
Lambda Calculus Term Grammar
term ::= variable
term ::= term term
term ::= ( term )
term ::= λ variable . term
Alpha Reduction: (renaming variables)
λ y . M →α λ v . M [y |→ v]) where v does not occur in M.We can change the name of a lambda variable by replacing all occurances of the variable in the body term with a new name that does not appear in the body term.
Beta Reduction: (substitution)
(λ x . M) N →β M [ x |→ N ]All computation can be modeled using Beta Reduction! Examples
I ≡ λ x . x
C ≡ λ x . (λ y . yx)
CII = (λx.(λy. yx)) (λx.x) (λx.x)
λ f . ((λ x . f (xx)) (λ x . f (xx)))
(Note: you may need some more space to finish this one.)
Making "Primitives" out of nothing but Glue
cons ≡ λ xy . (λ z . zxy)
null ≡ λ p . T
null? ≡ λ x . (x λ y . λ z . F)
zero? ≡ null?
pred ≡ cdr
succ ≡ λ x . cons F x
0 ≡ null
1 ≡ succ 0 ≡ cons F null