Suppose there are a number of assumptions attached to a certain symbol. How do we query Mathematica to see if a given assumption holds? To be more precise, how can we define a function elementQ such that

Block[{$Assumptions = Element[x, Reals]}, elementQ[x, Reals]]
(* True *)

Assuming[Element[x, Reals], elementQ[x, Reals]]
(* True *)

elementQ[x, Reals]
(* False *)

In some circumstances this is automatically given by Element itself: for example Element[Pi, Reals] correctly returns True. However, the same technique does not work when querying for user-defined assumptions on symbols:

Assuming[Element[z, Reals], Element[z, Reals]]
(* Element[z, Reals] *)

The matter is of course also complicated by the fact that there are several ways to set assumptions. Such functions should both check the content of $Assumptions and if there are assumptions set up by the use of some Assuming or similar function.


1 Answer 1


The function Refine does what you want

Assuming[x ∈ Reals, Refine[Element[x, Reals]]]
(* True *)

Assuming[x > 0, Refine[Element[x, Reals]]]
(* True *)
  • $\begingroup$ well this is kind of embarrassing, I was sure I checked whether Refine did the job, and somehow convinced myself it didn't. Anyway, I guess we can say that the function elementQ[x_, dom_] := Refine[Element[x, dom]] === True is the solution. Or more generally, checkAssumption[assumption_] := Refine[assumption] === True. Thanks for the answer! $\endgroup$
    – glS
    Sep 16, 2016 at 21:14

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.