Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Eta-expansion<br />
(λx.ex)e ′ β<br />
→ ee<br />
′<br />
if x /∈ fv(e)<br />
e opposite of eta reduction is eta-expansion, which takes a function that is not saturated and makes<br />
all variables explicitly bound in a lambda. Eta-expansion will be important when we discuss translation<br />
into STG.<br />
Reduction<br />
Evaluation of lambda calculus expressions proceeds by beta reduction. e variables bound in a lambda<br />
are substituted across the body of the lambda. ere are several degrees of freedom in the design space<br />
about how to do this, and in which order an expression should be evaluated. For instance we could<br />
evaluate under the lambda and then substitute variables into it, or instead evaluate the arguments and<br />
then substitute and then reduce the lambda expressions. More on this will be discussed in the section<br />
on Evaluation models.<br />
Untyped> (\x.x) 1<br />
1<br />
Untyped> (\x y . y) 1 2<br />
2<br />
Untyped> (\x y z. x z (y z)) (\x y . x) (\x y . x)<br />
=> \x y z . (x z (y z))<br />
=> \y z . ((\x y . x) z (y z))<br />
=> \x y . x<br />
=> \y . z<br />
=> z<br />
=> \z . z<br />
\z . z<br />
In the untyped lambda calculus we can freely represent infinitely diverging expressions:<br />
Untyped> \f . (f (\x . (f x x)) (\x . (f x x)))<br />
\f . (f (\x . (f x x)) (\x . (f x x)))<br />
Untyped> (\f . (\x. (f x x)) (\x. (f x x))) (\f x . f f)<br />
...<br />
Untyped> (\x. x x) (\x. x x)<br />
...<br />
49