3

So, using Church numerals, we define

$3 = {\lambda} f. {\lambda}x.f(f(f(x)))$,

and

$4 = {\lambda} f. {\lambda}x.f(f(f(f(x))))$.

We can then add with an expression like

$3\ g\ (4\ g\ z)$

And this reduces to:

$(g (g (g (g (g (g (g\ z)))))))$

... but why?

$g$ is a free variable in each expression, and my understanding is that you must ${\alpha}$-convert free standing variables in unrelated expressions. Shouldn't we instead end up with something like

$(g (g (g (g_2 (g_2 (g_2 (g_2\ z)))))))$?

Ben I.
  • 1,730
  • 14
  • 26

2 Answers2

5

The answer here is the same as in the other question: one thing is missing here!

Your addition result should be:

$$3 + 4 = \lambda g . \lambda z . 3 g (4 g z) = \lambda g . \lambda z . 7 g z$$

Note that $g$ is now a lambda parameter, not a free variable! So now if you want to apply this to something, it'll get substituted in the same everywhere:

$$7 q r = (\lambda g . \lambda z . 7 g z) q r = q q q q q q q r$$

Draconis
  • 7,216
  • 1
  • 19
  • 28
4

Free variables never get $\alpha$-converted, only bound variables can.

In the term $(\lambda x.\ xy)$ we can rename the bound variable $x$ to any other variable (except $y$, since that would cause a name clash). For instance, we can obtain $(\lambda z.\ zy)$. Instead, we can never rename $y$, since that is free, not being under any $\lambda y$.

By contrast, in $(\lambda y.\ \lambda x.\ xy)$ we can $\alpha$-convert both variables to any other pair of (distinct) variables. This is because now they are both bound.

In the OP's example, $g$ is free, so no renaming is possible. At most, we can $\alpha$-convert $f$ and $x$, but not $g$.

chi
  • 14,704
  • 1
  • 31
  • 40