[Math] Natural deduction proof of $\forall x (\exists y (P(x) \vee Q(y))) \vdash \exists y (\forall x (P(x) \vee Q(y)))$

logic

I'm trying to do a Fitch proof of

$$
\forall x (\exists y (P(x) \vee Q(y))) \vdash \exists y (\forall x (P(x) \vee Q(y)))
$$

Edit: using only the axioms on http://www.proofwiki.org/wiki/Category:Natural_Deduction_Axioms, along with universal/existential generalisation/instantiation

The following is my first attempt.

$$
\begin{array}{lll}
1 & \begin{array}{l}\forall x (\exists y (P(x) \vee Q(y))) \\ \hline \end{array} & \text{assumption} \\
2 & \exists y (P(v) \vee Q(y)) & \text{$\forall$E, 1} \\
3 & \begin{array}{ll} & \begin{array}{l} P(v) \vee Q(w) \\ \hline\end{array} \end{array} & \text{assumption} \\
4 & \begin{array}{ll} & \forall x (P(x) \vee Q(w)) \end{array} & \text{$\forall$I, 3} \\
5 & \forall x (P(x) \vee Q(w)) & \text{$\exists$E, 2, 3, 4} \\
6 & \exists y (\forall x (P(x) \vee Q(y))) & \text{$\exists$I, 5} \\
\end{array}
$$

Edit: I know that this proof is incorrect, since replacing $P(x) \vee Q(y)$ with $R(x, y)$ would yield the result
$$
\forall x (\exists y (R(x, y)) \vdash \exists y (\forall x (R(x, y)))
,$$
which is clearly not true in general.

I'm not exactly sure on which line the flaw is. I would appreciate it if someone could point that out, and explain why it's wrong.

I suspect that I'm supposed to use the distributivity of $\exists$ over $\vee$ for this one. But I don't know how to formally justify this distributivity, and I can't find a natural deduction proof for it.

Edit: I think I have successfully proved this, based on @ZevChonoles's answer. Here is a screencap:

Best Answer

You can't go from step 3 to step 4. For the particular $v$ you chose, you know that you can find $w$ such that $P(v)\vee Q(w)$. If $Q(w)$ is true, then certainly $P(x)\vee Q(w)$ is true for all $x$, but if $Q(w)$ is false there's no reason why it should be the case that $P(x)\vee Q(w)$ for all $x$.


I don't know how to write this in the Fitch format, but the essential idea is just that either $Q(y)$ is true for some $y$, or $Q(y)$ is false for all $y$.

If $Q(v)$ is true for some particular $v$, then $P(x)\vee Q(v)$ is true for all $x$, and so we certainly have that $\exists y(\forall x(P(x)\vee Q(y)))$; the $y$ that exists is just $y=v$.

If $Q(y)$ is false for all $y$, then $P(x)\vee Q(y)\iff P(x)$, so $\forall x(\exists y(P(x)\vee Q(y)))$ implies that $P(x)$ is true for all $x$, and hence $\exists y(\forall x(P(x)\vee Q(y)))$; any $y$ at all will work.