Q:

Problems with universal generalization

I’ve been studying universal generalization recently and, according to the textbooks, $\forall x Q(x)$ can be derived from $Q(a)$, if the variable $a$ is arbitrary. A variable is arbitrary, when it does not appear in any of the undischarged assumptions throughout the derivation.
Example 1: prove that $\forall x Q(x)$ derives from $\forall x [P(x) \rightarrow Q(x)]$ and $\forall x P(x)$.

$\forall x [P(x) \rightarrow Q(x)]$ (P)
$\forall x P(x)$ (P)
$P(a) \rightarrow Q(a)$ (UI - 1)
$P(a)$ (UI - 2)
$Q(a)$ (MP - 3, 4)
$\forall x Q(x)$ (UG - 5)

We could generalize $Q(a)$ in step 6, because the variable $a$ was not in the premises of our proof (steps 1 and 2).
However, consider the following example:
Example 2: prove that $\forall x Q(x)$ derives from $\forall x [P(a) \rightarrow Q(x)]$ and $P(a)$.

$\forall x [P(a) \rightarrow Q(x)]$ (P)
$P(a)$ (P)
$P(a) \rightarrow Q(a)$ (UI - 1)
$Q(a)$ (MP - 2, 3)
$\forall x Q(x)$ (UG - 4) – MISTAKE: $a$ appears in $P(a)$

In this case, according to the definition of arbitrariness presented above, we are actually not able to universally generalize $Q(a)$ in step 5, since the variable $a$ does appear in one of the premises (step 2). Nevertheless, $\forall x Q(x)$ does derive from $\forall x [P(a) \rightarrow Q(x)]$ and $P(a)$, so universal generalization should be possible here. Where is my reasoning flawed?

A:

Prove that $(\forall x)Q(x)$ derives from $(\forall x)[P(a) \implies Q(x)]$ and $P(a)$.

$(\forall x)[P(a) \implies Q(x)]$ (P)
$P(a)$
$P(a) \implies Q(x_0)$ (UI - 1)
$Q(x_0)$ (M.P - 2,3)
$(\forall x)Q(x)$ (UG - 4)

Note that when we use the UI rule, we are considering that $P(a) \implies Q(x_0)$ for any $x_0$. So in the end, you have $Q(x_0)$ for all $x_0$. So you use the UG rule.

