Motivation and some examples of Quantifier Rules I am reading A Friendly Introduction to Mathematical Logic by  Christopher Leary and Lars Kristiansen. The authors define rules of inference of type (QR):

Definition. Suppose that the variable $x$ is not free in the formula $\psi$. Then both of the following are rules of inference of type (QR):
$$\left( \{ \psi \to \phi \}, \psi \to \left( \forall x\phi \right) \right)$$
$$\left( \{ \phi \to \psi \}, \left( \exists x\phi\right)  \to  \psi \right)$$

The authors write the following as a motivation which is intuitive but I cannot seem to relate the motivation and the definition:
The motivation behind our quantifier rules is very simple. Suppose, without
making any particular assumptions about x, that you were able to prove
“x is an ambitious aardvark.” Then it seems reasonable to claim that you
have proved “(∀x)x is an ambitious aardvark.” Dually, if you were able
to prove the Riemann Hypothesis from the assumption that “x is a bossy
bullfrog,” then from the assumption “(∃x)x is a bossy bullfrog,” you should
still be able to prove the Riemann Hypothesis.

This is intuitive but how does all this motivate the definition? Also, can someone explain the requirement of $x$ not being free in $\psi$ in the definition?
 A: See Universal generalization.
The rule formalize the intuitive sound argument that, if we can assert that a "generic" object $x$, i.e. an object whatever, has property $P$, then everything has that property.
The "generic" restriction must be expressed with the restriction that nothing must be asserted in the "context" [the premises] of the argument about the object $x$:

Assume that $\Gamma$  is a set of formulas, the set of premises, and that $\Gamma \vdash \varphi(x)$ has been derived. The generalization rule states that $\Gamma \vdash \forall y \varphi (y)$ can be derived, provided that $x$ is not used [is not free] in $\Gamma$.

Here are examples of invalid use of Generalization: "Socrates is a Philosopher, therefore everyone is a Philosopher".
The above fallacy shows that $P(x) \vdash \forall y P(y)$ is invalid.
Why so? Because we have not satisfied the restriction in the formulation of the Generalization rule: the variable $x$ occurs free in the premise of the argument ($\Gamma = \{ P(x) \}$).

The second rule is the contraposed of the first one; thus the "motivation" is the same.
