Ternary logic

Ternary logic is a multi-valued logic in which there are three truth values indicating true, false and unknown.


Contents

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.
  • conjunction (AND)
  • disjunction (OR)
  • 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 <math>3^{3^v}<math>, 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 (<math>3^{bc(2, 3)}<math>, 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. (Above it says 16. The 8 probably refers to commutative functions.)

Implementation

  • Setun a computer actually implemented in ternary logic.

External links

See also: Digital circuit, Ternary, Boolean algebra, Boolean function, binary logic.

de:Dreiwertige Logik

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools