Is it legitimate to quantify a variable twice?

Your formula is a perfectly acceptable and grammatical formula in first-order logic, and it is exactly as you say: the $s$ in $Q(s)$ is quantified by the the $\exists s$, while the $s$ in $R(s)$ is quantified by the $\forall s$.

Note that you can even have something like $\forall s \ \exists s \ P(s)$. In this case, the $s$ in $P(s)$ gets quantified by the $\exists s$, meaning that there are no free variables $s$ to quantify for the $\forall s$. This is why in this formula the $\forall s$ is called a 'null quantifier': while still following the grammatical rules, it effectively serves no purpose. Indeed, the formula is equivalent to simply $\exists s \ P(s)$

But yes, you can use quantifiers with the same variable any number of times. But as you also say, it looks weird, and can certainly invite confusion, so I would recommend never to do this in practice. And if you need a lot of variables, you can always use $x_1, x_2, x_3, ...$


Yes, it is okay to reuse the same symbol for a variable in different "scopes". A quantifier binds the variable that it introduces within the subexpression headed by that quantifier.

Note that it's always possible to rewrite an expression into an equivalent one that does not reuse variable symbols, unless there are only finitely many variable symbols.

A variable may appear free in a well-formed formula, meaning that it isn't bound

$$ x \;\;\text{is free in}\;\; P(x) \land Q(x) $$

We can be more precise and use $\text{FV}$ to denote the set of free variables.

$$ \text{FV}(P(x) \land Q(x)) = \{ x \} $$

If a variable is bound by a quantifier then it is no longer free.

$$ \text{FV}\!\left(\forall x \mathop. P(x)\right) = \emptyset $$

We can think about the meaning of $\forall$ as well:

$$ \Gamma \models \forall x \mathop. \varphi \;\;\text{if and only if} \;\; \text{$\Gamma \models \varphi$ for every $x$ in the domain of discourse } $$

So, in the course of determining the truth of a well-formed formula headed by a quantifier, we can remove the quantifier and then consider the result of replacing the newly free variable with all the elements of the domain.

However, instances of $x$ that are hidden behind another quantifier won't actually be free in $\varphi$.

More concretely, the following two statements are equivalent

$$ \forall x \mathop. (P(x) \to \exists x \mathop. Q(x)) \;\;\text{is equivalent to}\;\; \forall x \mathop. (P(x) \to \exists y \mathop. Q(y)) $$