# Equality implies Substitution

## Theorem

Let $\map P x$ denote a Well-Formed Formula which contains $x$ as a free variable.

Then the following are tautologies:

$\forall x: \paren {\map P x \iff \exists y: \paren {y = x \land \map P y} }$
$\forall x: \paren {\map P x \iff \forall y: \paren {y = x \implies \map P y} }$

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

## Proof

$\paren {\exists y: y = x \land \forall y: \paren {y = x \implies \map P x} } \implies \exists y: \paren {y = x \land \map P x}$

Then:

 $\ds$  $\ds x = x$ Equality is Reflexive $\ds$ $\leadsto$ $\ds \exists y: y = x$ Existential Generalisation $\ds$ $\leadsto$ $\ds \paren {\forall y: \paren {y = x \implies \map P x} \implies \exists y: \paren {y = x \land \map P x} }$ Modus Ponendo Ponens

$\Box$

 $\ds \paren { y = x \land \map P y}$ $\implies$ $\ds \map P x$ Substitutivity of Equality $\text {(1)}: \quad$ $\ds \leadsto \ \$ $\ds \exists y: \,$ $\ds \paren {y = x \land \map P y}$ $\implies$ $\ds \map P x$ Universal Generalisation $\text {(2)}: \quad$ $\ds \leadsto \ \$ $\ds \forall y: \,$ $\ds \paren {y = x \implies \map P y}$ $\implies$ $\ds \map P x$ Hypothetical Syllogism with first lemma

$\Box$

Similarly:

 $\ds$  $\ds \map P x$ $\ds \leadsto \ \$ $\ds y = x$ $\implies$ $\ds \map P y$ Substitutivity of Equality $\text {(3)}: \quad$ $\ds \leadsto \ \$ $\ds \forall y: \,$ $\ds y = x$ $\implies$ $\ds \map P y$ Universal Generalisation $\text {(4)}: \quad$ $\ds \leadsto \ \$ $\ds \exists y: \,$ $\ds y = x$ $\land$ $\ds \map P y$ 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$