Substitution for Equivalent Subformula is Equivalent

Theorem
Let $\mathbf B$ a WFF of propositional logic.

Let $\mathbf A, \mathbf A'$ be equivalent WFFs.

Let $\mathbf A$ be a subformula of $\mathbf B$.

Let $\mathbf B' = \mathbf B \left({\mathbf A \,//\, \mathbf A'}\right)$ be the substitution of $\mathbf A'$ for $\mathbf A$ in $\mathbf B$.

Then $\mathbf B$ and $\mathbf B'$ are equivalent.

Proof
Let $v$ be an arbitrary boolean interpretation.

Then $v \left({\mathbf A}\right) = v \left({\mathbf A'}\right)$.

It is to be shown that $v \left({\mathbf B}\right) = v \left({\mathbf B'}\right)$.

We proceed by induction.

Let $n \left({\mathbf B}\right)$ be the number of WFFs $\mathbf C$ such that:


 * $\mathbf A$ is a subformula of $\mathbf C$, and $\mathbf C$ is a subformula of $\mathbf B$.

Note that $n \left({\mathbf B}\right) \ne 0$, for $\mathbf C = \mathbf A$ is a valid choice.

Suppose now that $n \left({\mathbf B}\right) = 1$.

Because we have the valid choices $\mathbf C = \mathbf A$ and $\mathbf C = \mathbf B$, it follows that these choices must be identical, i.e. $\mathbf A = \mathbf B$.

Hence $\mathbf B' = \mathbf A'$, and so:


 * $v \left({\mathbf B}\right) = v \left({\mathbf B'}\right)$

Suppose now that the assertion is true for all $\mathbf B$ with $n \left({\mathbf B}\right) \le n$.

Let $n \left({\mathbf B}\right) = n + 1$.

Suppose $\mathbf B = \neg \mathbf B_1$.

Then obviously $n \left({\mathbf B_1}\right) = n$, so by hypothesis:


 * $v \left({\mathbf B_1}\right) = v \left({\mathbf B_1 \left({\mathbf A \,//\, \mathbf A'}\right)}\right)$

Also, by definition of substitution:


 * $\mathbf B' = \neg \mathbf B_1 \left({\mathbf A \,//\, \mathbf A'}\right)$

Now, by definition of boolean interpretation:

Suppose now that $\mathbf B = \mathbf B_1 \mathbin{\mathsf B} \mathbf B_2$ for a binary connective $\mathsf B$.

Then $n \left({\mathbf B_1}\right), n \left({\mathbf B_2}\right) \le n$, so:


 * $v \left({\mathbf B_1}\right) = v \left({\mathbf B_1 \left({\mathbf A \,//\, \mathbf A'}\right)}\right)$
 * $v \left({\mathbf B_2}\right) = v \left({\mathbf B_2 \left({\mathbf A \,//\, \mathbf A'}\right)}\right)$

This follows by either the induction hypothesis, or when $\mathbf A$ is not a subformula of $\mathbf B_1$ or $\mathbf B_2$, is entirely trivial, considering the substitution does not change anything.

Also, by definition of substitution:


 * $\mathbf B' = \mathbf B_1 \left({\mathbf A \,//\, \mathbf A'}\right) \mathbin{\mathsf B} \mathbf B_2 \left({\mathbf A \,//\, \mathbf A'}\right)$

Now, by definition of boolean interpretation:

By definition of the language of propositional logic, $\mathbf B$ must have either of the above forms.

Hence the result, from the Second Principle of Mathematical Induction.