Operations AND, OR, and XOR (exclusive OR), and NOT are defined, thinking of 1 as true and 0 as false.
So, for example, 1 AND 1 is 1, while 1 AND 0 is 0.
p | q | p AND q |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
p | q | p OR q |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
p | q | p XOR q |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
p | NOT p |
---|---|
0 | 1 |
1 | 0 |
Curious facts:
-
NOT p is a unary operator.
There are exactly 2 unary operators.
-
p AND q, p OR q, and p XOR q are binary operators.
There are exactly 16 different possible binary operators: p OP q.
However, each such binary operator can easily be expressed using a combination of only the AND, OR, and NOT operators.