Sub topic 14
Boolean expressions and De Morgan's theorems
This chapter assumes you know the OR, AND and NOT gates and their truth tables. It also assumes you can read a gate circuit and write the output for each input row. Here you will write gate circuits as algebra and simplify them. You will also use De Morgan's theorems, which connect NAND and NOR to the basic gates.
Writing gates as expressions
A Boolean expression uses variables that can only be 0 or 1. NEET uses these symbols.
| Gate | Expression | Reads as |
|---|---|---|
| OR | Y = A + B | A or B |
| AND | Y = A · B | A and B |
| NOT | Y = Ā | not A |
| NAND | Y = NOT(A · B) | not (A and B) |
| NOR | Y = NOT(A + B) | not (A or B) |
Here "+" means OR, not arithmetic addition. So 1 + 1 = 1.
Basic identities
These rules let you shrink an expression before building or evaluating it.
- A + 0 = A and A · 1 = A
- A + 1 = 1 and A · 0 = 0
- A + A = A and A · A = A
- A + Ā = 1 and A · Ā = 0
- NOT(Ā) = A
The last rule says two NOT gates in a row cancel.
De Morgan's theorems
There are two theorems.
- NOT(A + B) = Ā · B̄
- NOT(A · B) = Ā + B̄
To remember them, break the bar and change the sign between the variables. AND becomes OR, and OR becomes AND. Each theorem gives a gate equivalence:
- A NOR gate acts like an AND gate whose inputs are both inverted.
- A NAND gate acts like an OR gate whose inputs are both inverted.
Checking the theorems by computer
A truth table proves a Boolean identity because every input case can be listed. This program checks both theorems on all four input pairs.
from itertools import product
for a, b in product((0, 1), repeat=2):
nor = 1 - (a | b)
and_of_nots = (1 - a) & (1 - b)
nand = 1 - (a & b)
or_of_nots = (1 - a) | (1 - b)
print(a, b, "| NOR:", nor, "NOT A.NOT B:", and_of_nots,
"| NAND:", nand, "NOT A+NOT B:", or_of_nots)In every row the NOR column matches the "NOT A · NOT B" column, and the NAND column matches the "NOT A + NOT B" column.
Simplifying an expression
Take Y = A · B + A · B̄.
- Factor out A: Y = A · (B + B̄).
- Use B + B̄ = 1: Y = A · 1.
- Use A · 1 = A: Y = A.
The circuit's output is just A, so the two AND gates, the NOT gate and the OR gate are not needed.
Common errors
- Treating "+" as ordinary addition and writing 1 + 1 = 2.
- Applying De Morgan to only part of a bar. The bar must be broken over the whole expression, one level at a time.
- Forgetting that A + Ā = 1, which hides simplifications.
- Not checking the answer with a truth table. When unsure, test all four input rows.
Exercise
Using De Morgan's theorem, write NOT(A · B̄) in terms of A and B without a bar over a product. Then find Y when A = 1 and B = 1.
Show answer
NOT(A · B̄) = Ā + NOT(B̄) = Ā + B. For A = 1 and B = 1, Y = 0 + 1 = 1.