2

I am doing some simple Boolean algebra and wanted to perform some calculations in Mathematica but found it doesn't work.

Let us consider the expression:

expr1 = ((b < 0 && A <= AA) || A < AA);
expr2 = ((b < 0 && A == AA) || A < AA);

From our point of view they are the same. Or do we miss a special case?

FullSimplify[{expr1 == expr2}, #] & /@ {A < AA, A > AA, A == AA}

{{True}, {True}, {True}}

Now the problem is Mathematica does not see them as equivalent, in general:

FullSimplify[
expr1
 ==
expr2
,
A > 0 && AA > 0]

This does not yield True, but instead expr1 == expr2.

Do we have an error in reasoning?

How can I make Mathematica simplify expr1 to expr2?

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
Philipp
  • 641
  • 3
  • 8

2 Answers2

4
Equivalent[expr1, expr2] // FullSimplify

(* True*)
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
2

Just to amplify belisarius comments, let b<0 be x, A < AA be y and A==AA be z,

then your expressions are:

e1 = (x && (y || z)) || z
e2 = (x && y) || z

BooleanMinimize applied to these yields: (x && y) || z

The truth tables can be shown:

Framed@TableForm[BooleanTable[{x, y, z, e1, e2}], 
  TableHeadings -> {None, {x, y, z, e1, e2}}]

enter image description here

And TautologyQ[Equivalent[e1, e2]] yields True.

ubpdqn
  • 60,617
  • 3
  • 59
  • 148