77. Order of quantifiers
Many important mathematical principles are statements with several quantified variables. The ordering of the quantifiers matters. The subtleties involved can be confusing.
77.1.1 Example The following statement is the Archimedean property of the real numbers.
$$(\forall x{:}\mathrm{R})(\exists n{:}\mathrm{N})(x < n) \tag{77.1}$$
In other words, “For any real number $x$ there is an integer $n$ bigger than $x$.”
Proof If you are given a real number $x$, then $\mathrm{trunc}(x) + 1$ is an integer bigger than $x$.
77.1.2 Example On the other hand, the statement
$$(\exists n{:}\mathrm{N})(\forall x{:}\mathrm{R})(x < n) \tag{77.2}$$
is false. It says there is an integer which is bigger than any real number. That is certainly not true: if you think 456,789 is bigger than any real number, then I reply, “It is not bigger than 456,790”. In general, for any integer $n, n+ 1$ is bigger — and of course it is a real number, like any integer.
As these examples illustrate, in general, $(\forall x )(\exists y )P (x,y)$ does not mean the same as $(\exists y )(\forall x )P (x,y)$, although of course for particular statements both might be true.
On the other hand, two occurrences of the same quantifier in a row can be interchanged:
77.2 Theorem
For any statement $P (x,y)$ ,
$$(\forall x )(\forall y )P (x,y )\vdash (\forall y )(\forall x )P (x,y) \tag{77.3}$$
and
$$(\forall y )(\forall x )P (x,y )\vdash (\forall x )(\forall y )P (x,y) \tag{77.4}$$
and similarly
$$(\exists x )(\exists y )P (x,y )\vdash (\exists y )(\exists x )P (x,y) \tag{77.5}$$
and
$$(\exists y )(\exists x )P (x,y )\vdash (\exists x )(\exists y )P (x,y) \tag{77.6}$$
77.2.1 Exercise Are these statements true or false? Explain your answers. All variables are real.
a) $(\forall x )(\exists y )(x > y)$.
b) $(\exists x )(\forall y )(x > y)$
c) $(\exists x )(\exists y )((x > y )\Rightarrow (x =y))$.
(Answer on page 247.)
77.2.2 Exercise Are these statements true or false? Explain your answers. All variables are of type integer.
a) $(\forall m )(\exists n )(m \mid n)$.
b) $(\exists m )(\forall n )(m \mid n)$.
c) $(\forall m )(\exists n )((m|n )\Rightarrow (m \mid mn))$.
d) $(\exists m )(\forall n )((m|n )\Rightarrow (m \mid mn))$.
77.2.3 Exercise Are these statements true or false? Give counterexamples if they are false. In these statements, $p$ and $q$ are primes and $m$ and $n$ are positive integers.
a) $(\forall p)(\forall m)(\forall n)\bigl((p \mid m \Rightarrow p \mid n) \Rightarrow m \mid n\bigr)$
b) $(\forall m)(\forall n)\bigl(m \mid n \Rightarrow (\exists p)(p \mid m \wedge p \mid n)\bigr)$
77.2.4 Exercise (hard) Are these equivalences true for all predicates $P$ and $Q$? Assume that the only variable in $P$ is $x$ and the only variables in $Q$ are $x$ and $y$. Give reasons for your answer.
a) $(\forall x)(\exists y)\bigl(P(x) \Rightarrow Q(x,y)\bigr) \Leftrightarrow (\forall x)\bigl(P(x) \Rightarrow (\exists y)Q(x,y)\bigr)$
b) $(\exists x)(\forall y)\bigl(P(x) \Rightarrow Q(x,y)\bigr) \Leftrightarrow (\exists x)\bigl(P(x) \Rightarrow (\forall y)Q(x,y)\bigr)$
Pages 115–116 of the book (PDF).