In logic, disjunction, also known as logical disjunction or logical or or logical addition or inclusive disjunction, is a logical connective typically notated as and read aloud as "or". For instance, the English language sentence "it is sunny or it is warm" can be represented in logic using the disjunctive formula , assuming that abbreviates "it is sunny" and abbreviates "it is warm".
OR | |
---|---|
Definition | |
Truth table | |
Logic gate | |
Normal forms | |
Disjunctive | |
Conjunctive | |
Zhegalkin polynomial | |
Post's lattices | |
0-preserving | yes |
1-preserving | yes |
Monotone | yes |
Affine | no |
Self-dual | no |
In classical logic, disjunction is given a truth functional semantics according to which a formula is true unless both and are false. Because this semantics allows a disjunctive formula to be true when both of its disjuncts are true, it is an inclusive interpretation of disjunction, in contrast with exclusive disjunction. Classical proof theoretical treatments are often given in terms of rules such as disjunction introduction and disjunction elimination. Disjunction has also been given numerous non-classical treatments, motivated by problems including Aristotle's sea battle argument, Heisenberg's uncertainty principle, as well as the numerous mismatches between classical disjunction and its nearest equivalents in natural languages.
An operand of a disjunction is a disjunct.
Inclusive and exclusive disjunction
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.
Notation
In logic and related fields, disjunction is customarily notated with an infix operator (Unicode U+2228 ∨ LOGICAL OR). Alternative notations include , used mainly in electronics, as well as and in many programming languages. The English word or is sometimes used as well, often in capital letters. In Jan Łukasiewicz's prefix notation for logic, the operator is , short for Polish alternatywa (English: alternative).
In mathematics, the disjunction of an arbitrary number of elements can be denoted as an iterated binary operation using a larger ⋁ (Unicode U+22C1 ⋁ N-ARY LOGICAL OR):
Classical disjunction
Semantics
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:
- if or or both
This semantics corresponds to the following truth table:
F | F | F |
F | T | T |
T | F | T |
T | T | T |
Defined by other operators
In classical logic systems where logical disjunction is not a primitive, it can be defined in terms of the primitive and () and not () as:
- .
Alternatively, it may be defined in terms of implies () and not as:
- .
The latter can be checked by the following truth table:
F | F | T | F | F |
F | T | T | T | T |
T | F | F | T | T |
T | T | F | T | T |
It may also be defined solely in terms of :
- .
It can be checked by the following truth table:
F | F | T | F | F |
F | T | T | T | T |
T | F | F | T | T |
T | T | T | T | T |
Properties
The following properties apply to disjunction:
- Associativity:
- Commutativity:
- Distributivity:
- Idempotency:
- Monotonicity:
- Truth-preserving: The interpretation under which all variables are assigned a truth value of 'true', produces a truth value of 'true' as a result of disjunction.
- Falsehood-preserving: The interpretation under which all variables are assigned a truth value of 'false', produces a truth value of 'false' as a result of disjunction.
Applications in computer science
This section needs expansion. You can help by adding to it. (February 2021) |
Operators corresponding to logical disjunction exist in most programming languages.
Bitwise operation
Disjunction is often used for bitwise operations. Examples:
- 0 or 0 = 0
- 0 or 1 = 1
- 1 or 0 = 1
- 1 or 1 = 1
- 1010 or 1100 = 1110
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.[citation needed]
Logical operation
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. This allows it to fulfill the role of the Elvis operator.
Constructive disjunction
The Curry–Howard correspondence relates a constructivist form of disjunction to tagged union types.[citation needed]
Set theory
This section needs expansion. You can help by adding to it. (February 2021) |
The membership of an element of a union set in set theory is defined in terms of a logical disjunction: . Because of this, logical disjunction satisfies many of the same identities as set-theoretic union, such as associativity, commutativity, distributivity, and de Morgan's laws, identifying logical conjunction with set intersection, logical negation with set complement.
Natural language
Disjunction in natural languages does not precisely match the interpretation of in classical logic. Notably, classical disjunction is inclusive while natural language disjunction is often understood exclusively, as the following English example typically would be.
- Mary is eating an apple or a pear.
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.
- You can have an apple or a pear.
- You can have an apple and you can have a pear (but you can't have both)
In many languages, disjunctive expressions play a role in question formation.
- Is Mary a philosopher or a linguist?
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.
Johnš
John-NOM
Billš
Bill-NOM
vʔaawuumšaa
3-come-PL-FUT-INFER
'John or Bill will come.'
See also
- Affirming a disjunct
- Boolean algebra (logic)
- Boolean algebra topics
- Boolean domain
- Boolean function
- Boolean-valued function
- Conjunction/disjunction duality
- Disjunctive syllogism
- Fréchet inequalities
- Free choice inference
- Hurford disjunction
- Logical graph
- Simplification of disjunctive antecedents
Notes
- For the sake of generality across classical systems, this entry suppresses the parameters of evaluation. The double turnstile symbol here is intended to mean "semantically entails".
- George Boole, closely following analogy with ordinary mathematics, premised, as a necessary condition to the definition of x + y, that x and y were mutually exclusive. Jevons, and practically all mathematical logicians after him, advocated, on various grounds, the definition of logical addition in a form that does not necessitate mutual exclusiveness.
References
- Aloni, Maria (2016), "Disjunction", in Zalta, Edward N. (ed.), The Stanford Encyclopedia of Philosophy (Winter 2016 ed.), Metaphysics Research Lab, Stanford University, retrieved 2020-09-03
- "Disjunction | logic". Encyclopedia Britannica. Retrieved 2020-09-03.
- Beall, Jeffrey C. (2010). Logic: the basics (1. publ ed.). London: Routledge. p. 57. ISBN 978-0-203-85155-5.
- Józef Maria Bocheński (1959), A Précis of Mathematical Logic, translated by Otto Bird from the French and German editions, Dordrecht, North Holland: D. Reidel, passim.
- Weisstein, Eric W. "OR". MathWorld--A Wolfram Web Resource. Retrieved 24 September 2024.
- Walicki, Michał (2016). Introduction to Mathematical Logic. WORLD SCIENTIFIC. p. 150. doi:10.1142/9783. ISBN 978-9814343879.
- Howson, Colin (1997). Logic with trees: an introduction to symbolic logic. London; New York: Routledge. p. 38. ISBN 978-0-415-13342-5.
- "Python 3.12.1 Documentation - The Python Language Reference - 6.11 Boolean operations". Retrieved 25 Dec 2023.
- "JavaScript References - Expressions & Operators - Logical AND (&&)". 25 September 2023. Retrieved 25 Dec 2023.
- Marcus Vinícius Midena Ramos; de Queiroz, Ruy J. G. B. (2015). "Context-Free Language Theory Formalization". Universidade Federal de Pernambuco: 6. arXiv:1505.00061.
- Ebbinghaus, Heinz-Dieter (2021). Einführung in die Mengenlehre (in German) (5 ed.). Springer. p. 32. ISBN 978-3-662-63865-1.
External links
- "Disjunction", Encyclopedia of Mathematics, EMS Press, 2001 [1994]
- Aloni, Maria. "Disjunction". In Zalta, Edward N. (ed.). Stanford Encyclopedia of Philosophy.
- Eric W. Weisstein. "Disjunction." From MathWorld—A Wolfram Web Resource
In logic disjunction also known as logical disjunction or logical or or logical addition or inclusive disjunction is a logical connective typically notated as displaystyle lor and read aloud as or For instance the English language sentence it is sunny or it is warm can be represented in logic using the disjunctive formula S W displaystyle S lor W assuming that S displaystyle S abbreviates it is sunny and W displaystyle W abbreviates it is warm Logical disjunctionORDefinitionx y displaystyle x y Truth table 1110 displaystyle 1110 Logic gateNormal formsDisjunctivex y displaystyle x y Conjunctivex y displaystyle x y Zhegalkin polynomialx y xy displaystyle x oplus y oplus xy Post s lattices0 preservingyes1 preservingyesMonotoneyesAffinenoSelf dualnovteVenn diagram of A B C displaystyle scriptstyle A lor B lor C In classical logic disjunction is given a truth functional semantics according to which a formula ϕ ps displaystyle phi lor psi is true unless both ϕ displaystyle phi and ps displaystyle psi are false Because this semantics allows a disjunctive formula to be true when both of its disjuncts are true it is an inclusive interpretation of disjunction in contrast with exclusive disjunction Classical proof theoretical treatments are often given in terms of rules such as disjunction introduction and disjunction elimination Disjunction has also been given numerous non classical treatments motivated by problems including Aristotle s sea battle argument Heisenberg s uncertainty principle as well as the numerous mismatches between classical disjunction and its nearest equivalents in natural languages An operand of a disjunction is a disjunct Inclusive and exclusive disjunctionBecause 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 NotationIn logic and related fields disjunction is customarily notated with an infix operator displaystyle lor Unicode U 2228 LOGICAL OR Alternative notations include displaystyle used mainly in electronics as well as displaystyle vert and displaystyle vert vert in many programming languages The English word or is sometimes used as well often in capital letters In Jan Lukasiewicz s prefix notation for logic the operator is A displaystyle A short for Polish alternatywa English alternative In mathematics the disjunction of an arbitrary number of elements a1 an displaystyle a 1 ldots a n can be denoted as an iterated binary operation using a larger Unicode U 22C1 N ARY LOGICAL OR i 1nai a1 a2 an 1 an displaystyle bigvee i 1 n a i a 1 lor a 2 lor ldots a n 1 lor a n Classical disjunctionSemantics 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 ϕ ps displaystyle models phi lor psi if ϕ displaystyle models phi or ps displaystyle models psi or both dd This semantics corresponds to the following truth table A displaystyle A B displaystyle B A B displaystyle A lor B FFFFTTTFTTTTDefined by other operators In classical logic systems where logical disjunction is not a primitive it can be defined in terms of the primitive and displaystyle land and not displaystyle lnot as A B A B displaystyle A lor B neg neg A land neg B Alternatively it may be defined in terms of implies displaystyle to and not as A B A B displaystyle A lor B lnot A to B The latter can be checked by the following truth table A displaystyle A B displaystyle B A displaystyle neg A A B displaystyle neg A rightarrow B A B displaystyle A lor B FFTFFFTTTTTFFTTTTFTT It may also be defined solely in terms of displaystyle to A B A B B displaystyle A lor B A to B to B It can be checked by the following truth table A displaystyle A B displaystyle B A B displaystyle A rightarrow B A B B displaystyle A rightarrow B rightarrow B A B displaystyle A lor B FFTFFFTTTTTFFTTTTTTT Properties The following properties apply to disjunction Associativity a b c a b c displaystyle a lor b lor c equiv a lor b lor c Commutativity a b b a displaystyle a lor b equiv b lor a Distributivity a b c a b a c displaystyle a land b lor c equiv a land b lor a land c a b c a b a c displaystyle a lor b land c equiv a lor b land a lor c a b c a b a c displaystyle a lor b lor c equiv a lor b lor a lor c a b c a b a c displaystyle a lor b equiv c equiv a lor b equiv a lor c dd dd Idempotency a a a displaystyle a lor a equiv a Monotonicity a b c a c b displaystyle a rightarrow b rightarrow c lor a rightarrow c lor b a b a c b c displaystyle a rightarrow b rightarrow a lor c rightarrow b lor c dd dd Truth preserving The interpretation under which all variables are assigned a truth value of true produces a truth value of true as a result of disjunction Falsehood preserving The interpretation under which all variables are assigned a truth value of false produces a truth value of false as a result of disjunction Applications in computer scienceThis section needs expansion You can help by adding to it February 2021 OR logic gate Operators corresponding to logical disjunction exist in most programming languages Bitwise operation Disjunction is often used for bitwise operations Examples 0 or 0 0 0 or 1 1 1 or 0 1 1 or 1 1 1010 or 1100 1110 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 citation needed Logical operation 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 This allows it to fulfill the role of the Elvis operator Constructive disjunction The Curry Howard correspondence relates a constructivist form of disjunction to tagged union types citation needed Set theoryThis section needs expansion You can help by adding to it February 2021 The membership of an element of a union set in set theory is defined in terms of a logical disjunction x A B x A x B displaystyle x in A cup B Leftrightarrow x in A vee x in B Because of this logical disjunction satisfies many of the same identities as set theoretic union such as associativity commutativity distributivity and de Morgan s laws identifying logical conjunction with set intersection logical negation with set complement Natural languageDisjunction in natural languages does not precisely match the interpretation of displaystyle lor in classical logic Notably classical disjunction is inclusive while natural language disjunction is often understood exclusively as the following English example typically would be Mary is eating an apple or a pear 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 You can have an apple or a pear displaystyle rightsquigarrow You can have an apple and you can have a pear but you can t have both dd In many languages disjunctive expressions play a role in question formation Is Mary a philosopher or a linguist 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 saa Johns John NOMBills Bill NOMvʔaawuumsaa 3 come PL FUT INFER Johns Bills vʔaawuumsaa John NOM Bill NOM 3 come PL FUT INFER John or Bill will come See alsoAffirming a disjunct Boolean algebra logic Boolean algebra topics Boolean domain Boolean function Boolean valued function Conjunction disjunction duality Disjunctive syllogism Frechet inequalities Free choice inference Hurford disjunction Logical graph Simplification of disjunctive antecedentsNotesFor the sake of generality across classical systems this entry suppresses the parameters of evaluation The double turnstile symbol displaystyle models here is intended to mean semantically entails George Boole closely following analogy with ordinary mathematics premised as a necessary condition to the definition of x y that x and y were mutually exclusive Jevons and practically all mathematical logicians after him advocated on various grounds the definition of logical addition in a form that does not necessitate mutual exclusiveness ReferencesAloni Maria 2016 Disjunction in Zalta Edward N ed The Stanford Encyclopedia of Philosophy Winter 2016 ed Metaphysics Research Lab Stanford University retrieved 2020 09 03 Disjunction logic Encyclopedia Britannica Retrieved 2020 09 03 Beall Jeffrey C 2010 Logic the basics 1 publ ed London Routledge p 57 ISBN 978 0 203 85155 5 Jozef Maria Bochenski 1959 A Precis of Mathematical Logic translated by Otto Bird from the French and German editions Dordrecht North Holland D Reidel passim Weisstein Eric W OR MathWorld A Wolfram Web Resource Retrieved 24 September 2024 Walicki Michal 2016 Introduction to Mathematical Logic WORLD SCIENTIFIC p 150 doi 10 1142 9783 ISBN 978 9814343879 Howson Colin 1997 Logic with trees an introduction to symbolic logic London New York Routledge p 38 ISBN 978 0 415 13342 5 Python 3 12 1 Documentation The Python Language Reference 6 11 Boolean operations Retrieved 25 Dec 2023 JavaScript References Expressions amp Operators Logical AND amp amp 25 September 2023 Retrieved 25 Dec 2023 Marcus Vinicius Midena Ramos de Queiroz Ruy J G B 2015 Context Free Language Theory Formalization Universidade Federal de Pernambuco 6 arXiv 1505 00061 Ebbinghaus Heinz Dieter 2021 Einfuhrung in die Mengenlehre in German 5 ed Springer p 32 ISBN 978 3 662 63865 1 External links Disjunction Encyclopedia of Mathematics EMS Press 2001 1994 Aloni Maria Disjunction In Zalta Edward N ed Stanford Encyclopedia of Philosophy Eric W Weisstein Disjunction From MathWorld A Wolfram Web Resource