Playing around with the Boolean Operators

Feb 02, 2006 21:52

Ok, yet another geeky computer logic post. Don't feel bad if you're not reading these.

In the last post I talked about boolean operators and found that there are 16 of them. Let me classify them into sections:
No InputAlways Zero
Always One0 0 0 0
1 1 1 1 Single InputA
Not A
B
Not B0 0 1 1
1 1 0 0
0 1 0 1
1 0 1 0 Two Input (XOR)A Xor B
(Not A) Xor B
A Xor (Not B)
(Not A) Xor (Not B)
Not (A Xor B)0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0
1 0 0 1 Two Input (AND)A And B
(Not A) And B
A And (Not B)
(Not A) And (Not B)
Not (A And B)0 0 0 1
0 1 0 0
0 0 1 0
1 0 0 0
1 1 1 0 Two Input (OR)A Or B
(Not A) Or B
A Or (Not B)
(Not A) Or (Not B)
Not (A Or B)0 1 1 1
1 1 0 1
1 0 1 1
1 1 1 0
1 0 0 0
The first six are pretty simple. They're not really binary operators, since they don't take two inputs, but they fill out 6 of the 16 possibilities.

The other 10 come in three flavors. Applying NOT to the input or output of our three favored operators gives us the others.

XOR (Exclusive OR) "A single input is One, but not both" gives us itself and it's opposite operator "Both inputs are equal." No matter how we place the NOT operator, only those two results come out.

When we combine NOT with AND we get 5 different results. NOT with OR gives us 5 as well. Look closely at the last two results of both groups though: they are the same.

It looks that "(Not A) And (Not B)" is equivelent to "Not (A Or B)". Also "Not (A And B)" is equivelent to "(Not A) Or (Not B)." This relationship between AND, OR, and NOT is known as De Morgan's Theorem, and it's used extensively in the analysis of binary logic expressions to simplify them.

"Not (A And B)" is known in boolean logic as NAND. "Not (A Or B)" is known as NOR. I'm going to now talk about NAND, but the same reasoning could be applied to NOR.

NAND B 01 A010 100When both A and B are 0, then the output is 1. Otherwise the output is 0.
The interesting thing about this operator is that it is somewhat half-way between an OR and an AND. If I apply the NOT operator to both the inputs the logic is the same as the AND, but if I apply the NOT operator to the output the logic is the same as the OR.

Inputs - A B 0 00 11 01 1 OutputsAND0001 NAND1000 OR0111 more later...

geek

Previous post Next post
Up