# Best practice for typesetting quantifiers?

When I work with quantifiers I noted that are very close to the other symbols and the result does not look good, for example

$\exists a\in\mathbb{R}\exists b\in\mathbb{R}\forall c\in\mathbb{R}\forall d\in\mathbb{R}$


Which is the proper form to write quantifiers?

-
There exist real scalars a,b for all real scalars c,d – percusse May 21 '13 at 18:56
I would recommend using $\exists a\in\mathbb{R}$, $\exists b\in\mathbb{R}$, $\forall c\in\mathbb{R}$, and $\forall b\in\mathbb{R}$, or perhaps $\exists a, b \in\mathbb{R}$, $\forall c, d \in\mathbb{R}$. – Peter Grill May 21 '13 at 19:02
@PeterGrill Breaking down (the beginning of) such a mathematical statement into multiple math-mode parts seems odd to me... – Jubobs May 21 '13 at 19:13
Sometimes even a space $\exists a\in\mathbb{R}\ \exists b\in\mathbb{R}$ can help. I agree with @percusse though. – marczellm May 21 '13 at 19:19
@percusse the problem is I can't always use the metalanguage working in logic. – Gastón Burrull May 21 '13 at 19:47

It depends on the context.

If this is part of a piece of text, then you might consider Peter Grill's suggestion:

$\exists a\in\mathbb{R}$, $\exists b\in\mathbb{R}$,
$\forall c\in\mathbb{R}$, and $\forall b\in\mathbb{R}$


On the other hand, if the quantifiers are part of a logical formula, you might consider a dot between the quantifiers, like this:

$\exists a\in\mathbb{R}\ldotp\exists b\in\mathbb{R}\ldotp \forall c\in\mathbb{R}\ldotp\forall b\in\mathbb{R}\ldotp P$


This dot notation is inherited, I think, from Russell and Whitehead's Principia Mathematica, and is quite widely used, particularly in computer science. A comma between quantifiers is quite unusual, though it does appear in the syntax of the Coq theorem prover.

$\exists a\in\mathbb{R}, \exists b\in\mathbb{R}, \forall c\in\mathbb{R}, \forall d\in\mathbb{R}, P$


The comma notation becomes awkward when you want to quantify several variables at the same time, because then you have two different types of comma in the same formula:

$\exists a,b\in\mathbb{R}, \forall c,d\in\mathbb{R}, P$


In such cases, you might consider putting just a space between the variables, like this:

$\exists a\;b\in\mathbb{R}, \forall c\;d\in\mathbb{R}, P$


The idea of putting spaces between variables, rather than commas, is taken from the syntax of the Isabelle theorem prover.

-
I strongly disagree about using dots between quantifiers. Commas are fine, though. – Jubobs May 21 '13 at 19:35
I liked the second one, I prefer commas but is there a code for commas instead of using \ldotp? What about simple spaces "\ "? – Gastón Burrull May 21 '13 at 19:37
this answer is the closest to what I want, because what I want is a unique formula, not a separation into two parts what do you think about use of "\ " or "," instead of "\ldotp"? – Gastón Burrull May 21 '13 at 20:08
\  and , are fine alternatives. I incorporated , into my answer. – John Wickerson May 22 '13 at 7:42
@Jubobs Sometimes one replaces AND by a comma, which makes the notation very messy and inappropriate if commas are used between quantifiers instead of periods. – Dávid Tóth Aug 14 '15 at 12:31

Simply make these characters what they should be: Operators. They aren't arithmetic operators but logical ones, but that doesn't make any difference here:

\documentclass{article}
\usepackage{amsmath,amssymb}
\DeclareMathOperator{\Exists}{\exists}
\DeclareMathOperator{\Forall}{\forall}
\begin{document}
$\Exists a\in\mathbb{R}\Exists b\in\mathbb{R}\Forall c\in\mathbb{R}\Forall d\in\mathbb{R}$

$\Exists a\in\mathbb{R}:\Exists b\in\mathbb{R}:\Forall c\in\mathbb{R}:\Forall d\in\mathbb{R}$

$\Exists a,b\in\mathbb{R}:\Forall c,d\in\mathbb{R}$
\end{document}


Last but not least, it's equivalent but easier to grasp, if the both "exists" and "foralls" are grouped. R^2 would be wrong in this case, because a and b should each be in R. (a,b) would be in R^2, but that's not written.

-
Logical conjunction ∧ is an operator because if P and Q are formulae, then so is (P)∧(Q). ∃x is an operator because if P is a formula then so is ∃x(P). ∃x∈R is an operator for the same reason. But ∃, by itself, is not an operator in this sense, so I don't think it should be declared as one. – John Wickerson May 22 '13 at 7:28
\colon is better than : when writing for example "For every x there exists y such that...". – Jori Mäntysalo May 22 '13 at 9:42
@JohnWickerson: You are right. But ∃x is not a symbol by itself and so cannot be an operator in a typographical sense. The same is true for the integral: if f(x) is an formula, then \int f(x) is not a formula, but \int f(x)dx is. Yet, \int is a typographical operator. So \exists alone is not a logical operator, but \exists x\in M:P(x) is. Yet, \exists should be a typhographical operator. – Toscho May 22 '13 at 12:26
TLA+ uses colons: research.microsoft.com/en-us/um/people/lamport/tla/tla.html, and Lamport authored LaTeX. – Ioannis Filippidis Mar 25 at 6:18

In my opinion, the real issue with quantifiers is that it's hard to obtain consistent spacing, as I explained in this answer. The most striking example I found: $\forall W\forall A$ gives

Of course there should be more space before the second quantifier; a single space \   will usually be OK. The problem is the spacing after the quantifiers. There is no simple solution to this, other than using manual kerning where needed. In this case, $\forall\mkern2mu W\ \forall\mkern-1mu A$ looks quite alright:

Let me point out that I'd use quantifiers only in displayed formulas, never in inline math.

-

Another possibility is:

$\exists\ a,b \in \mathbb{R},\ \forall\ c, b \in\mathbb{R}$

-
I liked use of comma. I probably will use this in the future $\exists a\in\mathbb{R}, \exists b\in\mathbb {R}, \forall c\in \mathbb{R}, \forall d\in\mathbb{R}$. Since I don't like the space "\ " after the quantifier. – Gastón Burrull May 21 '13 at 19:52
The disadvantage of using commas, at least in the example above, is that you now have two different types of comma in your formula, with two different meanings, and this could make the formula a bit hard to understand. – John Wickerson May 22 '13 at 7:31

I don't know if this is what you are asking, but it's related.

In my opinion it's horrible the space after the quantifiers (they look very close to the next letter). I always edit them and add an small space

\let\existstemp\exists
\let\foralltemp\forall
\renewcommand*{\exists}{\existstemp\mkern2mu}
\renewcommand*{\forall}{\foralltemp\mkern2mu}


By the way, as others are saying, it depends on the situation. If it's inline I would go for There exist real scalars a,b for all real scalars c,d (Percusse's comment). But if it's inside a \displaymath I would go for the symbols.

First of all, I usually space my math with \quads (this is personal taste, and you have to choose what you use). And, in second place, I don't know how your example should be read:

• If it's read There exist real scalars a,b for all real scalars c,d I would change the order and write For all real scalars c,d there exist real scalars a,b… and write \forall c,d \in \mathbb{R} \quad \exists a,b \in \mathbb{R}.

• And if it's read as There exist real scalars a,b such that for all real scalars c,d… then I would write \exists a,b \in \mathbb{R}, \quad \forall c,d \in \mathbb{R}

Here it is a full example.

\documentclass{article}
\usepackage{amssymb}

\let\existstemp\exists
\let\foralltemp\forall

\begin{document}
$\exists a,b \in \mathbb{R}, \quad \forall c,d \in \mathbb{R}$

\renewcommand*{\exists}{\existstemp\mkern2mu}
\renewcommand*{\forall}{\foralltemp\mkern2mu}

$\exists a,b \in \mathbb{R}, \quad \forall c,d \in \mathbb{R}$
$\forall c,d \in \mathbb{R} \quad \exists a,b \in \mathbb{R}$
\end{document}


In order to justify the \quads instead of the \s, here is another example which, in my opinion, shows my idea (and why in displaymaths \quads are useful):

I think that the first line is far more readable than the second one.

-
I'm interested in space between \mathbb{R} and \exists. Writting "\mathbb{R} \exists" is horrible and "\mathbb{R}\quad \exists" is exaggerated, I prefer "\mathbb{R}\ \exists" or "\mathbb{R}\ \exists". About your suggestion, what about $\forall\, c$? "\," is a little space after quantifier also. – Gastón Burrull May 21 '13 at 20:00
@GastónBurrull About the \,, yes, it works (I used \mkern2mu to show how to adjust it). By the way the \quad if it's in a \displaymath I think it's much better than \  because it clearly separates the sentence. – Manuel May 21 '13 at 20:03
In your first item the meaning changes drastically if you swap the order. – percusse May 22 '13 at 7:55
@percusse My answer to that is: Of course. But then I think, may be I misunderstood part of the question. Shouldn't it change if I swap the order? May be in logic (which I don't know) it shouldn't. My point was only to add the space after the quantifiers and show the \quads as useful mathematical spaces. If I'm wrong, please correct me, it's true I know nothing about logic. – Manuel May 22 '13 at 10:02
@Manuel Sure. I learned it the hard way so I have an eye for that structure from my PhD :) One says there are fixed a,b for all c,d if you swap the order. The other one says for each a and b you can find some c and d. And that caused me a lot of trouble in thepast because they don't teach that in engineering heh. – percusse May 22 '13 at 10:31