This web page discusses semantic aspects of substitution in first-order logic. In particular we explore the connections between substitutions and assignments of variables to values in an $L$-structure.

The first of our two propositions discusses two substitutions that may be different but which are semantically the same.

Proposition.

Let $M$ be an $L$-structure, $a:{\mathrm{VAR}}_{L}\to M$ an assignment, and $T,S$ be substitutions with $V=dom\left(S\right)=dom\left(T\right)$. Then if $a\left(T\right(v\left)\right)=a\left(S\right(v\left)\right)$ for all $v\in V$ we have $a\left(T\right(t\left)\right)=a\left(S\right(t\left)\right)$ and $a\left(T\right(\theta \left)\right)=a\left(S\right(\theta \left)\right)$ for all terms and formulas $t,\theta $ such that the substitutions $T\left(\theta \right),S\left(\theta \right)$ are both valid.

Intutively, this proposition works because $S$ and $T$
are the same

substitution semantically. That is, $a\left(T\right(v\left)\right)=a\left(S\right(v\left)\right)$
for all $v$. Unfortunately, it isn't quite so simple as this
since $T\left(v\right)$ and $S\left(v\right)$ might use quite different variables to obtain
the same value $a\left(T\right(v\left)\right)=a\left(S\right(v\left)\right)$, so we need to be careful of this point.
Fortunately we are told that the substitutions $T\left(\theta \right)$, $S\left(\theta \right)$
are valid. This means that whatever variables are used in $T\left(v\right)$
and $S\left(v\right)$ they will not be in the scope of any existing quantifiers
and so the values of these variables as given by the assignment $a$
will be unchanged. So the idea is clear, but this technical consideration
makes the induction hypothesis rather more complicated!

**Proof.**

By induction on terms and formulas $t,\theta $. Our induction hypothesis is that for all terms and formulas $\theta $ with construction sequence of length at most $n$, all assignments $a$ and all substitutions $S,T$ with the same domain and same forbidden set of variables, if $a\left(S\right(w\left)\right)=a\left(T\right(w\left)\right)$ for each $w\in dom\left(S\right)=dom\left(T\right)$ such that neither $S\left(w\right),T\left(w\right)$ contain any variable in $(S\prime )=(T\prime )$ and $T\left(\theta \right),S\left(\theta \right)$ are both valid then $a\left(T\right(\theta \left)\right)=a\left(S\right(\theta \left)\right)$.

The base case of the induction is when $\theta $ is a variable $v$ or a constant symbol $c$ or $\top $ or $\perp $. The first of these is covered by the assumptions of the proposition. For if $a$ is given with $a\left(S\right(w\left)\right)=a\left(T\right(w\left)\right)$ for all $w\in dom\left(S\right)=dom\left(T\right)$ such that neither $S\left(w\right),T\left(w\right)$ contain any variable in $(S\prime )=(T\prime )$, then either $S\left(v\right)=T\left(v\right)=v$ in which case there is nothing to prove, or else $v\in dom\left(S\right)=dom\left(T\right)$ and neither $S\left(v\right)$ nor $T\left(v\right)$ contain any forbidden variable (since the substitution is valid) so the assumption applies giving $a\left(S\right(v\left)\right)=a\left(T\right(v\left)\right)$. The cases of $c$, $\top $ and $\perp $ are easy.

The induction steps for the various ways of building a more complex term or formula from simpler ones are mostly straightforward. This is because their clauses defining substitition don't change the domains or forbidden variables for substitutions. The only awkward steps are those for the quantifiers $\exists $ and $\forall $. We do the case of $\exists $ here leaving the other as an exercise.

Suppose $\theta $ is $v\psi $ and $a$ is an assignment. Then let $x\in M$ be arbitrary and $b=a[x/v]$. If $v\in dom\left(S\right)=dom\left(T\right)$ then let $S\prime $ be the restriction substitution with $dom(S\prime )=dom\left(S\right)\setminus \left\{v\right\}$ and $(S\prime )=\left(S\right)\cup \left\{v\right\}$ and let $T\prime $ be the restriction substitution with $dom(T\prime )=dom\left(T\right)\setminus \left\{v\right\}$ and $(T\prime )=\left(T\right)\cup \left\{v\right\}$. Else $v\notin dom\left(S\right)$ and we let $S\prime $ be the substitution with $dom(S\prime )=dom\left(S\right)$ and $(S\prime )=\left(S\right)\cup \left\{v\right\}$ and $T\prime $ with $dom(T\prime )=dom\left(T\right)$ and $(T\prime )=\left(T\right)\cup \left\{v\right\}$.

We now examine our assignment $b$ and the substitutions $S\prime $ and $T\prime $. Clearly we still have $b(S\prime (w\left)\right)=b(T\prime (w\left)\right)$ for each $w\in dom(S\prime )=dom(T\prime )$ such that neither $S\prime \left(w\right),T\prime \left(w\right)$ contain any variable in $(S\prime )=(T\prime )$. This means by induction that $b(S\prime (\psi \left)\right)=b(T\prime (\psi \left)\right)$. Hence as $x$ is arbitrary, $a\left(S\right(\exists v\psi \left)\right)=a\left(T\right(\exists v\psi \left)\right)$, as required. The case for ∀ is similar.

The second of our two propositions says that renaming a variable in a formula does not affect the truth of that formula provided we remember to modify the assignment in a similar way. Here a variable $v$ is renamed to $u$: this renaming is valid if the formula it is being applied to does not already have any free occurences of $u$ and the substitution $v\mapsto u$ is valid.

Proposition.

Let $M$ be an $L$-structure, $a:{\mathrm{VAR}}_{L}\to M$ an assignment, $u,v$ variables of $L$ and $\varphi $ a formula that does not contain any free occurrences of $u$. Let $S$ be the substitution $v\mapsto u$, and assume $S\left(\varphi \right)$ is valid. Then for any $x$ in $M$ we have $a[x/v]\left(\varphi \right)=a[x/u]\left(S\right(\varphi \left)\right)$.

**Proof.**

By induction again. We fix $v,u$ and $M$. The induction hypthesis is the remaining proposition, i.e. the rather weighty statement $H\left(n\right)$ following.

- whenever $a:{\mathrm{VAR}}_{L}\to M$ is an assignment, $\varphi $ a term or formula constructed in at most $n$ steps that does not contain any free occurrences of $u$ and $S$ the substitution $v\mapsto u$ with some or no forbidden variables, and assume $S\left(\varphi \right)$ is valid. Then for any $x$ in $M$ we have $a[x/v]\left(\varphi \right)=a[x/u]\left(S\right(\varphi \left)\right)$.

Given this, the induction step in all cases is straightforward.