In Lang, Serge. "Basic Mathematics" (p.42), appears this proof:
From the existence of an inverse for non-zero rational numbers, we deduce: $$\text{If } ab=0, \text{then $a=0$ or $b=0$}$$ Proof. Suppose $a \neq 0$. Multiply both sides of the equation $ab=0$ by $a^{-1}$. We get: $$a^{-1}ab=0a^{-1}=0.$$ On the other hand, $a^{-1}ab=1b=b$, so that we find $b=0$, as desired.
As I see it, the author is implicitly doing one of two options.
Option 1: he is adding $\forall x(x=0 \lor x \neq 0)$ as a premise and then using Law of Excluded Middle.
$ \def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline#2\end{array}} \def\Ae#1{\qquad\mathbf{\forall E} \: #1 \\} \def\Ai#1{\qquad\mathbf{\forall I} \: #1 \\} \def\Ee#1{\qquad\mathbf{\exists E} \: #1 \\} \def\Ei#1{\qquad\mathbf{\exists I} \: #1 \\} \def\R#1{\qquad\mathbf{R} \: #1 \\} \def\ci#1{\qquad\mathbf{\land I} \: #1 \\} \def\ce#1{\qquad\mathbf{\land E} \: #1 \\} \def\oi#1{\qquad\mathbf{\lor I} \: #1 \\} \def\oe#1{\qquad\mathbf{\lor E} \: #1 \\} \def\ii#1{\qquad\mathbf{\to I} \: #1 \\} \def\ie#1{\qquad\mathbf{\to E} \: #1 \\} \def\be#1{\qquad\mathbf{\leftrightarrow E} \: #1 \\} \def\bi#1{\qquad\mathbf{\leftrightarrow I} \: #1 \\} \def\qi#1{\qquad\mathbf{=I}\\} \def\qe#1{\qquad\mathbf{=E} \: #1 \\} \def\ne#1{\qquad\mathbf{\neg E} \: #1 \\} \def\ni#1{\qquad\mathbf{\neg I} \: #1 \\} \def\IP#1{\qquad\mathbf{IP} \: #1 \\} \def\x#1{\qquad\mathbf{X} \: #1 \\} \def\DNE#1{\qquad\mathbf{DNE} \: #1 \\} $
$ \fitch{ 1.\,\forall x(x \neq 0 \to \exists y(yx=1 \land xy=1))\\ 2.\,\forall x(x \in \mathbb{Q} \to 0x=0)\\ 3.\,\forall x(x \in \mathbb{Q} \to 1x=x)\\ 4.\,\forall x(x=0 \lor x \neq 0) }{ \fitch{5.\, ab=0 \land a \in \mathbb{Q} \land b \in \mathbb{Q}}{ 6.\,a=0 \lor a \neq 0 \Ae{4} \fitch{7.\, a=0}{ 8.\,a=0 \lor b=0 \oi{7} }\\ \fitch{9.\, a \neq 0}{ 10.\,a \neq 0 \to \exists y(ya=1 \land ay=1) \Ae{1} 11.\,\exists y(ya=1 \land ay=1) \ie{10,9} \fitch{12.\, a^{-1}a=1 \land aa^{-1}=1}{ 13.\, a^{-1}a=1 \ce{12} 14.\, a^{-1}ab= a^{-1}0 \qquad Leibniz(5)\\ 15.\,1b=0 \qe{13,14} 16.\,b \in \mathbb{Q} \to 1b=b \Ae{3} 17.\,b \in \mathbb{Q} \ce{5} 18.\,1b=b \ie{16,17} 19.\,b=0 \qe{18,15} 20.\,a=0 \lor b=0 \oi{19} }\\ 21.\,a=0 \lor b=0 \Ee{11,12-20} }\\ 22.\,a=0 \lor b=0 \oe{6,7-8,9-21} }\\ 23.\,ab=0 \land a \in \mathbb{Q} \land b \in \mathbb{Q} \to a=0 \lor b=0 \ii{5-22} 24.\,\forall y(ay=0 \land a \in \mathbb{Q} \land y \in \mathbb{Q} \to a=0 \lor y=0) \Ai{23} 25.\,\forall x\forall y(xy=0 \land x \in \mathbb{Q} \land y \in \mathbb{Q} \to x=0 \lor y=0) \Ai{24} } $
Option 2: assuming $a \neq 0$, he sets up a proof by contradiction. If that is the case, I think this would be the proof.
$ \fitch{ 1.\,\forall x(x \neq 0 \to \exists y(yx=1 \land xy=1))\\ 2.\,\forall x(x \in \mathbb{Q} \to 0x=0)\\ 3.\,\forall x(x \in \mathbb{Q} \to 1x=x)\\ 4.\,\forall x(x=0 \lor x \neq 0) }{ \fitch{5.\, ab=0 \land a \in \mathbb{Q} \land b \in \mathbb{Q}}{ \fitch{8.\, \neg(a = 0 \lor b=0)}{ \fitch{9.\, a \neq 0}{ 10.\,a \neq 0 \to \exists y(ya=1 \land ay=1) \Ae{1} 11.\,\exists y(ya=1 \land ay=1) \ie{10,9} \fitch{12.\, a^{-1}a=1 \land aa^{-1}=1}{ 13.\, a^{-1}a=1 \ce{12} 14.\, a^{-1}ab= a^{-1}0 \qquad Leibniz(5)\\ 15.\,1b=0 \qe{13,14} 16.\,b \in \mathbb{Q} \to 1b=b \Ae{3} 17.\,b \in \mathbb{Q} \ce{5} 18.\,1b=b \ie{16,17} 19.\,b=0 \qe{18,15} 20.\,a=0 \lor b=0 \oi{19} 21.\,\bot \ne{8,20} }\\ 22.\ \bot \Ee{11,12-21} }\\ 23.\,a=0 \IP{9-22} 24.\,a=0 \lor b=0 \oi{23} 25.\,\bot \ne{8,24} }\\ 26.\,a=0 \lor b=0 \IP{8-25} }\\ 27.\,ab=0 \land a \in \mathbb{Q} \land b \in \mathbb{Q} \to a=0 \lor b=0 \ii{5-26} 28.\,\forall y(ay=0 \land a \in \mathbb{Q} \land y \in \mathbb{Q} \to a=0 \lor y=0) \Ai{27} 29.\,\forall x\forall y(xy=0 \land x \in \mathbb{Q} \land y \in \mathbb{Q} \to x=0 \lor y=0) \Ai{28} } $
Are these valid reasonings ?
What is the option the author is following, if any ?