Boolean Algebra, Canonical Forms & Logic Minimization
Boolean algebra separates binary behavior from its representation; canonical DNF, CNF, and ANF expose different structure, while Post's criterion, exact two-level minimization, and hazard analysis explain what a gate basis or simplified expression does and does not guarantee.
Boolean algebra separates a binary specification from any particular formula or gate network. Its equations establish steady-state input/output equivalence: they do not by themselves predict delay, fan-out, power, metastability, or glitches. Good logic design therefore keeps three questions distinct: what function is required, how that function is represented, and how the chosen representation behaves as a physical circuit.
Abstract Boolean algebra and the two-element model #
An abstract Boolean algebra is a set with join , meet , complement , least element , and greatest element . The operations form a bounded distributive lattice and every has a complement:
The elements need not be truth values. For example, the subsets of a universe form a Boolean algebra under union, intersection, and set complement. Digital logic normally uses the special two-element algebra , with interpreted as false and as true. That interpretation is a convention of the model, not an axiom that every abstract Boolean algebra has only two elements.
For , an -ary Boolean function is a map
There are such functions: a truth table has rows, and each row's output can independently be 0 or 1. This count includes functions that ignore some formal arguments. A variable is essential for exactly when two input vectors exist that differ only in coordinate and produce different outputs. Otherwise is a dummy variable for that function.
Formulas are syntax; functions are behavior #
A Boolean formula is a finite syntax tree built from variables, constants, and operations. Assigning values to its variables evaluates the tree and induces a Boolean function. Different trees can induce the same function:
The left formula contains , but the induced function does not essentially depend on . Two formulas are equivalent when their induced functions agree on every assignment. This distinction matters throughout minimization: the object being preserved is the function, while literals, terms, depth, and gates are costs of a chosen representation.
The same function can also be represented by a truth table, a set of ON-set rows, a decision diagram, a circuit, or one of several algebraic normal forms. None of these representations is the function itself.
DNF, CNF, and their canonical forms #
A literal is or . A disjunctive normal form (DNF), called a sum of products in switching algebra, is an OR of ANDs of literals. A conjunctive normal form (CNF), or product of sums, is an AND of ORs of literals. Ordinary DNF and CNF terms may omit variables.
For an input vector , its minterm contains every variable exactly once and is true at that row alone:
Its maxterm also contains every variable exactly once and is false at that row alone:
Consequently every Boolean function has canonical expansions
The first is the canonical DNF; the second is the canonical CNF. The empty disjunction is , so it represents the constant-zero function, and the empty conjunction is , so it represents the constant-one function. These conventions prevent the constants from becoming exceptions to the theorem.
With variable order and binary row indices, consider
Its zero rows are , so the same function is . The symbols and are unambiguous only after the variable order and row-number convention are stated. Canonical forms are systematic and unique up to term ordering, but they deliberately repeat information and are seldom minimal.
Algebraic normal form over GF(2) #
Another basis treats XOR as addition and AND as multiplication in the field . Because and a Boolean input satisfies , every Boolean function has a unique square-free algebraic normal form (ANF), also called a Zhegalkin polynomial:
The empty product is 1 and supplies the constant coefficient. If denotes the input whose 1-coordinates are exactly the set , then the coefficients can be recovered directly from the truth table:
This is the Möbius transform on the subset lattice; applying the same XOR transform again recovers the truth table. It also proves uniqueness: the square-free monomials form a basis for the -dimensional vector space of Boolean truth tables over .
For the previous example,
ANF exposes algebraic degree and XOR structure that DNF can hide. For instance,
Functions whose ANF has degree at most one have the form . They are affine; the narrower word linear is appropriate only when .
Functional completeness and Post's five obstructions #
A gate basis is useful only if composition can express the required functions. Start with a family of Boolean functions, allow projections such as , and repeatedly substitute outputs of functions into inputs of other functions. The resulting composition-closed family is the clone generated by . The basis is functionally complete when this clone contains every Boolean function.
Post's 1921 paper developed the truth-table and metalogical setting. At the opening of Section 26 of his 1941 monograph, he states that there are exactly five immediately subcomplete closed systems and gives the corresponding generator criterion. Modern clone theory supplies the composition-and-maximal-clone framework; a modern five-class account presents the obstructions as the following maximal proper Boolean classes:
The table uses the common symbols for the self-dual clone and for the affine clone. Gonda writes these two classes as SF and ; this is only a notation change.
| Clone | Membership condition for |
|---|---|
| Zero-preserving: | |
| One-preserving: | |
| Monotone: for all implies | |
| Self-dual: | |
| Affine: the ANF of has degree at most one |
Every proper Boolean clone is contained in at least one of these five. Therefore the exact completeness criterion is
In words: for each of the five classes, at least one generator must lie outside it. The same generator may escape several classes, and different generators may supply different witnesses. Escaping all five is not merely a useful heuristic; it is both necessary and sufficient.
NAND and NOR are universal bases #
The Post criterion proves completeness abstractly; explicit identities show how synthesis works. Define NAND and NOR by
NAND alone constructs NOT, AND, and OR:
NOR has the dual constructions:
Since NOT, AND, and OR can express every canonical DNF or CNF, either or is a universal basis. Universality says that an implementation exists; it says nothing about whether the resulting gate count, depth, delay, or power is acceptable.
Implicants are cubes in the input space #
For two-level sum-of-products minimization, partition the input rows into an ON-set where the output must be 1, an OFF-set where it must be 0, and optionally a don't-care set where either output is allowed. A product term can be written as a cube over : a dash means that coordinate is unconstrained. For example, the cube denotes and covers both and .
A cube is an implicant of a fully specified function when every row it covers lies in the ON-set. With don't-cares, a usable implicant may cover rows in but no row in the OFF-set, and it must cover at least one required ON row.
- A prime implicant is an implicant from which no fixed literal can be removed without covering an OFF row. Geometrically, it is a maximal legal cube.
- An essential prime implicant covers at least one ON minterm that no other prime implicant covers. Every valid SOP cover must select it.
Prime does not mean globally optimal. Prime implicants are the maximal-cube, literal-irreducible candidates; a prime may still be redundant in a selected cover. Selecting a minimum-cost subset of the primes is a separate covering problem.
Quine–McCluskey: generate primes, then solve the cover #
The Quine–McCluskey method makes both phases explicit:
- List the ON and don't-care minterms as bit strings and group them by number of 1s.
- Combine terms that have the same dash positions and differ in exactly one remaining fixed coordinate, replacing that coordinate with a dash. Mark both parents as combined and deduplicate identical results.
- Repeat on the new cubes. Retain every generated cube through all combination rounds, including a cube that currently covers only don't-care rows: it may still combine with an ON-containing cube to remove another literal. Every cube left uncombined in an iteration is a prime candidate. Only after all rounds, discard final candidates that cover no required ON row.
- Build a prime-implicant chart whose columns are required ON minterms only. Don't-care rows helped form larger primes but do not require coverage.
- Select essential primes, remove the ON columns they cover, and solve the remaining set-cover problem exactly, for example with Petrick's method or branch-and-bound.
For , the initial minterms are , , , and . Pairwise combinations produce three primes:
Minterm is covered only by , while is covered only by . Those two essential primes already cover the whole ON-set, so is redundant and
The word minimum needs an explicit cost contract. In this example, use the lexicographic objective
and minimize among all valid two-level SOP covers of the required ON-set under the stated don't-care contract. A weighted cell-area model, a maximum-fan-in limit, shared inversions, or a delay objective can choose a different cover. Prime generation can itself be exponential, and the residual chart is a set-cover problem; the method is exact, not inherently cheap.
Karnaugh and Veitch maps #
Veitch and Karnaugh diagrams encode the same Boolean-cube adjacency idea: neighboring cells must differ in exactly one input bit. The common Karnaugh layout labels rows and columns in Gray-code order so that geometric rectangles correspond to implicants. For the running example:
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 |
The upper cells in columns 01 and 11 form ; the lower cells in columns 00 and 01 form . A legal group:
- contains cells for some ;
- contains only ON or chosen don't-care cells, never an OFF cell;
- is rectangular in the map's wrapped topology; and
- contributes the literals whose coordinates remain fixed across the group.
The left and right edges are adjacent, as are the top and bottom edges. In a four-variable map the four corners are therefore one rectangular group. This wrap is not a drawing trick: it is the adjacency of vertices in the Boolean hypercube.
A don't-care cell may be treated as 1 when it enlarges a useful group or as 0 when it does not; different groups may simply ignore it. The final circuit chooses some concrete output on that row, so the don't-care assumption is safe only while the environment truly permits either value.
Karnaugh maps work well for human inspection of a small number of variables. Quine–McCluskey preserves the same cube operations in a tabular algorithm, but exact methods still scale poorly; industrial synthesis uses more sophisticated exact or heuristic procedures and optimizes beyond a single two-level expression.
Boolean minimum is not circuit minimum #
Algebraic identities such as absorption and De Morgan's laws preserve the function:
They do not define a unique hardware cost. A minimum-literal SOP can be worse after technology mapping than a factored multilevel network; factoring can reduce gate count yet increase depth, fan-out, reconvergent paths, or critical delay. A universal NAND-only realization can likewise be larger than a mixed-gate realization. The cost function must match the available cells and the physical objective.
Hazards are a separate boundary. Consider
When and changes, the ideal function remains 1. Unequal delays through the two paths can nevertheless make both product terms temporarily 0, producing a static-1 hazard. In a two-level AND–OR implementation under the single-input-change model, adding the consensus term closes the adjacent ON transition:
The consensus term is redundant in steady-state Boolean algebra and may make the SOP more expensive, yet it supplies temporal overlap. A later multilevel rewrite or technology mapper can reintroduce a hazard, so hazard freedom must be checked on the implemented topology and delay model, not inferred from the source expression alone.
Synchronous sampling often masks a combinational glitch when every path settles before the receiving clock edge. That protection does not automatically apply to asynchronous controls, clocks, latches, analog enables, clock-domain crossings, or external interfaces.
A disciplined design flow #
- State the legal input space and specify ON, OFF, and don't-care rows. Treat every don't-care as an environmental contract.
- Fix variable order and derive a truth table or another executable specification.
- Choose a representation that exposes the needed structure: canonical DNF/CNF for row-level traceability, ANF for XOR and degree, or cubes for two-level minimization.
- Declare the cost model before claiming a minimum. For an exact SOP, generate primes and solve the covering phase rather than relying on greedy grouping.
- Map the selected function into the actual gate or cell library, accounting for fan-in, inversions, sharing, depth, load, and power.
- Verify functional equivalence over all legal inputs, then verify hazards and timing against the implemented network and its operating assumptions.
The truth table is the behavioral contract, minimization chooses a representation under a cost model, and circuit verification checks the physical consequences. Conflating those layers is the source of most “algebraically correct but electrically wrong” logic designs.
Sources
- bookComputer Electronics: Digital Electronic Devicespdfnotes
- bookDiscrete Mathematics: Lecture Notes, Part 2pdfnotes
- paperIntroduction to a General Theory of Elementary Propositionspdfnotes
- bookThe Two-Valued Iterative Systems of Mathematical Logicnotes
- paperMinimization of Boolean Functionspdfnotes
- paperThe Map Method for Synthesis of Combinational Logic Circuitspdfnotes
- bookCompositions and Clones of Boolean Functions (Official Excerpt, pp. 3–10)pdfnotes
- paperPolynomial-like Boolean Functions and the Maximal Closed Classespdfnotes