Bit-wise algebra

Posted Wed, Apr 30 2008 1:31 by bill

Today I answered a question saying use A XOr (A And B).  Then I thought, well isn't that the same as A And Not (A And B).  Now I knew there is a simplification because of the double A and both And's but I honestly couldn't remember all my boolean algebra back from my circuits days. (seems I just don't use it that much <g>).  So for my own reference, I've got my "Circuits, Devices and System" text book out, and I'm going to attempt to translate the theorems into VB rules.

Communication Rules:
A Or B = B Or A 
A And B = B And A

Association Rules:
A Or (B Or C) = (A Or B) Or C
A And (B And C) = (A And B) And C

Distribution Rules:
A And (B Or C) = (A And B) Or (A And C)
A Or (B And C) = (A Or B) And (A Or C)

Absorption Rules:
A Or (A And B) = A
A And (A Or B) = A

DeMorgan's Theorems:
Not (A Or B) = (Not A) And (Not B)
Not (A And B) = (Not A) Or (Not B)

 

So applying DeMorgan's theorem, to A And Not (A And B) we get A And ((Not A) Or (Not B)) and then the distribution rule we get (A And Not A) Or (A And Not B) Since A And Not A is 0, the result is A And Not B.  Much simpler :)

As to  A XOr B, it is defined as (A Or B) And Not (A And B).  I'll leave it as an exercise for the reader to deduce  A And Not B from A XOr (A And B)

Filed under: