I'm trying to work through "Elements of Functional Languages" by Martin Henson. On p. 17 he says:
$v$ occurs free in $v$, $(\lambda v.v)v$, $vw$ and $(\lambda w.v)$ but not in $\lambda v.v$ or in $\lambda v.w$. And $v$ occurs bound in $\lambda v.v$ and in $(\lambda v.v)v$ but not in $v$, $vw$ or $(\lambda w.v)$. Note that free and bound variables are not opposites. A variable may occur free and bound in the same expression.
Can someone explain what this means?
In the more normal mathematical world, we might say something like:
In that case, $x$ is a bound variable. If we later wrote:
Then $g$ would be the same as $f$.
On the other hand, if we said:
We cannot assert that $h$ is the same as $f$, because $m$ and $n$ are "free" variables.
In $\lambda$-calculus, you have to be careful about which variables are free in an expression. After a while it becomes natural.