Bound vs Free Variables

Lambda calculus ideas explained using Python intuition

What does “bound” mean?

In a λ-expression like λx. A, the λ introduces a name.

“Inside A, the variable x belongs to this λ.”

Any occurrence of x inside A is bound. A bound variable is simply one that is declared by a λ (or a function).

λx. x y
bound: x free: y

Here, x is bound because λx introduces it. y is free because nothing defines it.

Same idea in Python

A Python function behaves the same way. Parameters are bound variables.

def f(x): return x + y
bound: x free: y

x is bound — the function defines it.
y is free — it comes from outside the function.

This matches λ-calculus exactly: λx. x y has a bound x and a free y.