Quick and dirty intro to Lambda Calculus – Post #2

This is a continuatin of my previous post.

In this post and all the following posts I write, all \lambda-calculus expressions are left-associative, ie..

ABCD = ((AB)C)D

In this post I will expound upon some of the things I glossed over in the last post.

Variable Bindings

The \lambda operator binds a variable. If a variable occurs in the body of an abstraction but is not bound, then it is called free. In the case of name clashes, variable x is bound to the inner most \lambda x.

\alpha-conversion

The easiest way to ensure that variable names don’t have scope issues is to simply rename all bound variables to a unique name:

\lambda x . \lambda x . (\lambda x . x) x \equiv \lambda x_1 . \lambda x_2 . (\lambda x_3 . x_3) x_2

\beta-reduction

What I referred to as simplifying in the last post was actually a \beta-reduction. \beta-reduction is the act of making all the applications in an expression that do not use any bound variables. If all bound variables in expression have unique names, then a beta-reduction is very simple:

(\lambda A . B) B reduces to B[A := B]

The \alpha-conversion described above is very important because if variable names clash, then a \beta-reduction is much more complicated. Take the following term:

(\lambda ab . ab) (cb)

Without first applying an \alpha-conversion we might end up with something like this:

wrong:

\lambda ab . ab [a := cb]

\equiv \lambda b . (cb) b

Now our free variable b in (cb) is incorrectly bound. Instead we should get this:

correct:

(\lambda ab . ab) (cb) \equiv (\lambda a_1 b_1 . a_1 b_1) (c_1 b_2)

\equiv \lambda a_1 b_1 . a_1 b_1 [ a_1 := c_1 b_2 ]

\equiv \lambda b_1 . (c_1 b_2) b_1

Now our newly renamed b_2 is still a free variable.

That’s it for this post, in an upcoming post I will explain how to encode some basic datatypes using pure \lambda-calculus.

One Response to “Quick and dirty intro to Lambda Calculus – Post #2”

  1. Quick and dirty intro to Lambda Calculus - Post #3 « Brandon Niemczyk’s Stuff Says:

    [...] Quick and dirty intro to Lambda Calculus – Post #3 This is a continuation of my previous post. [...]


Leave a Reply