Introduction
Every Boolean function has two canonical representations that are unique up to term order: the sum of minterms (canonical SOP) and the product of maxterms (canonical POS). From those forms you can read the truth table directly, and you can ask which gate sets are functionally complete: able to express every Boolean function. NAND alone and NOR alone are complete; AND and OR together are not (no NOT).
The working skills are minterm and maxterm numbering, conversions between SOP and POS, and deciding whether a given gate set is complete (with a short functional-completeness argument).
Prerequisites
- Boolean Algebra: literals, truth tables, De Morgan, counting of functions.
Core concepts
Minterms and maxterms
For variables ordered left to right:
- A minterm is the product that is 1 only for the input row whose binary index is . Example (): .
- A maxterm is the sum that is 0 only for input row . Example: (each variable is complemented relative to the minterm pattern).
Relation: as functions, and .
Canonical SOP and POS
If on index set , then
(the sum of those minterms). If on index set , then
(the product of those maxterms). The two sets partition : is the complement of .
Notation: .
The four index lists of one function
With the 1-rows of and the 0-rows:
| Function | As a sum of minterms | As a product of maxterms |
|---|---|---|
The dual row follows from : complementing all inputs maps row to row . For with : and .
Different count: minterms covered by a product term. A product of literals over variables covers minterms. So expands to and , giving : 5 minterms, not 6, because is shared. The number of functions of variables with exactly minterms is .
Standard (non-canonical) SOP and POS
A sum of products that is not necessarily minterms (some products omit variables) is an ordinary SOP. A product of sums that is not necessarily maxterms is an ordinary POS. Minimization seeks short SOP or POS forms; they are not unique, unlike the canonical ones.
Functional completeness
A set of Boolean operators is functionally complete (universal) if every Boolean function of any arity can be written using only operators from that set (and constants, or without constants, depending on the precise definition used in the question; this note allows composing the gates and using the input variables, and asks separately whether constants are needed).
| Set | Complete? | Reason sketch |
|---|---|---|
| yes | NOT: ; AND: ; OR via De Morgan | |
| yes | dual construction | |
| yes | OR by De Morgan | |
| yes | AND by De Morgan | |
| no | cannot make NOT; monotone functions only | |
| no | every result is linear and 0-preserving ( gives the constant 0, never 1) | |
| no | every result is affine; constants do not help | |
| no | both preserve 0, so NOT is impossible | |
| yes | NOT is ; AND and NOT suffice (Reed-Muller form) | |
| (implication ) | no | preserves 1: if all inputs are 1 the output is 1 |
| yes | ; OR is | |
| no | both are self-dual, and compositions of self-dual functions are self-dual | |
| (inhibition) with constant 1 | yes | , then : AND and NOT |
IMPERATIVE RULE. To show incompleteness, name an invariant preserved by the set (for example monotonicity for , or linearity over for ) that some target function violates (NOT is not monotone; AND is not linear).

How it works
Listing minterms from a truth table
Number rows 0 to in binary order of . Every row where contributes its minterm. That list is the canonical SOP.
SOP to POS
Complement the minterm list to get the maxterm list (the rows where ), then write . Alternatively: take the SOP of , then apply De Morgan once.
Gate conversion to NAND-only
- Obtain a minimal (or any) SOP.
- Apply double negation: , push the inner NOT with De Morgan to get a NAND-NAND form, or replace every AND by NAND with complemented outputs bubble-pushed.
Why NAND-NAND equals AND-OR. by De Morgan, and each is a NAND of the literals of . So a two-level NAND-NAND circuit realizes an SOP with the AND-OR levels replaced using NAND gates; the SOP is minimal only if it was minimized under the stated cost model, and this conversion alone does not prove gate-count optimality. Dually, NOR-NOR realizes a POS. A single literal entering the second level directly must be complemented.
The sixteen two-level forms
Taking any of AND, OR, NAND, NOR at each of the two levels gives 16 forms. Eight are degenerate: they collapse to a single gate. AND-AND and OR-OR are trivial; NAND-NOR and NOR-NAND collapse by De Morgan, for example . The other eight compute an SOP or POS:
| Computes | Forms |
|---|---|
| SOP (sum of products) | AND-OR, NAND-NAND, NOR-OR, OR-NAND |
| POS (product of sums) | OR-AND, NOR-NOR, NAND-AND, AND-NOR |
| Single gate (degenerate) | AND-AND, AND-NAND, OR-OR, OR-NOR, NAND-OR, NAND-NOR, NOR-AND, NOR-NAND |
Read AND-NOR as , an AND-OR-INVERT that gives the complement of an SOP, which equals a POS of the complemented function. NOR-OR and OR-NAND use complemented literals at the first level.
Minimum gate counts with one universal gate (two-input gates)
| Target | NAND gates | NOR gates |
|---|---|---|
| NOT | 1 | 1 |
| AND | 2 | 3 |
| OR | 3 | 2 |
| XOR | 4 | 5 |
| XNOR | 5 | 4 |
The 4-NAND XOR is , then . No circuit of fewer two-input NAND gates computes XOR; the counts in the table are minimum over all circuits, not only over two-level forms.
Algorithms and pseudocode
MINTERM-LIST(truth_table, n)
1 S <- empty list
2 for i <- 0 to 2^n - 1
3 if truth_table[i] = 1 then append i to S
4 return S
CANONICAL-SOP(S, n)
1 return OR over i in S of MINTERM(i, n)
IS-COMPLETE-BY-NAND-BUILD(gateset)
1 // constructive check used in notes: can we build NOT, AND, OR?
2 return (NAND in gateset) or (NOR in gateset)
or ({AND,NOT} subset gateset) or ({OR,NOT} subset gateset)The constructive check is sufficient but not necessary: sets such as and are complete without containing NAND, NOR or NOT directly. The exact test is Post's criteria below.
Algorithm costs, not gate delays. Use unit-cost indexed row lookup, word comparison and amortised constant-time output append; an index/loop word must hold . Inputs and output buffers are excluded from workspace. MINTERM-LIST reads all rows: time in best, average and worst cases, working words, and output-list words. With iterative literal emission, CANONICAL-SOP takes time and output tokens in every case, and workspace beyond the input/output. Empty emits constant 0; for , the sole selected zero-variable minterm emits constant 1. For IS-COMPLETE-BY-NAND-BUILD, precomputed membership flags for the fixed named basis make time and auxiliary space in all cases, excluding the input and Boolean result. If gates arrive as an unsorted list of word-sized tags, first building those flags takes time and words. These are representation-specific software costs, not arbitrary-precision or circuit-latency claims.
Mathematical explanation
Uniqueness. Canonical SOP is unique because each minterm corresponds to exactly one 1 in the truth table. Canonical POS is unique for the same reason on the 0s.
Post's criteria. Emil Post showed that a set of Boolean functions (with composition and the input variables freely available, constants only if they are in ) is functionally complete if and only if, for each of the five classes below, contains at least one function outside that class. Each class is closed under composition, so a set lying inside one class can never leave it; that is the incompleteness argument.
| Class | Member satisfies | Example member | Example non-member |
|---|---|---|---|
| , 0-preserving | AND, OR, XOR | NOT, NAND, constant 1 | |
| , 1-preserving | AND, OR, | NOT, XOR, constant 0 | |
| , self-dual | NOT, MAJ, | AND, OR, constants | |
| , monotone | implies | AND, OR, MAJ, constants | NOT, XOR, |
| , affine | NOT, XOR, XNOR, constants | AND, OR, NAND |
Applying the test. Mark, for each function in the set, which classes it falls outside; the set is complete when every column has a mark.
- NAND on its own: NAND (outside ), NAND (outside ), not monotone, not affine, and not self-dual (at , NAND gives 1 and at the complement also 1). Complete.
- : both lie in , and . Incomplete (three reasons, one is enough).
- : both in . Incomplete. Add the constant 1 and every column gets a mark: 1 is outside and , XOR is outside and , and AND is outside . Complete.
A completeness question names a gate set (sometimes with constants 0 and 1 allowed) and asks if it is complete. Two steps settle it: try to construct NOT and either AND or OR; if that fails, find the class that contains every member of the set.
Worked examples
Example 1: for
Rows: . Canonical SOP: . Zeros at , so POS: , that is .
Example 2: NAND builds NOT
.
Example 3: cannot make NOT
Any expression using only AND and OR is monotone: flipping an input from 0 to 1 never flips the output from 1 to 0. NOT is not monotone, so it cannot be expressed.
Example 4: number of minterms
For there are 16 minterms . A function with ones has exactly minterms in its canonical SOP.
Example 5: expand to canonical form and convert
. The term covers ; covers . So , that is . The complement is .
Example 6: is complete for ?
Check the five classes. : outside . : outside . is not monotone (raising from 0 to 1 at lowers the output from 1 to 0). It is not affine (it contains the product ). Self-dual? At the value is 1, and at the complement input it is 0, which is consistent; but at the value is 1 and at it is also 1, so is not self-dual. All five marks: complete. Constructively, (since ), and NOT together with gives AND.
Important properties and observations
- and for .
- Expanding a non-canonical product by inserting recovers minterms (Shannon expansion).
- Active-low logic: a NAND network is natural when outputs assert 0; De Morgan dualizes the drawing.
Common misconceptions.
- "SOP means canonical SOP." SOP is any sum of products; canonical means every product is a minterm.
- "NAND is complete only with two inputs." Multi-input NAND is also complete; two-input NAND already is.
- "XOR and NOT are complete." Without a constant or AND, you stay inside affine functions; check the question's allowed constants.
- "Adding constants makes complete." Constants are affine too; the set stays inside .
- "The dual of is ." That is the complement written as a product. The dual uses the mirrored indices .
- "A product of literals and another of literals together cover minterms." Only if they are disjoint; count the overlap once.
GATE examination perspective
- MINTERM INDEXING. Confirm variable order; for is when is MSB.
- SOP TO POS. Complement the index list.
- FUNCTIONAL COMPLETENESS. Prove by construction (build NOT, AND, OR) or by invariant (monotonicity, linearity).
- COUNT ONES. Number of minterms equals number of 1s in the truth table.
- POST TABLE. For an unfamiliar gate, test , , monotonicity, linearity and self-duality; one gate outside all five classes is complete on its own.
- CONSTANTS ALLOWED? Read whether 0 and 1 are free inputs; and change answer when they are.
- TWO-LEVEL FORMS. NAND-NAND is SOP, NOR-NOR is POS; NAND-NOR and NOR-NAND are degenerate.
- GATE COUNTS. XOR takes 4 two-input NANDs or 5 two-input NORs.
Summary
Sources
- M. Morris Mano, M. D. Ciletti, Digital Design, 5th ed., Pearson, 2013: Chapter 2, Sections 2.5 to 2.8 (Boolean functions, canonical and standard forms, other logic operations, digital logic gates).