Sub topic 16
Petrick's method for cyclic charts
This chapter assumes you can build a prime implicant chart from the Quine-McCluskey method. It also assumes you can pick essential prime implicants and that you know the Boolean absorption laws. Petrick's method is the algebraic fallback for the step where the chart gives you no obvious choice.
Where the chart gets stuck
After Quine-McCluskey you have a list of prime implicants (PIs) and a chart showing which minterms each PI covers. The usual selection routine is:
- Mark every minterm that is covered by exactly one PI. That PI is essential, so take it.
- Delete the minterms the essential PIs cover.
- Remove dominated rows (a PI whose remaining minterms are a subset of another PI's, at no lower cost) and dominating columns (a minterm whose covering PIs include all those of another minterm).
- Repeat until nothing changes.
Sometimes this loop ends with minterms left over and no essential PI. Every remaining minterm is covered by at least two PIs, and no row or column dominates another. The remaining chart is called cyclic. You must choose among several equally plausible covers, and a wrong guess can cost an extra term.
Petrick's method removes the guesswork. It writes the covering requirement as a Boolean expression and expands it. The result lists every irredundant cover, so you can pick the cheapest.
The idea
Give each PI a Boolean variable that is 1 when you select that PI. For each uncovered minterm, write a sum (OR) of the PIs that cover it. That sum must be true, because at least one covering PI has to be chosen. All minterms must be covered at once, so you AND the sums together:
P = (sum for ma) · (sum for mb) · …
Multiply P out into a sum of products. Each product term is a set of PIs, and choosing exactly those PIs covers every minterm. Two laws keep the expansion small:
- Idempotence: X·X = X
- Absorption: X + XY = X
After absorption, every remaining product is an irredundant cover. Compare them by cost and keep the cheapest.
A worked cyclic example
Take F(A,B,C) = Σm(0,1,2,5,6,7). This is the function in the chapter's Quine-McCluskey code. It has six prime implicants, which we name P1 to P6:
| PI | Term | Minterms covered |
|---|---|---|
| P1 | A'B' | 0, 1 |
| P2 | B'C | 1, 5 |
| P3 | AC | 5, 7 |
| P4 | AB | 6, 7 |
| P5 | BC' | 2, 6 |
| P6 | A'C' | 0, 2 |
On a K-map with Gray-coded columns, the function looks like this:
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 |
The six 1-cells form a ring, and the six pairs are the ring's edges. The chart is:
| PI | m0 | m1 | m2 | m5 | m6 | m7 |
|---|---|---|---|---|---|---|
| P1 | x | x | - | - | - | - |
| P2 | - | x | - | x | - | - |
| P3 | - | - | - | x | - | x |
| P4 | - | - | - | - | x | x |
| P5 | - | - | x | - | x | - |
| P6 | x | - | x | - | - | - |
Every column has exactly two x marks, so there is no essential PI. No row contains another row. The chart is cyclic.
Writing the product
Reading the columns gives one sum per minterm:
P = (P1+P6)(P1+P2)(P2+P3)(P3+P4)(P4+P5)(P5+P6)
Expanding with absorption
Work in pairs and absorb as you go.
- (P1+P6)(P1+P2) = P1 + P1P2 + P1P6 + P2P6 = P1 + P2P6.
- (P3+P4)(P4+P5) = P4 + P3P5, by the same steps.
- Multiply the first two results: (P1 + P2P6)(P4 + P3P5) = P1P4 + P1P3P5 + P2P4P6 + P2P3P5P6.
- Multiply by (P2+P3). After absorbing P1P2P3P5 into P1P3P5, you get P1P2P4 + P1P3P4 + P1P3P5 + P2P4P6 + P2P3P5P6.
- Multiply by (P5+P6). After absorption you get:
P = P1P3P5 + P2P4P6 + P1P2P4P5 + P1P3P4P6 + P2P3P5P6
The term P1P3P4P5 appeared along the way. It was absorbed by P1P3P5.
Choosing the cover
The two shortest terms use three PIs each:
- P1P3P5 gives F = A'B' + AC + BC'.
- P2P4P6 gives F = B'C + AB + A'C'.
Each has 3 terms and 6 literals, so they tie. The other three products need four PIs and are not minimal. This function therefore has two distinct minimal SOP forms, which is typical of cyclic charts.
Cost and tie-breaking
"Cheapest" needs a definition. The standard order for GATE-style problems is:
- Fewest product terms (fewest PIs).
- Among those, fewest literals.
When PIs have different literal counts, the product with the fewest PIs is not always the cheapest overall. Compute the literal total for every surviving product before deciding. If your textbook counts gate inputs instead, use that count for the second step.
Automating the expansion
The same procedure can be written directly in Python. The loop handles one minterm at a time, then removes any product that contains a smaller one.
PIS = {
"P1": ("A'B'", {0, 1}),
"P2": ("B'C", {1, 5}),
"P3": ("AC", {5, 7}),
"P4": ("AB", {6, 7}),
"P5": ("BC'", {2, 6}),
"P6": ("A'C'", {0, 2}),
}
MINTERMS = [0, 1, 2, 5, 6, 7]
def absorb(terms):
kept = []
for t in sorted(set(terms), key=len):
if not any(k <= t for k in kept):
kept.append(t)
return kept
def petrick(pis, minterms):
products = [frozenset()]
for m in minterms:
covering = [name for name, (_, cells) in pis.items() if m in cells]
products = absorb(p | {c} for p in products for c in covering)
return products
def literals(term):
return sum(ch.isalpha() for ch in term)
def cost(cover, pis):
return (len(cover), sum(literals(pis[n][0]) for n in cover))
covers = petrick(PIS, MINTERMS)
best = min(cost(c, PIS) for c in covers)
for c in sorted(covers, key=lambda c: (cost(c, PIS), sorted(c))):
mark = " <- minimal" if cost(c, PIS) == best else ""
print(sorted(c), f"cost={cost(c, PIS)}{mark}")The output is:
['P1', 'P3', 'P5'] cost=(3, 6) <- minimal
['P2', 'P4', 'P6'] cost=(3, 6) <- minimal
['P1', 'P2', 'P4', 'P5'] cost=(4, 8)
['P1', 'P3', 'P4', 'P6'] cost=(4, 8)
['P2', 'P3', 'P5', 'P6'] cost=(4, 8)This matches the hand expansion, including the absorbed terms that do not appear.
Edge cases and common errors
- Don't-cares. Leave don't-care minterms out of the chart columns, so they never appear as a sum in the product. Don't-cares may still help form large PIs, but they need no covering.
- Reduce first. Always remove essential PIs and dominated rows and columns before building the product. Skipping this step makes the expansion much longer without changing the answer.
- Forgetting absorption. Without X+XY=X the product grows exponentially, and you will list covers that contain redundant PIs.
- Repeated variables. A term like P1·P1·P2 must be reduced to P1P2 using X·X = X. It is not a three-PI cover.
- Wrong minimality criterion. The product with the fewest PIs is the starting point, not always the final answer. Check literals when PIs differ in size.
- Scale. The number of intermediate products can grow quickly with the chart size. This is why Petrick's method is done by hand only on small cyclic cores.
Summary of the procedure
- Build the chart and strip essential PIs, covered minterms, and dominated rows and columns.
- If a cyclic core remains, name the remaining PIs and write one sum per remaining minterm.
- AND the sums and expand using X·X = X and X + XY = X.
- Add back the essential PIs to every surviving product.
- Choose the product with the lowest cost by fewest terms, then fewest literals.
Exercise
A cyclic core has three minterms and three PIs. Minterm a is covered by P1 or P2, minterm b by P1 or P3, and minterm c by P2 or P3. Write the Petrick product, expand it, and state the minimal covers.
Show answer
P = (P1+P2)(P1+P3)(P2+P3). First, (P1+P2)(P1+P3) = P1 + P1P3 + P1P2 + P2P3 = P1 + P2P3. Then (P1 + P2P3)(P2+P3) = P1P2 + P1P3 + P2P3 (P2P3 absorbs P2P3·P2 and P2P3·P3). Every product has two PIs, so any two of the three PIs form a minimal cover. If the PIs have equal literal counts, there are three equally good answers.
Exercise
In the worked example, you also have an essential PI E that covers minterm m9. Does E appear in the Petrick product? What do you do with E afterwards?
Show answer
E does not appear in the product, because essential PIs are removed before the product is built, along with the minterms they cover. After expanding and choosing the cheapest product, add E back to that cover to form the final minimal expression.