I've sometimes seen that this operator is used to specify that each of given variables is in some set, e.g. Reals. Like (x|y|z) ∈ Reals as a shorthand for x ∈ Reals && y ∈ Reals && z ∈ Reals. This was in the context of specifying Assumptions to functions like Simplify or Integrate.

But I remember that when I tried something like this (don't remember exactly what), for some reason it gave me unexpected results, so I've been staying clear of this syntax for a while.

I've read the the documentation on the Alternatives operator,


is a pattern object that represents any of the patterns $p_i$.

If a named pattern such as x_ appears in $p_i$ that are not used in a particular match, then the named pattern is taken to have a value that is a zero-length sequence Sequence[].

But that didn't make it clear what the "any" means.

Now I'm wondering: what is the difference between the two variants? FullSimplify for equality doesn't appear to say True, so I assume they are different. What are the conditions for (x|y|z)∈Reals to mean exactly that each of $x$, $y$ and $z$ is in $\mathbb R$, as does the &&-chained version?

  • 4
    $\begingroup$ Note that (5 | 4) [Element] Integers is True while (5 | 4.2) [Element] Integers is False. So the pattern using | requires that both be True, hence is effectively an AND operation. $\endgroup$
    – bill s
    Jul 11, 2018 at 16:13
  • $\begingroup$ Not sure off-hand what the behavior of Element[a|b, set], but you can use Element[{a,b}, set] to get the behavior equivalent to Element[a,set] && Element[b,set]. $\endgroup$
    – nben
    Jul 11, 2018 at 17:31
  • 1
    $\begingroup$ To give another example of what @bills wrote, LogicalExpand[! LogicalExpand[! exp1]] will expand exactly to exp2 (see Element, under Properties&Relations). The Element documentation also states that all elements need to be part of the domain for the (x|y|z)∈Reals syntax, answering your original question directly. $\endgroup$ Jul 11, 2018 at 22:58

1 Answer 1

exp1 = (x | y | z) ∈ Reals;
exp2 = x ∈ Reals && y ∈ Reals && z ∈ Reals;
exp3 = {x, y, z} ∈ Reals

As stated in Element >> Details that (1) exp1 is equivalent to exp3, and (2) exp3 evaluates to exp1 "if its truth or falsity cannot immediately be determined."

For exp1 and exp2, as observed by bill s and Thies Heidecke in comments, we can show that !exp1 is equal to ! exp2:

LogicalExpand[! exp1] == LogicalExpand[! exp2]


An alternative way is to Simplify exp1 assuming exp2, and vice versa.

Assuming[exp1,  Simplify[exp2]]


Assuming[exp2, Simplify[exp1]]


  • $\begingroup$ Just a reminder. I'm not exactly sure but I believe since your answer consists only of code, the post popped up in the "Low-quality queue". $\endgroup$
    – halirutan
    Jul 11, 2018 at 22:45
  • $\begingroup$ thank you @halirutan. I will add a few words. $\endgroup$
    – kglr
    Jul 12, 2018 at 2:09
  • $\begingroup$ Did you mean that exp1 is equivalent to exp3, not exp2 in the (1), and that exp3 evaluates to exp1, not exp2 does in (2)? $\endgroup$
    – Ruslan
    Aug 2, 2018 at 7:45
  • $\begingroup$ @Ruslan, right. I will edit in a moment. $\endgroup$
    – kglr
    Aug 2, 2018 at 7:48
  • $\begingroup$ To future readers: don't fall into the trap of thinking that this extends to other operators: e.g. (x|y)>0 is not_equivalent to x>0&&y>0! $\endgroup$
    – Ruslan
    Jan 18, 2019 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.