next up previous
Next: Connection with relational databases Up: Review of logic. Previous: First order logic.

Free and bound variables

Consider the formula

\begin{displaymath}
Z=\{\forall _{x}\neg \mathrm{Cretan}(x)\vee \mathrm{liar}(x)\}\end{displaymath}

Inside this formula, \( x \) is a variable. Outside this formula there are no variables -- because \( \forall \) is doing an implied AND:

\begin{eqnarray*}
Z & = & \neg \mathrm{Cretan}(\mathrm{Thing}_{1})\vee \mathrm{l...
...\vee \mathrm{liar}(\mathrm{Thing}_{2})\\
& \bigwedge & \vdots
\end{eqnarray*}



So \( x \) is successively set equal to all of the objects in the universe and a huge AND is taken. The variable \( x \) is being used to perform a computation and no longer exists outside the formula -- it is said to be bound.

The same is true of variables that appear as subscripts to an \( \exists \) quantifier, as the following example shows

\begin{displaymath}
\{\exists _{x}\mathrm{big}(x)\wedge \mathrm{dog}(x)\}\end{displaymath}

(``there exists a big dog''). Since an \( \exists \) quantifier is performing an implied OR:

\begin{eqnarray*}
& & \mathrm{big}(\mathrm{Thing}_{1})\wedge \mathrm{dog}(\math...
...)\wedge \mathrm{dog}(\mathrm{Thing}_{2})\\
& \bigvee & \vdots
\end{eqnarray*}



so that the variable \( x \) no longer exists outside the formula. Rule:

Variables that appear as subscripts to quantifiers are bound and do not exist outside their scope (the portion of the formula in which they appear).
Bound variables are like local variables to a subroutine or variables over which you are computing definite integrals. Variables that are not bound are said to be free. Example:

\begin{displaymath}
Z=\{\exists _{x}\mathrm{bigger}(x,y)\}\end{displaymath}

Since \( y \) was not a subscript of a quantifies, it remains free. Consequently, \( Z \) is really a function of one variable, and we should have written

\begin{displaymath}
Z(y)=\{y\vert\exists _{x}\mathrm{bigger}(x,y)\}\end{displaymath}

It is true for a given \( y \) if there exists something bigger than it (assuming that we have defined the predicate function \( \mathrm{bigger}() \) in this way).


next up previous
Next: Connection with relational databases Up: Review of logic. Previous: First order logic.
Justin R. Smith 2001-04-06