Prove: For all sets $A$ and $B$, ( $A \cap B = A \cup B \implies A = B$ )
In the upcoming proof, we make use of the next lemma.
Lemma: For all sets $A$ and $B$, $A = B$ iff $A - B = B - A$.
Proof: Let $A$ and $B$ be arbitrary sets and let $S = A \cap B$ and $T = A \cup B$. If $S = T$, then $S$ and $T$ have got the same elements. Thus, by simplification law, Towe can state that
$\forall x \in A \cup B \, ( x \in A \cap B ) \tag 1 \label 1$
To prove $A = B$ we might as well harness our lemma and establish that $A - B = A - B$, which we can be verified through the axiom of extension by showing that $\forall y \in A - B \,( y \in B - A )$ and $\forall y^* \in B - A \, (y^* \in A - B )$. So, let
$y \in A - B \tag 2 \label 2$
and let $y^* \in B - A \tag 3 \label 3$
From \eqref{2} we rest assured that $y\in A$ and $y\not\in B$. Furthermore, by \eqref{1} we know that
$y \in A \land y \in B \tag 4 \label 4$
Nonetheless \eqref{4} is an antilogy since from \eqref{2} we deduced, inter alia, that $y\not\in B$. Notice thus far we are trying to prove that \eqref{3} and $F$ implies $y \in B - A $ and $y^* \in A - B$. Therefore, it’s vacuously true that
$A = B$
Q.E.D
I believe I could've done this proof more easily by using the contrapositive method, but my question is, is this proof right?
Your proof is correct up to $y \notin B.$ Note that $y \in A \setminus B \implies y \in A \cup B =A\cap B \implies y \in B,$ which is a contradiction. This implies $A\setminus B=\emptyset$ and similarly $B\setminus A =\emptyset.$ Therefore $A \setminus B=B\setminus A.$ Moreover, the use of "vacuously true" in the end is also incorrect.
Alternatively, the statement can be proved in a much simpler way as follows:
$$A\subseteq A \cup B = A \cap B \subseteq B.$$ Similarly $B\subseteq A$ and hence $A=B.$