setbuilder notation

The expression $\{x \mid P(x)\}$ defines a set. Its elements are exactly those $x$ for which the condition $P(x)$ is true. (The type of $x$ is often deduced from the context.) This is called setbuilder notation (a low-status name) or set comprehension (a higher status but confusing name). The condition $P$ is called the defining condition. Setbuilder notation is a form of structural notation.

Difficulties The basic rule of inference for setbuilder notation is that $P(a)$ is true if and only if $a \in \{x \mid P(x)\}$. This means in particular that if $P(a)$ then $a \in \{x \mid P(x)\}$, and if not $P(a)$, then $a \notin \{x \mid P(x)\}$. Students may fail to make use of the latter fact. This may be related to the phenomenon described under collective coreference.

Variations A colon is used by some authors instead of a vertical line.

One may put an expression before the vertical line. This can be misleading.

Example 1 The set $\{x^{2} \mid x \in \mathbb{R} \text{ and } x \neq 3\}$ does contain 9, because $9 = (-3)^{2}$.

Gries and Schneider [1993], Chapter 11, give examples that show that putting an expression before the vertical line can be ambiguous. (Example 1 above is not ambiguous.) They introduce a more elaborate notation that eliminates the ambiguity. Citation: (139), and (for the colon variation) (66).

Pages 228–229 of the book (PDF).