This site is supported by donations to The OEIS Foundation.

# Truth table

A truth table is a tabular array that illustrates the computation of a logical function, that is, a function of the form ${\displaystyle f:\mathbb {A} ^{k}\to \mathbb {A} ,}$ where ${\displaystyle k}$ is a non-negative integer and ${\displaystyle \mathbb {A} }$ is the domain of logical values ${\displaystyle \{\mathrm {false} ,\mathrm {true} \}.}$ The names of the logical values, or truth values, are commonly abbreviated in accord with the equations ${\displaystyle \mathrm {F} =\mathrm {false} }$ and ${\displaystyle \mathrm {T} =\mathrm {true} .}$

In many applications it is usual to represent a truth function by a boolean function, that is, a function of the form ${\displaystyle f:\mathbb {B} ^{k}\to \mathbb {B} ,}$ where ${\displaystyle k}$ is a non-negative integer and ${\displaystyle \mathbb {B} }$ is the boolean domain ${\displaystyle \{0,1\}.}$ In most applications ${\displaystyle \mathrm {false} }$ is represented by ${\displaystyle 0}$ and ${\displaystyle \mathrm {true} }$ is represented by ${\displaystyle 1}$ but the opposite representation is also possible, depending on the overall representation of truth functions as boolean functions. The remainder of this article assumes the usual representation, taking the equations ${\displaystyle \mathrm {F} =0}$ and ${\displaystyle \mathrm {T} =1}$ for granted.

## Logical negation

Logical negation is an operation on one logical value, typically the value of a proposition, that produces a value of true when its operand is false and a value of false when its operand is true.

The truth table of ${\displaystyle \mathrm {NOT} ~p,}$ also written ${\displaystyle \lnot p,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle \lnot p}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$

The negation of a proposition ${\displaystyle p}$ may be found notated in various ways in various contexts of application, often merely for typographical convenience. Among these variants are the following:

 ${\displaystyle {\text{Notation}}}$ ${\displaystyle {\text{Vocalization}}}$ ${\displaystyle {\bar {p}}}$ ${\displaystyle p}$ bar ${\displaystyle {\tilde {p}}}$ ${\displaystyle p}$ tilde ${\displaystyle p'}$ ${\displaystyle p}$ prime ${\displaystyle p}$ complement ${\displaystyle !p}$ bang ${\displaystyle p}$

## Logical conjunction

Logical conjunction is an operation on two logical values, typically the values of two propositions, that produces a value of true if and only if both of its operands are true.

The truth table of ${\displaystyle p~\mathrm {AND} ~q,}$ also written ${\displaystyle p\land q}$ or ${\displaystyle p\cdot q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p\land q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$

## Logical disjunction

Logical disjunction, also called logical alternation, is an operation on two logical values, typically the values of two propositions, that produces a value of false if and only if both of its operands are false.

The truth table of ${\displaystyle p~\mathrm {OR} ~q,}$ also written ${\displaystyle p\lor q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p\lor q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$

## Logical equality

Logical equality is an operation on two logical values, typically the values of two propositions, that produces a value of true if and only if both operands are false or both operands are true.

The truth table of ${\displaystyle p~\mathrm {EQ} ~q,}$ also written ${\displaystyle p=q,}$ ${\displaystyle p\Leftrightarrow q,}$ or ${\displaystyle p\equiv q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p=q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$

## Exclusive disjunction

Exclusive disjunction, also known as logical inequality or symmetric difference, is an operation on two logical values, typically the values of two propositions, that produces a value of true just in case exactly one of its operands is true.

The truth table of ${\displaystyle p~\mathrm {XOR} ~q,}$ also written ${\displaystyle p+q}$ or ${\displaystyle p\neq q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p~\mathrm {XOR} ~q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$

The following equivalents may then be deduced:

 ${\displaystyle {\begin{matrix}p+q&=&(p\land \lnot q)&\lor &(\lnot p\land q)\\[6pt]&=&(p\lor q)&\land &(\lnot p\lor \lnot q)\\[6pt]&=&(p\lor q)&\land &\lnot (p\land q)\end{matrix}}}$

## Logical implication

The logical implication relation and the material conditional function are both associated with an operation on two logical values, typically the values of two propositions, that produces a value of false if and only if the first operand is true and the second operand is false.

The truth table associated with the material conditional ${\displaystyle {\text{if}}~p~{\text{then}}~q,}$ symbolized ${\displaystyle p\rightarrow q,}$ and the logical implication ${\displaystyle p~{\text{implies}}~q,}$ symbolized ${\displaystyle p\Rightarrow q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p\Rightarrow q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$

## Logical NAND

The logical NAND is an operation on two logical values, typically the values of two propositions, that produces a value of false if and only if both of its operands are true. In other words, it produces a value of true if and only if at least one of its operands is false.

The truth table of ${\displaystyle p~\mathrm {NAND} ~q,}$ also written ${\displaystyle p{\stackrel {\circ }{\curlywedge }}q}$ or ${\displaystyle p\barwedge q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p{\stackrel {\circ }{\curlywedge }}q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$

## Logical NNOR

The logical NNOR (“Neither Nor”) is an operation on two logical values, typically the values of two propositions, that produces a value of true if and only if both of its operands are false. In other words, it produces a value of false if and only if at least one of its operands is true.

The truth table of ${\displaystyle p~\mathrm {NNOR} ~q,}$ also written ${\displaystyle p\curlywedge q,}$ appears below:

 ${\displaystyle p}$ ${\displaystyle q}$ ${\displaystyle p\curlywedge q}$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {F} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {T} }$ ${\displaystyle \mathrm {F} }$

## Document history

Portions of the above article were adapted from the following sources under the GNU Free Documentation License, under other applicable licenses, or by permission of the copyright holders.