I'm looking for a way to simplify this logical expression:
((x == y) and (x > 0 or z > 0))
or
((x != y) and (x > 0 and y > 0 and z > 0))
All variables are non-negative integers.
I thought about using Karnaugh Map, but my variables aren't boolean, which kind of complicates things.
Then I figured I should probably translate that into a set of boolean variables, for example:
a = (x == y)b = (x > 0)c = (y > 0)d = (z > 0)
But those boolean variables aren't exactly independent of each other.
For example, if a is true, then b must be equal to c.
Any idea would be very much appreciated.
Thank you!
Let us define propositions (in fact propositional functions) $p$, $q$, and $r$ as follows: $$ p \colon \ (x == y), $$ $$ q \colon \ (x > 0 \mbox{ or } z > 0), $$ and $$ r \colon \ (x > 0 \mbox{ and } y > 0 \mbox{ and } z > 0). $$ Then we have $$ r \implies q, $$ and the given logical expression is $$ (p \land q ) \lor \big( (\lnot p) \land r \big), $$ which we can operate upon as follows: $$ \begin{align} (p \land q ) \lor \big( (\lnot p) \land r \big) &= \big( p \lor \big( (\lnot p) \land r \big) \big) \land \big( q \lor \big( (\lnot p) \land r \big) \big) \\ &= \big( p \lor (\lnot p) \big) \land (p \lor r) \land \big( q \lor (\lnot p) \big) \land (q \lor r) \\ &= T \land (p \lor r) \land \big( q \lor (\lnot p) \big) \land (q \lor r) \\ &= (p \lor r) \land \big( q \lor (\lnot p) \big) \land (q \lor r) \\ &= \end{align} $$
Hope this helps.