|
|
|
|
|
Ternary LogicTernary logic is a multi-valued logic in which there are three truth values indicating true, false and unknown. Formal definitions Representation of values In ternary logic, the number symbols 0, 1, and 2 are usually assigned to the following truth values (or some permutation thereof): - 0 means unknown
- 1 means true
- 2 means false
This article will use the above representations of truth values. Ternary operators The operations from boolean logic can be extended to work with ternary logic. In general, the result of an operation op on the unknown value is determined by: - if op(1) ≠ op(2)
-
- op(0) = 0
- else
-
- op(0) = op(1) = op(2)
Common connectives - negation (NOT) ¬
- The negation operator should interchange true and false, while leaving the unknown value unchanged, since the negation of an unknown statement is still unknown.
- implication (IF...THEN) ⇒
- equivalence (EQUALS) ⇔
- Note that any two statements with the same truth value are equivalent, even if the truth value is unknown.
| P | Q | ¬P | P ∧ Q | P ∨ Q | P ⇒ Q | P ⇔ Q | | 0 | 0 | 0 | 0 | 0 | 1 | 1 | | 0 | 1 | 0 | 0 | 1 | 1 | 0 | | 0 | 2 | 0 | 2 | 0 | 0 | 0 | | 1 | 0 | 2 | 0 | 1 | 0 | 0 | | 1 | 1 | 2 | 1 | 1 | 1 | 1 | | 1 | 2 | 2 | 2 | 1 | 2 | 2 | | 2 | 0 | 1 | 2 | 0 | 1 | 0 | | 2 | 1 | 1 | 2 | 1 | 1 | 2 | | 2 | 2 | 1 | 2 | 2 | 1 | 1 | Other operators All other ternary logic operators can be constructed from the four basic operators NOT, AND, OR and IF...THEN. The 27 unary operators in ternary logic are represented in the following table. Some of them are given names: | ! 0 || 1 || 2 | | f0, "clear to 0" | 0 | 0 | 0 | | f1, "shift down" | 0 | 0 | 1 | | f2 | 0 | 0 | 2 | | f3 | 0 | 1 | 0 | | f4 | 0 | 1 | 1 | | f5, "identity" | 0 | 1 | 2 | | f6 | 0 | 2 | 0 | | f7. "NOT" | 0 | 2 | 1 | | f8 | 0 | 2 | 2 | | f9 | 1 | 0 | 0 | | f10 | 1 | 0 | 1 | | f11, "swap 0/1" | 1 | 0 | 2 | | f12 | 1 | 1 | 0 | | f13, "clear to 1" | 1 | 1 | 1 | | f14 | 1 | 1 | 2 | | f15, "rotate up" | 1 | 2 | 0 | | f16 | 1 | 2 | 1 | | f17, "shift up" | 1 | 2 | 2 | | f18 | 2 | 0 | 0 | | f19, "rotate down" | 2 | 0 | 1 | | f20 | 2 | 0 | 2 | | f21, "swap 0/2" | 2 | 1 | 0 | | f22 | 2 | 1 | 1 | | f23 | 2 | 1 | 2 | | f24 | 2 | 2 | 0 | | f25 | 2 | 2 | 1 | | f26, "clear to 2" | 2 | 2 | 2 | The number of functions for a given number of variables for trinary logic can be calculated by the equation , where v represents the number of variables. This gives us - 27 one-variable functions in ternary logic (as compared to only 4 one-variable Boolean functions).
- 19,683 two-variable functions in trinary logic (compared with 16 for binary), and
- 7,625,597,484,987 three-variable functions.
Two-argument functions Commutativity As stated above, there are 19,683 two-argument ternary functions. However, only 729 (, where bc is the binomial coefficient) of these are commutative. Of the four functions defined above, OR, AND, and EQUIV are commutative, while IF/THEN is not. For comparison, there are 8 two-argument binary functions. Implementation - Setun a computer actually implemented in ternary logic.
External links See also: Digital circuit, Ternary, Boolean algebra, Boolean function, binary logic.
|
 |
|
| Copyright 2005-2009 OnPedia.com. All Rights Reserved |
|
|