Threevalued logic
This article needs additional citations for verification. (January 2011) 
In logic, a threevalued logic (also trinary logic, trivalent, ternary, or trilean,^{[1]} sometimes abbreviated 3VL) is any of several manyvalued logic systems in which there are three truth values indicating true, false and some third value. This is contrasted with the more commonly known bivalent logics (such as classical sentential or Boolean logic) which provide only for true and false.
Emil Leon Post is credited with first introducing additional logical truth degrees in his 1921 theory of elementary propositions.^{[2]} The conceptual form and basic ideas of threevalued logic were initially published by Jan Łukasiewicz and Clarence Irving Lewis. These were then reformulated by Grigore Constantin Moisil in an axiomatic algebraic form, and also extended to nvalued logics in 1945.
Prediscovery[edit]
Around 1910, Charles Sanders Peirce defined a manyvalued logic system. He never published it. In fact, he did not even number the three pages of notes where he defined his threevalued operators.^{[3]} Peirce soundly rejected the idea all propositions must be either true or false; boundarypropositions, he writes, are "at the limit between P and not P."^{[4]} However, as confident as he was that "Triadic Logic is universally true,"^{[5]} he also jotted down that "All this is mighty close to nonsense."^{[6]} Only in 1966, when Max Fisch and Atwell Turquette began publishing what they rediscovered in his unpublished manuscripts, did Peirce's triadic ideas become widely known.^{[7]}
Representation of values[edit]
As with bivalent logic, truth values in ternary logic may be represented numerically using various representations of the ternary numeral system. A few of the more common examples are:
 in balanced ternary, each digit has one of 3 values: −1, 0, or +1; these values may also be simplified to −, 0, +, respectively;^{[8]}
 in the redundant binary representation, each digit can have a value of −1, 0, 0/1 (the value 0/1 has two different representations);
 in the ternary numeral system, each digit is a trit (trinary digit) having a value of: 0, 1, or 2;
 in the skew binary number system, only the leastsignificant nonzero digit can have a value of 2, and the remaining digits have a value of 0 or 1;
 1 for true, 2 for false, and 0 for unknown, unknowable/undecidable, irrelevant, or both;^{[9]}
 0 for false, 1 for true, and a third noninteger "maybe" symbol such as ?, #, ½,^{[10]} or xy.
Inside a ternary computer, ternary values are represented by ternary signals.
This article mainly illustrates a system of ternary propositional logic using the truth values {false, unknown, true}, and extends conventional Boolean connectives to a trivalent context. Ternary predicate logics exist as well;^{[citation needed]} these may have readings of the quantifier different from classical (binary) predicate logic and may include alternative quantifiers as well.
Logics[edit]
Boolean logic allows 2^{2} = 4 unary operators, the addition of a third value in ternary logic leads to a total of 3^{3} = 27 distinct operators on a single input value. (This may be made clear by considering all possible truth tables for an arbitrary unary operator. Given 2 possible values of the boolean (input) variable there are four different patterns of output (result of the unary operator operating on the variable): TT,TF,FT,FF. Whereas, given three possible values of a ternary variable, and three possible results of a unary operation, there are twenty seven different output patterns:TTT,TTU,TTF, TUT,TUU,TUF, TFT,TFU,TFF, UTT,UTU,UTF, UUT,UUU,UUF, UFT,UFU,UFF, FTT,FTU,FTF, FUT,FUU,FUF, FFT,FFU, and FFF.) Similarly, where Boolean logic has 2^{2×2} = 16 distinct binary operators (operators with 2 inputs) possible, ternary logic has 3^{3×3} = 19,683 such operators. Where we can easily name a significant fraction of the Boolean operators (NOT, AND, NAND, OR, NOR, XOR, XNOR, equivalence, implication), it is unreasonable to attempt to name all but a small fraction of the possible ternary operators.^{[11]}
Kleene and Priest logics[edit]
Below is a set of truth tables showing the logic operations for Stephen Cole Kleene's "strong logic of indeterminacy" and Graham Priest's "logic of paradox".
(F, false; U, unknown; T, true)  



(−1, false; 0, unknown; +1, true)  



In these truth tables, the unknown state can be thought of as neither true nor false in Kleene logic, or thought of as both true and false in Priest logic. The difference lies in the definition of tautologies. Where Kleene logic's only designated truth value is T, Priest logic's designated truth values are both T and U. In Kleene logic, the knowledge of whether any particular unknown state secretly represents true or false at any moment in time is not available. However, certain logical operations can yield an unambiguous result, even if they involve an unknown operand. For example, because true OR true equals true, and true OR false also equals true, one can infer that true OR unknown equals true, as well. In this example, because either bivalent state could be underlying the unknown state, but either state also yields the same result, a definitive true results in all three cases.
If numeric values, e.g. balanced ternary values, are assigned to false, unknown and true such that false is less than unknown and unknown is less than true, then A AND B AND C... = MIN(A, B, C ...) and A OR B OR C ... = MAX(A, B, C...).
Material implication for Kleene logic can be defined as:
, and its truth table is


which differs from that for Łukasiewicz logic (described below).
Kleene logic has no tautologies (valid formulas) because whenever all of the atomic components of a wellformed formula are assigned the value Unknown, the formula itself must also have the value Unknown. (And the only designated truth value for Kleene logic is True.) However, the lack of valid formulas does not mean that it lacks valid arguments and/or inference rules. An argument is semantically valid in Kleene logic if, whenever (for any interpretation/model) all of its premises are True, the conclusion must also be True. (The Logic of Paradox (LP) has the same truth tables as Kleene logic, but it has two designated truth values instead of one; these are: True and Both (the analogue of Unknown), so that LP does have tautologies but it has fewer valid inference rules).^{[12]}
Łukasiewicz logic[edit]
The Łukasiewicz Ł3 has the same tables for AND, OR, and NOT as the Kleene logic given above, but differs in its definition of implication in that "unknown implies unknown" is true. This section follows the presentation from Malinowski's chapter of the Handbook of the History of Logic, vol 8.^{[13]}
Material implication for Łukasiewicz logic truth table is


In fact, using Łukasiewicz's implication and negation, the other usual connectives may be derived as:
 A ∨ B = (A → B) → B
 A ∧ B = ¬(¬A ∨ ¬ B)
 A ⇔ B = (A → B) ∧ (B → A)
It is also possible to derive a few other useful unary operators (first derived by Tarski in 1921):^{[citation needed]}
 MA = ¬A → A
 LA = ¬M¬A
 IA = MA ∧ ¬LA
They have the following truth tables:



M is read as "it is not false that..." or in the (unsuccessful) Tarski–Łukasiewicz attempt to axiomatize modal logic using a threevalued logic, "it is possible that..." L is read "it is true that..." or "it is necessary that..." Finally I is read "it is unknown that..." or "it is contingent that..."
In Łukasiewicz's Ł3 the designated value is True, meaning that only a proposition having this value everywhere is considered a tautology. For example, A → A and A ↔ A are tautologies in Ł3 and also in classical logic. Not all tautologies of classical logic lift to Ł3 "as is". For example, the law of excluded middle, A ∨ ¬A, and the law of noncontradiction, ¬(A ∧ ¬A) are not tautologies in Ł3. However, using the operator I defined above, it is possible to state tautologies that are their analogues:
 A ∨ IA ∨ ¬A (law of excluded fourth)
 ¬(A ∧ ¬IA ∧ ¬A) (extended contradiction principle).
HT logic[edit]
The logic of here and there (HT, also referred as Smetanov logic SmT or as Gödel G3 logic), introduced by Heyting in 1930^{[14]} as a model for studying intuitionistic logic, is a threevalued intermediate logic where the third truth value NF (not false) has the semantics of a proposition that can be intuitionistically proven to not be false, but does not have an intuitionistic proof of correctness.
(F, false; NF, not false; T, true)  


It may be defined either by appending one of the two equivalent axioms (¬q → p) → (((p → q) → p) → p) or equivalently p∨(¬q)∨(p → q) to the axioms of intuitionistic logic, or by explicit truth tables for its operations. In particular, conjunction and disjunction are the same as for Kleene's and Łukasiewicz's logic, while the negation is different.
HT logic is the unique coatom in the lattice of intermediate logics. In this sense it may be viewed as the "second strongest" intermediate logic after classical logic.
Bochvar logic[edit]
This section is empty. You can help by adding to it. (August 2014) 
Ternary Post logic[edit]
 not(a) = (a + 1) mod 3, or
 not(a) = (a + 1) mod (n), where (n) is the value of a logic
Modular algebras[edit]
Some 3VL modular algebras have been introduced more recently, motivated by circuit problems rather than philosophical issues:^{[15]}
 Cohn algebra
 Pradhan algebra
 Dubrova and Muzio algebra
Applications[edit]
SQL[edit]
The database structural query language SQL implements ternary logic as a means of handling comparisons with NULL field content. NULL was originally intended to be used as a sentinel value in SQL to represent missing data in a database, i.e. the assumption that an actual value exists, but that the value is not currently recorded in the database. SQL uses a common fragment of the Kleene K3 logic, restricted to AND, OR, and NOT tables.
In SQL, the intermediate value is intended to be interpreted as UNKNOWN. Explicit comparisons with NULL, including that of another NULL yields UNKNOWN. However this choice of semantics is abandoned for some set operations, e.g. UNION or INTERSECT, where NULLs are treated as equal with each other. Critics assert that this inconsistency deprives SQL of intuitive semantics in its treatment of NULLs.^{[16]} The SQL standard defines an optional feature called F571, which adds some unary operators, among which is IS UNKNOWN
corresponding to the Łukasiewicz I in this article. The addition of IS UNKNOWN
to the other operators of SQL's threevalued logic makes the SQL threevalued logic functionally complete,^{[17]} meaning its logical operators can express (in combination) any conceivable threevalued logical function.
See also[edit]
 Binary logic (disambiguation)
 Boolean algebra (structure)
 Boolean function
 Digital circuit
 Fourvalued logic
 Paraconsistent logic § An ideal threevalued paraconsistent logic
 Setun – an experimental Russian computer which was based on ternary logic
 Ternary numeral system (and Balanced ternary)
 Threestate logic (tristate buffer)
References[edit]
 ^ "Stanford JavaNLP API". Stanford University. Stanford NLP Group.
 ^ Post, Emil L. (1921). "Introduction to a General Theory of Elementary Propositions". American Journal of Mathematics. 43 (3): 163–185. doi:10.2307/2370324. hdl:2027/uiuo.ark:/13960/t9j450f7q. ISSN 00029327. JSTOR 2370324.
 ^ "Peirce's Deductive Logic > Peirce's ThreeValued Logic (Stanford Encyclopedia of Philosophy)". plato.stanford.edu. Retrieved 20200730.
 ^ Lane, R. (2001). "Triadic Logic".
 ^ Peirce, Charles S. (1839–1914). "Logic : autograph manuscript notebook, November 12, 1865November 1, 1909". hollisarchives.lib.harvard.edu/repositories/24/digital_objects/63983. Houghton Library, Harvard University. Retrieved May 15, 2023.
Triadic Logic is universally true. But Dyadic Logic is not aboslutely false
{{cite web}}
: CS1 maint: date format (link)  ^ Peirce, Charles S. (1839–1914). "Logic : autograph manuscript notebook, November 12, 1865November 1, 1909". hollisarchives.lib.harvard.edu/repositories/24/digital_objects/63983. Houghton Library, Harvard University. Retrieved May 15, 2023.
{{cite web}}
: CS1 maint: date format (link)  ^ Lane, Robert. "Triadic Logic". www.digitalpeirce.fee.unicamp.br. Retrieved 20200730.
 ^ Knuth, Donald E. (1981). The Art of Computer Programming Vol. 2. Reading, Mass.: AddisonWesley Publishing Company. p. 190.
 ^ Hayes, Brian (November–December 2001). "Third base" (PDF). American Scientist. Sigma Xi, the Scientific Research Society. 89 (6): 490–494. doi:10.1511/2001.40.3268. Archived (PDF) from the original on 20191030. Retrieved 20200412.
 ^ Nelson, David (2008). The Penguin Dictionary of Mathematics. Fourth Edition. London, England: Penguin Books. Entry for 'threevalued logic'. ISBN 9780141920870.
 ^ Douglas W. Jones, Standard Ternary Logic, Feb. 11, 2013.
 ^ "Beyond Propositional Logic"
 ^ Grzegorz Malinowski, "Manyvalued Logic and its Philosophy" in Dov M. Gabbay, John Woods (eds.) Handbook of the History of Logic Volume 8. The Many Valued and Nonmonotonic Turn in Logic, Elsevier, 2009
 ^ Heyting (1930). "Die formalen Regeln der intuitionistischen Logik". Sitz. Berlin. 42–56.
 ^ Miller, D. Michael; Thornton, Mitchell A. (2008). Multiple valued logic: concepts and representations. Synthesis lectures on digital circuits and systems. Vol. 12. Morgan & Claypool Publishers. pp. 41–42. ISBN 9781598291902.
 ^ Ron van der Meyden, "Logical approaches to incomplete information: a survey" in Chomicki, Jan; Saake, Gunter (Eds.) Logics for Databases and Information Systems, Kluwer Academic Publishers ISBN 9780792381297, p. 344; PS preprint (note: page numbering differs in preprint from the published version)
 ^ C. J. Date, Relational database writings, 1991–1994, AddisonWesley, 1995, p. 371
Further reading[edit]
 Bergmann, Merrie (2008). An Introduction to ManyValued and Fuzzy Logic: Semantics, Algebras, and Derivation Systems. Cambridge University Press. ISBN 9780521881289. Retrieved 24 August 2013., chapters 59
 Mundici, D. The C*Algebras of ThreeValued Logic. Logic Colloquium ’88, Proceedings of the Colloquium held in Padova 61–77 (1989). doi:10.1016/s0049237x(08)702623
 Reichenbach, Hans (1944). Philosophic Foundations of Quantum Mechanics. University of California Press. Dover 1998: ISBN 0486404595