[prev in list] [next in list] [prev in thread] [next in thread] 

List:       spamassassin-users
Subject:    Re: OR NOT Logic
From:       Matt Kettler <mkettler () evi-inc ! com>
Date:       2006-05-02 22:11:06
Message-ID: 4457D8FA.5010309 () evi-inc ! com
[Download RAW message or body]

Russell Miller wrote:
> On Tuesday 02 May 2006 14:59, Dan wrote:
>> Is:
>>
>> A && (B || C || D || E || F)
>>
>> equivalent to?:
>>
>> A && (!B && !C && !D && !E && !F)

No the two are NOT equivalent.

The first statement will be true if A and any one of B-F is true.

The second statement will be true if A and all of B-F are false.

It would be true if you modified the second rule to be:

A && !(!B && !C && !D && !E && !F)

>>
> I believe that's a fundamental logic rule, so yes.
> 
> A && B == ~A || ~B

No, that is not a fundamental logic rule. It is not even true, they are in fact
exact opposites of each other.

I'm going to change the use of ~ to !, just to match the OP's syntax of the NOT
operation. ( A && B == !A || !B )


Truth tables:

A  B  (A && B) ( !A || !B)
0  0     0          1
0  1     0          1
1  0     0          1
1  1     1          0



The correct rule is:

!( A && B) == !A || !B

It's called DeMorgan's theorem. Note the difference being that there's negation
on both sides.

A  B  !(A && B) ( !A || !B)
0  0     1          1
0  1     1          1
1  0     1          1
1  1     0          0
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic