# Three-valued logic

Last updated

In logic, a three-valued logic (also trinary logic, trivalent, ternary, or trilean, [1] sometimes abbreviated 3VL) is any of several many-valued logic systems in which there are three truth values indicating true, false and some indeterminate 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.

## Contents

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 three-valued logic were initially published by Jan Łukasiewicz and Clarence Irving Lewis. These were then re-formulated by Grigore Constantin Moisil in an axiomatic algebraic form, and also extended to n-valued logics in 1945.

## Pre-discovery

Around 1910, Charles Sanders Peirce defined a many-valued logic system. He never published it. In fact, he did not even number the three pages of notes where he defined his three-valued operators. [3] Peirce soundly rejected the idea all propositions must be either true or false; boundary-propositions, he writes, are "at the limit between P and not P." [4] However, as confident as he was that "Triadic Logic is universally true," he also jotted down that "All this is mighty close to nonsense." 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. [5]

## Representation of values

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; [6]
• 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 most-significant non-zero digit has a value 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; [7]
• 0 for false, 1 for true, and a third non-integer "maybe" symbol such as ?, #, ½, [8] 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

Where Boolean logic has 22 = 4 unary operators, the addition of a third value in ternary logic leads to a total of 33 = 27 distinct operators on a single input value. Similarly, where Boolean logic has 22×2 = 16 distinct binary operators (operators with 2 inputs), ternary logic has 33×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. [9]

### Kleene and Priest logics

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)
NOT(A)
A¬A
FT
UU
TF
AND(A, B)
A ∧ BB
FUT
AFFFF
UFUU
TFUT
OR(A, B)
A ∨ BB
FUT
AFFUT
UUUT
TTTT
(−1, false; 0, unknown; +1, true)
NEG(A)
A¬A
−1+1
00
+1−1
MIN(A, B)
A ∧ BB
−10+1
A−1−1−1−1
0−100
+1−10+1
MAX(A, B)
A ∨ BB
−10+1
A−1−10+1
000+1
+1+1+1+1

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 at least one 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:

${\displaystyle A\rightarrow B\ {\overset {\underset {\mathrm {def} }{}}{=}}\ {\mbox{OR}}(\ {\mbox{NOT}}(A),\ B)}$, and its truth table is

IMPK(A, B), OR(¬A, B)
A → BB
FUT
AFTTT
UUUT
TFUT
IMPK(A, B), MAX(−A, B)
A → BB
−10+1
A−1+1+1+1
000+1
+1−10+1

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 well-formed 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. (Note that 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). [10]

### Łukasiewicz logic

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. [11]

Material implication for Łukasiewicz logic truth table is

IMPŁ(A, B)
A → BB
FUT
AFTTT
UUTT
TFUT
IMPŁ(A, B), MIN(1, 1−A+B)
A → BB
−10+1
A−1+1+1+1
00+1+1
+1−10+1

In fact, using Łukasiewicz's implication and negation, the other usual connectives may be derived as:

• AB = (AB) → B
• AB = ¬(¬A ∨ ¬ B)
• AB = (AB) ∧ (BA)

It is also possible to derive a few other useful unary operators (first derived by Tarski in 1921): [ citation needed ]

• MA = ¬AA
• LA = ¬M¬A
• IA = MA ∧ ¬LA

They have the following truth tables:

AMA
FF
UT
TT
ALA
FF
UF
TT
AIA
FF
UT
TF

M is read as "it is not false that..." or in the (unsuccessful) Tarski–Łukasiewicz attempt to axiomatize modal logic using a three-valued 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, AA and AA 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 non-contradiction, ¬(A ∧ ¬A) are not tautologies in Ł3. However, using the operator I defined above, it is possible to state tautologies that are their analogues:

### Ternary Post logic

not(a) = (a + 1) mod 3, or
not(a) = (a + 1) mod (n), where (n) is the value of a logic

### Modular algebras

Some 3VL modular algebras have been introduced more recently, motivated by circuit problems rather than philosophical issues: [12]

• Cohn algebra
• Dubrova and Muzio algebra

## Applications

### SQL

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. [13] 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 three-valued logic makes the SQL three-valued logic functionally complete, [14] meaning its logical operators can express (in combination) any conceivable three-valued logical function.

## Related Research Articles

In logic, mathematics and linguistics, And is the truth-functional operator of logical conjunction; the and of a set of operands is true if and only if all of its operands are true. The logical connective that represents this operator is typically written as or .

In logic, a logical connective is a logical constant used to connect two or more formulas. For instance in the syntax of propositional logic, the binary connective can be used to join the two atomic formulas and , rendering the complex formula .

Propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. It deals with propositions and relations between propositions, including the construction of arguments based on them. Compound propositions are formed by connecting propositions by logical connectives. Propositions that contain no logical connectives are called atomic propositions.

In logic, the semantic principleof bivalence states that every declarative sentence expressing a proposition has exactly one truth value, either true or false. A logic satisfying this principle is called a two-valued logic or bivalent logic.

In logic, a many-valued logic is a propositional calculus in which there are more than two truth values. Traditionally, in Aristotle's logical calculus, there were only two possible values for any proposition. Classical two-valued logic may be extended to n-valued logic for n greater than 2. Those most popular in the literature are three-valued, four-valued, nine-valued, the finite-valued with more than three values, and the infinite-valued (infinitely-many-valued), such as fuzzy logic and probability logic.

Classical logic is the intensively studied and most widely used class of deductive logic. Classical logic has had much influence on analytic philosophy, the type of philosophy most often found in the English-speaking world.

In logic, negation, also called the logical complement, is an operation that takes a proposition to another proposition "not ", written , or . It is interpreted intuitively as being true when is false, and false when is true. Negation is thus a unary (single-argument) logical connective. It may be applied as an operation on notions, propositions, truth values, or semantic values more generally. In classical logic, negation is normally identified with the truth function that takes truth to falsity. In intuitionistic logic, according to the Brouwer–Heyting–Kolmogorov interpretation, the negation of a proposition is the proposition whose proofs are the refutations of .

In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth.

In boolean logic, logical nor or joint denial is a truth-functional operator which produces a result that is the negation of logical or. That is, a sentence of the form is true precisely when neither p nor q is true—i.e. when both of p and q are false. In grammar, nor is a coordinating conjunction.

In logic, a truth function is a function that accepts truth values as input and produces a unique truth value as output. In other words: The input and output of a truth function are all truth values; a truth function will always output exactly one truth value; and inputting the same truth value(s) will always output the same truth value. The typical example is in propositional logic, wherein a compound statement is constructed using individual statements connected by logical connectives; if the truth value of the compound statement is entirely determined by the truth value(s) of the constituent statement(s), the compound statement is called a truth function, and any logical connectives used are said to be truth functional.

Laws of Form is a book by G. Spencer-Brown, published in 1969, that straddles the boundary between mathematics and philosophy. LoF describes three distinct logical systems:

In computer science, the Boolean data type is a data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false. It is a special case of a more general logical data type —logic doesn't always need to be Boolean.

Null or NULL is a special marker used in Structured Query Language to indicate that a data value does not exist in the database. Introduced by the creator of the relational database model, E. F. Codd, SQL Null serves to fulfil the requirement that all true relational database management systems (RDMS) support a representation of "missing information and inapplicable information". Codd also introduced the use of the lowercase Greek omega (ω) symbol to represent Null in database theory. In SQL, NULL is a reserved word used to identify this marker.

In mathematical logic, a tautology is a formula or assertion that is true in every possible interpretation. An example is "x=y or x≠y". Similarly, "either the ball is green, or the ball is not green" is always true, regardless of the colour of the ball.

Logic is the formal science of using reason and is considered a branch of both philosophy and mathematics and to a lesser extent computer science. Logic investigates and classifies the structure of statements and arguments, both through the study of formal systems of inference and the study of arguments in natural language. The scope of logic can therefore be very large, ranging from core topics such as the study of fallacies and paradoxes, to specialized analyses of reasoning such as probability, correct reasoning, and arguments involving causality. One of the aims of logic is to identify the correct and incorrect inferences. Logicians study the criteria for the evaluation of arguments.

T-norm fuzzy logics are a family of non-classical logics, informally delimited by having a semantics that takes the real unit interval [0, 1] for the system of truth values and functions called t-norms for permissible interpretations of conjunction. They are mainly used in applied fuzzy logic and fuzzy set theory as a theoretical basis for approximate reasoning.

A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arguments, that is, for each combination of values taken by their logical variables. In particular, truth tables can be used to show whether a propositional expression is true for all legitimate input values, that is, logically valid.

The syntax of the SQL programming language is defined and maintained by ISO/IEC SC 32 as part of ISO/IEC 9075. This standard is not freely available. Despite the existence of the standard, SQL code is not completely portable among different database systems without adjustments.

In mathematics and mathematical logic, Boolean algebra is the branch of algebra in which the values of the variables are the truth values true and false, usually denoted 1 and 0, respectively. Instead of elementary algebra, where the values of the variables are numbers and the prime operations are addition and multiplication, the main operations of Boolean algebra are the conjunction (and) denoted as ∧, the disjunction (or) denoted as ∨, and the negation (not) denoted as ¬. It is thus a formalism for describing logical operations, in the same way that elementary algebra describes numerical operations.

In logic, a finite-valued logic is a propositional calculus in which truth values are discrete. Traditionally, in Aristotle's logic, the bivalent logic, also known as binary logic was the norm, as the law of the excluded middle precluded more than two possible values for any proposition. Modern three-valued logic allows for an additional possible truth value.

## References

1. "Stanford JavaNLP API". Stanford University. Stanford NLP Group.
2. 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:. ISSN   0002-9327. JSTOR   2370324.
3. "Peirce's Deductive Logic > Peirce's Three-Valued Logic (Stanford Encyclopedia of Philosophy)". plato.stanford.edu. Retrieved 2020-07-30.
4. Lane, R. (2001). "Triadic Logic".
5. Lane, Robert. "Triadic Logic". www.digitalpeirce.fee.unicamp.br. Retrieved 2020-07-30.
6. Knuth, Donald E. (1981). The Art of Computer Programming Vol. 2. Reading, Mass.: Addison-Wesley Publishing Company. p. 190.
7. 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 2019-10-30. Retrieved 2020-04-12.
8. Nelson, David (2008). The Penguin Dictionary of Mathematics. Fourth Edition. London, England: Penguin Books. Entry for 'three-valued logic'. ISBN   9780141920870.
9. Douglas W. Jones, Standard Ternary Logic, Feb. 11, 2013.
10. Grzegorz Malinowski, "Many-valued 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
11. Miller, D. Michael; Thornton, Mitchell A. (2008). Multiple valued logic: concepts and representations. Synthesis lectures on digital circuits and systems. 12. Morgan & Claypool Publishers. pp. 41–42. ISBN   978-1-59829-190-2.
12. 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   978-0-7923-8129-7, p. 344; PS preprint (note: page numbering differs in preprint from the published version)
13. C. J. Date, Relational database writings, 1991–1994, Addison-Wesley, 1995, p. 371