2 different results using associative property in boolean expression

41 Views Asked by At

I have the following expression that i'm trying to simplify: $Q \vee P \vee Q \vee T$

I simplified this like so: $Q \wedge P \vee Q \vee T \equiv Q \wedge P \vee (Q\vee T) \equiv Q\wedge P \vee T \equiv Q \wedge (P\vee T) \equiv Q\wedge T \equiv Q. $

But then I noticed there might also be another way to proceed, which would be like so: $Q \wedge P \vee Q \vee T \equiv (Q \wedge P \vee Q)\vee T \equiv T $

Both of these clearly get different results, what am I missing here?

1

There are 1 best solutions below

0
On BEST ANSWER

Order of operations matters.   $Q\wedge(P\vee Q\vee T)$ and $(Q\wedge P)\vee Q\vee T$ are quite different expressions.

I simplified this like so: $Q \wedge P \vee Q \vee T \equiv Q \wedge P \vee (Q\vee T) \equiv Q\wedge P \vee T \equiv Q \wedge (P\vee T) \equiv Q\wedge T \equiv Q. $

You are treating that as ${Q\wedge (P\vee Q\vee T)\\Q\wedge((P\vee Q)\vee T)\\Q\wedge T\\ Q}$

But then I noticed there might also be another way to proceed, which would be like so: $Q \wedge P \vee Q \vee T \equiv (Q \wedge P \vee Q)\vee T \equiv T $

Here you treat it as: $(Q\wedge P)\vee Q\vee T\\ ((Q\wedge P)\vee Q)\vee T\\ T$

Which is the usual convention: that $\land$ has precedence over $\lor$ in the same way $\times$ has precedence over $+$.

Not everyone uses the same convention, so the best practice is to always use explicit bracketing to ensure the epression is read as intended.


Compare with: $q\times p+q+1 = (q\times p)+q+1$