Three-valued logic

From Wiki @ Karl Jones dot com
Jump to: navigation, search

In logic, a three-valued logic (also trinary logic, trivalent, ternary, or trilean, 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.

Description

This is contrasted with the more commonly known bivalent logics (such as classical sentential or Boolean logic) which provide only for true and false.

Conceptual form and basic ideas were initially created by Jan Łukasiewicz and C. I. Lewis.

These were then re-formulated by Grigore Moisil in an axiomatic algebraic form, and also extended to n-valued logics in 1945.

Application in SQL

The SQL language implements ternary logic as a means of handling comparisons with NULL field content.

The original intent of NULL in SQL was 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.

The SQL standard defines an optional feature called F571, which adds some unary operators, including IS UNKNOWN.

The addition of IS UNKNOWN to the other operators of SQL's three-valued logic makes the SQL three-valued logic functionally complete, meaning its logical operators can express (in combination) any conceivable three-valued logical function.

See also

External links