I am trying to prove by natural deduction the following laws of sets, but I doubt I am doing it the right way.
$$\begin{align} a) A \cup B = B \cup A \end{align}$$
$$\begin{align} (1) & A \cup B && [\text{hypothesis }] \\ (2) & |A && [\text{hypothesis }] \\ (3) & |B \cup A && [\text{introduction (2)}] \\ (4) & |B && [\text{hypothesis }] \\ (5) & |B \cup A && [\text{introduction (4)}] \\ (4) & B \cup A && [\text{assumed}] \\ \end{align}$$
$$\begin{align} b) A \cap B = B \cap A \end{align}$$
$$\begin{align} (1) & A \cap B && [\text{hypothesis }] \\ (2) & B && [\cap \text{-elim}(1)] \\\ (3) & A && [\cap \text{-elim}(1)] \\\ (5) & B \cap A && [\cap - \text{introduction (2,3)}] \\ \end{align}$$
Could someone point out any errors?
With Natural Deduction you prove logical formulae, with logical conncetive, like $\lor, \land$; thus, we have to use : $\equiv$ (equivalence) and not $=$ (identity).
To prove the equivalence (or bi-implication) $\varphi \equiv \psi$, we have to prove two implications : $\varphi \rightarrow \psi$ and $\psi \rightarrow \varphi$, and then use the $\equiv$-introduction rule :
For
steps (1)-(5) are correct (the rule to be referenced in comments is : $\lor$-introduction), but the final steps are missing :
(6) $B \lor A$ --- from (1), (2) and (4) by $\lor$-elimination
where $\lor$-elimination is the rule :
Finally :
(7) $(A \lor B) \rightarrow (B \lor A)$ --- from (1) and (6) by $\rightarrow$-introduction.
Then, you have to repeat it for :
From $a_1)$ and $a_2)$, by $\equiv$-introduction, we conclude with :