# De Morgan's laws

(Redirected from Demorgan's law)

In propositional logic and boolean algebra, De Morgan's laws[1][2][3] are a pair of transformation rules that are both valid rules of inference. 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 conjunction is the disjunction of the negations.
The negation of a disjunction is the conjunction of the negations.

or informally as:

"not (A and B)" is the same as "(not A) or (not B)"

and also,

"not (A or B)" is the same as "(not A) and (not B)"

The rules can be expressed in formal language with two propositions P and Q as:

$\neg(P\land Q)\iff(\neg P)\lor(\neg Q)$
$\neg(P\lor Q)\iff(\neg P)\land(\neg Q)$

where: how the Deborah is born

• $\land$ is the conjunction operator (AND)
• $\lor$ is the disjunction operator (OR)
• ⇔ 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:

$\neg(P \and Q) \vdash (\neg P \or \neg Q)$

The negation of disjunction rule may be written as:

$\neg(P \or Q) \vdash (\neg P \and \neg Q)$

In rule form: negation of conjunction

$\frac{\neg (P \and Q)}{\therefore \neg P \or \neg Q}$

and negation of disjunction

$\frac{\neg (P \or Q)}{\therefore \neg P \and \neg Q}$

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

$\neg (P \and Q) \to (\neg P \or \neg Q)$
$\neg (P \or Q) \to (\neg P \and \neg Q)$

where $P$, and $Q$ are propositions expressed in some formal system.

### Substitution form

De Morgan's laws are normally shown in the compact form above, with negation of the output on the left and negation of the inputs on the right. A clearer form for substitution can be stated as:

$(P \and Q) \equiv \neg (\neg P \or \neg Q)$
$(P \or Q) \equiv \neg (\neg P \and \neg Q)$

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

### Set theory and Boolean algebra

In set theory and Boolean algebra, it is often stated as "Union and intersection interchange under complementation",[4] which can be formally expressed as:

• $\overline{A \cup B}\equiv\overline{A} \cap \overline{B}$
• $\overline{A \cap B}\equiv\overline{A} \cup \overline{B}$

where:

• A is the negation of A, the overline being written above the terms to be negated
• ∩ is the intersection operator (AND)
• ∪ is the union operator (OR)

The generalized form is:

$\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}}$

where I is some, possibly uncountable, indexing set.

In set notation, De Morgan's law can be remembered using the mnemonic "break the line, change the sign".[5]

### Engineering

In electrical and computer engineering, De Morgan's law is commonly written as:

$\overline{A \cdot B} \equiv \overline {A} + \overline {B}$
$\overline{A + B} \equiv \overline {A} \cdot \overline {B}$

where:

• $\cdot$ is a logical AND
• $+$ is a logical OR
• the overbar is the logical NOT of what is underneath the overbar.

## History

The law is 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. Although a similar observation was made by Aristotle and was known to Greek and Medieval logicians[7] (in the 14th century, William of Ockham wrote down the words that would result by reading the laws out),[8] De Morgan is given credit for stating the laws formally and incorporating them into the language of logic. De Morgan's Laws can be proved easily, and may even seem trivial.[9] 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:

$\neg(A\lor B)$

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:

$(\neg A)\wedge(\neg B)$

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 a 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\land B)$

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:

$(\neg A)\lor(\neg B)$

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

The proof that $(A\cap B)^c = A^c \cup B^c$ is done by first proving that $(A\cap B)^c \subseteq A^c \cup B^c$, and then by proving that $A^c \cup B^c \subseteq (A\cap B)^c$

Let $x \in (A \cap B)^c$. Then $x \not\in A \cap B$. Because $A \cap B = \{y | y \in A \text{ and } y \in B\}$, then either $x \not\in A$ or $x \not\in B$. If $x \not\in A$, then $x \in A^c$, so then $x \in A^c \cup B^c$. Otherwise, if $x \not\in B$, then $x \in B^c$, so $x \in A^c\cup B^c$. Because this is true for any arbitrary $x \in (A\cap B)^c$, then $\forall x \in (A\cap B)^c, x \in A^c \cup B^c$, and so $(A\cap B)^c \subseteq A^c \cup B^c$.

To prove the reverse direction, assume that $\exists x \in A^c \cup B^c$ such that $x \not\in (A\cap B)^c$. Then $x \in A\cap B$. It follows that $x \in A$ and $x \in B$. Then $x \not\in A^c$ and $x \not\in B^c$. But then $x \not\in A^c \cup B^c$, in contradiction to the hypothesis that $x \in A^c \cup B^c$. Therefore, $\forall x \in A^c \cup B^c, x \in (A\cap B)^c$, and $A^c \cup B^c \subseteq (A\cap B)^c$.

Because $A^c \cup B^c \subseteq (A\cap B)^c$ and $(A \cap B)^c \subseteq A^c \cup B^c$, then $(A\cap B)^c = A^c \cup B^c$, concluding the proof of De Morgan's Law.

The other De Morgan's Law, that $(A\cup B)^c = A^c \cap B^c$, is proven similarly.

## Extensions

In extensions of classical propositional logic, the duality still holds (that is, to any logical operator we 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 a prerequisite for finding 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 us define the dual of any propositional operator P(p, q, ...) depending on elementary propositions p, q, ... to be the operator $\mbox{P}^d$ defined by

$\mbox{P}^d(p, q, ...) = \neg P(\neg p, \neg q, \dots).$

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

$\forall x \, P(x) \equiv \neg \exists x \, \neg P(x),$
$\exists x \, P(x) \equiv \neg \forall x \, \neg P(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 = {a, b, c}.

Then

$\forall x \, P(x) \equiv P(a) \land P(b) \land P(c)$

and

$\exists x \, P(x) \equiv P(a) \lor P(b) \lor P(c).\,$

But, using De Morgan's laws,

$P(a) \land P(b) \land P(c) \equiv \neg (\neg P(a) \lor \neg P(b) \lor \neg P(c))$

and

$P(a) \lor P(b) \lor P(c) \equiv \neg (\neg P(a) \land \neg P(b) \land \neg P(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:

$\Box p \equiv \neg \Diamond \neg p,$
$\Diamond p \equiv \neg \Box \neg p.\,$

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.