Problemcore
Two-level logic minimization
Also called SOP minimization, two-level minimization.
Given a Boolean function with don't-cares, find a sum of products for it with the fewest product terms, then the fewest literals. NP-hard from a truth table, Sigma_2^p-complete from a DNF.
Two-level logic minimization asks for a cheapest sum of products of a Boolean function, where the function may have don't-care conditions. The cost is the number of product terms first and the number of literals second. A sum of products is a circuit with one level of AND gates and one OR gate, or a programmable logic array (PLA), so the cost is the gate count, or the number of PLA rows. The problem was the first big problem of logic synthesis, from Quine and McCluskey in the 1950s to Espresso in the 1980s. Its hardness depends on how the function is given. From a truth table, the decision version is NP-complete (Masek 1979, unpublished; later proofs by Czort 1999 and by Allender and coauthors 2008). From a DNF formula, it is -complete (Umans 2001), one level above NP in the polynomial hierarchy.
In plain words
A light must turn on for some settings of a few switches and stay off for others. For a few settings you do not care. You want to build the rule with AND gates feeding one OR gate. Each AND gate looks at some switches and fires when each one is in the position it wants. The light is on when any gate fires. A gate that checks fewer switches fires for more settings, so it does more work. The task is to use as few gates as you can, and then as few gate inputs as you can. A gate must never fire for a setting where the light must stay off. For a setting you do not care about, a gate may fire or not.
Definition
Input. A function of variables, given by its on-set and its don't-care set . The off-set is . The input form is part of the problem; the common forms are below under Variants.
Feasible solutions. A set of cubes, each a product of literals, such that
Such a is a cover of . Each cube of a cover is an implicant.
Objective. Minimize the cost
in lexicographic order, where is the number of literals of .
Decision version. Given and an integer , is there a cover with at most cubes? The literal version asks for at most literals in total.
By Quine's theorem on the prime implicant page, every minimum cover for this cost consists of prime implicants. So the problem is the same as: choose a cheapest set of primes whose union contains . This second form is a weighted set cover problem with the minterms of as the elements and the primes as the sets.
Variants
- By the input form.
- Truth table. and are given as lists of minterms, or as a table of entries. The input size is up to a factor .
- Cover, or DNF. and are given as sums of products. The input can be exponentially smaller than the truth table. This is the form of PLA files and of Espresso.
- BDD or circuit. is given by a binary decision diagram or by a circuit. Exact methods that work on BDDs of the primes use this form.
- By the cost. The number of cubes only; the number of literals only; the pair above; or weighted literals. For the number of cubes only, some minimum cover is prime, but not every one is.
- Minimal instead of minimum. A cover is minimal, or prime and irredundant, when each cube is prime and no cube can be dropped. Many minimal covers are not minimum. The heuristic tools find a minimal cover.
- Irredundant subcover. Given a cover and , is there a subset of at most of its cubes that is still a cover? Schaefer and Umans list this problem, IRREDUNDANT, as -complete for a DNF input.
- Multiple outputs. functions share one AND plane, so a cube used by several outputs is paid for once. The cost is the number of distinct cubes. Each output has its own don't-cares.
- Output phase. For each output, the PLA may build or and invert it. Choosing the phases is part of the problem.
- Multiple-valued inputs. Variables with more than two values, as in the input decoders of PLAs. Espresso-MV handles this form.
- Product of sums. A cheapest CNF of is the dual problem: a cheapest SOP of , with the roles of and swapped.
Examples
- BCD digit at least 5. and over . The minimum is : 3 cubes and 5 literals. Without it is , with 3 cubes and 9 literals.
- Essential primes and one choice. and over . The primes and are essential. The minterm 8 is left, and the primes and cover it at the same cost. Both covers have 3 cubes and 7 literals.
- A cyclic instance. over , the function "not all three equal". It has six primes, none essential, and each minterm lies in two of them. The minimum covers have 3 cubes and 6 literals, for example . The cover is minimal (prime and irredundant) but has 4 cubes.
- Parity. has a unique cover, its minterms, with literals.
Known algorithms
- Karnaugh map. By hand, for up to four or five variables. The primes are the largest rectangles. The usual reading takes the essential groups and then picks groups by eye, which is not always minimum.
- Quine-McCluskey. Exact. Lists all primes by merging cubes, then solves the prime table. The table step is exponential in the worst case.
- Petrick's method. Exact for the prime table. Lists every irredundant set of primes by multiplying out a product of sums, and can take exponential time and space.
- Greedy set cover on the prime table. A cover within a factor of the fewest cubes, after the primes are listed.
- Espresso. Heuristic. Works on covers without listing all primes, and returns a prime and irredundant cover. It has no proved bound on the gap to the minimum.
- Espresso-EXACT (Rudell and Sangiovanni-Vincentelli 1987) and the implicit methods surveyed by Coudert (1994). Exact, with the primes and the table stored as BDDs or ZDDs, and with branch and bound on the cyclic core.
- A pseudo-Boolean or MaxSAT solver on the covering step. Exact, with one 0-1 variable for each prime.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Espresso | O(n^2 c^3 (n^2 (r + c) + 2^n (c + r^2))) worst | O(n^2 (c + r)) extra | deterministicnot exactofflinerecursive | 1 language |
| Petrick's method | O(m p^2 T^2) worst | O(p T) extra | deterministicexactofflineiterative | 1 language |
| Quine-McCluskey algorithm | O(n^2 3^n + p^m poly(p, m)) worst | O(n 3^n) extra | deterministicexactofflinerecursive | 1 language |
Bounds
Upper bounds (proved).
- Every -variable function has a cover with at most cubes, for . By the Shannon expansion , a cover of is , so the bound doubles with each variable, from 1 cube for . Parity needs exactly , so the bound is tight.
- For a truth table input, the decision version is in NP: a cover with at most cubes is a certificate of size polynomial in , and checking it takes time polynomial in . The primes number at most , and they can be listed in time polynomial in .
- For a DNF input, the decision version is in : guess a cover with at most cubes, then check for all points that it agrees with on the care set, which is a co-NP check.
Lower bounds (proved, as hardness).
- Truth table input: the decision version with at most cubes is NP-complete. Masek (1979, unpublished) gave the first proof; Czort (1999, a master's thesis) and Allender, Hellerstein, McCabe, Pitassi and Saks (2008) give full proofs. So no algorithm runs in time polynomial in unless P = NP.
- DNF input: MIN DNF, an equivalent DNF with at most literals, is -complete (Umans 2001). The compendium of Schaefer and Umans lists the version with terms as -complete too, and lists hardness of approximation results for it. So the problem is not in NP unless the polynomial hierarchy collapses to NP.
- Even the case with no literal is hard for a DNF input: a DNF has a cover with one cube and no literal exactly when it is a tautology, which is co-NP-complete.
Measured. Brayton, Hachtel, McMullen and Sangiovanni-Vincentelli (1984) ran Espresso-II on a set of 56 PLAs and compared it with the minimizers MINI, PRESTO and POP. Rudell and Sangiovanni-Vincentelli (1987) ran Espresso-EXACT and Espresso-MV on a set of benchmark PLAs and compared the heuristic results with the exact minima on that set. These are measurements on those sets, not proved bounds.
Reductions
- To set cover. After the primes are listed, the problem is weighted set cover with elements and at most sets. For a truth table input this reduction takes time polynomial in .
- From tautology. A DNF is a tautology exactly when its minimum cover is the one cube with no literal. So the DNF version is co-NP-hard by a reduction that only copies the input.
- CNF and SOP. A cheapest CNF of is the De Morgan dual of a cheapest SOP of . For a truth table input the two problems are the same up to swapping and . For a DNF input, the complement can be exponentially larger, as the example on the unate function page shows.
- Multiple outputs to one output. A function with outputs becomes one function of the inputs and one extra variable with values, the output number. A cube of the new function names a cube of the inputs and the set of outputs that use it. Rudell and Sangiovanni-Vincentelli (1987) treat outputs this way in Espresso-MV.
Applications
- PLAs and PLDs. The AND and OR planes of a PLA, and the product terms of a PAL or GAL device, are a sum of products, and their area is close to the number of distinct cubes.
- Nodes of multi-level circuits. In multi-level logic synthesis, each node of a Boolean network holds a small SOP, and a two-level minimizer simplifies it with the observability don't-cares of the node.
- State machines and control logic. The next-state and output functions of a controller, with the unused state codes as don't-cares.
- Rule sets. A DNF is a set of if-then rules, so the same minimization makes a rule set shorter.
References
- Christopher Umans, The minimum equivalent DNF problem and shortest implicants, Journal of Computer and System Sciences 63(4), 597 to 611, 2001, the Sigma_2^p-completeness of MIN DNF (an equivalent DNF with at most k literals) and of the shortest implicant problem
- Completeness in the polynomial-time hierarchy, a compendium, the entries for MIN DNF and for IRREDUNDANT (the term count version and the hardness of approximation)
- Eric Allender, Lisa Hellerstein, Paul McCabe, Toniann Pitassi and Michael Saks, Minimizing disjunctive normal form formulas and AC0 circuits given a truth table, SIAM Journal on Computing 38(1), 63 to 84, 2008, the NP-completeness of Min-DNF for a function given by its truth table, with the history of the earlier proofs of Masek and Czort
- Some NP-complete set covering problems, the first proof of NP-completeness for a truth table input (known through later citations)
- Richard L. Rudell and Alberto L. Sangiovanni-Vincentelli, Multiple-valued minimization for PLA optimization, IEEE Transactions on Computer-Aided Design 6(5), 727 to 750, 1987, the exact minimizer Espresso-EXACT and the heuristic Espresso-MV, with measurements on PLA benchmarks
- Olivier Coudert, Two-level logic minimization, an overview, Integration, the VLSI Journal 17(2), 97 to 140, 1994, the survey of exact and heuristic methods, the cyclic core and implicit prime generation
- Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 7, Two-Level Combinational Logic Optimization
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 0D4QNX Edit this page History Report an error Markdown