This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Truth value" – news ·newspapers ·books ·scholar ·JSTOR(February 2012) (Learn how and when to remove this message) |
Inlogic andmathematics, atruth value, sometimes called alogical value, is a value indicating the relation of aproposition totruth, which inclassical logic has only two possible values (true orfalse).[1][2] Truth values are used incomputing as well as various types oflogic.
In some programming languages, anyexpression can be evaluated in a context that expects aBoolean data type. Typically (though this varies by programming language) expressions like the numberzero, theempty string, empty lists, andnull are treated as false, and strings with content (like "abc"), other numbers, and objects evaluate to true. Sometimes these classes of expressions are calledfalsy andtruthy. For example, inLisp,nil, the empty list, is treated as false, and all other values are treated as true. InC, the number 0 or 0.0 is false, and all other values are treated as true.
InJavaScript, the empty string (""
),null
,undefined
,NaN
, +0,−0 andfalse
[3] are sometimes calledfalsy (of which thecomplement istruthy) to distinguish between strictlytype-checked andcoerced Booleans (see also:JavaScript syntax#Type conversion).[4] As opposed to Python, empty containers (Arrays, Maps, Sets) are considered truthy. Languages such asPHP also use this approach.
⊤ | ·∧· | ||
true | conjunction | ||
¬ | ↕ | ↕ | |
⊥ | ·∨· | ||
false | disjunction | ||
Negation interchanges true with false and conjunction with disjunction. |
Inclassical logic, with its intended semantics, the truth values aretrue (denoted by1 or theverum ⊤), anduntrue orfalse (denoted by0 or thefalsum ⊥); that is, classical logic is atwo-valued logic. This set of two values is also called theBoolean domain. Corresponding semantics oflogical connectives aretruth functions, whose values are expressed in the form oftruth tables.Logical biconditional becomes theequality binary relation, andnegation becomes abijection whichpermutes true and false. Conjunction and disjunction aredual with respect to negation, which is expressed byDe Morgan's laws:
Propositional variables becomevariables in the Boolean domain. Assigning values for propositional variables is referred to asvaluation.
Whereas in classical logic truth values form aBoolean algebra, inintuitionistic logic, and more generally,constructive mathematics, the truth values form aHeyting algebra. Such truth values may express various aspects of validity, including locality, temporality, or computational content.
For example, one may use theopen setsof a topological space as intuitionistic truth values, in which case the truth value of a formula expresseswhere the formula holds, not whether it holds.
Inrealizability truth values are sets of programs, which can be understood as computational evidence of validity of a formula. For example, the truth value of the statement "for every number there is a prime larger than it" is the set of all programs that take as input a number, and output a prime larger than.
Incategory theory, truth values appear as the elements of thesubobject classifier. In particular, in atopos every formula ofhigher-order logic may be assigned a truth value in the subobject classifier.
Even though a Heyting algebra may have many elements, this should not be understood as there being truth values that are neither true nor false, because intuitionistic logic proves ("it is not the case that is neither true nor false").[5]
Inintuitionistic type theory, theCurry-Howard correspondence exhibits an equivalence of propositions and types, according to which validity is equivalent to inhabitation of a type.
For other notions of intuitionistic truth values, see theBrouwer–Heyting–Kolmogorov interpretation andIntuitionistic logic § Semantics.
Multi-valued logics (such asfuzzy logic andrelevance logic) allow for more than two truth values, possibly containing some internal structure. For example, on theunit interval[0,1] such structure is atotal order; this may be expressed as the existence of variousdegrees of truth.
Not alllogical systems are truth-valuational in the sense that logical connectives may be interpreted as truth functions. For example,intuitionistic logic lacks a complete set of truth values because its semantics, theBrouwer–Heyting–Kolmogorov interpretation, is specified in terms ofprovability conditions, and not directly in terms of thenecessary truth of formulae.
But even non-truth-valuational logics can associate values with logical formulae, as is done inalgebraic semantics. The algebraic semantics of intuitionistic logic is given in terms ofHeyting algebras, compared toBoolean algebra semantics of classical propositional calculus.