Bulletin of the Marathwada Mathematical Society Vol.5, No.1, June 2004, Pages 35-44 REPRESENTATION AND MINIMIZATION OF BOOLEAN FUNCTIONS. Part II Minimization of Boolean Functions. S.R. Joshi 3, Accharya Shree Colony, Kokanwadi, Padampura Road, Aurangabad, 431005, (M.S.), India. ABSTRACT Several methods of repersenting a given Boolean function are already discussed in Part I of this paper [1]. In this second part methods of minimizing a given Boolean function are discussed with the help of algorithms and examples. 1. INTORDUCTION One of the important applications of Boolean Algebra is the expression of circuit design problems in a form that lends it self to being more readily understood and simplified. If D 1 and D 2 are two circuit designs related to a given problem producing the same output, then we say that D 1 is simpler than D 2 if less number of input and connective devics are required in the contruction of D 1 than for D 2. The Problem of obtaining a simplest circuit design is known as a minimization problem. The importance of Boolean algebra is that it makes minimization more readily possible. The reason for this fact is that Boolean algebra is a language whose rules and permissible operations are known and are suitable for the purpose. In the begining, a person indicates a desire to have a particular circuit built related to some problem. He or she then specifies what this circuit is supposed to do. A circuit designer after further discussion with the person produces a preliminary design of the circuit to be built up, which is often a set of Boolean functions. This design is then simplified and modified in such a way that a reliable circuit that performs to specifications without waste of circuit elements is produced. The procedure of minimizing a Boolean function is discussed in
36 section 3 giving stress on two methods, cube array method and Karnaugh map method. 2. SOME DEFINITIONS AND ILLUSTRATIONS Definition 2.1 : Let E and F be two Boolean expressions such that E and F are equivalent and each of E and F is a sun of products. Let E contain K 1 products and F contain K 2 products. Furthur let E contain l 1 literals and F contain l 2 literals. Then E is said to be simpler than F if any of the fillowing conditions holds. (C 1 ) : K 1 < K 2 and L 1 < L 2. (C 2 ) : K 1 < K 2 and L 1 < L 2.. Example 2.1 : Let n = 4, and let a, b, c, d, be four variables. Let E = a / b / c / + a / b c / d / + a / b c / d + a b / d + a b / c / d and F = a / c / + a b / d + a b / c / d. We observe that E = F, K 1 = 5, K 2 = 3, l 1 = 18 and l 2 = 9. It is clear that F is simpler than E. Definition 2.2 : Among different equivalent Boolean experssions each being a sum of products, an experssion E is said to be minimal if no other expression simpler than E can be found. For example if E and F are the same as in example 2.1, and G = a / c / + a b / d, then it can be verified that E = F = G and that G is minimal among E,F,G. Note that for a given set of equivalent Boolean expressions there can be more than one minimal expressions. For example if we take n = 3, E 1, = ab +a / b / +bc /, E 2 =ab +a / b / + a / c /, E 3 = ab +a / b / + abc / +a / c / and E 4 = ab + a / b / + bc / + abc / are equivalent and that both E 1 and E 2 are minimal. then we observe that all these four expressions Definition 2.3 : Two products P 1 and P 2 each containing K literals (or factors) are said to be adjacent if (P 1 +P 2 ) is a product containing (K - 1) literals. For example ab / c / and abc / are adjacent because ab / c / + abc / =ac /.
Binary Notation and Hamming Distance : We have already considered binary notation for minterms and the concept of Hamming Distance between two minterms in the part I of this paper. [1]. We shall now illustrate these concepts for product terms, without giving formal definitions. Let n = 4 and let a,b, c, d, be four variables. Let P 1 = bcd /, P 2 = b c / d /, P 3 = ac /, P 4 = ad. To denote these products in binary notation we use 1 or 0 for each litteral according as it is uncomplemented or complimented. Further if any variable is absent in a product then that variable is denoted by x and is written at the respective position. In our example a is the first varible, b is the second varible and so on. Now for the product P 1, a is absent hence we write x in the beginning. b is uncomplimented and hence we write 1 at the second position. Similary c is replaced by 1 and d / is seplaced by 0. Thus P 1 can be expressed as P 1 = bcd / = x110. 37 Similarly P 2 = b c / d / = x100, P 3 = 1x 0x, P 4 = ad = 1x x1. Note that in P 4 no variable is complimented and hence no zero occurs in P 4. Furthe b and c are absent hence x occurs at the second and third position. Here in each case x means 0 or 1.For example consider P 1. P 1 = x 110 = (1110) + (0110). = abcd / + a / bcd / = (a + a / ) ( bcd / ) = 1. ( bcd / ) = bcd / Similarly P 4 = 1 x x 1 = 1 1 x 1 + 1 0 x 1 = ( 1 1 1 1 + 1 1 0 1 ) + ( 1 0 1 1 ) + ( 1 0 0 1 ) i e. P 4 = abcd + abc / d + ab / cd + ab / c / d = abd + ab / d = ad. Definition 2.4 : Let P 1 and P 2 be two product terms consisting of equal number of literals experssed in binary notation such that in each of P 1 and P 2 there are equal number of x s and occur at the same position. If there is a change in m places as far as the binary digits 1 and 0 are considered then m is defined as the Humning distance between P 1 and P 2 and it is denoted by H ( P 1, P 2 ). For example if n = 4, P 1 = 1 x 00 and P 2 = 0x10 then H ( P 1, P 2 ) =2 since there is a change in two positions first and third. Similarly if P 1 = 1011 and P 2 = 1010 then H ( P 1, P 2 ) =1 since there is a change only in the fourth position. Note that if a product P is a minterm then there is no x present in it.
38 Definition 2.5: Two minterms P and Q are said to form a 1-cube or a line segement of order 1 if H ( P, Q) = 1. For example if n = 4, P = (0101) and Q = (0,1,1,1) thenp and Q form a 1- cube since H(P, Q) = 1. Here P and Q differ only at one place (third place ). Note that P + Q = a / bc / d + a / bcd = a / bd = 01x1. Thus P + Q is a product containing one x. Definition 2.6 : Two 1- cubes P and Q are said to form a 2-cube if P and Q have x at the same position and H ( P, Q ) =1. For example if P = 0 x10 and Q = 0 x11 then H ( P, Q ) =1, and hence P and Q form a 2-cube. Here P + Q = a / x cd / + a / xcd = a / xcx = a / c Similarly a K-cube can be defined. Definition 2.7 : a K-cube P ( k 0 ) is said to be a prime implicant for a given Boolean function f if f + P = f and there is no (K+1)-cube Q satisfying f + Q = f and P.Q = P. For example if n = 4, f = (0011) + (1101) + ( 1100) and P= 110x, we observe that f + P = f. Further it can be observed that there is no Q ( a. 2- cube) covering P and satisfying Q + f = f.. 3. METHODS OF MINIMIZATION In this section we shall discuss methods of minimizing a given Boolean function f. These methods mainly depend on an algorithm described below. At the outset we state a theorem without proof, which is used in the algorithm. Thorem 3.1 : Let P 1, P 2,...P be different prime implicants for a given Boolean m function f, then the sum P 1 + P 2 +...+ P m is a minimal expression for f. To obtain the totality of the prime implicants for a given function f, the following algorithm is used. Algorithm 3.1 : The steps involved in the algorithm are as follows. (A 1 ) Express the given function f as a sum of minterms ( i.e.0-cubes ) and write each minterm in Binary notation. (A 2 ) Form all kinds of 1-cubes by considering pairs of minterms. If no such 1-cube can be formed call all the minterms as prime implicants. After forming 1-cubes if a minterm left is covered by any one of the 1-cubes, then delete it, otherwise call it a prime implicant. (A 3 ) Form all kinds of two cubes by considering different pairs of 1-cubes. While forming a two-cube take care that the position of x in both the 1-cubes of a pair is the same. After formation of two cubes if any of the remaining 1-cubes is such that it is covered by a 2-cube or the union of two or more
39 2-cubes then delete it, otherwise call it a prime implicant. ( A 4 ) Repeat step ( A 3 ) with 2 replaced by 3,4, etc. unitl formation of higher cubes is not possible. ( A 5 ) Add all prime implicants obtained in steps ( A 2 ) to ( A 4 ) and call the sum as S. ( A 6 ) S is the required minimal expression for f. There are different methods of minimizing a given Boolean function f, all of which depend on the algorithm described above. We shall discuss only two methods in this paper. ( M 1 ) Quine - McCluskey method and ( M 2 ) Karnaugh map method. ( M 1 ) Quine - McCluskey Method : In this method the concepts K-cube, Hamming distance and Prime implicant mentioned earlier are used. The main steps involved in this method are as follows: For more details see [ 1, 4 ]. ( S 1 ) Express the given Boolean function which is to be minimized as a sum of minterms each being expressed in the binary notation ( i.e. in the form of 0-cube ). If d is the decimal representation of the binary form, the correspording min-term is denoted by m d. ( S 2 ) Arrange the minterms in groups depending on the number of 1 s present in the minterms. For example if n = 4 and ( 0000 ) is present in f then it will form the first group. Similarly if the minterms (0010),(1000) and (0100) are present in f, then these three together will form the second group since each of these contains only one 1 in it. In this way groups are formed and minterms are arranged in one column according to the groups. ( S 3 ) In this step all possible 1-cubes are formed by combining two minterms in the same group. These 1-cubes are arranged in the second column. If some ninterm, can not be combined with any other minterm to form a 1-cube, call it a prime implicant. ( S 4 ) In this step all possible 2-cubes are formed by considering pairs of 1-cubes, for which x should be in the same position. If a 1-cube can not be combined with any other 1-cube to form a 2-cube, call it a prime implicant. The 2-cubes formed are arranged in the third column avoiding the repeatitions if any. ( S 5 ) Repeat step ( S 4 ) with 2 replaced by 3,4,5,...etc. to form higher order cubes and arrange them in the 4 th, 5 th etc... columns. ( S 6 ) If any prime implicant P obtained in the steps S 3 to S 5 is covered
by any other prime implement or their union then delete P. ( S 7 ) Add all prime implicants obtained in steps S 3 to S 5 after deleting the prime implicants considered in ( S ) and call the sum as f*. 6 ( S 8 ) f* is a minimal expression for f. We illustrate the method discussed above for a function f = b / d ( a + c ) + d / ( ac / + a / bc ) + a / b / d ( n = 4). It can be verified that f = m 1 + m 3 + m 6 + m 8 + m 9 + m 11 + m 12. Here m 9 = ( 1001) because 1001 is the binary representation of 9. We observe that there are three groups. G 1 = { ( 0001 ), ( 1000 ) } G 2 = { ( 0011 ), ( 0110 ), ( 1001 ), ( 1100 ) } G 3 = { ( 1011 ) } Following the steps ( S 3 ) to ( S 5 ) described in the method we get different prime implicants for f as indicated below. G (0001) (00 1) 1 x ( x0x1) P (1000) ( x001) 4 (0011) (100 x) P G (0110) P (1 00) (1001) (1100) ( x011) G 2 1 2 x P3 3 (1011) (10 x1) 40 Groups 1-cubes 2-cubes 3-cubes No 3-cube is possible In this example we observe that ( after following the steps ( S 2 ) to (S 5 ) ) the prime implicants for f are P 1 = ( 0 1 1 0), P 2 = ( 1 0 0 x ), P 3 = ( 1 x 0 0) and P 4 = ( x o x 1 ). Further the prime implicant P 2 is covered by P 3 + P 4 because 1001 is covered by P 4 and ( 1 0 0 0 ) is covered by P 3. Hence according to step ( S 6 ) P 2 can be deleted. Hence we conculude that the minimal expression for f is f* = P 1 + P 3 + P 4 = ( 0 1 1 0 ) + ( 1 x 0 0 ) + ( x 0 x 1 ) = a / bcd / + ac / d / + b / d. ( M 2 ): Karnaugh Map Method : As mentioned in part I of this paper [ 1 ], a Karnaugh map is a diagram representing 2 n minterms for a given positive integer n The diagram is drawn in such a way that for each minterm a
41 square or a suitable area is prescribed. In general a rectangle is divided into 2 n parts known as cells, each representing a minterm. If n = 4, and the input variables are a, b, c, d then in this case there are 16 minterms ( 2 4 = 16 ), and hence in this case a rectangle is divided into 16 cells in such a way. that for each variable halving the rectangle into 8 + 8 cells is done in four different ways ( See fig 3.1). The representation of 16 minterms can also be shown in one figure ( See fig 3.2 ). Halving by a Halving by b Halving by c Halving by d a / a / a a b / b / b / b / c / c c c / d / d / d / d / a / a / a a b / b / b / b // c / c c c / d d d d a / a / a a b b b b c / c c c / d d d d a / a / a a b b b b c / c c c / d / d / d / d / (A) (B) (C) (D) Fig.3.1 b / d / b / d bd bd / C 1 = a / c / C 2 = a / c C 3 = ac C 4 = ac / m 0 =(0000) m 1 m 10 (1000) = ( a / b / c / d / ) m 8 = ab / c / d / m 1 m 3 m 11 m 9 ( Second row represents b / d ) = R 2 = m 1 + m 3 + m 11 + m 9 m 5 m 7 m 15 = (1111) m 13 = abcd m 4 m 6 m 14 m 12 = (1100) = a / bcd / = abc / d / R 1 R 2 R 3 R 4 Fig. 3.2 Figure fig 3.1 (A) shows the nature of the first variable a whether it is in the original form or complemented form. In each of the 8 cells in the first and second column the variable a is in the complemented form. Similarly for the variables b, c and d, the halving a rectangle is shown in fig 3.1 ( B ),( C ) and ( D ) respectively. If we combine ( A ), ( B ), ( C ), and ( D ) of fig 3.1 we get figure 3.2. In this figure the form of each of the 16 minterms is indicated. For example in m 12 a and b are uncomplemented and c and d are complemented. Hence m 12 = abc / d /. m 12 is also the same as ( 1 1 0 0 ) ( Binary form ) because 12 = 1 1 0 0 2. If we combine all the minterms in the second
42 row R 2 we get R 2 = m 1 + m 3 + m 11 + m 9 = a / b / c / d + a / b / cd + a b / c d + a b / c / d. Applying the rules of Boolean Algebra we get R 2 = b / d = x 0 x 1. Similary the third column in Fig 3.2 represents the product ac = 1 x 1 x. In order to minimize a given Boolean function f it is first expressed as a sum of minterms and the corresponding cells in a Karnaugh map are considered. For example if n = 4 and f is the same as in Quine- McCluskey method i.e. f = m 1 + m 3 + m 6 + m 8 + m 9 + m 11 + m 12, then these minterms are shown in the shaded form as in the following figure. m 8 = (1000) b / d m 1 m 3 m 11 m 9 R 2 m 6 = (0110) m 12 = (1100) Fig. 3.3 From the figure it is clear that the minterm m 1, m 3, m 11 and m 9 together represent the row R 2 i.e. the product b / d. Further the minterms m 8 and m 12 can be combined to form the product ac / d /. The minterm m 6 ( = a / bcd / ) can not be combined with any of the other minterms in f and hence it is a prime implicant. Thus there are three prime implicants b / d, ac / d / and a / bcd / for the function f. Note that the minterm m 8 can also be combined with m 9 to form a prime implicant ( 1 0 0 x ) = ab / c /, which was deleted in Quine McCluskey Method. Thus by an application of Theorem 2.1 we conclude that the minimal expression for f is f* = b / d + ac / d / + a / bcd /, which is the same as in Quine McCluskey Method.
43 The block diagram for the function f considered in the above described method using different types of gates is shown in figure 3.4. It contains 13 gates, while f* requires only 8 gates and the corresponding block diagram for f* is shown in figure 3.5. Note that the output for f and f* is the same since f and f* are equivalent. Fig. 3.4 Fig. 3.5 REMARKS: The method of minimizing a given Boolean function with the help of Karnaugh map becomes more and more clumzy as the number of variables in the Boolean function increases. This method is suitable only when the number of variables is 6. As far as the Quine-McClusky Method is concerned, it can be used for any finite number of variables since an algorithm for minimizung a Boolean function is available. Futher an algorithm can be converted into a computer program and the job of minimizing a functiuon becomes simpler.
44 ACKNOWLEDGEMENT I am grateful to Dr. G. R. Shendge for several useful discussions in the preparation of this paper. REFERENCES 1. 2. 3. 4. 5. S.R. Joshi, Representation and Minization of Boolean Functions, part I Representation of Boolean Functions. The Bulletin of the Marthwada Mathematical Society, Dec. 2002, 54-67. Segmour Lipschutz, and Morci Lipson, Discrete Mathematics ( 2nd Ed. ) Tata McGraw Hill Pub. Co. Ltd. New Delhi 1999. Thomas C. Bartee, Digital Computer Fundamentals ( 6 th Ed.) Tata McGraw Hill Pub.Co.Ltd. New Delhi 1991. J. P. Tremblay and R. Manohar, Discrete Mathmatical Structures with Applications to Computer Science, Tata McGraw Hill 1997. Barry Wilkinson, Digital Systems Design, Prentice Hall International, 1987.