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 $\map {\mathbf A} {x \gets \tau}$ be the substitution instance of $\mathbf A$ substituting $\tau$ for $x$.

Let $\AA$ be a structure for predicate logic.

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

Suppose that:


 * $\map {\operatorname{val}_\AA} \tau \sqbrk \sigma = a$

where $\map {\operatorname{val}_\AA} \tau \sqbrk \sigma$ is the value of $\tau$ under $\sigma$.

Then:


 * $\map {\operatorname{val}_\AA} {\map {\mathbf A} {x \gets \tau} } \sqbrk \sigma = \map {\operatorname{val}_\AA} {\mathbf A} \sqbrk {\sigma + \paren {x / a} }$

where $\sigma + \paren {x / a}$ 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 = \map p {\tau_1, \ldots, \tau_n}$, then:


 * $\map {\mathbf A} {x \gets \tau} = \map p {\map {\tau_1} {x \gets \tau}, \ldots, \map {\tau_n} {x \gets \tau} }$

where $\map {\tau_i} {x \gets \tau}$ 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:


 * $\map {\mathbf A} {x \gets \tau} = \mathbf A$

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


 * $\map {\operatorname{val}_\AA} {\mathbf A} \sqbrk \sigma = \map {\operatorname{val}_\AA} {\mathbf A} \sqbrk {\sigma + \paren {x / a} }$

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

From the definition of value under $\sigma$, $\map {\operatorname{val}_\AA} {\map {\mathbf A} {x \gets \tau} } \sqbrk \sigma$ is determined by:


 * $\map {\operatorname{val}_\AA} {\map {\mathbf B} {x \gets \tau} } \sqbrk {\sigma + \paren {y / a'} }$

where $a'$ ranges over $\AA$.

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


 * $\map {\operatorname{val}_\AA} \tau \sqbrk {\sigma + \paren {y / a'} } = \map {\operatorname{val}_\AA} \tau \sqbrk \sigma = a$

for all $a'$.

Hence the induction hypothesis also applies to the assignment $\sigma + \paren {y / a'}$.

Thus, for all $a'$:

from which we infer:


 * $\map {\operatorname{val}_\AA} {\map {\mathbf A} {x \gets \tau} } \sqbrk \sigma = \map {\operatorname{val}_\AA} {\mathbf A} \sqbrk {\sigma + \paren {x / a} }$

as desired.

The result follows by the Principle of Structural Induction.