Quine–McCluskey algorithm

The Quine–McCluskey algorithm (or the method of prime implicants) is a method used for minimization of Boolean functions that was developed by Willard V. Quine[1][2] and extended by Edward J. McCluskey.[3] It is functionally identical to Karnaugh mapping, but the tabular form makes it more efficient for use in computer algorithms, and it also gives a deterministic way to check that the minimal form of a Boolean function has been reached. It is sometimes referred to as the tabulation method.

The method involves two steps:

  1. Finding all prime implicants of the function.
  2. Use those prime implicants in a prime implicant chart to find the essential prime implicants of the function, as well as other prime implicants that are necessary to cover the function.


Although more practical than Karnaugh mapping when dealing with more than four variables, the Quine–McCluskey algorithm also has a limited range of use since the problem it solves is NP-complete.[4][5][6] The running time of the Quine–McCluskey algorithm grows exponentially with the number of variables. For a function of n variables the number of prime implicants can be as large as 3nln(n), e.g. for 32 variables there may be over 534 * 1012 prime implicants. Functions with a large number of variables have to be minimized with potentially non-optimal heuristic methods, of which the Espresso heuristic logic minimizer was the de facto standard in 1995.[7]

Step two of the algorithm amounts to solving the set cover problem;[8]NP-hard instances of this problem may occur in this algorithm step.[9][10]



In this example, the input is a Boolean function in four variables, which evaluates to on the values and , evaluates to an unknown value on and , and to everywhere else (where these integers are interpreted in their binary form for input to for succinctness of notation). The inputs that evaluate to are called 'minterms'. We encode all of this information by writing

This expression says that the output function f will be 1 for the minterms and (denoted by the 'm' term) and that we don't care about the output for and combinations (denoted by the 'd' term).

Step 1: finding prime implicants

First, we write the function as a table (where 'x' stands for don't care):


One can easily form the canonical sum of products expression from this table, simply by summing the minterms (leaving out don't-care terms) where the function evaluates to one:

fA,B,C,D = A'BC'D' + AB'C'D' + AB'CD' + AB'CD + ABC'D' + ABCD.

which is not minimal. So to optimize, all minterms that evaluate to one are first placed in a minterm table. Don't-care terms are also added into this table (names in parentheses), so they can be combined with minterms:

of 1s
1 m40100
2 (m9)1001
3 m111011
4 m151111

At this point, one can start combining minterms with other minterms. If two terms differ by only a single digit, that digit can be replaced with a dash indicating that the digit doesn't matter. Terms that can't be combined any more are marked with an asterisk (*). For instance 1000 and 1001 can be combined to give 100-, indicating that both minterms imply the first digit is 1 and the next two are 0.

of 1s
Minterm0-CubeSize 2 Implicants
1 m40100m(4,12)-100*
2 m91001m(9,11)10-1
3 m111011m(11,15)1-11
4 m151111

When going from Size 2 to Size 4, treat - as a third bit value. For instance, -110 and -100 can be combined to give -1-0, as can -110 and -11- to give -11-, but -110 and 011- cannot because -110 is implied by 1110 while 011- is not. (Trick: Match up the - first.)

of 1s
Minterm0-CubeSize 2 ImplicantsSize 4 Implicants
1 m40100m(4,12)-100*m(8,9,10,11)10--*
2 m91001m(9,11)10-1m(10,11,14,15)1-1-*
3 m111011m(11,15)1-11
4 m151111

Note: In this example, none of the terms in the size 4 implicants table can be combined any further. In general this process should be continued (sizes 8, 16 etc.) until no more terms can be combined.

Step 2: prime implicant chart

None of the terms can be combined any further than this, so at this point we construct an essential prime implicant table. Along the side goes the prime implicants that have just been generated, and along the top go the minterms specified earlier. The don't care terms are not placed on top—they are omitted from this section because they are not necessary inputs.


To find the essential prime implicants, we run along the top row. We have to look for columns with only one "✓". If a column has only one "✓", this means that the minterm can only be covered by one prime implicant. This prime implicant is essential.

For example: in the first column, with minterm 4, there is only one "✓". This means that m(4,12) is essential. So we place a star next to it. Minterm 15 also has only one "✓", so m(10,11,14,15) is also essential. Now all columns with one "✓" are covered.

The second prime implicant can be 'covered' by the third and fourth, and the third prime implicant can be 'covered' by the second and first, and neither is thus essential. If a prime implicant is essential then, as would be expected, it is necessary to include it in the minimized boolean equation. In some cases, the essential prime implicants do not cover all minterms, in which case additional procedures for chart reduction can be employed. The simplest "additional procedure" is trial and error, but a more systematic way is Petrick's method. In the current example, the essential prime implicants do not handle all of the minterms, so, in this case, the essential implicants can be combined with one of the two non-essential ones to yield one equation:

fA,B,C,D = BC'D' + AB' + AC[11]


fA,B,C,D = BC'D' + AD' + AC

Both of those final equations are functionally equivalent to the original, verbose equation:

fA,B,C,D = A'BC'D' + AB'C'D' + AB'C'D + AB'CD' + AB'CD + ABC'D' + ABCD' + ABCD.

See also


  1. Quine, Willard Van Orman (October 1952). "The Problem of Simplifying Truth Functions". The American Mathematical Monthly. 59 (8): 521–531. doi:10.2307/2308219. JSTOR 2308219.
  2. Quine, Willard Van Orman (November 1955). "A Way to Simplify Truth Functions". The American Mathematical Monthly. 62 (9): 627–631. doi:10.2307/2307285. hdl:10338.dmlcz/142789. JSTOR 2307285.
  3. McCluskey, Jr., Edward J. (November 1956). "Minimization of Boolean Functions". Bell System Technical Journal. 35 (6): 1417–1444. doi:10.1002/j.1538-7305.1956.tb03835.x. hdl:10338.dmlcz/102933. Retrieved 2014-08-24.
  4. Masek, William J. (1979). Some NP-complete set covering problems. unpublished.
  5. Czort, Sebastian Lukas Arne (1999). The complexity of minimizing disjunctive normal form formulas (Master's thesis). University of Aarhus.
  6. Umans, Christopher; Villa, Tiziano; Sangiovanni-Vincentelli, Alberto Luigi (2006-06-05). "Complexity of two-level logic minimization". IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems. 25 (7): 1230–1246. doi:10.1109/TCAD.2005.855944.
  7. Nelson, Victor P.; Nagle, H. Troy; Carroll, Bill D.; Irwin, J. David (1995). Digital Logic Circuit Analysis and Design (2 ed.). Prentice Hall. p. 234. ISBN 978-0-13463894-2. Retrieved 2014-08-26.
  8. Feldman, Vitaly (2009). "Hardness of Approximate Two-Level Logic Minimization and PAC Learning with Membership Queries". Journal of Computer and System Sciences. 75: 13–25 (13–14). doi:10.1016/j.jcss.2008.07.007.
  9. Gimpel, James F. (1965). "A Method for Producing a Boolean Function Having an Arbitrary Prescribed Prime Implicant Table". IEEE Transactions on Computers. 14: 485–488.
  10. Paul, Wolfgang Jakob (1974). "Boolesche Minimalpolynome und Überdeckungsprobleme". Acta Informatica (in German). 4 (4): 321–336. doi:10.1007/BF00289615.
  11. Logic Friday program

Further reading

  • Curtis, H. Allen (1962). "Chapter 2.3. McCluskey's Method". A new approach to the design of switching circuits. The Bell Laboratories Series. Princeton, New Jersey, USA: D. van Nostrand Company, Inc. pp. 90–160.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.