In
logic
Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the science of deductively valid inferences or of logical truths. It is a formal science investigating how conclusions follow from premis ...
, a truth function is a
function that accepts
truth value
In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth, which in classical logic has only two possible values ('' true'' or ''false'').
Computing
In some prog ...
s 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
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 (which can be true or false) and relations ...
, wherein a compound statement is constructed using individual statements connected by
logical connective
In logic, a logical connective (also called a logical operator, sentential connective, or sentential operator) is a logical constant. They can be used to connect logical formulas. For instance in the syntax of propositional logic, the binary ...
s; 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.
Classical propositional logic is a truth-functional logic, in that every statement has exactly one truth value which is either true or false, and every logical connective is truth functional (with a correspondent
truth table
A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra (logic), Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expression (mathematics) ...
), thus every compound statement is a truth function.
[Roy T. Cook (2009). ''A Dictionary of Philosophical Logic'', p. 47: Classical Logic. Edinburgh University Press.] On the other hand,
modal logic is non-truth-functional.
Overview
A
logical connective
In logic, a logical connective (also called a logical operator, sentential connective, or sentential operator) is a logical constant. They can be used to connect logical formulas. For instance in the syntax of propositional logic, the binary ...
is truth-functional if the truth-value of a compound sentence is a function of the truth-value of its sub-sentences. A class of connectives is truth-functional if each of its members is. For example, the connective "''and''" is truth-functional since a sentence like "''Apples are fruits and carrots are vegetables''" is true ''
if, and only if'' each of its sub-sentences "''apples are fruits''" and "''carrots are vegetables''" is true, and it is false otherwise. Some connectives of a natural language, such as English, are not truth-functional.
Connectives of the form "x ''believes that'' ..." are typical examples of connectives that are not truth-functional. If e.g. Mary mistakenly believes that Al Gore was President of the USA on April 20, 2000, but she does not believe that the moon is made of green cheese, then the sentence
:"''Mary believes that Al Gore was President of the USA on April 20, 2000''"
is true while
:"''Mary believes that the moon is made of green cheese''"
is false. In both cases, each component sentence (i.e. "''Al Gore was president of the USA on April 20, 2000''" and "''the moon is made of green cheese''") is false, but each compound sentence formed by prefixing the phrase "''Mary believes that''" differs in truth-value. That is, the truth-value of a sentence of the form "''Mary believes that...''" is not determined solely by the truth-value of its component sentence, and hence the (unary)
connective (or simply ''operator'' since it is unary) is non-truth-functional.
The class of
classical logic connectives (e.g.
&,
→) used in the construction of formulas is truth-functional. Their values for various truth-values as argument are usually given by
truth table
A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra (logic), Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expression (mathematics) ...
s.
Truth-functional propositional calculus is a
formal system
A formal system is an abstract structure used for inferring theorems from axioms according to a set of rules. These rules, which are used for carrying out the inference of theorems from axioms, are the logical calculus of the formal system.
A for ...
whose formulae may be interpreted as either true or false.
Table of binary truth functions
In two-valued logic, there are sixteen possible truth functions, also called
Boolean functions, of two inputs ''P'' and ''Q''. Any of these functions corresponds to a truth table of a certain
logical connective
In logic, a logical connective (also called a logical operator, sentential connective, or sentential operator) is a logical constant. They can be used to connect logical formulas. For instance in the syntax of propositional logic, the binary ...
in classical logic, including several
degenerate
Degeneracy, degenerate, or degeneration may refer to:
Arts and entertainment
* ''Degenerate'' (album), a 2010 album by the British band Trigger the Bloodshed
* Degenerate art, a term adopted in the 1920s by the Nazi Party in Germany to descr ...
cases such as a function not depending on one or both of its arguments. Truth and falsehood are denoted as 1 and 0, respectively, in the following truth tables for sake of brevity.
Functional completeness
Because a function may be expressed as a
composition, a truth-functional logical calculus does not need to have dedicated symbols for all of the above-mentioned functions to be
functionally complete. This is expressed in a
propositional calculus
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 (which can be true or false) and relations ...
as
logical equivalence of certain compound statements. For example, classical logic has equivalent to . The conditional operator "→" is therefore not necessary for a classical-based
logical system
A formal system is an abstract structure used for inferring theorems from axioms according to a set of rules. These rules, which are used for carrying out the inference of theorems from axioms, are the logical calculus of the formal system.
A for ...
if "¬" (not) and "∨" (or) are already in use.
A
minimal set of operators that can express every statement expressible in the
propositional calculus
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 (which can be true or false) and relations ...
is called a ''minimal functionally complete set''. A minimally complete set of operators is achieved by NAND alone and NOR alone .
The following are the minimal functionally complete sets of operators whose arities do not exceed 2:
[Wernick, William (1942) "Complete Sets of Logical Functions," ''Transactions of the American Mathematical Society 51'': 117–32. In his list on the last page of the article, Wernick does not distinguish between ← and →, or between and .]
;One element: , .
;Two elements:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
.
;Three elements:
,
,
,
,
,
.
Algebraic properties
Some truth functions possess properties which may be expressed in the theorems containing the corresponding connective. Some of those properties that a binary truth function (or a corresponding logical connective) may have are:
*
associativity
In mathematics, the associative property is a property of some binary operations, which means that rearranging the parentheses in an expression will not change the result. In propositional logic, associativity is a valid rule of replacement ...
: Within an expression containing two or more of the same associative connectives in a row, the order of the operations does not matter as long as the sequence of the operands is not changed.
*
commutativity: The operands of the connective may be swapped without affecting the truth-value of the expression.
*
distributivity: A connective denoted by · distributes over another connective denoted by +, if ''a'' · (''b'' + ''c'') = (''a'' · ''b'') + (''a'' · ''c'') for all operands ''a'', ''b'', ''c''.
*
idempotence
Idempotence (, ) is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application. The concept of idempotence arises in a number of pla ...
: Whenever the operands of the operation are the same, the connective gives the operand as the result. In other words, the operation is both truth-preserving and falsehood-preserving (see below).
*
absorption: A pair of connectives
satisfies the absorption law if
for all operands ''a'', ''b''.
A set of truth functions is
functionally complete if and only if for each of the following five properties it contains at least one member lacking it:
*
monotonic
In mathematics, a monotonic function (or monotone function) is a function between ordered sets that preserves or reverses the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of ord ...
: If ''f''(''a''
1, ..., ''a''
''n'') ≤ ''f''(''b''
1, ..., ''b''
''n'') for all ''a''
1, ..., ''a''
''n'', ''b''
1, ..., ''b''
''n'' ∈ such that ''a''
1 ≤ ''b''
1, ''a''
2 ≤ ''b''
2, ..., ''a''
''n'' ≤ ''b''
''n''. E.g.,
.
*
affine: For each variable, changing its value either always or never changes the truth-value of the operation, for all fixed values of all other variables. E.g.,
,
.
*self dual: To read the truth-value assignments for the operation from top to bottom on its
truth table
A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra (logic), Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expression (mathematics) ...
is the same as taking the complement of reading it from bottom to top; in other words, ''f''(¬''a''
1, ..., ¬''a''
''n'') = ¬''f''(''a''
1, ..., ''a''
''n''). E.g.,
.
*truth-preserving: The interpretation under which all variables are assigned a
truth value
In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth, which in classical logic has only two possible values ('' true'' or ''false'').
Computing
In some prog ...
of 'true' produces a truth value of 'true' as a result of these operations. E.g.,
. (see
validity
Validity or Valid may refer to:
Science/mathematics/statistics:
* Validity (logic), a property of a logical argument
* Scientific:
** Internal validity, the validity of causal inferences within scientific studies, usually based on experiments
...
)
*falsehood-preserving: The interpretation under which all variables are assigned a
truth value
In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth, which in classical logic has only two possible values ('' true'' or ''false'').
Computing
In some prog ...
of 'false' produces a truth value of 'false' as a result of these operations. E.g.,
. (see
validity
Validity or Valid may refer to:
Science/mathematics/statistics:
* Validity (logic), a property of a logical argument
* Scientific:
** Internal validity, the validity of causal inferences within scientific studies, usually based on experiments
...
)
Arity
A concrete function may be also referred to as an ''operator''. In two-valued logic there are 2 nullary operators (constants), 4
unary operators, 16
binary operators, 256
ternary operators, and
''n''-ary operators. In three-valued logic there are 3 nullary operators (constants), 27