Connections
Why should we be interested in the lambda calculus?What are the key ideas of the lambda calculus?
- The lambda calculus was introduced as a notation for representing and studying functions.
- As a model of computation, it is equivalent to the Turing machine.
- It provides the theoretical foundations for functional programming languages (Lisp is syntacticaly similar) and is used to provide the denotational semantics for programming languages.
- In it, functions are first class objects. They may be assigned to a variable, passed as an argument, or returned as a result.
- It is the source of inspiration for lexical scope rules and lazy evaluation.
- Simple syntax
- Execution (expression evaluation) is by reduction to a normal form.
| formula | ::= | term = term |
| term | ::= | identifier | application | abstraction |
| identifier | ::= | x0 | x1 | x2 | ... |
| application | ::= | ( term term ) |
| abstraction | ::= | ( λ identifier . term ) |
| [e⁄x]x | → | e | |
| [e⁄x]y | → | y | x ≠ y |
| [e⁄x]( M N ) | → | ( [e⁄x]M [e⁄x]N ) | |
| [e⁄x]λx.M | → | λx.M | |
| [e/x]λy.M | → | λz.[e⁄x][z⁄y]M | x ≠ y & z does not occur in either e or M |
| M = M | ||
| M = N then N = M | ||
| M = N, N = L then M = L |
| if N = N' then M N = M N' | ||
| if M = M' then M N = M' N | ||
| if M = N then λx.M = λx.N |
| Expansion | Reduction | |||
| alpha | λx.M | = | λy.[y⁄x]M | (y does not occur in M) |
| beta | (λx.M) N | = | [N⁄x]M | |
| eta | λx.M x | = | M |
M is reduceable to N (M red N) if there is a sequence of
alpha, beta, and/or eta reductions from M to N.
M is convertable to N ( M cnv N) if M = N is a theorem of the
lambda calculus.
A term containing no free variables is called a combinator.
Definition: A term M is said to be in normal form if it does not contain a (beta or eta) redux as a subterm. If M cnv N and N is a normal form, then N is said to be the normal form of M.
The key questions include
Reducing the argument first is known as applicative order evaluation and corresponds to call by value. Performing the substitution first is known as normal order reduction and corresponds to call by name. Applicative order is desireable when a function is sure to use its arguments as the arguments are evaluated just once and may be used several times. Normal order reduction requires that the arguments be evaluated each time they are needed however, it is possible that the value of an argument may not be needed.
The following theorem assures us that any two reduction sequences that terminate will do so with the same result.
THEOREM (Church-Rosser) If X cnv Y then there is a Z such that X red Z and Y red Z.
Haskell B. Curry Combinatorial Logic |
||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
|