How to | Use Logical Operators

The Wolfram Language supports logical operators not only for programming, but for mathematical operations as well.

The infix operators && and || stand for conjunction (And) and disjunction (Or), while ! is the prefix operator for negation (Not). The next two inputs are equivalent:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

You can use symbols instead of True and False. BooleanConvert symbolically evaluates many logical expressions. We expect to be :

In[3]:=
Click for copyable input
Out[3]=

Use Resolve to find truth values of quantified logical statements:

In[4]:=
Click for copyable input
Out[4]=

You can also use the existential quantifier to check that :

In[5]:=
Click for copyable input
Out[5]=

The Wolfram Language also recognizes the logical operator Implies; you can use it to show :

In[6]:=
Click for copyable input
Out[6]=
    

Use SatisfiableQ to check if a and b satisfy :

In[1]:=
Click for copyable input
Out[1]=

Tutorials

See Also

Resolve  Exists  ForAll  And  Or  Not  Implies  Booleans