Logical Operators, Truth Table, Unicode
Truth Table and Possible Logical Operators
Here is definition of the operator “and”, using a black triangle ▲ to represent the operator:
And 0 ▲ 0 = 0 0 ▲ 1 = 0 1 ▲ 0 = 0 1 ▲ 1 = 1
Here is definition of the operator “or”, also using a black triangle ▲ to represent the operator:
Or 0 ▲ 0 = 0 0 ▲ 1 = 1 1 ▲ 0 = 1 1 ▲ 1 = 1
Consider their results, we can encode the definition in a condensed way by the code 0001
“Or” is therefore 0111
These can be considered as 4-digit binary numbers. So, number of possible logical function with 2 parameters are the same as total number of 4 digit binary numbers, and that's 16. (2^4=16) Let's see the complete list of what they are, and what they are named, and their symbols, if any.
Truth Table; All Possible Logical Operators
Definition | Code | Name | Symbol | Comment |
---|---|---|---|---|
0▲0=0; 0▲1=0; 1▲0=0; 1▲1=0 | 0000 | ◇ | ◇ | false |
0▲0=0; 0▲1=0; 1▲0=0; 1▲1=1 | 0001 | and | ∧ | ◇ |
0▲0=0; 0▲1=0; 1▲0=1; 1▲1=0 | 0010 | ◇ | ◇ | |
0▲0=0; 0▲1=0; 1▲0=1; 1▲1=1 | 0011 | ◇ | ◇ | |
0▲0=0; 0▲1=1; 1▲0=0; 1▲1=0 | 0100 | ◇ | ◇ | |
0▲0=0; 0▲1=1; 1▲0=0; 1▲1=1 | 0101 | ◇ | ◇ | |
0▲0=0; 0▲1=1; 1▲0=1; 1▲1=0 | 0110 | xor | ⊻ | ◇ |
0▲0=0; 0▲1=1; 1▲0=1; 1▲1=1 | 0111 | or | ∨ | ◇ |
0▲0=1; 0▲1=0; 1▲0=0; 1▲1=0 | 1000 | nor | ⊽ | ◇ |
0▲0=1; 0▲1=0; 1▲0=0; 1▲1=1 | 1001 | xnor | ⊻̅ | The symbol is a combining char in Unicode. |
0▲0=1; 0▲1=0; 1▲0=1; 1▲1=0 | 1010 | ◇ | ◇ | |
0▲0=1; 0▲1=0; 1▲0=1; 1▲1=1 | 1011 | ◇ | ◇ | |
0▲0=1; 0▲1=1; 1▲0=0; 1▲1=0 | 1100 | ◇ | ◇ | |
0▲0=1; 0▲1=1; 1▲0=0; 1▲1=1 | 1101 | ◇ | ⇒ | |
0▲0=1; 0▲1=1; 1▲0=1; 1▲1=0 | 1110 | nand | ⊼ | |
0▲0=1; 0▲1=1; 1▲0=1; 1▲1=1 | 1111 | ◇ | ◇ | true |
It is interesting to note that half of them don't have a name. Wikipedia on Logical connective gives some name to some of them. For example, the “0000” is just “false”, the “1111” is “true”, the “1101” is “if/then”. Though, much of these names are rather forced and don't make much sense. First of all, remember we are dealing with functions of 2 parameters (so-called “binary operators”). The term “true” isn't usually thought of as a binary operator, and the “if then” and “not” doesn't make sense here neither.
〔see Unicode: Math Symbols π² ∞ ∫〕
Functional Completeness
A set (L) of binary logical operators are “functional complete” if the semantic of any of the 16 possible logical operator can be expressed by a combination of operators in the set L.
We know that the total number of possible binary function in the binary space {1,0} is 16, from the truth table above.
So, a functionally complete set of function is one that any of the possible function in truth table can be expressed by a combination of the functions in the set.
One of the functionally complete set of function is just one single function the nand by itself.
Exercise 1: express all possible binary functions by nand.
Exercise 2: write a program that lists all possible sets of binary logical operators that are functional complete.
Programing Language Operators
- What is Function, What is Operator?
- Programing Language Design: Why You Need Operators
- What is the Definition of Operator in Computer Language?
- Necessity of Operator Overload in Computer Languages
- Unicode Support in Programing Language Function Name and Operator
- Logical Operators, Truth Table, Unicode