OR is a connective in logic which yields true if any one of a sequence of conditions
is true, and false if all
conditions are false. In formal logic,
the term disjunction (or, more specifically, inclusive
disjunction) is commonly used to describe the OR operator. OR
is denoted
(Mendelson 1997, p. 13),
,
(Simpson 1987, p. 539), or
(Simpson 1987, p. 539). The circuit diagram symbol for an OR gate is illustrated
above.
The symbol is often associated with the Latin
word "vel," meaning "or," but this association is not a well-supported
account of its origin. Elkind and Zach (2023) identify early uses for disjunction
in Whitehead's manuscript "The Logic of Propositional Functions" (Whitehead
1903) and Russell's manuscripts "Classes" and "Frege on the Contradiction"
(Russell 1994ab), dating from around 1903. The relative priority of these manuscripts
is uncertain. The expression
is voiced either "
or
" or "
vel
." The way to distinguish
the similar symbols
(AND) and
(OR) is to note that the symbol for AND is oriented in the same direction as the
capital letter 'A."
The OR operation is implemented in the Wolfram Language as Or[A, B, ...].
The OR operation can be written in terms of NOT and AND as
(Mendelson 1997, p. 26).
The binary OR operator has the following truth table (Carnap 1958, p. 10; Simpson 1987, p. 542; Mendelson 1997, p. 13).
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
A product of ORs is called a disjunction and is denoted
For example, the truth table for the ternary OR operator is shown below (Simpson 1987, p. 543).
| T | T | T | T |
| T | T | F | T |
| T | F | T | T |
| T | F | F | T |
| F | T | T | T |
| F | T | F | T |
| F | F | T | T |
| F | F | F | F |
A bitwise version of OR can also be defined that performs a bitwise OR on the binary digits of two numbers
and
and then converts the resulting binary
number back to decimal. Bitwise OR is sometimes denoted
and is implemented in the Wolfram
Language as BitOr[n1,
n2, ...]. The illustration above plots the bitwise OR of the array of numbers
from
to 31 (Wolfram 2002, p. 871).