Fundamental Hardware Elements of Computers: De Morgan's Laws

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

PAPER 2 - ⇑ Fundamentals of computer systems ⇑

← 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:

Rule 1 Rule 2

An easy way to remember De Morgan's Laws is through the rhyme: "break the line, change the sign"!

Let's prove that I'm not lying to you by creating a truth table to prove that:

Answer:

P 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 by the same method:

Answer:

P 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 to stand for padlock 1 is open, and to stand for padlock 2 is open.

You can go through the gate if padlock 1 is open AND padlock 2 is open () You can not go through the gate if padlock 1 is locked OR padlock 2 is locked ()

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 = gate is closed = you should be able to see that NOT{gate is open} = or

=

Example: Simplifying boolean equations using boolean algebra

Simplify the following:

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 . 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: . Where P = and Q =
  2. Take each side separately and applying De Morgans Law convert the centre gate to an AND:
  3. Now dealing with the left hand side of our new equation (), apply De Morgans Law again () and cancel out the double bars:
  4. Multiply out both sides:
  5. From the Identity we can replace the left hand side:
  6. From the Identity we can ignore the 0 leaving us with:
  7. From the Identity we can swap the values around:
    = 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:

Answer:

  1. Using Demorgans rule that:
  2. Making
  3. Using the boolean identity that
  4. Making
  5. Using the boolean identity that
  6. We simplify down to


Answer:

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 . 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:
  2. Take each side separately and applying De Morgans Law convert the centre gate to an AND:
  3. Cancel out the double bars:
  4. Now dealing with the left hand side of our new equation, apply De Morgans Law again and cancel out the double bars:
  5. Multiply out both sides:
  6. From the Identity we can replace the left hand side:
  7. From the Identity we can ignore the 1 leaving us with:
  8. From the Identity we can swap the values around:
    = the value we calculated by truth table

Answer:

0 0
0
1
1
0
0 1
1
0
1
0
1 0
1
0
0
1
1 1
1
0
1
0

If you're catching on to this, you'll notice that this is the equivalent of . 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:
  2. Take each side separately (P= and Q=) and applying De Morgans Law convert the centre gate to an AND:
  3. Cancel out the double bars:
  4. Multiply out both sides:
  5. From the Identity we can replace the right hand side:
  6. From the Identity we can ignore the 0 leaving us with:
    = the value we calculated by truth table