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: