Sub topic 10
Prime and essential prime implicants
This chapter assumes you can build a Karnaugh map (K-map) and group adjacent 1-cells into pairs, quads and octets, including wraparound. It also assumes you know sum-of-products (SOP) notation, where a prime like A' means NOT A. Grouping tells you which cells to circle. This chapter explains which circles you must keep.
Definitions
An implicant of a function F is a product term that equals 1 only on input rows where F is 1. Every group of 1s on a K-map is an implicant. Single minterms, pairs, quads and octets are all implicants.
A prime implicant is an implicant that stops being an implicant if you delete any one literal. On the map, it is a group that cannot be enlarged. A group of 2 inside a legal group of 4 is not prime.
An essential prime implicant is a prime implicant that covers at least one minterm that no other prime implicant covers. You cannot leave it out of any cover.
The three ideas nest. Every essential prime is a prime, and every prime is an implicant. The reverse does not hold.
| Term | Test | On a K-map |
|---|---|---|
| Implicant | F is 1 wherever the term is 1 | Any rectangle of 1s (or don't-cares), size a power of 2 |
| Prime implicant | No literal can be dropped | A rectangle that cannot grow |
| Essential prime implicant | Covers a minterm no other prime covers | A prime that owns a 1-cell alone |
A worked example
Take F(A,B,C,D) = Σm(0,1,2,5,6,7,8,9,10,14). Rows are AB and columns are CD, both in Gray code order.
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 | 1 | 0 | 1 |
| 01 | 0 | 1 | 1 | 1 |
| 11 | 0 | 0 | 0 | 1 |
| 10 | 1 | 1 | 0 | 1 |
Draw every maximal group, with wraparound. This gives six prime implicants.
| Prime implicant | Minterms | Size |
|---|---|---|
| B'D' | 0, 2, 8, 10 | 4 (four corners) |
| B'C' | 0, 1, 8, 9 | 4 (wraps top to bottom) |
| CD' | 2, 6, 10, 14 | 4 (wraps top to bottom) |
| A'C'D | 1, 5 | 2 |
| A'BD | 5, 7 | 2 |
| A'BC | 6, 7 | 2 |
BCD' (minterms 6 and 14) is not on the list. It sits inside the quad CD', so it is an implicant but not prime.
Finding the essential primes
For each 1-cell, count the primes that cover it. If the count is 1, that prime is essential.
- Minterm 9 (1001) is covered only by B'C'. So B'C' is essential.
- Minterm 14 (1110) is covered only by CD'. So CD' is essential.
- Every other minterm has at least two covering primes. Minterm 0, for example, is covered by B'D' and B'C'.
Both essential primes go into the answer. They cover minterms 0, 1, 2, 6, 8, 9, 10 and 14. Minterms 5 and 7 remain. A'BD covers both, so one more term finishes the cover.
F = B'C' + CD' + A'BD
That is 3 terms and 7 literals. B'D' is prime but redundant, because its cells are already covered. A'C'D and A'BC are also prime but unnecessary.
Checking the result with code
The tabular method finds the same primes. This program merges terms as in the Quine-McCluskey method, expands each prime back into minterms, and flags a prime when it is the only owner of some minterm. The - marks an eliminated variable, and the bit order is ABCD.
from itertools import product
def combine(a, b):
diff = [i for i, (x, y) in enumerate(zip(a, b)) if x != y]
if len(diff) == 1 and a[diff[0]] != '-' and b[diff[0]] != '-':
i = diff[0]
return a[:i] + '-' + a[i + 1:]
return None
def prime_implicants(minterms, n):
terms = {format(m, f'0{n}b') for m in minterms}
primes = set()
while terms:
used, nxt = set(), set()
for a in terms:
for b in terms:
c = combine(a, b)
if c:
nxt.add(c)
used.update((a, b))
primes |= terms - used
terms = nxt
return sorted(primes)
def covers(term):
options = [('0', '1') if ch == '-' else (ch,) for ch in term]
return {int(''.join(bits), 2) for bits in product(*options)}
def essential(primes, minterms):
result = set()
for m in minterms:
owners = [p for p in primes if m in covers(p)]
if len(owners) == 1:
result.add(owners[0])
return sorted(result)
minterms = [0, 1, 2, 5, 6, 7, 8, 9, 10, 14]
primes = prime_implicants(minterms, 4)
print(primes)
print(essential(primes, minterms))It prints:
['--10', '-0-0', '-00-', '0-01', '01-1', '011-']
['--10', '-00-']--10 is CD' and -00- is B'C'. The other four strings match the remaining four primes in the table.
Cyclic cases: no essential primes
Essential primes do not always exist. Consider F(A,B,C) = Σm(0,1,2,5,6,7). Its primes are A'B', A'C', B'C, BC', AC and AB. Each minterm is covered by exactly two of them, so no prime is essential.
Two different minimal covers exist, each with three terms:
- A'B' + BC' + AC
- A'C' + B'C + AB
Neither is more correct. When no essential primes exist, you must choose a cover by trial or by a systematic method. The prime implicant chart and Petrick's method, covered in later chapters, handle this.
Common errors
- Stopping at a non-maximal group. A pair that fits inside a quad is not prime. Always expand first, including across edges and corners.
- Calling a prime essential because it is large. Size does not decide it. B'D' is a quad but is not essential, because every cell it covers is covered elsewhere.
- Counting overlap wrongly. A cell covered by two circles does not make either circle essential. Essential means some cell has only one circle.
- Including every prime in the answer. The minimal SOP uses all essential primes plus only as many others as needed. The six-term sum of all primes is correct but not minimal.
- Mishandling don't-cares. A don't-care cell may be used to enlarge a group, so primes can include don't-cares. When testing essentiality, count only required 1-cells. A prime that covers only don't-cares is never needed.
Quick procedure for exam use
- Mark all 1-cells, and mark don't-cares separately.
- Circle maximal groups, using wraparound, and list them. These are the prime implicants.
- For each 1-cell, check how many primes cover it. Cells with one owner mark essential primes.
- Select the essential primes and cross off the cells they cover.
- Cover the remaining 1-cells with as few and as large primes as possible.
- Count terms and literals from the selected primes only.
Exercise
For F(A,B,C) = Σm(0,1,2,5,6,7), how many prime implicants are there, and how many are essential?
Show answer
There are 6 prime implicants: A'B', A'C', B'C, BC', AC and AB. None is essential, because every minterm is covered by exactly two primes. The function is cyclic, and a minimal cover uses 3 terms.
Exercise
In the worked example, B'D' is a prime implicant. Explain why it does not appear in the minimal SOP.
Show answer
B'D' covers minterms 0, 2, 8 and 10. Minterms 0, 1, 8 and 9 are covered by the essential prime B'C', and minterms 2, 6, 10 and 14 are covered by the essential prime CD'. So 0, 2, 8 and 10 are already covered, and B'D' adds nothing. It is prime but redundant.