# Equality implies Substitution

## Theorem

Let $P \left({x}\right)$ denote a Well-Formed Formula which contains $x$ as a free variable.

Then the following are tautologies:

$\forall x: \left({P \left({ x }\right) \iff \exists y: \left({y = x \land P \left({y}\right)}\right)}\right)$
$\forall x: \left({P \left({ x }\right) \iff \forall y: \left({y = x \implies P \left({y}\right)}\right)}\right)$

Note that when $y$ is substituted for $x$ in either formula, it is false in general; compare Confusion of Bound Variables.

## Proof

$\left({\exists y: y = x \land \forall y: \left({y = x \implies P \left({x}\right)}\right)}\right) \implies \exists y: \left({y = x \land P \left({x}\right)}\right)$

Then:

 $\displaystyle$  $\displaystyle x = x$ Equality is Reflexive $\displaystyle$ $\implies$ $\displaystyle \exists y: y = x$ Existential Generalisation $\displaystyle$ $\implies$ $\displaystyle \left({ \forall y: \left({ y = x \implies P \left({ x }\right) }\right) \implies \exists y: \left({ y = x \land P\left({ x }\right) }\right) }\right)$ Modus Ponendo Ponens

$\Box$

 $\displaystyle \left({ y = x \land P \left({ y }\right) }\right)$ $\implies$ $\displaystyle P \left({x}\right)$ Substitutivity of Equality $\text {(1)}: \quad$ $\displaystyle \implies \ \$ $\displaystyle \exists y: \left({ y = x \land P \left({y}\right) }\right)$ $\implies$ $\displaystyle P \left({x}\right)$ Universal Generalisation $\text {(2)}: \quad$ $\displaystyle \implies \ \$ $\displaystyle \forall y: \left({ y = x \implies P \left({y}\right) }\right)$ $\implies$ $\displaystyle P \left({x}\right)$ Hypothetical Syllogism with first lemma

$\Box$

Similarly:

 $\displaystyle P \left({x}\right)$ $\implies$ $\displaystyle \left({ y = x \implies P \left({y}\right) }\right)$ Substitutivity of Equality $\text {(3)}: \quad$ $\displaystyle$ $\implies$ $\displaystyle \forall y: \left({ y = x \implies P \left({y}\right) }\right)$ Universal Generalisation $\text {(4)}: \quad$ $\displaystyle$ $\implies$ $\displaystyle \exists y: \left({ y = x \land P \left({y}\right) }\right)$ First lemma

The above two statements comprise the other direction of the biconditional assertions.

Together, $(1)$, $(2)$, $(3)$, and $(4)$ prove the two assertions.

$\blacksquare$