I don't really understand when we're allowed to use $\exists$-elimination when making first-order natural deduction proofs. I understand that the criteria are that the variable must be free in the conclusion, and in the "context" of the implication. When reading this, I feel like I understand, but when looking at examples, I get confused. For example,
$\exists x P(x)$ and $P(x) \implies \forall y P(y)$, we cannot use the elimination rule; why is this?
Another example would be $\exists x P(x)$ and $P(x) \implies P(x)$. Here I understand that, since x is free in $P(x)$, we cannot use the elimination. However, would it be possible if we instead had $\exists x P(x)$ and $P(x) \implies \forall xP(x)$?
If so, why? Wouldn't x still be free in the context?
Any help is appreciated. Thanks!
$\begin{array}{lllll} 1&1&\text{Assume }\exists x\,P(x)\land(P(x)\to\forall y\,Q(y))&\qquad\\ 1&2&\exists x~P(x) &&\land E_1,1\\ 1 &3& P(x)\to\forall y~Q(y)&&\land E_2,1\\ \color{red}1&4&\forall y~Q(y)&&\exists E~2, 3~\color{red}{\text{ERROR}} \end{array}$