Shorter expression of a special conditions

48 Views Asked by At

Let $A$ be a set and $B$ a condition (can be either true or false). Is there any shorter description of the expression $$ x = \begin{cases} A & B \\ \emptyset & \text{otherwise} \end{cases} \text{?} $$ An inline solution would be nice.

One possibility is to define $$ \text{cond}(A, B) = \begin{cases} A & B \\ \emptyset & \text{otherwise} \end{cases} $$ and set $x = \text{cond}(A, B)$. But is there a more "intuitive" way to do this without defining a new function?

1

There are 1 best solutions below

1
On BEST ANSWER

How about $\{ x\ \lvert\ x \in A \wedge B \}$ or $\{ x \in A\ \lvert\ B \}$? I would personally stick to your original approach, though.