Theorem: Substitution Theorem for Terms

Let $\beta, \tau$ be terms.
Let $x \in \mathrm {VAR}$ be a variable.
Let $\map \beta {x \gets \tau}$ be the substitution instance of $\beta$ substituting $\tau$ for $x$.
Let $\AA$ be a structure for predicate logic.
Let $\sigma$ be an assignment for $\beta$ 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 \beta {x \gets \tau} } \sqbrk \sigma = \map {\operatorname{val}_\AA} \beta \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 definition of term, applied to $\beta$.
If $\beta = y$ for some variable $y$, then:
:$\map \beta {x \gets \tau} = \begin {cases} \tau & : \text{if $y = x$} \\ y & : \text {otherwise} \end {cases}$
In the first case:
{{begin-eqn}}
{{eqn | l = \map {\operatorname{val}_\AA} {\map \beta {x \gets \tau} } \sqbrk \sigma
      | r = \map {\operatorname{val}_\AA} \tau \sqbrk \sigma
}}
{{eqn | r = a
      | c = Definition of $a$
}}
{{eqn | r = \map {\paren {\sigma + \paren {x / a} } } x
      | c = {{Defof|Extension of Assignment}}
}}
{{eqn | r = \map {\operatorname{val}_\AA} \beta \sqbrk {\sigma + \paren {x / a} }
      | c = {{Defof|Value of Term under Assignment|Value under $\sigma + \paren {x / a}$}}
}}
{{end-eqn}}
In the second case:
{{begin-eqn}}
{{eqn | l = \map {\operatorname{val}_\AA} {\map \beta {x \gets \tau} } \sqbrk \sigma
      | r = \map {\operatorname{val}_\AA} y \sqbrk \sigma
}}
{{eqn | r = \map \sigma y
      | c = {{Defof|Value of Term under Assignment|Value under $\sigma$}}
}}
{{eqn | r = \map {\paren {\sigma + \paren {x / a} } } y
      | c = {{Defof|Extension of Assignment}}
}}
{{eqn | r = \map {\operatorname{val}_\AA} \beta \sqbrk {\sigma + \paren {x / a} }
      | c = {{Defof|Value of Term under Assignment|Value under $\sigma + \paren {x / a}$}}
}}
{{end-eqn}}
as desired.
If $\beta = \map f {\tau_1, \ldots, \tau_n}$ and the induction hypothesis holds for $\tau_1, \ldots, \tau_n$, then:
:$\map \beta {x \gets \tau} = \map f {\map {\tau_1} {x \gets \tau}, \ldots, \map {\tau_n} {x \gets \tau} }$
Now:
{{begin-eqn}}
{{eqn | l = \map {\operatorname{val}_\AA} {\map \beta {x \gets \tau} } \sqbrk \sigma
      | r = \map {\operatorname{val}_\AA} {\map f {\map {\tau_1} {x \gets \tau}, \ldots, \map {\tau_n} {x \gets \tau} } } \sqbrk \sigma
}}
{{eqn | r = \map {f_\AA} {\map {\operatorname{val}_\AA} {\map {\tau_1} {x \gets \tau} } \sqbrk \sigma, \ldots, \map {\operatorname{val}_\AA} {\map {\tau_n} {x \gets \tau} } \sqbrk \sigma}
      | c = {{Defof|Value of Term under Assignment|Value under $\sigma$}}
}}
{{eqn | r = \map {f_\AA} {\map {\operatorname{val}_\AA} {\tau_1} \sqbrk {\sigma + \paren {x / a} }, \ldots, \map {\operatorname{val}_\AA} {\tau_n} \sqbrk {\sigma + \paren {x / a} } }
      | c = Induction Hypothesis
}}
{{eqn | r = \map {\operatorname{val}_\AA} \beta \sqbrk {\sigma + \paren {x / a} }
      | c = {{Defof|Value of Term under Assignment|Value under $\sigma + \paren {x / a}$}}
}}
{{end-eqn}}
as desired.
The result follows by the Principle of Structural Induction.
{{qed}}