# Expressions with Boolean variables and simplification

I have some familiarity with Mathematica, but have no experience with any Boolean computation. Suppose we have the Boolean formula $(x_1 \lor x_2) \land (x_2 \lor x_3)$. This can be simplified by applying rules of Boolean logic, as follows.

\begin{align} &(x_1 \lor x_2) \land (x_2 \lor x_3) \\ &= (x_1 \land x_2) \lor (x_1 \land x_3) \lor (x_2 \land x_2) \lor (x_2 \land x_3) \\ &=x_2 \lor (x_1 \land x_2) \lor (x_2 \land x_3) \lor (x_1 \land x_3) \\ &=x_2 \lor (x_1 \land x_3) \end{align}

Can formulas of Boolean variables be computed in Mathematica 9? Can Mathematica apply rules of Boolean logic to make simplifications like as shown above?

Yes.

For your example, e.g., BooleanMinimize[(x1 || x2) && (x2 || x3)] outputs (x1 && x3) || x2

FullSimplify will also do basic simplifications on boolean constructs, but the boolean specific functions available in MM give you more options & flexibility.

You can enter the traditional characters is desired using MM character names, and get the output using traditional characters also, e.g. BooleanMinimize[(x1 || x2) && (x2 || x3)]//TraditionalForm

There's a nice article in the Mathematica Journal.

• You should review too LogicalExpand because it's very useful if you handled with logical expression. e.g In the particular example above, the outcome is the same by BooleanMinimize. Feb 3, 2014 at 7:04
• It works. BTW, is there a way to get Mathematica to output the result in symbols $\land$ instead of &&, and $\lor$ instead of ||? Feb 3, 2014 at 7:52
• @Identity: Just add //TraditionalForm to end, or enclose whatever you do in TraditionalForm[...] - I'll edit answer.
– ciao
Feb 3, 2014 at 8:13