Fundamental Hardware Elements of Computers: De Morgan's Laws

From Wikibooks, open books for an open world
Jump to: navigation, search

UNIT 2 - ⇑ Fundamental Hardware Elements of Computers ⇑

← Boolean identities De Morgan's Laws Gate conversion →

De Morgan's laws are used to simplify Boolean equations so that you can build equations only involving one sort of gate, generally only using NAND or NOR gates. This can lead to cheaper hardware. There are two laws that you need to remember:

\overline{P . Q} = \overline{P}+\overline{Q} \overline{P + Q} = \overline{P}.\overline{Q}
Rule 1 Rule 2

Let's prove that I'm not lying to you by creating a truth table to prove that: \overline{P + Q} = \overline{P}.\overline{Q}

Answer :

P Q {P}+{Q} \overline{P + Q} \overline{P} \overline{Q} \overline{P}.\overline{Q}
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0

Since the values in the 4th and last columns are the same for all rows (which cover all possible truth value assignments to the variables), we can conclude that the two expressions are logically equivalent.

Now we prove \overline{P . Q} = \overline{P}+\overline{Q} by the same method:

Answer :

P Q {P}.{Q} \overline{P . Q} \overline{P} \overline{Q} \overline{P}+\overline{Q}
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0

There is a rather nice concrete way of thinking about this, with a gate that's padlocked with two padlocks, padlock 1 and padlock 2.

We'll use P to stand for padlock 1 is open, and Q to stand for padlock 2 is open.

You can go through the gate if padlock 1 is open AND padlock 2 is open (P . Q) You can not go through the gate if padlock 1 is locked OR padlock 2 is locked (\overline{P} + \overline{Q})

Since 'You can not go through the gate' is the same as the opposite (negation) of 'You can go through the gate' and, remembering

gate is open = P.Q gate is closed = \overline{P} + \overline{Q} you should be able to see that NOT{gate is open} = \overline{P} + \overline{Q} or

\overline{P . Q} = \overline{P} + \overline{Q}

Example: Simplifying boolean equations using boolean algebra

Simplify the following: \overline{(A . \overline{B})+\overline{A}}

A B \overline{A} \overline{B} A.\overline{B} (A.\overline{B})+\overline{A} \overline{(A . \overline{B})+\overline{A}}
0 0
1
1
0
1
0
0 1
1
0
0
1
0
1 0
0
1
1
1
0
1 1
0
0
0
0
1

From looking at the truth table we can see that it equates to A.B. But we should also know how to get to this result by using boolean identities. Let's give it a go:

  1. Using De Morgans Law: \overline{P + Q} = \overline{P}.\overline{Q}. Where P = (A . \overline{B}) and Q = (\overline{A})
  2. Take each side separately and applying De Morgans Law convert the centre gate to an AND:
    \overline{(A . \overline{B})+(\overline{A})} = (\overline{A . \overline{B}}).(\overline{\overline{A}})
  3. Now dealing with the left hand side of our new equation (\overline{A . \overline{B}}), apply De Morgans Law again (\overline{P . Q} == \overline{P}+\overline{Q}) and cancel out the double bars:
    (\overline{\overline{\overline{A} + \overline{\overline{B}}}}).({A}) = (\overline{A} + {B}).({A})
  4. Multiply out both sides:
    (\overline{A}.A) + (B.A)
  5. From the Identity \overline{A}.A = 0 we can replace the left hand side:
    0 + (B.A)
  6. From the Identity 0 + X = X we can ignore the 0 leaving us with:
    B.A
  7. From the Identity X.Y = Y.X we can swap the values around:
    A.B = the value we calculated by truth table

Let's try another

Exercise: Simplifying boolean equations
Simplify the following using De Morgan's Laws and boolean identities. Check your answers by making truth tables:

\overline{A . B}+A

Answer :

  1. Using Demorgans rule that: \overline{A . B} = \overline{A}+\overline{B}
  2. Making \overline{A . B}+A = \overline{A}+\overline{B}+A
  3. Using the boolean identity that \overline{A}+A = 1
  4. Making \overline{A}+\overline{B}+A = \overline{B}+1
  5. Using the boolean identity that \overline{B}+1 = 1
  6. We simplify down to \overline{A . B} + A == 1

\overline{(A + \overline{B}).\overline{A}}

Answer :

A B \overline{A} \overline{B} A+\overline{B} (A+\overline{B}).\overline{A} \overline{(A + \overline{B}).\overline{A}}
0 0
1
1
1
1
0
0 1
1
0
0
0
1
1 0
0
1
1
0
1
1 1
0
0
1
0
1

If you're catching on to this, you'll notice that this is the equivalent of A+B. But we better check it with boolean algebra identities and De Morgans Law to confirm we have the correct answer.

  1. Using De Morgans Law: \overline{P . Q} = \overline{P}+\overline{Q}
  2. Take each side separately and applying De Morgans Law convert the centre gate to an AND:
    \overline{(A + \overline{B}).(\overline{A})} = {(\overline{A + \overline{B}})+(\overline{\overline{A}})}
  3. Cancel out the double bars:
    {(\overline{A + \overline{B}})+(\overline{\overline{A}})} = (\overline{A + \overline{B}})+({A})
  4. Now dealing with the left hand side of our new equation, apply De Morgans Law again and cancel out the double bars:
    (\overline{\overline{\overline{A} . \overline{\overline{B}}}})+({A}) = (\overline{A} . {B})+({A})
  5. Multiply out both sides:
    (\overline{A}+A) . (B+A)
  6. From the Identity \overline{A}+A = 1 we can replace the left hand side:
    1 . (B.A)
  7. From the Identity 1 . X = X we can ignore the 1 leaving us with:
    B+A
  8. From the Identity X+Y = Y+X we can swap the values around:
    A+B = the value we calculated by truth table

\overline{(\overline{A + B})+B}

Answer :

A B A+B \overline{A+B} (\overline{A+B})+B \overline{(\overline{A+B})+B}
0 0
0
1
1
0
0 1
1
0
1
0
1 0
1
0
0
1
1 1
1
0
1
0
\overline{(\overline{A+B})+B}

If you're catching on to this, you'll notice that this is the equivalent of A.\overline{B}. But we better check it with boolean algebra identities and De Morgans Law to confirm we have the correct answer.

  1. Using De Morgans Law: \overline{P . Q} = \overline{P}+\overline{Q}
  2. Take each side separately (P=\overline{A+B} and Q=B) and applying De Morgans Law convert the centre gate to an AND:
    \overline{(\overline{A+B})+B} = (\overline{\overline{A+B}}).\overline{B}
  3. Cancel out the double bars:(\overline{\overline{A+B}}).\overline{B} = (A+B).\overline{B}
  4. Multiply out both sides:
    (A.\overline{B})+(B.\overline{B})
  5. From the Identity (B.\overline{B}) = 0 we can replace the right hand side:
    (A.\overline{B})+0
  6. From the Identity X + 0 = X we can ignore the 0 leaving us with:
    A.\overline{B} = the value we calculated by truth table