4

The Mathematica Boolean Computation webpage specifies that Mathematica has full support for "don't care" arguments and values. However I don't see any examples demonstrating this functionality. Could someone provide an example, preferably using the BooleanMinterm function?

1 Answers1

3

BooleanMinterm doesn't afford the possibility tu use "don't care", but BooleanFunction has it :

myTruthTableForm[bf_BooleanFunction] := 
  Append[#, bf @@ #] & /@  Tuples[{True, False}, 2] // Boole // 
    Reverse // Grid[#, Dividers -> {{False, False, True}, None}] &;

{#, myTruthTableForm [ReleaseHold[#]]} & /@ {
   HoldForm @ BooleanFunction[{{0, 0} -> 1, {_, 1} -> 0}],
   HoldForm @ BooleanFunction[{{0, 0} -> 1, {0, 1} -> 0}],
   HoldForm @ BooleanFunction[{{0, 0} -> 1, {0, 1} -> 0, {__} -> _ }],
   HoldForm @ BooleanFunction[{{0, 0} -> 1, {0, 1} -> 0, {__} -> 1 }]
   } // Grid[#, Alignment -> Left] &

enter image description here

Edit

Note that BooleanFunction make some definitives choices about what happen with the "don't care" outputs. Theses choices are not predictible and doesn't correspond to any kind of minimization ("DNF","SOP","CNF","POS" etc..., see a counter example here). Nevertheless real optimisation with "don't care" are available with the third argument of BooleanMinimize (there is a example here )

andre314
  • 18,474
  • 1
  • 36
  • 69