Equality of Ordered Pairs/Necessary Condition/Proof from Kuratowski Formalization

Proof
First a lemma:

Let $\tuple {a, b} = \tuple {c, d}$.

From the Kuratowski formalization:
 * $\set {\set a, \set {a, b} } = \set {\set c, \set {c, d} }$

There are two cases: either $a = b$, or $a \ne b$.

Case 1
Suppose $a = b$.

Then:
 * $\set {\set a, \set {a, b} } = \set {\set a, \set a} = \set {\set a}$

Thus $\set {\set c, \set {c, d} }$ has only one element.

Thus $\set c = \set {c, d}$ and so $c = d$.

So:
 * $\set {\set c, \set {c, d} } = \set {\set a}$

and so $a = c$ and $b = d$.

Thus the result holds.

Case 2
Now suppose $a \ne b$. By the same argument it follows that $c \ne d$.

So that means that either $\set a = \set c$ or $\set a = \set {c, d}$.

Since $\set {c, d}$ has $2$ distinct elements, $\set a \ne \set {c, d}$.

Thus:
 * $\set a = \set c$

and so $a = c$.

Then:
 * $\set {a, b} = \set {c, d}$

But as $a = c$ that means we have:
 * $\set {a, b} = \set {a, d}$

It follows from the lemma that:
 * $b = d$