Logical disjunction | |
Other Titles: | OR |
Venn Diagram: | Venn0111.svg |
Definition: | x+y |
Truth Table: | (1110) |
Logic Gate: | OR_ANSI.svg |
Dnf: | x+y |
Cnf: | x+y |
Zhegalkin: | x ⊕ y ⊕ xy |
0-Preserving: | yes |
1-Preserving: | yes |
Monotone: | yes |
Affine: | no |
Self-Dual: | no |
In logic, disjunction, also known as logical disjunction or logical or or logical addition or inclusive disjunction, is a logical connective typically notated as
\lor
S\lorW
S
W
In classical logic, disjunction is given a truth functional semantics according to which a formula
\phi\lor\psi
\phi
\psi
An operand of a disjunction is a disjunct.[2]
Because the logical "or" means a disjunction formula is true when either one or both of its parts are true, it is referred to as an inclusive disjunction. This is in contrast with an exclusive disjunction, which is true when one or the other of the arguments are true, but not both (referred to as "exclusive or", or "XOR").
When it is necessary to clarify whether inclusive or exclusive "or" is intended, English speakers sometimes uses the phrase "and/or". In terms of logic, this phrase is identical to "or", but makes the inclusion of both being true explicit.
In logic and related fields, disjunction is customarily notated with an infix operator
\lor
+
\vert
\vert\vert
A
In the semantics of logic, classical disjunction is a truth functional operation which returns the truth value "true" unless both of its arguments are "false". Its semantic entry is standardly given as follows:[4]
\models\phi\lor\psi
\models\phi
\models\psi
This semantics corresponds to the following truth table:
In classical logic systems where logical disjunction is not a primitive, it can be defined in terms of the primitive "and" (
\land
lnot
A\lorB=\neg((\negA)\land(\negB))
Alternatively, it may be defined in terms of "implies" (
\to
A\lorB=(lnotA)\toB
It may also be defined solely in terms of
\to
A\lorB=(A\toB)\toB
The following properties apply to disjunction:
a\lor(b\lorc)\equiv(a\lorb)\lorc
a\lorb\equivb\lora
(a\land(b\lorc))\equiv((a\landb)\lor(a\landc))
(a\lor(b\landc))\equiv((a\lorb)\land(a\lorc))
(a\lor(b\lorc))\equiv((a\lorb)\lor(a\lorc))
(a\lor(b\equivc))\equiv((a\lorb)\equiv(a\lorc))
a\lora\equiva
(a → b) → ((c\lora) → (c\lorb))
(a → b) → ((a\lorc) → (b\lorc))
Operators corresponding to logical disjunction exist in most programming languages.
Disjunction is often used for bitwise operations. Examples:
The or
operator can be used to set bits in a bit field to 1, by or
-ing the field with a constant field with the relevant bits set to 1. For example, x = x | 0b00000001
will force the final bit to 1, while leaving other bits unchanged.
Many languages distinguish between bitwise and logical disjunction by providing two distinct operators; in languages following C, bitwise disjunction is performed with the single pipe operator (|
), and logical disjunction with the double pipe (||
) operator.
Logical disjunction is usually short-circuited; that is, if the first (left) operand evaluates to true
, then the second (right) operand is not evaluated. The logical disjunction operator thus usually constitutes a sequence point.
In a parallel (concurrent) language, it is possible to short-circuit both sides: they are evaluated in parallel, and if one terminates with value true, the other is interrupted. This operator is thus called the parallel or.
Although the type of a logical disjunction expression is boolean in most languages (and thus can only have the value true
or false
), in some languages (such as Python and JavaScript), the logical disjunction operator returns one of its operands: the first operand if it evaluates to a true value, and the second operand otherwise.[7] [8] This allows it to fulfill the role of the Elvis operator.
The Curry–Howard correspondence relates a constructivist form of disjunction to tagged union types.[9]
The membership of an element of a union set in set theory is defined in terms of a logical disjunction:
x\inA\cupB\Leftrightarrow(x\inA)\vee(x\inB)
Disjunction in natural languages does not precisely match the interpretation of
\lor
This inference has sometimes been understood as an entailment, for instance by Alfred Tarski, who suggested that natural language disjunction is ambiguous between a classical and a nonclassical interpretation. More recent work in pragmatics has shown that this inference can be derived as a conversational implicature on the basis of a semantic denotation which behaves classically. However, disjunctive constructions including Hungarian vagy... vagy and French soit... soit have been argued to be inherently exclusive, rendering ungrammaticality in contexts where an inclusive reading would otherwise be forced.
Similar deviations from classical logic have been noted in cases such as free choice disjunction and simplification of disjunctive antecedents, where certain modal operators trigger a conjunction-like interpretation of disjunction. As with exclusivity, these inferences have been analyzed both as implicatures and as entailments arising from a nonclassical interpretation of disjunction.
\rightsquigarrow
In many languages, disjunctive expressions play a role in question formation.
For instance, while the above English example can be interpreted as a polar question asking whether it's true that Mary is either a philosopher or a linguist, it can also be interpreted as an alternative question asking which of the two professions is hers. The role of disjunction in these cases has been analyzed using nonclassical logics such as alternative semantics and inquisitive semantics, which have also been adopted to explain the free choice and simplification inferences.
In English, as in many other languages, disjunction is expressed by a coordinating conjunction. Other languages express disjunctive meanings in a variety of ways, though it is unknown whether disjunction itself is a linguistic universal. In many languages such as Dyirbal and Maricopa, disjunction is marked using a verb suffix. For instance, in the Maricopa example below, disjunction is marked by the suffix šaa.
\models