Three Models and Some Theorems on Decomposition of Boolean Functions Steinach, Bernd Freierg University of Mining and Technology stein@informati.tu-freierg.de Zarevsij, Aradij Institute of Engineering Cyernetics of the NAS of Belarus zar@newman.asnet.mins.y Astract The prolem of parallel decomposition f () = ϕ ( µ (u), λ (v) ) of an incompletely specified Boolean function y = f () is regarded for aritrary susets u and v of the set of variales. Seven possile properties of f () are formulated in terms of the three suggested models: ipartite graph, ternary matri and mar functions. Revealing decomposaility of f () and constructing proper Boolean functions ϕ, µ and λ are reduced to checing f () for these seven properties. A fast algorithm solving the prolem is proposed and results of eperiments are presented. 1 Introduction Traditionally, any decomposition of a Boolean function is regarded as its representation y a composition of several functions with a smaller numer of variales. This prolem has important practical applications, and many pulications have een devoted to it [1-6, 8-18 and others]. Depending on the structure of the circuit, we distinguish different approaches for decomposition [1, 3, 5]. In this paper we focus on one ind of decomposition called Grouping in [3, 6, 10, 11, 12, 13, 14] or Bi-Decomposition in [9]. It is well nown [3, 6, 9], that such a decomposition does not eist for all Boolean functions. In [9] are considered disjoint (see Figure 1a) and one-variale-non-disjoint Bi- Decomposition of completely specified Boolean functions. The prospects for finding a Grouping enlarge enormously if we consider multivariale-non-disjoint groupings (see Figure 1) of incompletely specified Boolean functions. Therefore, we select this approach in our paper. From previous wor we now, that different inds of groupings are possile. Nevertheless, the results otained so far do not completely cover the prolem, especially in the case of parallel decomposition considered in this paper. Let = ( 1, 2,..., n ) e a vector of Boolean variales, y = f () - an incompletely specified Boolean function specified on set D of some values of vector, and let u and v e some susets from. Parallel decomposition of function f on the pair u, v means otaining a composition ϕ(µ(u), λ(v)) of three Boolean functions ϕ, µ and λ which realizes function f, i.e. coincides with it on the area of definition of the latter. We regard the conditions of eistence of such a composition and the rules for defining functions ϕ, µ and λ. µ ( u ) a µ ( u ) ϕ f ( ) ϕ f ( ) λ ( v ) c λ ( v ) ( a ) ( ) Figure 1. Structure of the decomposition y grouping - ( a ) disjoint, ( ) non-disjoint
2 Preliminaries In this paper we use some operations from the Boolean Differential Calculus [2]. Definition 1 The -times Maimum-Operation is defined as: ma f ( 0, 1) = ma... ma ma f ( 0, 1)... 1 1 12 11 where ma f, = f, = 1 f, = 0. i ( 0 i ) ( 0 i ) ( 0 i ) The -times maimum of a Boolean function f( 0, 1 ) in 1 - direction forms another function f '( 0 ) which has the value 1 for all those inputs 0 for which the original function f( 0, 1 ) has the value 1 at least once in the suspace 0 = const. Definition 2 The -times Minimum-Operation is defined as: min f ( 0, 1) = min... min min f ( 0, 1)... 1 1 12 11 where min f (, ) f (, 1 ) f (, 0 ) i = = =. 0 i 0 i 0 i The -times minimum of a Boolean function f( 0, 1 ) in 1 - direction forms another function f '( 0 ) which has the value 1 for all those inputs 0 for which the original function f( 0, 1 ) has the value 1 in the whole suspace 0 = const. Definition 3 The vectored Maimum-Operation is defined as: ( 0 1) ( 0 1) ( 0 1) ma f, = f, f,. 1 The vectored maimum of a Boolean function f( 0, 1 ) in 1 - direction forms another function { 0 1 0 1 } f '( 0, 1 ) which has the value 1 for all those pairs of inputs ( ) ( ) function f( 0, 1 ) has the value 1 at least once in this pair of inputs. 3 Models and Properties 3.1 First Model: Bipartite Graph G,,, for which the original Let us denote A and B the sets of different projections of elements from D onto u and v, correspondingly. We construct the function g: A B {1, 0, } it in such a way: for any a i A and j B, if there eists d D with projections onto u and v equal correspondingly to a i and j, then g(a i, j ) = f (d ); if such d does not eist, then g(a i, j ) =. Figure 2 shows a Boolean function f (a,, c, d, e) defined on set D and sets A and B of projections of elements from D onto u = (a,, c) and v = (, c, d, e). a c d e f 0 1 0 0 1 0 D = 1 1 1 1 0 1 0 1 0 1 1 1 0 0 0 1 1 0 a c 0 1 0 A = 1 1 1 0 0 0 c d e 1 0 0 1 B = 1 1 1 0 1 0 1 1 0 0 1 1 Figure 2. Incompletely specified Boolean function f (a,, c, d, e) and sets A and B
The function g can e represented y a ipartite graph G (see Figure 3). The vertices of this graph correspond to elements of sets A and B and are mared in the same way, and it has edges of two types: vertices a i and j are connected y a 1-edge (old line) if g(a i, j ) = 1, and y a 0-edge (dotted line) if g(a i, j ) = 0. Edges of these two types can form multitype chains in graph G, which will e denoted similarly, for eample, 0101-chain consists of consequently connected 0- edge, 1- edge, 0- edge and 1- edge. Consider now the following properties of graph G: 1 a 1 2 a 2 3 a 3 4 Figure 3. The ipartite graph G p 1 the graph contains a 1-edge; p 2 the graph contains a 0- edge; p 3 the graph contains a 10-chain passing through a verte from A; p 4 the graph contains a 10-chain passing through a verte from B; p 5 the graph contains a 010-chain; p 6 the graph contains a 101-chain; the graph contains a cycle with odd numer of 1-edges, i.e. it is non-dichromatic. p 7 3.2 Second Model: Ternary Matri T The function g can also e represented y a ternary matri T, in which t i j = g(a i, j ). The rows of this mari correspond to the elements of set A and the columns - to the elements of set B, respectively. Note, that the ternary matri T can e regarded as the matri of adjacency of the ipartite graph G. Figure 4 shows the matri T corresponding to the ipartite graph G from Figure 3. Let us epress the same seven properties in terms of the matri T representation, calling compound a vector containing oth elements 1 and 0: 1 2 3 4 a 1 0-1 - T = a 2-1 - - a 3 - - - 0 Figure 4. The Ternary matri T p 1 matri T contains a 1-element; p 2 matri T contains a 0-element; p 3 matri T contains a compound row; p 4 matri T contains a compound column; p 5 matri T contains a 1-element on an intersection of compound row and column; p 6 matri T contains a 0-element on an intersection of compound row and column; p 7 the set of rows of matri T is incompatile, which means that it is impossile to get rid of 1- elements y successive componentwise inversion of rows and columns of the matri. 3.3 Third Model: Mar Functions q() and r() The incompletely specified Boolean function f () can e represented y ON-set and OFF-set. The mar functions q() = 1 ON-set and r() =1 OFF-set are completely specified functions. Let us define the susets of more in detail: = ( a,, c ), u = ( a, c ) and v = (, c ). By means of the mar functions q() and r() and some operation of the Boolean Differential Calculus [2] we get the following list of the enumerated aove properties: p 1 q() 0 p 2 r() 0 p 3 ma q ma r 0 a a p 4 ma q ma r 0
p 5 q ma r ma r 0 a p 6 r ma q ma q 0 a p 7 ( ) ' a, ' q r q r a ma ma ma ma min min 0 ' ' ' ' ' ' a a a a The mar functions q() and r() in the formula of property p 7 are enlarged in such a way, that property p 7 can e detected using only the 4 values f ( 0, 0, 0), f ( 0, 0, 1), f ( 0, 1, 0) and f ( 0, 1, 1). You find a more detailed discussion of these properties in [10]. These definitions facilitate consideraly checing a Boolean function on possession of the indicated properties. It is important inasmuch as is shown elow that the regarded prolem of decomposition is reduced to such a checing. Note, for real calculation of the aove formulas each representation of completely specified Boolean functions, e.g. inary decision diagram s (BDD s) [7] or lists of ternary vectors (TVL s) [4] can e used. 4 Theorems T h e o r e m 1. If the graph G, the ternary matri T or the mar functions [q, r] have one of the properties p 5, p 6 or p 7, they have also the properties p 3 and p 4. a a Because the graph G has any of the properties p 5, p 6 or p 7 the graph has some chains which contain suchains with properties p 3 and p 4. It follows from each of the properties p 5, p 6 and p 7 of ternary matri T that there eists at least one compound row and one compound column in T. The [q, r]-formulas of the properties p 3 and p 4 remain right, removing eactly one ma -operation [6]. From q ma r ma r 0 q ma r 0 follows p 5 p 3. By means of similar transformation it can e shown, that each of the properties p 5, p 6 or p 7 implies the properties p 3 and p 4. T h e o r e m 2. If the graph G, the ternary matri T or the mar functions [q, r] possess the properties p 3 or p 4, they possess also properties p 1 and p 2. The proof is similar to the previous one. Each of the enumerated properties of graph G puts some restrictions on the two-variale Boolean function ϕ in the sought-for composition ϕ(µ(u), λ(v)). The set of such restrictions constitutes a an relation etween the set of properties {p 1, p 2,..., p 7 } and the set {ϕ 0, ϕ 1,..., ϕ 15 } of different two-variale Boolean functions, shown elow in the tale 1. Tale 1. Definition of functions ϕ i µ λ ϕ 0 ϕ 1 ϕ 2 ϕ 3 ϕ 4 ϕ 5 ϕ 6 ϕ 7 ϕ 8 ϕ 9 ϕ 10 ϕ 11 ϕ 12 ϕ 13 ϕ 14 ϕ 15 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
T h e o r e m 3. The Boolean matri B shown elow represents the an relation: i j = 1 means that p i (ϕ ϕ j ). If graph G possesses the property p i and i j = 1 then the given Boolean function cannot e realized y a composition ϕ(µ(u), λ(v)) where ϕ = ϕ j. ϕ 0 ϕ 1 ϕ 2 ϕ 3 ϕ 4 ϕ 5 ϕ 6 ϕ 7 ϕ 8 ϕ 9 ϕ 10 ϕ 11 ϕ 12 ϕ 13 ϕ 14 ϕ 15 p 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 p 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 p 3 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 B = p 4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 p 5 1 0 0 1 0 1 0 1 0 0 1 1 1 1 1 1 p 6 1 1 1 1 1 1 0 0 1 0 1 0 1 0 0 1 p 7 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 The modus tollens rule could e used for proving assertions corresponding to each 1 of the tale. For eample, suppose there eists a composition of the regarded type with ϕ = ϕ 7 (disjunction) when graph G has property p 5. To define functions µ(u) and λ(v) we have to mar vertices of graph G with 1s and 0s. By that every verte incident to a 0-chain should e mared with 0, and at least one verte incident to a 1-chain should e mared with 1. When graph G has property p 5 it has a 010-chain containing two 0-suchains and one 1-suchain and it is impossile to mar four incident vertices in such a way as to satisfy all these conditions. So the supposition is false. T h e o r e m 4. The shown elow Boolean matri C represents the necessary and sufficient conditions for eistence of a composition ϕ j (µ(u), λ(v)) (with a concrete function ϕ j ) which realizes f(): c i j = 1 means that such a composition eists if and only if graph G does not possess property p i. ϕ 0 ϕ 1 ϕ 2 ϕ 3 ϕ 4 ϕ 5 ϕ 6 ϕ 7 ϕ 8 ϕ 9 ϕ 10 ϕ 11 ϕ 12 ϕ 13 ϕ 14 ϕ 15 p 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 p 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 p 3 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 C = p 4 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 p 5 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 p 6 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 p 7 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 The necessity of the conditions follows from Theorem 3, the sufficiency is proved y showing how to construct the regarded composition (see Theorem 6 for that). It could e convenient to use the conventional division of two-variale Boolean functions into four classes: (1) constants (ϕ 0, ϕ 15 ), (2) functions depending on one variale only (ϕ 3, ϕ 5, ϕ 10, ϕ 12 ), (3) non-linear functions of two variales (ϕ 1, ϕ 2, ϕ 4, ϕ 8 - conjunctions of variales which could e inverted, ϕ 7, ϕ 11, ϕ 13, ϕ 14 - disjunctions) and (4) linear functions of two variales (ϕ 6, ϕ 9 ).
The properties can e divided similarly into four classes: P 1 = {p 1, p 2 }, P 2 = {p 3, p 4 }, P 3 = {p 5, p 6 }, P 4 = {p 7 }. The asence of some property from class P i when regarding some Boolean function means that it can e represented y the composition ϕ(µ(u), λ(v)) with ϕ chosen from the corresponding class numer i. It is easy to notice that the three last rows of the matri B constitute its only irredundant cover. From aove arguments follows theorem 5. T h e o r e m 5. An incompletely specified Boolean function can e realized y a composition ϕ(µ(u), λ(v)), if and only if at least one of the following conditions is satisfied: p 5 - the corresponding graph G does not contain 010-edges; p 6 - graph G does not contain 101-edges; p 7 - graph G does not contain cycles with odd numer of 1-edges. The following theorem shows how to find proper functions ϕ, µ and λ when some of the conditions p 5, p 6, p 7 are satisfied. T h e o r e m 6. If condition p 5 is satisfied, function f can e realized y a composition µ(u) λ(v) in which µ(a i ) and λ( j ) tae value 0 when g(a i, j ) = 0 and value 1 otherwise. If condition p 6 is satisfied, function f can e realized y a composition µ(u) λ(v) in which µ(a i ) and λ( j ) tae value 1 when g(a i, j ) = 1 and value 0 otherwise. If condition p 7 is satisfied, function f can e realized y a composition µ(u) λ(v). In the latter case the vector of values of function λ(v) on the set B is otained y matching rows of matri T - deleting orthogonality etween the rows y componentwise inversion of some of them, and the vector of values of function µ(u) on the set A taes value 1 in the components corresponding to inverted rows and value 0 in the remaining ones. Using the third model we get p 5 q ma r ma r = 0, the condition for OR-decomposition µ(u) λ(v) a p 6 r ma q ma q = 0, the condition for AND-decomposition µ(u) λ(v) a nown from [3]. The condition p 7 for EXOR-decomposition is proved in [10]. E a m p l e A\B 1 2 3 4 5 6 7 8 µ 1 1 0 0 2 1 1 1 3 0 1 1 T = 4 0 1 0 5 1 0 1 6 1 0 0 1 7 0 1 0 λ 1 0 0 0 1 1 1 1 The matri T shown aove has properties p 5 and p 6, ut not p 7. Hence, the function f () corresponding to it could e realized y a composition µ(u) λ(v). The values of functions µ(u) and λ(v) on sets A and B are shown on the right side and elow the matri, correspondingly.
5 Eperimental Results In practical applications of decomposition we have to chec the three inds of groupings for many incompletely specified Boolean functions and many disjoint / non-disjoint partitions of variales very often. Therefore, we need fast algorithms and programs and have to compare our three models relating this aim. We suppose that the first two models have similar properties of computational compleity. The first model (ipartite graph G) is very helpful for perception and understanding, whereas the second one (ternary Matri T) is more convenient for programming. Quite different is the third model, ecause the mar functions q() and r() have no relationship to the susets A and B. For the eperiments we use the representation of q() and r() y TVL's and their calculation y the XBOOLE system [4]. For comparison we use the following eperiment. In the range of n = 6,..., 16 variales we generate incompletely specified Boolean random functions defined on m input cominations. In ranges of m = [1,..., 20] + 20 *, = 0,..., 8, we select 10 such pseudo random functions and calculate all inds of disjoint decompositions. The numers of variales in sets of u and v are equal or differ y one. Results of these eperiments on a PC Pentium 200 MHz are presented in tale 2 for model 2 and tale 3 for model 3. Tale 2. Time in milliseconds for parallel decomposition using model 2 - ternary matri T n 6 7 8 9 10 11 12 13 14 15 16 m 1-20 2.1 2.5 2.8 3.0 3.1 3.2 3.4 3.6 3.7 3.9 4.0 21-40 2.4 3.0 3.7 3.8 4.1 4.4 4.5 4.7 4.9 5.0 6.3 41-60 - - 4.2 5.6 6.4 7.0 8.1 8.5 10.0 11.0 15.0 61-80 - - 4.6 6.1 7.2 8.0 13.0 14.0 20.0 22.0 28.0 81-100 - - 5.3 7.0 8.0 10.0 16.0 22.0 31.0 35.0 40.0 101-120 - - - - 9.0 12.0 20.0 28.0 48.0 51.0 55.0 121-140 - - - - 10.0 17.0 26.0 36.0 64.0 72.0 75.0 141-160 - - - - - - 33.0 44.0 78.0 91.0 97.0 161-180 - - - - - - - - 93.0 117.0 124.0 Tale 3. Time in milliseconds for parallel decomposition using model 3 - mar functions [q(), r()] n 6 7 8 9 10 11 12 13 14 15 16 m 1-20 0.7 0.5 1.2 1.3 1.4 1.7 1.2 1.2 1.3 1.5 1.1 21-40 0.3 0.6 1.3 2.2 2.7 3.9 4.0 3.7 4.0 4.2 4.0 41-60 - - 0.9 0.8 1.2 2.3 6.1 6.3 6.1 6.9 7.1 61-80 - - 0.8 0.8 1.2 2.1 7.3 8.2 9.0 9.2 10.7 81-100 - - 1.1 1.0 1.2 1.6 3.1 6.4 12.3 11.2 13.9 101-120 - - - - 1.6 1.5 2.9 6.3 13.1 15.5 16.9 121-140 - - - - 1.4 1.9 2.3 4.6 14.2 16.1 20.5 141-160 - - - - - - 2.3 3.6 12.4 15.5 22.0 161-180 - - - - - - - - 7.2 15.0 26.6 6 Conclusion The algorithm for a Boolean function decomposition ased on the theorems formulated aove seems to e rather fast. Its computational compleity is O(n m 2 ) or even O(m 2 ) - when vector operations (over vectors of the function values) are availale. Here n is the numer of variales, m - the size of the definition area D.
Using the third model, our algorithm needs in general and especially for a large definition area D the shortest time for calculation. Note, in this case the time for checing EXOR grouping is nearly ten times the time for checing AND and OR grouping. The real time of some milliseconds for the analysis relating all possile decompositions of an incompletely specified Boolean function and given susets of variales is a good asis for future applications of this approach. 7 Acnowledgments We lie to epress our gratitude to the assistant Mrs. B. Steffen and postgraduate student A. Peryshin for programming and conducting eperiments. 8 References [1] Ashenhurst, R. L.: The decomposition of switching functions. - Proceedings of an International Symposium on the Theory of Switching, April 1957, pp. 74-116. [2] Bochmann, D.; Posthoff, Ch.: Binäre dynamische Systeme. - Aademie-Verlag, Berlin, 1981. [3] Bochmann, D.; Dresig, F.; Steinach B.: A new decomposition method for multilevel circuit design. - EDAC-91, Amsterdam, pp.374-377. [4] Bochmann, D.; Steinach, B.: Logientwurf mit XOOLE, Verlag Techni, Berlin 1991. [5] Curtis, H. A.: Design of Switching Circuits. - Van Nostrand, Princeton, N. J., 1962. [6] Dresig, F.: Gruppierung - Theorie und Anwendung in der Logisynthese. Dissertation, Fortschritt - Berichte VDI, Reihe 9 Nr. 1445, VDI - Verlag, Düsseldorf, 1992. [7] Drechsler, R.; Becer, B.: Graphenasierte Funtionsdarstellungen. B. G. Teuner, Stuttgart, 1998. [8] Sasao, T.: FPGA design y generalized functional decomposition. - Logic synthesis and optimization (Ed. y Sasao T.), Kluwer Academic Pulishers, Boston / London / Dordrecht, 1993, pp. 233-258. [9] Sasao, T.; Butler, J.T.: On Bi-Decomposition of Logic Functions, ACM/IEEE International Worshop on Logic Synthesis, Tahoe City, California, May 18-21, Volume 2, pp. 1-6, 1997. [10] Steinach, B.; Wereszczynsi, A.: Synthesis of multilevel circuits using EXOR-gates. - Proceedings of IFIP WG 10.5 Worshop on Application of the Reed-Muller Epansion in Circuit Design, Chia-Mauhary, Japan, 1995, pp.161-168. [11] Stöcert, M.; Steinach, B.: Design of Fully Testale Circuits y Functional Decomposition and Implicit Test Pattern Generation, Proceedings of the 12th IEEE VLSI Test Symposium, 1994, pp. 22 27. [12] Steinach, B.; Zhang, Z.: Synthesis for Full Testaility of Large Partitioned Cominational Circuits, in: Steinach, B. (Hrsg.): Boolesche Proleme, Proceedings 2. Worshops, 19/20. Sep. 1996, TU Bergaademie Freierg, S. 31-38. [13] Steinach, B.; Zhang, Z.: Designing for Testaility of Long Pipeline of Modules, in: Anheier, W.; Pöhl, F. (Hrsg.): Tagungsand - 9. Worshop "Testmethoden und Zuverlässigeit von Schaltungen und Systemen", Report 1/97, Berichte Eletrotechni, Universität Bremen, 1997, S. 74-77. [14] Steinach, B.; Zhang, Z.: Synthesis for Full Testaility of Partitioned Cominational Circuits Using Boolean Differential Calculus, Proc. of IEEE/ACM International Worshop on Logic Synthesis 1997 (IWLS'97 - Synthesis in the Sierra), Granliaen Resort - Tahoe City, CA - USA, 1997, pp. 1-4. [15] Wan, W.; Perowsi, M. A.: A new approach to the decomposition of incompletely specified multi-output functions ased on graph coloring and local transformations and its application to FPGA mapping. - Proceedings of Euro DAC 92, 1992. [16] Zarevsij, A. D.: An algorithm for decomposition of Boolean functions. - Trudy SPhTI, is. 44, 1964, Toms, pp. 5-16 (in Russian). [17] Zarevsij, A. D.: PLA decomposition over input variales. - Dolady AN B, 1980, v.24, No 5, pp. 419-422 (in Russian). [18] Zarevsij, A. D.: On a special type decomposition of wealy specified Boolean functions. Proceedings of the Second International Conference on CAD of Discrete Devices, Mins, 1997, v.1, pp. 36-41.