Vulcan telemarketers?

Yuk yuk yuk. But seriously... In the Boolean sense, an operator (such as AND, OR, XOR, NOT) which produces either True or False as its output per its given inputs.

AND returns True if both of its inputs are True, else it returns False. OR returns True if either or both A or B are True. XOR returns True if and only if either of its inputs are True, but not both. NOT returns the logical inverse of its input.

For example, (A AND 0) is False, (A AND A) is True; (A OR 0) is True, as is (A OR A); (A XOR B) is True iff A is True and B is False, or vice versa; (NOT A) is False if A is True, and True if A is False.

And yeah, there are such beasts as NAND, NOR, and XNOR... they are explained elsewhere in this node.

A NAND B is equivalent to NOT (A AND B)
A NOR B is equivalent to NOT (A OR B)
A XNOR B is equivalent to (you guessed it) NOT (A XOR B)

There are also a few others: implication and biconditional.
Implication is false iff A is true and B is false. It is equivalent to (NOT A) OR B. It can also be written "If A then B".
Biconditional is true iff A and B have the same truth value. In fact, iff is biconditional. It is equivalent to A XNOR B or (A implies B) AND (B implies A).

The logical operators aren't very logical per se, because we think of them as axioms. We consider only operators which take one or two inputs at a time. There are four outputs for one bit of input: leaving the bit alone (wire), flipping it (NOT) and forcing TRUE or FALSE. Consider their truth tables.

In. 0 1
Out 0 0 Forcing FALSE
Out 0 1 Leaving alone
Out 1 0 Flipping i.e. NOT
Out 1 1 Forcing TRUE

You can see that there are 2 possible inputs (0 and 1), so there's 22 = 4 possible operators. This leads one to think: what if there are two bits of inputs A and B? Then, as there are 4 possible inputs (00, 01, 10 and 11), there will be 24 = 16 possible operators. Consider this truth table. Read it vertically: the first two rows specify the inputs A and B, and the rest specify the response of each possible operator. For example, AND 10: read the third column at the row 1, where AND is. As you see, the output is false.

A 0011
B 0101
0 0000 FALSE
1 0001 AND
2 0010 XOR; IF A
3 0011 IF A
4 0100 XOR; IF B
5 0101 IF B
6 0110 XOR
7 0111 OR
8 1000 NOT OR (NOR)
9 1001 NOT XOR (XNOR)
A 1010 NOT IF B
B 1011 NOT (XOR; IF B) -or- TRUE; NOT IF B
C 1100 NOT IF A
D 1101 NOT (XOR; IF A) -or- TRUE; NOT IF A
F 1111 TRUE

This seems chaotic at first, but when you look at it more closely, you see that the outcomes 8-F are NOT'ed mirror images of 0-7. Still, it's interesting that outcomes 2,4 and their NOT'ed mirror images B,D can be expressed only as compound operations.

Another interesting property of these operators specified with 4 binary digits is that the number of the operator is its truth table, and the operation is the operator itself. As you can see, the operator listed as the sixth (XOR) has the truth table 0110, or six in binary.

Then, the output can be found directly without any logical thought! Forget the decimal system (for the sake of clarity) for a while and count in binary only. For input 00, output the 00th digit of the operator; for 01, output the 01th digit; for 10, output the 10th digit; for 11, output the 11th digit.

For example, XOR 10 is operation 0110 for input 10. Thus, take the 10th digit, which is 1.

00 01 10 11 ordinal number of digit
.0 .1 .1 .0 the operator

Far more elegant than the words, isn't it? Maybe we should construct computers so that they don't take OR, XOR etc., but the number of the operation as listed in the table above.

Obviously, in practice, computer engineers use the logical operators that are useful and easy to implement. Operators 0000b and 1111b, for example, represent constant off or on states, and don't do any logic. They also select a particular set of operators that commute, namely AND, XOR, OR and their negations NAND, XNOR and NOR. Noncommuting operators are constructed from simpler systems. Operator 0010, for example, is "A except when B", which can be implemented by placing an off-switch transistor operated by B on the wire A.

Please msg me, if there are terminology or other errors in this table.

Log in or registerto write something here or to contact authors.