Free variables in a logical statement stand for objects that the statement says something about. Anything can be substituted for a free variable and it is free to stand for anything. Bound variables, on the other hand, are simply letters used to help express an idea and should not be thought of as standing for any particular object. A bound variable can always be replaced by a new variable without changing the meaning of the statement, and often the statement can be rephrased so that the bound variables are eliminated.
Example:
Bothand
are bound variables in this statement. We could change
for
and
for
throughout to obtain the statement
The meaning of the stament does not change – the statement says that addition is commutative.
Example:
Ifis a natural number then
is even.
is a bound variable here and
is a free variable.
Example:
Nothing can be substituted foror
so both variables are bound.
A variable can be both bound and free in the same expression.
The first and fifth occurrences ofare free and the others are bound.