# De Morgan's laws

__: Pair of logical equivalences__

**Short description**Transformation rules |
---|

Propositional calculus |

Rules of inference |

Rules of replacement |

Predicate logic |

In propositional logic and Boolean algebra, **De Morgan's laws**,^{[1]}^{[2]}^{[3]} also known as **De Morgan's theorem**,^{[4]} 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:

- The negation of a disjunction is the conjunction of the negations
- The negation of a conjunction is the disjunction of the negations

or

- The complement of the union of two sets is the same as the intersection of their complements
- The complement of the intersection of two sets is the same as the union of their complements

or

- not (A or B) = (not A) and (not B)
- not (A and B) = (not A) or (not B)

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

- [math]\displaystyle{ \begin{align} \overline{A \cup B} &= \overline{A} \cap \overline{B}, \\ \overline{A \cap B} &= \overline{A} \cup \overline{B}, \end{align} }[/math]

where

- [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] are sets,
- [math]\displaystyle{ \overline{A} }[/math] is the complement of [math]\displaystyle{ A }[/math],
- [math]\displaystyle{ \cap }[/math] is the intersection, and
- [math]\displaystyle{ \cup }[/math] is the union.

In formal language, the rules are written as

- [math]\displaystyle{ \neg(P\lor Q)\iff(\neg P)\land(\neg Q), }[/math]

and

- [math]\displaystyle{ \neg(P\land Q)\iff(\neg P)\lor(\neg Q) }[/math]

where

*P*and*Q are propositions,*- [math]\displaystyle{ \neg }[/math] is the negation logic operator (NOT),
- [math]\displaystyle{ \land }[/math] is the conjunction logic operator (AND),
- [math]\displaystyle{ \lor }[/math] is the disjunction logic operator (OR),
- [math]\displaystyle{ \iff }[/math] is a metalogical symbol meaning "can be replaced in a logical proof with".

Applications of the rules include simplification of logical expressions in computer programs and digital circuit designs. De Morgan's laws are an example of a more general concept of mathematical duality.

## Formal notation

The *negation of conjunction* rule may be written in sequent notation:

- [math]\displaystyle{ \neg(P \land Q) \vdash (\neg P \lor \neg Q) }[/math],

and

- [math]\displaystyle{ (\neg P \lor \neg Q) \vdash \neg(P \land Q) }[/math].

The *negation of disjunction* rule may be written as:

- [math]\displaystyle{ \neg(P \lor Q) \vdash (\neg P \land \neg Q) }[/math],

and

- [math]\displaystyle{ (\neg P \land \neg Q) \vdash \neg(P \lor Q) }[/math].

In rule form: *negation of conjunction*

- [math]\displaystyle{ \frac{\neg (P \land Q)}{\therefore \neg P \lor \neg Q} }[/math]
- [math]\displaystyle{ \frac{\neg P \lor \neg Q}{\therefore \neg (P \land Q)} }[/math]

and *negation of disjunction*

- [math]\displaystyle{ \frac{\neg (P \lor Q)}{\therefore \neg P \land \neg Q} }[/math]
- [math]\displaystyle{ \frac{\neg P \land \neg Q}{\therefore \neg (P \lor Q)} }[/math]

and expressed as a truth-functional tautology or theorem of propositional logic:

- [math]\displaystyle{ \begin{align} \neg (P \land Q) &\to (\neg P \lor \neg Q), \\ (\neg P \lor \neg Q) &\to \neg (P \land Q), \\ \neg (P \lor Q) &\to (\neg P \land \neg Q), \\ (\neg P \land \neg Q) &\to \neg (P \lor Q), \end{align} }[/math]

where [math]\displaystyle{ P }[/math] and [math]\displaystyle{ Q }[/math] are propositions expressed in some formal system.

### Substitution form

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:

- [math]\displaystyle{ \begin{align} (P \land Q) &\Longleftrightarrow \neg (\neg P \lor \neg Q), \\ (P \lor Q) &\Longleftrightarrow \neg (\neg P \land \neg Q). \end{align} }[/math]

This emphasizes the need to invert both the inputs and the output, as well as change the operator when doing a substitution.

The laws have an important gap to the ([math]\displaystyle{ \neg(\neg p) \iff p }[/math]) double negation law. [math]\displaystyle{ \mathbb{L} }[/math], to become a formal logic system: [math]\displaystyle{ \ p, q, r, ...., \emptyset \in \mathbb{L}\ }[/math] sequence reports symbols that are defined well formed at first order. The same system has those conjunctions: [math]\displaystyle{ C_{|j}:x\ |\ x \in set :: \{\land, \lor, \iff, \vdash\} }[/math]. Obviously, [math]\displaystyle{ C_{|j} = set, \ x \in C_{|j} }[/math] is valid knowledge, then there is at least one [math]\displaystyle{ x }[/math] conjunction, which -[math]\displaystyle{ T }[/math] number —in the truth table, basic proposition of [math]\displaystyle{ x }[/math]— is equal to atomic existence context of [math]\displaystyle{ x }[/math], of course according to the [math]\displaystyle{ \forall x:(\mathbb{L}\vDash \forall c \subsetneq C_{|j}, \ x\in c) }[/math] knowledge. We regarded the equivalence theory, the logic does. At this point, De Morgan Laws show effect that is upward or downward, the atomic context of [math]\displaystyle{ x }[/math].^{[6]}

### Set theory and Boolean algebra

In set theory and Boolean algebra, it is often stated as "union and intersection interchange under complementation",^{[7]} which can be formally expressed as:

- [math]\displaystyle{ \begin{align} \overline{A \cup B} &= \overline{A} \cap \overline{B}, \\ \overline{A \cap B} &= \overline{A} \cup \overline{B}, \end{align} }[/math]

where:

- [math]\displaystyle{ \overline{A} }[/math] is the negation of [math]\displaystyle{ A }[/math], the overline being written above the terms to be negated,
- [math]\displaystyle{ \cap }[/math] is the intersection operator (AND),
- [math]\displaystyle{ \cup }[/math] is the union operator (OR).

#### Unions and intersections of any number of sets

The generalized form is

- [math]\displaystyle{ \begin{align} \overline{\bigcap_{i \in I} A_{i}} &\equiv \bigcup_{i \in I} \overline{A_{i}}, \\ \overline{\bigcup_{i \in I} A_{i}} &\equiv \bigcap_{i \in I} \overline{A_{i}}, \end{align} }[/math]

where *I* 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".^{[8]}

### Engineering

In electrical and computer engineering, De Morgan's laws are commonly written as:

- [math]\displaystyle{ \overline{(A \cdot B)} \equiv \overline {(A} + \overline {B)} }[/math]

and

- [math]\displaystyle{ \overline{A + B} \equiv \overline {A} \cdot \overline {B}, }[/math]

where:

- [math]\displaystyle{ \cdot }[/math] is the logical AND,
- [math]\displaystyle{ + }[/math] is the logical OR,
- the overbar is the logical NOT of what is underneath the overbar.

### Text searching

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).

## History

The laws are named after Augustus De Morgan (1806–1871),^{[9]} 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.^{[10]} For example, in the 14th century, William of Ockham wrote down the words that would result by reading the laws out.^{[11]} Jean Buridan, in his *Summulae de Dialectica*, also describes rules of conversion that follow the lines of De Morgan's laws.^{[12]} 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.^{[13]} Nonetheless, these laws are helpful in making valid inferences in proofs and deductive arguments.

## Informal proof

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.

### Negation of a disjunction

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:

- [math]\displaystyle{ \neg(A\lor B). }[/math]

In that it has been established that *neither* A nor B is true, then it must follow that both A is not true and B is not true, which may be written directly as:

- [math]\displaystyle{ (\neg A)\wedge(\neg B). }[/math]

If either A or B *were* true, then the disjunction of A and B would be true, making its negation false. Presented in English, this follows the logic that "since two things are both false, it is also false that either of them is true".

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.

### Negation of a conjunction

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:

- [math]\displaystyle{ \neg(A\land B). }[/math]

In order for this claim to be true, either or both of A or B must be false, for if they both were true, then the conjunction of A and B would be true, making its negation false. Thus, one (at least) or more of A and B must be false (or equivalently, one or more of "not A" and "not B" must be true). This may be written directly as,

- [math]\displaystyle{ (\neg A)\lor(\neg B). }[/math]

Presented in English, this follows the logic that "since it is false that two things are both true, at least one of them must be false".

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.

## Formal proof

Here we use [math]\displaystyle{ A^\complement }[/math]to denote the complement of A. The proof that [math]\displaystyle{ (A\cap B)^\complement = A^\complement \cup B^\complement }[/math] is completed in 2 steps by proving both [math]\displaystyle{ (A\cap B)^\complement \subseteq A^\complement \cup B^\complement }[/math] and [math]\displaystyle{ A^\complement \cup B^\complement \subseteq (A\cap B)^\complement }[/math].

### Part 1

Let [math]\displaystyle{ x \in (A \cap B)^\complement }[/math]. Then, [math]\displaystyle{ x \not\in A \cap B }[/math].

Because [math]\displaystyle{ A \cap B = \{\,y\ |\ y\in A \wedge y \in B\,\} }[/math], it must be the case that [math]\displaystyle{ x \not\in A }[/math] or [math]\displaystyle{ x \not\in B }[/math].

If [math]\displaystyle{ x \not\in A }[/math], then [math]\displaystyle{ x \in A^\complement }[/math], so [math]\displaystyle{ x \in A^\complement \cup B^\complement }[/math].

Similarly, if [math]\displaystyle{ x \not\in B }[/math], then [math]\displaystyle{ x \in B^\complement }[/math], so [math]\displaystyle{ x \in A^\complement\cup B^\complement }[/math].

Thus, [math]\displaystyle{ \forall x\Big( x \in (A\cap B)^\complement \implies x \in A^\complement \cup B^\complement\Big) }[/math];

that is, [math]\displaystyle{ (A\cap B)^\complement \subseteq A^\complement \cup B^\complement }[/math].

### Part 2

To prove the reverse direction, let [math]\displaystyle{ x \in A^\complement \cup B^\complement }[/math], and for contradiction assume [math]\displaystyle{ x \not\in (A\cap B)^\complement }[/math].

Under that assumption, it must be the case that [math]\displaystyle{ x \in A\cap B }[/math],

so it follows that [math]\displaystyle{ x \in A }[/math] and [math]\displaystyle{ x \in B }[/math], and thus [math]\displaystyle{ x \not\in A^\complement }[/math] and [math]\displaystyle{ x \not\in B^\complement }[/math].

However, that means [math]\displaystyle{ x \not\in A^\complement \cup B^\complement }[/math], in contradiction to the hypothesis that [math]\displaystyle{ x \in A^\complement \cup B^\complement }[/math],

therefore, the assumption [math]\displaystyle{ x \not\in (A\cap B)^\complement }[/math] must not be the case, meaning that [math]\displaystyle{ x \in (A\cap B)^\complement }[/math].

Hence, [math]\displaystyle{ \forall x\Big( x \in A^\complement \cup B^\complement \implies x \in (A\cap B)^\complement\Big) }[/math],

that is, [math]\displaystyle{ A^\complement \cup B^\complement \subseteq (A\cap B)^\complement }[/math].

### Conclusion

If [math]\displaystyle{ A^\complement \cup B^\complement \subseteq (A\cap B)^\complement }[/math] *and* [math]\displaystyle{ (A \cap B)^\complement \subseteq A^\complement \cup B^\complement }[/math], then [math]\displaystyle{ (A\cap B)^\complement = A^\complement \cup B^\complement }[/math]; this concludes the proof of De Morgan's law.

The other De Morgan's law, [math]\displaystyle{ (A \cup B)^\complement = A^\complement \cap B^\complement }[/math], is proven similarly.

## Generalising De Morgan duality

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 [math]\displaystyle{ \mbox{P}^d }[/math] defined by

- [math]\displaystyle{ \mbox{P}^d(p, q, ...) = \neg P(\neg p, \neg q, \dots). }[/math]

## Extension to predicate and modal logic

This duality can be generalised to quantifiers, so for example the universal quantifier and existential quantifier are duals:

- [math]\displaystyle{ \forall x \, P(x) \equiv \neg [ \exists x \, \neg P(x)] }[/math]

- [math]\displaystyle{ \exists x \, P(x) \equiv \neg [ \forall x \, \neg P(x)] }[/math]

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*= {*a*,*b*,*c*}.

Then

- [math]\displaystyle{ \forall x \, P(x) \equiv P(a) \land P(b) \land P(c) }[/math]

and

- [math]\displaystyle{ \exists x \, P(x) \equiv P(a) \lor P(b) \lor P(c). }[/math]

But, using De Morgan's laws,

- [math]\displaystyle{ P(a) \land P(b) \land P(c) \equiv \neg (\neg P(a) \lor \neg P(b) \lor \neg P(c)) }[/math]

and

- [math]\displaystyle{ P(a) \lor P(b) \lor P(c) \equiv \neg (\neg P(a) \land \neg P(b) \land \neg P(c)), }[/math]

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:

- [math]\displaystyle{ \Box p \equiv \neg \Diamond \neg p, }[/math]
- [math]\displaystyle{ \Diamond p \equiv \neg \Box \neg p. }[/math]

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.

## In intuitionistic logic

Three out of the four implications of de Morgan's laws hold in intuitionistic logic. Specifically, we have

- [math]\displaystyle{ \neg(P\lor Q)\iff(\neg P)\land(\neg Q), }[/math]

and

- [math]\displaystyle{ (P\lor Q)\rightarrow \neg ((\neg P)\land(\neg Q)), }[/math]
- [math]\displaystyle{ (P\land Q)\rightarrow \neg ((\neg P)\lor(\neg Q)), }[/math]
- [math]\displaystyle{ (\neg P)\lor(\neg Q) \rightarrow \neg(P\land Q) }[/math]

while the converse of the last implication does not hold in pure intuitionistic logic and would be equivalent to the law of the weak excluded middle

- [math]\displaystyle{ \neg P \lor \neg \neg P }[/math]

which can be used as a foundation for an intermediate logic.

This remains true if negation [math]\displaystyle{ \neg P }[/math] is replaced by implication [math]\displaystyle{ P \rightarrow C }[/math] for some arbitrary constant predicate C, meaning that the above laws are still true in minimal logic.

Similarly, the quantifier laws:

- [math]\displaystyle{ \forall x \, \neg P(x) \iff \neg [ \exists x \,P(x) ] }[/math]

and

- [math]\displaystyle{ \forall x \, P(x) \rightarrow \neg [ \exists x \, \neg P(x)] }[/math]
- [math]\displaystyle{ \exists x \, P(x) \rightarrow \neg [ \forall x \, \neg P(x)] }[/math]
- [math]\displaystyle{ \exists x \, \neg P(x) \rightarrow \neg [ \forall x \, P(x)] }[/math]

are tautologies even in minimal logic with negation replaced with implying a fixed Q, while the converse of the last law does not have to be true in general.

## In computer engineering

De Morgan's laws are widely used in computer engineering and digital logic for the purpose of simplifying circuit designs.^{[14]}

## See also

- Isomorphism – NOT operator as isomorphism between positive logic and negative logic
- List of Boolean algebra topics
- List of set identities and relations
- Positive logic

## References

- ↑ Copi, Irving M.; Cohen, Carl; McMahon, Kenneth.
*Introduction to Logic*. doi:10.4324/9781315510897. https://www.taylorfrancis.com/books/mono/10.4324/9781315510897/introduction-logic-irving-copi-carl-cohen-kenneth-mcmahon. - ↑ Hurley, Patrick J. (2015),
*A Concise Introduction to Logic*(12th ed.), Cengage Learning, ISBN 978-1-285-19654-1 - ↑ Moore, Brooke Noel (2012).
*Critical thinking*. Richard Parker (10th ed.). New York: McGraw-Hill. ISBN 978-0-07-803828-0. OCLC 689858599. https://www.worldcat.org/oclc/689858599. - ↑ DeMorgan's Theorem
- ↑
Kashef, Arman. (2023),
*In Quest of Univeral Logic: A brief overview of formal logic's evolution*, doi:10.13140/RG.2.2.24043.82724, https://www.researchgate.net/publication/366867569 - ↑ Hayes, Andy; Wu, Vincent. "De Morgan's Laws". https://brilliant.org/wiki/de-morgans-laws/.
- ↑
*Boolean Algebra*by R. L. Goodstein. ISBN:0-486-45894-6 - ↑
*2000 Solved Problems in Digital Electronics*by S. P. Bali - ↑
*DeMorgan's Theorems*at mtsu.edu - ↑ Bocheński's
*History of Formal Logic* - ↑ William of Ockham,
*Summa Logicae*, part II, sections 32 and 33. - ↑ Jean Buridan,
*Summula de Dialectica*. Trans. Gyula Klima. New Haven: Yale University Press, 2001. See especially Treatise 1, Chapter 7, Section 5. ISBN:0-300-08425-0 - ↑ Augustus De Morgan (1806–1871) by Robert H. Orr
- ↑ "De Morgan's Theorems | GATE Notes". https://byjus.com/gate/de-morgans-theorems-notes/. Retrieved 21 December 2022.

## External links

- Hazewinkel, Michiel, ed. (2001), "Duality principle",
*Encyclopedia of Mathematics*, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 978-1-55608-010-4, https://www.encyclopediaofmath.org/index.php?title=p/d034130 - Weisstein, Eric W.. "de Morgan's Laws". http://mathworld.wolfram.com/deMorgansLaws.html.
- de Morgan's laws at PlanetMath.org.
- Duality in Logic and Language,
*Internet Encyclopedia of Philosophy*.

Original source: https://en.wikipedia.org/wiki/De Morgan's laws.
Read more |