5
$\begingroup$

I have several expressions similar to

a (a b + c d) != 0 || b (a b + c d) != 0 || c (a b + c d) != 0 || d (a b + c d) != 0

and I would like to reduce them maximally; in the above example, the given logical statement is clearly just equivalent to a b + c d != 0, but how to arrive at this?

Both Reduce and Resolve, as well as FullSimplify return it unchanged. I tried

BooleanConvert[
  (a != 0 && a b + c d != 0) ||
  (b != 0 && a b + c d != 0) ||
  (c != 0 && a b + c d != 0) ||
  (d != 0 && a b + c d != 0)
  , "CNF"
]

but it stops at

(a != 0 || b != 0 || c != 0 || d != 0) && a b + c d != 0

Is there a way?

$\endgroup$
3
  • 1
    $\begingroup$ If we know the required result, then Resolve[ForAll[{a, b, c, d}, Equivalent[(a != 0 && a b + c d != 0) || (b != 0 && a b + c d != 0) || (c != 0 && a b + c d != 0) || (d != 0 && a b + c d != 0), a b + c d != 0]]] confirms it by True. $\endgroup$
    – user64494
    Feb 23 at 15:16
  • $\begingroup$ @user64494 Thank you, this is important information. So it definitly should be doable in Mathematica somehow. $\endgroup$ Feb 23 at 15:26
  • 1
    $\begingroup$ A possible reason for non-simplification could be that FullSimplify[(a != 0 || b != 0) && a b != 0] simplifies to a b != 0, whereas FullSimplify[(a != 0 || b != 0) && a + b != 0] does not simplify to a + b != 0 $\endgroup$
    – yarchik
    Feb 24 at 23:12

2 Answers 2

2
$\begingroup$
$Version

"14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)"

Clear["Global`*"]

expr = a  (a  b + c  d) != 0 || b  (a  b + c  d) != 0 || 
   c  (a  b + c  d) != 0 || d  (a  b + c  d) != 0;

Tell Mathematica that the variables are boolean

Assuming[{a, b, c, d} ∈ Booleans, expr // Simplify]

(* a b + c d != 0 *)
$\endgroup$
2
  • 2
    $\begingroup$ The variables are not assumed to be Boolean, or at least this is not stated and also not a necessary assumption for the desired simplification to hold. $\endgroup$ Feb 23 at 20:46
  • $\begingroup$ @DanielLichtblau Actually I need it for complex numbers - or for that matter for any field... $\endgroup$ Feb 23 at 20:47
2
$\begingroup$

The following is a very manual approach, but might be informative

expr = a (a b + c d) != 0 || b (a b + c d) != 0 || 
   c (a b + c d) != 0 || d (a b + c d) != 0;

Considering the negation of the expression feels more natural

Simplify[! expr]
(* 
a (a b + c d) == 0 && b (a b + c d) == 0 && c (a b + c d) == 0 && 
 d (a b + c d) == 0 *)

Employing an obvious rule

x_ y_ == 0 :> x == 0 || y == 0;

%% /. %
(* (a == 0 || a b + c d == 0) && (b == 0 || 
   a b + c d == 0) && (c == 0 || a b + c d == 0) && (d == 0 || 
   a b + c d == 0) *)

We get a simple expression

negative = FullSimplify[%]
(* (a == 0 && b == 0 && c == 0 && d == 0) || a b + c d == 0 *)

The following implication is obviously true

implication = Implies[First[negative], Last[negative]]
(* 
a == 0 && b == 0 && c == 0 && d == 0 \[Implies] a b + c d == 0 *)

Mathematica but doesn't recognise this implication as true, but can recognise its negative as false

! FullSimplify[! implication]
(* True *)

Combining the implication and the statement we get

! (implication && negative) // BooleanConvert
(* a b + c d != 0 *)
$\endgroup$
1
  • $\begingroup$ I believe this same observation (or rather its equivalent without negation) was made by @user64494 in a comment to the question. This, I believe, shows that potentially Mathematica can do it without the hint too somehow. $\endgroup$ Feb 24 at 15:43

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.