Digital Logic Toolkit — SOP & POS canonical forms
SOP and POS Canonical Forms
Expand to canonical minterms and maxterms, and convert between the two.
Accepts + · ' ¬ ∧ ∨ ⊕ ~ ! & | and the words AND, OR, NOT, XOR.
read as (A + (¬B · C))
Notation ▾
+ is OR, juxtaposition is AND, a trailing ' is NOT. The fully parenthesised reading is always echoed back. Mᵢ complements the variable wherever bit i is 1, so M₅ over [A, B, C] is (A′ + B + C′). The full notation table and the maxterm convention are below.
Most significant bit first. Changing the order renumbers every minterm and every maxterm, and both lists are reprinted rather than left stale.
Start from a worked example
Four forms of one function
Read as ?expr=A + B'C — Σm(1, 4, 5, 6, 7) · ΠM(0, 2, 3) over A, B, C.
| Form | Expression | Cost | Copy |
|---|---|---|---|
| Canonical SOPcanonical — one product term per 1-row, every variable in every term | A′ · B′ · C + A · B′ · C′ + A · B′ · C + A · B · C′ + A · B · C | 5 terms · 15 literals | |
| Canonical POScanonical — one sum term per 0-row, every variable in every term | (A + B + C) · (A + B′ + C) · (A + B′ + C′) | 3 terms · 9 literals | |
| Minimal SOPthe cheapest sum of products, by Quine–McCluskey | B′ · C + A | 2 terms · 3 literals | |
| Minimal POSthe cheapest product of sums, minimised from the OFF-set | (A + C) · (A + B′) | 2 terms · 4 literals |
Minimal SOP is the cheapest of the four here — 2 terms · 3 literals, against 5 terms · 15 literals for the canonical SOP.
Canonical is unique for this variable order; minimal need not be. The badges on the minimal forms below say which claim is being made.
Minimal forms
Minimal SOP
B′ · C + A
Minimal POS
(A + C) · (A + B′)
SOP is cheaper here — 2 terms · 3 literals as a sum of products against 2 terms · 4 literals as a product of sums.
Why you can trust the count
Two pipelines run over the same prime-implicant chart. The walkthrough uses essential primes, then minterm (“row”) dominance, then implicant (“column”) dominance, then Petrick’s method — the sequence a textbook shows, which reaches one correct answer.
The list of every minimum cover is produced by a second pipeline that uses essentials and minterm dominance only. Essential-prime extraction is safe for enumeration and minterm dominance is safe; implicant dominance is not — striking out a dominated prime discards every cover that used it, and some of those cost exactly the minimum.
So the walkthrough answers “what is an optimum?” and the list answers “what are all the optima?”. Both are shown because the textbook shows the first and the truth is the second.
Canonical SOP
One product term per 1-row, every variable in every term.
A′ · B′ · C + A · B′ · C′ + A · B′ · C + A · B · C′ + A · B · C
5 product terms · 15 literalscanonical — unique for this variable order
Canonical POS
One sum term per 0-row, every variable in every term.
(A + B + C) · (A + B′ + C) · (A + B′ + C′)
3 sum terms · 9 literalscanonical — unique for this variable order
The canonical POS is shorter here — 9 literals against 15 in the canonical SOP. Neither is minimal; both are the truth table written out.
For a fixed variable order there is exactly one canonical SOP and exactly one canonical POS: they are the truth table rewritten. Minimal forms are the output of a covering problem and may tie — uniqueness has to be asked separately for each.
Minterms and maxterms
Σm()
ΠM()
The maxterm indices are exactly the indices the minterm list does not contain. {0…7} \ {1, 4, 5, 6, 7} = {0, 2, 3}
Don’t-cares belong to neither list, so the three counts add up to the whole index space: 5 + 3 + 0 = 8 = 2³
Σm(1, 4, 5, 6, 7) over 3 variables is ΠM(0, 2, 3).
The index sets do not change when you convert — the same numbers move from one list to the other. The variable order does matter, because the indices are positional.
| i | ABC | F | Minterm mi | Maxterm Mi |
|---|---|---|---|---|
| 0 | 000 | 0 | A′ · B′ · C′ | (A + B + C) |
| 1 | 001 | 1 | A′ · B′ · C | (A + B + C′) |
| 2 | 010 | 0 | A′ · B · C′ | (A + B′ + C) |
| 3 | 011 | 0 | A′ · B · C | (A + B′ + C′) |
| 4 | 100 | 1 | A · B′ · C′ | (A′ + B + C) |
| 5 | 101 | 1 | A · B′ · C | (A′ + B + C′) |
| 6 | 110 | 1 | A · B · C′ | (A′ + B′ + C) |
| 7 | 111 | 1 | A · B · C | (A′ + B′ + C′) |
The maxterm convention
Mᵢ complements the variable wherever bit i is 1. Over [A, B, C] that makes M₅ — binary 101 — the sum term (A′ + B + C′), not (A + B′ + C). A minterm is the opposite way round: it complements the variable wherever the bit is 0. That opposition is the whole difficulty, which is why the table below prints both columns side by side rather than describing them.
mᵢ′ = Mᵢ — complementing a minterm by De Morgan turns the product into a sum and every literal into its complement, which is exactly the maxterm at the same index.
Show the expansion working — how to get to canonical form by hand
Expanding to canonical SOP
Multiply each product term by (x + x′) for every variable it is missing [Complement, then Identity], distribute [Distributive], then drop the duplicates [Idempotent].
A is missing B and C, so it is padded with (x + x′) for each.
AequalsA · (B + B′) · (C + C′)[Complement, Identity]
A · (B + B′) · (C + C′)equalsA · B′ · C′ + A · B′ · C + A · B · C′ + A · B · C[Distributive]
B′ · C is missing A, so it is padded with (x + x′) for each.
B′ · CequalsB′ · C · (A + A′)[Complement, Identity]
B′ · C · (A + A′)equalsA′ · B′ · C + A · B′ · C[Distributive]
6 terms before duplicates; 1 repeat, and idempotence removes them, leaving 5 distinct minterms.
The count check: the number of distinct minterms must equal the number of 1-rows in the truth table — 5 here.
Method: Shannon (1938), the expansion theorem the canonical forms are a corollary of
Expanding to canonical POS
The expression is not written as a product of sums, so the expansion is read straight off the truth table instead: canonical POS is one sum term per 0-row.
M0equalsA + B + C[0-row 0]
M2equalsA + B′ + C[0-row 2]
M3equalsA + B′ + C′[0-row 3]
Method: Shannon (1938), the expansion theorem the canonical forms are a corollary of
Contingent — true in 5 of 8 rows
| # | A | B | C | B′ | B′ · C | F |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 1 |
| 2 | 0 | 1 | 0 | 0 | 0 | 0 |
| 3 | 0 | 1 | 1 | 0 | 0 | 0 |
| 4 | 1 | 0 | 0 | 1 | 0 | 1 |
| 5 | 1 | 0 | 1 | 1 | 1 | 1 |
| 6 | 1 | 1 | 0 | 0 | 0 | 1 |
| 7 | 1 | 1 | 1 | 0 | 0 | 1 |
Notation and operator precedence used here
Products are written A · B, sums A + B, and a complement carries a prime: A′. Every spelling below is accepted on input and input is NFKC-normalised before parsing, so a full-width A and a plain A are the same variable.
| Operation | Accepted input | Rendered as |
|---|---|---|
| NOT | A', !A, ~A, ¬A, NOT A | A′ |
| AND | A·B, A*B, A&B, A∧B, A AND B, AB | A · B |
| OR | A+B, A|B, A∨B, A OR B | A + B |
| XOR | A^B, A⊕B, A XOR B | A ⊕ B |
| XNOR | A@B, A⊙B, A XNOR B | A ⊙ B |
| NAND | A↑B, A NAND B | A ↑ B |
| NOR | A↓B, A NOR B | A ↓ B |
| IMPLIES | A->B, A=>B, A→B | A → B |
| IFF | A<->B, A<=>B, A↔B, A≡B | A ↔ B |
| Constants | 0, 1, F, T, FALSE, TRUE | 0, 1 |
Precedence, highest to lowest. ( ) → postfix ′ and prefix NOT → AND (including juxtaposition) → XOR / XNOR → NAND / NOR → OR → IMPLIES (right-associative) → IFF. Textbooks genuinely disagree about where XOR sits, so the fully parenthesised reading of whatever you type is echoed under the field and an unbracketed mix of XOR, XNOR, NAND or NOR with AND or OR raises a non-blocking warning.
Bit order. The variable list is most-significant-bit first, so over A B C the index 5 is A = 1, B = 0, C = 1. Reordering the variables renumbers every minterm and every maxterm, which is why the order is a control rather than an assumption.
The maxterm convention. Mᵢ complements the variable wherever bit i is 1. Over [A, B, C] that makes M₅ — binary 101 — the sum term (A′ + B + C′), not (A + B′ + C). A minterm is the opposite way round: it complements the variable wherever the bit is 0. That opposition is the whole difficulty, which is why the table below prints both columns side by side rather than describing them.
Four forms, and which one you were asked for
The words are used loosely and the marks depend on which is meant, so here they are side by side. Every row below is a statement about form, not about the function: the same function has all of them at once.
| Name | Also called | What it is | Unique? |
|---|---|---|---|
| Canonical SOP | standard SOP, canonical DNF, expanded sum of products, minterm form | one product term per 1-row, every variable in every term | yes, for a fixed variable order |
| Canonical POS | standard POS, canonical CNF, maxterm form | one sum term per 0-row, every variable in every term | yes, for a fixed variable order |
| SOP / POS | sum of products, DNF; product of sums, CNF | any sum of products, or product of sums; terms need not be complete | no |
| Minimal SOP / POS | minimum SOP, minimum POS | the cheapest of them under a stated cost model | not necessarily |
Minterms and maxterms
mᵢ is the product term that is 1 at exactly index i; Mᵢ is the sum term that is 0 at exactly index i. A minterm is written by complementing each variable whose bit is 0; a maxterm by complementing each variable whose bit is 1 — the opposite way round, which is the whole difficulty.
That is why the minterm and maxterm table above prints both columns side by side rather than describing them, and why mᵢ′ = Mᵢ sits underneath it: complementing a minterm by De Morgan turns the product into a sum and every literal into its complement, which is exactly the maxterm at the same index.
Converting between Σm and ΠM
The rule is a set complement over {0 … 2ⁿ−1}, minus the don't-cares, and that is all. On the page's default Σm(1, 4, 5, 6, 7) over three variables is ΠM(0, 2, 3). Two facts people expect to be harder: the index sets do not change when you convert — the same numbers move from one list to the other — and the variable order matters, because the indices are positional.
Expanding to canonical form by hand
For SOP, multiply each term by (x + x′) for every variable x it is missing [Complement, then Identity], distribute [Distributive] and drop duplicates [Idempotent]. On the default, A is missing B and C, so it splits into four minterms; B′·C is missing A, so it splits into two; the duplicate A·B′·C is removed by idempotence, leaving five — Σm(1, 4, 5, 6, 7).
For POS the dual works: add x·x′ to each sum term that is missing x, then factor. Both walkthroughs are printed in full under Show the expansion working above, generated by the engine rather than written out here. The count check that catches an error: after expanding, the number of distinct minterms must equal the number of 1-rows in the truth table.
Why canonical form is worth having at all
It is the unique fingerprint of a function. Two expressions are equal exactly when their canonical forms match, which is how this toolkit's equivalence check works underneath — it compares truth masks, the same statement one step further compressed. Canonical SOP is also where Quine–McCluskey starts: it is the first row of the combining table.
Canonical is not minimal, and the gap is large
The default is A + B'C. Its canonical SOP is A′ · B′ · C + A · B′ · C′ + A · B′ · C + A · B · C′ + A · B · C — 5 terms · 15 literals. Its minimal SOP is B′ · C + A — 2 terms · 3 literals. Same function; five times the literals. Its canonical POS is (A + B + C) · (A + B′ + C) · (A + B′ + C′) and its minimal POS (A + C) · (A + B′). Minimal SOP is the cheapest of the four here — 2 terms · 3 literals, against 5 terms · 15 literals for the canonical SOP.
Nobody builds the canonical form. It exists to be compared and to be minimised — by named laws, on a map or in a table. All three reach the same answer.
Don't-cares and canonical form
Don't-cares belong to neither list, so |Σm| + |ΠM| + |d| = 2ⁿ. The consequence is stronger than it looks: a function with kdon't-cares has no single canonical form at all, but a family of 2ᵏof them, one per assignment of the don't-cares — all equally consistent with the specification. This page shows the one that reads every don't-care as 0, labels it as that, and states the alternative rather than implying uniqueness.
Limits, stated plainly
Canonical expansion is O(2ⁿ) and needs no minimiser at all, so it stays exact to 12 variables and the truth mask itself reaches 24. The row-by-row minterm and maxterm table stops at 8 variables, and says so where it stops rather than truncating quietly — the two lists and both canonical forms stay exact past it. Minimal forms are exact to 12 variables and near-minimal, badged as a heuristic, to 20. Equally minimal covers are enumerated to 200, and the badge says so when the cap is reached rather than printing a count nothing proved.
Worked examples
Worked examples
- F = A·B + Cintroexpand to canonical SOP and POS
- F(A,B,C) = Σm(1,3,5,7)introΣm and ΠM of the same function
- F = (A + B)·(B + C)corePOS in, both canonical forms out
- F(A,B,C) = Σm(0,1,2,4)coreF and F′ as index sets
- F = Ā·B + A·B̄coreXOR in canonical form
- F = A·B·C·D + Ā·B̄·C̄·D̄exam2 minterms, 14 maxterms
- F(A,B,C) = Aexamexpanding a term with 2 missing variables
- F(A,B,C,D) = Σm(0,3,5,6,9,10,12,15)edge case8 minterms; XNOR chain
Related
- Boolean algebra simplifier — from canonical to minimal, one named law at a time
- Quine–McCluskey solver — the canonical SOP is the first row of its table
- Karnaugh map solver — the minterm list, drawn
- Truth table generator — where the minterm list comes from
- De Morgan's laws — why mᵢ′ = Mᵢ
- The distributive law — the law that converts between the two forms
- Shannon expansion — canonical SOP, derived one variable at a time
- Logic gate diagram builder — what each form costs in gates
Sources
- Shannon, Claude E. “A Symbolic Analysis of Relay and Switching Circuits.” Transactions of the American Institute of Electrical Engineers 57, no. 12 (December 1938): 713–723. doi:10.1109/T-AIEE.1938.5057767 — canonical expansion of a switching function, and the expansion theorem the canonical forms are a corollary of.
- Boole, George. An Investigation of the Laws of Thought, on Which are Founded the Mathematical Theories of Logic and Probabilities. London: Walton and Maberly, 1854.
- Huntington, Edward V. “Sets of Independent Postulates for the Algebra of Logic.” Transactions of the American Mathematical Society 5, no. 3 (1904): 288–309. doi:10.2307/1986459.
- De Morgan, Augustus. Formal Logic: or, The Calculus of Inference, Necessary and Probable. London: Taylor and Walton, 1847 — mᵢ′ = Mᵢ.
- Quine, Willard V. “The Problem of Simplifying Truth Functions.” The American Mathematical Monthly 59, no. 8 (October 1952): 521–531. doi:10.2307/2308219.
- McCluskey, Edward J. “Minimization of Boolean Functions.” The Bell System Technical Journal 35, no. 6 (November 1956): 1417–1444. doi:10.1002/j.1538-7305.1956.tb03835.x.
- Karnaugh, Maurice. “The Map Method for Synthesis of Combinational Logic Circuits.” Transactions of the AIEE, Part I 72, no. 5 (November 1953): 593–599. doi:10.1109/TCE.1953.6371932.