In propositional logic and Boolean algebra, De Morgan's laws,[1] [2] also known as De Morgan's theorem,[3] are a pair of transformation rules that are both valid rules of inference. They are named after Augustus De Morgan, a 19th-century British mathematician. The rules allow the expression of conjunctions and disjunctions purely in terms of each other via negation.
The rules can be expressed in English as:
or
or
where "A or B" is an "inclusive or" meaning at least one of A or B rather than an "exclusive or" that means exactly one of A or B.
In set theory and Boolean algebra, these are written formally as
\begin{align} \overline{A\cupB}&=\overline{A}\cap\overline{B},\\ \overline{A\capB}&=\overline{A}\cup\overline{B}, \end{align}
A
B
\overline{A}
A
\cap
\cup
In formal language, the rules are written as
\neg(P\lorQ)\iff(\negP)\land(\negQ),
\neg(P\landQ)\iff(\negP)\lor(\negQ)
\neg
\land
\lor
\iff
Another form of De Morgan's law is the following as seen in the right figure.
A-(B\cupC)=(A-B)\cap(A-C),
A-(B\capC)=(A-B)\cup(A-C).
The negation of conjunction rule may be written in sequent notation:
\begin{align} \neg(P\landQ)&\vdash(\negP\lor\negQ),and\\ (\negP\lor\negQ)&\vdash\neg(P\landQ). \end{align}
The negation of disjunction rule may be written as:
\begin{align} \neg(P\lorQ)&\vdash(\negP\land\negQ),and\\ (\negP\land\negQ)&\vdash\neg(P\lorQ). \end{align}
In rule form: negation of conjunction
\neg(P\landQ) | ||
\therefore\negP\lor\negQ |
\negP\lor\negQ | |
\therefore\neg(P\landQ) |
and negation of disjunction
\neg(P\lorQ) | ||
\therefore\negP\land\negQ |
\negP\land\negQ | |
\therefore\neg(P\lorQ) |
and expressed as truth-functional tautologies or theorems of propositional logic:
\begin{align} \neg(P\landQ)&\leftrightarrow(\negP\lor\negQ),\\ \neg(P\lorQ)&\leftrightarrow(\negP\land\negQ).\\ \end{align}
where
P
Q
The generalized De Morgan’s laws provide an equivalence for negating a conjunction or disjunction involving multiple terms.
For a set of propositions
P1,P2,...,Pn
\begin{align} lnot(P1\landP2\land...\landPn)\leftrightarrowlnotP1\lorlnotP2\lor\ldots\lorlnotPn\\ lnot(P1\lorP2\lor...\lorPn)\leftrightarrowlnotP1\landlnotP2\land\ldots\landlnotPn \end{align}
These laws generalize De Morgan’s original laws for negating conjunctions and disjunctions.
De Morgan's laws are normally shown in the compact form above, with the negation of the output on the left and negation of the inputs on the right. A clearer form for substitution can be stated as:
\begin{align} (P\landQ)&\Longleftrightarrow\neg(\negP\lor\negQ),\\ (P\lorQ)&\Longleftrightarrow\neg(\negP\land\negQ). \end{align}
This emphasizes the need to invert both the inputs and the output, as well as change the operator when doing a substitution.
In set theory and Boolean algebra, it is often stated as "union and intersection interchange under complementation",[4] which can be formally expressed as:
\begin{align} \overline{A\cupB}&=\overline{A}\cap\overline{B},\\ \overline{A\capB}&=\overline{A}\cup\overline{B}, \end{align}
where:
\overline{A}
A
\cap
\cup
The generalized form is
\begin{align} \overline{capiAi
where is some, possibly countably or uncountably infinite, indexing set.
In set notation, De Morgan's laws can be remembered using the mnemonic "break the line, change the sign".[5]
In electrical and computer engineering, De Morgan's laws are commonly written as:
\overline{(A ⋅ B)}\equiv(\overline{A}+\overline{B})
and
\overline{A+B}\equiv\overline{A} ⋅ \overline{B},
where:
⋅
+
De Morgan's laws commonly apply to text searching using Boolean operators AND, OR, and NOT. Consider a set of documents containing the words "cats" and "dogs". De Morgan's laws hold that these two searches will return the same set of documents:
Search A: NOT (cats OR dogs)
Search B: (NOT cats) AND (NOT dogs)
The corpus of documents containing "cats" or "dogs" can be represented by four documents:
Document 1: Contains only the word "cats".
Document 2: Contains only "dogs".
Document 3: Contains both "cats" and "dogs".
Document 4: Contains neither "cats" nor "dogs".
To evaluate Search A, clearly the search "(cats OR dogs)" will hit on Documents 1, 2, and 3. So the negation of that search (which is Search A) will hit everything else, which is Document 4.
Evaluating Search B, the search "(NOT cats)" will hit on documents that do not contain "cats", which is Documents 2 and 4. Similarly the search "(NOT dogs)" will hit on Documents 1 and 4. Applying the AND operator to these two searches (which is Search B) will hit on the documents that are common to these two searches, which is Document 4.
A similar evaluation can be applied to show that the following two searches will both return Documents 1, 2, and 4:
Search C: NOT (cats AND dogs),
Search D: (NOT cats) OR (NOT dogs).
The laws are named after Augustus De Morgan (1806–1871),[6] who introduced a formal version of the laws to classical propositional logic. De Morgan's formulation was influenced by algebraization of logic undertaken by George Boole, which later cemented De Morgan's claim to the find. Nevertheless, a similar observation was made by Aristotle, and was known to Greek and Medieval logicians.[7] For example, in the 14th century, William of Ockham wrote down the words that would result by reading the laws out.[8] Jean Buridan, in his Latin: Summulae de Dialectica, also describes rules of conversion that follow the lines of De Morgan's laws.[9] Still, De Morgan is given credit for stating the laws in the terms of modern formal logic, and incorporating them into the language of logic. De Morgan's laws can be proved easily, and may even seem trivial.[10] Nonetheless, these laws are helpful in making valid inferences in proofs and deductive arguments.
De Morgan's theorem may be applied to the negation of a disjunction or the negation of a conjunction in all or part of a formula.
In the case of its application to a disjunction, consider the following claim: "it is false that either of A or B is true", which is written as:
\neg(A\lorB).
(\negA)\wedge(\negB).
Working in the opposite direction, the second expression asserts that A is false and B is false (or equivalently that "not A" and "not B" are true). Knowing this, a disjunction of A and B must be false also. The negation of said disjunction must thus be true, and the result is identical to the first claim.
The application of De Morgan's theorem to conjunction is very similar to its application to a disjunction both in form and rationale. Consider the following claim: "it is false that A and B are both true", which is written as:
\neg(A\landB).
(\negA)\lor(\negB).
Working in the opposite direction again, the second expression asserts that at least one of "not A" and "not B" must be true, or equivalently that at least one of A and B must be false. Since at least one of them must be false, then their conjunction would likewise be false. Negating said conjunction thus results in a true expression, and this expression is identical to the first claim.
Here we use
\overline{A}
\overline{A\capB}=\overline{A}\cup\overline{B}
\overline{A\capB}\subseteq\overline{A}\cup\overline{B}
\overline{A}\cup\overline{B}\subseteq\overline{A\capB}
Let
x\in\overline{A\capB}
x\not\inA\capB
Because
A\capB=\{y | y\inA\wedgey\inB\}
x\not\inA
x\not\inB
If
x\not\inA
x\in\overline{A}
x\in\overline{A}\cup\overline{B}
Similarly, if
x\not\inB
x\in\overline{B}
x\in\overline{A}\cup\overline{B}
Thus,
\forallx(x\in\overline{A\capB}\impliesx\in\overline{A}\cup\overline{B})
that is,
\overline{A\capB}\subseteq\overline{A}\cup\overline{B}
To prove the reverse direction, let
x\in\overline{A}\cup\overline{B}
x\not\in\overline{A\capB}
Under that assumption, it must be the case that
x\inA\capB
so it follows that
x\inA
x\inB
x\not\in\overline{A}
x\not\in\overline{B}
However, that means
x\not\in\overline{A}\cup\overline{B}
x\in\overline{A}\cup\overline{B}
therefore, the assumption
x\not\in\overline{A\capB}
x\in\overline{A\capB}
Hence,
\forallx(x\in\overline{A}\cup\overline{B}\impliesx\in\overline{A\capB})
that is,
\overline{A}\cup\overline{B}\subseteq\overline{A\capB}
If
\overline{A}\cup\overline{B}\subseteq\overline{A\capB}
\overline{A\capB}\subseteq\overline{A}\cup\overline{B}
\overline{A\capB}=\overline{A}\cup\overline{B}
The other De Morgan's law,
\overline{A\cupB}=\overline{A}\cap\overline{B}
In extensions of classical propositional logic, the duality still holds (that is, to any logical operator one can always find its dual), since in the presence of the identities governing negation, one may always introduce an operator that is the De Morgan dual of another. This leads to an important property of logics based on classical logic, namely the existence of negation normal forms: any formula is equivalent to another formula where negations only occur applied to the non-logical atoms of the formula. The existence of negation normal forms drives many applications, for example in digital circuit design, where it is used to manipulate the types of logic gates, and in formal logic, where it is needed to find the conjunctive normal form and disjunctive normal form of a formula. Computer programmers use them to simplify or properly negate complicated logical conditions. They are also often useful in computations in elementary probability theory.
Let one define the dual of any propositional operator P(p, q, ...) depending on elementary propositions p, q, ... to be the operator
Pd
Pd(p,q,...)=\negP(\negp,\negq,...).
This duality can be generalised to quantifiers, so for example the universal quantifier and existential quantifier are duals:
\forallxP(x)\equiv\neg[\existsx\negP(x)]
\existsxP(x)\equiv\neg[\forallx\negP(x)]
To relate these quantifier dualities to the De Morgan laws, set up a model with some small number of elements in its domain D, such as
D = .
Then
\forallxP(x)\equivP(a)\landP(b)\landP(c)
and
\existsxP(x)\equivP(a)\lorP(b)\lorP(c).
But, using De Morgan's laws,
P(a)\landP(b)\landP(c)\equiv\neg(\negP(a)\lor\negP(b)\lor\negP(c))
and
P(a)\lorP(b)\lorP(c)\equiv\neg(\negP(a)\land\negP(b)\land\negP(c)),
verifying the quantifier dualities in the model.
Then, the quantifier dualities can be extended further to modal logic, relating the box ("necessarily") and diamond ("possibly") operators:
\Boxp\equiv\neg\Diamond\negp,
\Diamondp\equiv\neg\Box\negp.
In its application to the alethic modalities of possibility and necessity, Aristotle observed this case, and in the case of normal modal logic, the relationship of these modal operators to the quantification can be understood by setting up models using Kripke semantics.
Three out of the four implications of de Morgan's laws hold in intuitionistic logic. Specifically, we have
\neg(P\lorQ)\leftrightarrow((\negP)\land(\negQ)),
((\negP)\lor(\negQ))\to\neg(P\landQ).
P\landQ
{WPEM
(\negP)\lor\neg(\negP).
{LLPO
{WLPO
The validity of the other three De Morgan's laws remains true if negation
\negP
P\toC
Similarly to the above, the quantifier laws:
\forallx\negP(x)\leftrightarrow\neg\existsxP(x)
\existsx\negP(x)\to\neg\forallxP(x).
Q
Further, one still has
(P\lorQ)\to\neg((\negP)\land(\negQ)),
(P\landQ)\to\neg((\negP)\lor(\negQ)),
\forallxP(x)\to\neg\existsx\negP(x),
\existsxP(x)\to\neg\forallx\negP(x),
{PEM