Substitution Theorem for Well-Formed Formulas

Theorem
Let $\mathbf A$ be a WFF of predicate logic.

Let $x \in \mathrm{VAR}$ be a variable.

Let $\tau$ be a term of predicate logic which is freely substitutable for $x$ in $\mathbf A$.

Let $\mathbf A \left({x \gets \tau}\right)$ be the substitution instance of $\mathbf A$ substituting $\tau$ for $x$.

Let $\mathcal A$ be a structure for predicate logic.

Let $\sigma$ be an assignment for $\mathbf A$ and $\tau$.

Suppose that:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\tau}\right) } \left[{\sigma}\right] = a$

where $\mathop{ \operatorname{val}_{\mathcal A} \left({\tau}\right) } \left[{\sigma}\right]$ is the value of $\tau$ under $\sigma$.

Then:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A \left({x \gets \tau}\right) }\right) } \left[{\sigma}\right] = \mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A}\right) } \left[{\sigma + \left({x / a}\right)}\right]$

where $\sigma + \left({x / a}\right)$ is the extension of $\sigma$ by mapping $x$ to $a$.

Proof
Proceed by the Principle of Structural Induction on the bottom-up specification of predicate logic, applied to $\mathbf A$.

If $\mathbf A = p \left({\tau_1, \ldots, \tau_n}\right)$, then:


 * $\mathbf A \left({x \gets \tau}\right) = p \left({\tau_1 \left({x \gets \tau}\right), \ldots, \tau_n \left({x \gets \tau}\right)}\right)$

where $\tau_i \left({x \gets \tau}\right)$ is the substitution instance of $\tau_i$.

Now:

Suppose $\mathbf A = \neg \mathbf B$ and the induction hypothesis applies to $\mathbf B$.

Then since $\tau$ is also free for $x$ in $\mathbf B$:

Suppose $\mathbf A = \mathbf B \circ \mathbf B'$ for $\circ$ one of $\land, \lor, \implies, \iff$ and the induction hypothesis applies to $\mathbf B, \mathbf B'$.

Then since $\tau$ is also free for $x$ in $\mathbf B$ and $\mathbf B'$:

Suppose $\mathbf A = \exists y: \mathbf B$ or $\mathbf A = \forall y: \mathbf B$, and the induction hypothesis applies to $\mathbf B$.

Because $\tau$ is free for $x$ in $\mathbf A$, it must be that either $x$ does not occur freely in $\mathbf A$, or $y$ does not occur in $\tau$.

In the first case:


 * $\mathbf A \left({x \gets \tau}\right) = \mathbf A$

and by Value of Formula under Assignment Determined by Free Variables:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A }\right) } \left[{\sigma}\right] = \mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A }\right) } \left[{\sigma + \left({x / a}\right)}\right]$

Now consider the case where $y$ does not occur in $\tau$.

From the definition of value under $\sigma$, $\mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A \left({x \gets \tau}\right) }\right) } \left[{\sigma}\right]$ is determined by:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf B \left({x \gets \tau}\right) }\right) } \left[{\sigma + \left({y / a'}\right) }\right]$

where $a'$ ranges over $\mathcal A$.

Now from Value of Term under Assignment Determined by Variables, since $y$ does not occur in $\tau$:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\tau}\right) } \left[{\sigma + \left({y / a'}\right)}\right] = \mathop{ \operatorname{val}_{\mathcal A} \left({\tau}\right) } \left[{\sigma}\right] = a$

for all $a'$.

Hence the induction hypothesis also applies to the assignment $\sigma + \left({y / a'}\right)$.

Thus, for all $a'$:

from which we infer:


 * $\mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A \left({x \gets \tau}\right) }\right) } \left[{\sigma}\right] = \mathop{ \operatorname{val}_{\mathcal A} \left({\mathbf A}\right) } \left[{\sigma + \left({x / a}\right)}\right]$

as desired.

The result follows by the Principle of Structural Induction.