48

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?

18
  • 14
    There exist real scalars a,b for all real scalars c,d
    – percusse
    May 21, 2013 at 18:56
  • 2
    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}$. May 21, 2013 at 19:02
  • 2
    @PeterGrill Breaking down (the beginning of) such a mathematical statement into multiple math-mode parts seems odd to me...
    – jub0bs
    May 21, 2013 at 19:13
  • 1
    Sometimes even a space $\exists a\in\mathbb{R}\ \exists b\in\mathbb{R}$ can help. I agree with @percusse though.
    – marczellm
    May 21, 2013 at 19:19
  • 1
    @percusse the problem is I can't always use the metalanguage working in logic. May 21, 2013 at 19:47

6 Answers 6

20

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}$

enter image description here

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$

enter image description here

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$

enter image description here

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$

enter image description here

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$

enter image description here

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

8
  • 11
    I strongly disagree about using dots between quantifiers. Commas are fine, though.
    – jub0bs
    May 21, 2013 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 "\ "? May 21, 2013 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"? May 21, 2013 at 20:08
  • \ and , are fine alternatives. I incorporated , into my answer. May 22, 2013 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. Aug 14, 2015 at 12:31
30

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}

Three versions with <code>\DeclareMathOperator</code>

Additionally, I would add a colon which stands for "such that".

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.

5
  • 6
    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. May 22, 2013 at 7:28
  • 2
    \colon is better than : when writing for example "For every x there exists y such that...". May 22, 2013 at 9:42
  • 4
    @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, 2013 at 12:26
  • 1
    TLA+ uses colons: research.microsoft.com/en-us/um/people/lamport/tla/tla.html, and Lamport authored LaTeX.
    – 0 _
    Mar 25, 2016 at 6:18
  • You could also \let\oldexists\exists \let\exists\relax \DeclareMathOperator{\exists}{\oldexists} to continue writing \exists but get the above behaviour.
    – gsvg
    May 27, 2017 at 11:31
8

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

original output

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:

improved output

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

7

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.

enter image description here

\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):

enter image description here

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

12
  • 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. May 21, 2013 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, 2013 at 20:03
  • 1
    In your first item the meaning changes drastically if you swap the order.
    – percusse
    May 22, 2013 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, 2013 at 10:02
  • 1
    @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, 2013 at 10:31
3

Another possibility is:

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

enter image description here

2
  • 1
    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. May 21, 2013 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. May 22, 2013 at 7:31
1

I've always used \; after every symbol that goes with a quantifier. For example,

\begin{equation*}
\forall \varepsilon > 0 \; \exists N \in \mathbb{N} \; \forall n \in \mathbb{N} \; 
(n \geq N \implies |s_n - L| < \varepsilon)
\end{equation*}

enter image description here

Though I do understand that such an ad hoc method is not good practice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .