Set builder notation: Colon or Vertical Line

I remember once hearing offhandedly that in set builder notation, there was a difference between using a colon versus a vertical line, e.g. $\{x: x \in A\}$ as opposed to $\{x\mid x \in A\}$. I've tried searching for the distinction, but have come up empty-handed.


Solution 1:

There is no difference that I've ever heard of. I do strongly prefer "$\vert$" to "$\colon$", though, because I'm often interested in sets of maps, and e.g. $$\{f \mid f\colon \mathbb{R}\rightarrow\mathbb{C}\text{ with $f(6)=24$}\}$$ is easier to read than $$\{f: f\colon \mathbb{R}\rightarrow\mathbb{C}\text{ with $f(6)=24$}\}$$.

EDIT: Note that as Mike Pierce's answer shows, sometimes "$:$" is clearer. At the end of the day, use whichever notation is most clear for your context.

Solution 2:

There is no difference. The bar is just often easier to read than the colon (like in the example in Noah Schweber's answer). However in analysis and probability, the bar is used in other notation. In analysis it is used for absolute value (or distance or norms) and in probability it is used in conditional statements (the probability of $A$ given $B$ is $\operatorname{P}(A \mid B)$). So looking at bar versus colon in sets with these notations $$ \{x \in X \mid ||x|-|y_0||<\varepsilon\} \quad\text{vs}\quad \{x \in X : ||x|-|y_0||<\varepsilon\} $$ $$ \{A \subset X \mid \operatorname{P}(B \mid A) > 0.42\} \quad\text{vs}\quad \{A \subset X : \operatorname{P}(B \mid A) > 0.42\} $$ it can be better to use the colon just to avoid overloading the bar.