Information Processing Letters 109 (2009) 499–503
Contents lists available at ScienceDirect
Information Processing Letters www.elsevier.com/locate/ipl
On the size of (generalized) OBDDs for threshold functions Beate Bollig LS2 Informatik, TU Dortmund, 44221 Dortmund, Germany
a r t i c l e
i n f o
a b s t r a c t
Article history: Received 11 November 2008 Received in revised form 6 January 2009 Available online 19 January 2009 Communicated by K. Iwama Keywords: Branching programs Computational complexity Ordered binary decision diagrams Threshold functions
Ordered binary decision diagrams (OBDDs) are one of the most common dynamic data structures for Boolean functions. Among the many areas of application are hardware verification, model checking, and symbolic graph algorithms. Threshold functions are the basic functions for discrete neural networks and are used as building blocks in the design of some symbolic graph algorithms. In this paper the first exponential lower bound on the size of a more general model than OBDDs and the first nontrivial asymptotically optimal bound on the OBDD size for a threshold function are presented. © 2009 Elsevier B.V. All rights reserved.
1. Introduction and results 1.1. Ordered binary decision diagrams and threshold functions When working with Boolean functions as in circuit verification, synthesis, and model checking, ordered binary decision diagrams, denoted OBDDs, introduced by Bryant [4], are one of the most often used data structures supporting all fundamental operations on Boolean functions. Furthermore, in the last years a research branch has emerged which is concerned with the theoretical design and analysis of so-called symbolic algorithms which solve graph problems on OBDD-represented graph instances (see, e.g., [5,6,15,16]). Definition 1. Let X n = {x1 , . . . , xn } be a set of Boolean variables. A variable order π on X n is a permutation on {1, . . . , n} leading to the ordered list xπ (1) , . . . , xπ (n) of the variables. In the following a variable order π is sometimes identified with the corresponding order xπ (1) , . . . , xπ (n) of the variables if the meaning is clear from the context.
E-mail address:
[email protected]. 0020-0190/$ – see front matter doi:10.1016/j.ipl.2009.01.005
© 2009 Elsevier B.V.
All rights reserved.
Definition 2. A π -OBDD on X n is a directed acyclic graph G = ( V , E ) whose sinks are labeled by Boolean constants and whose non-sink (or inner) nodes are labeled by Boolean variables from X n . Each inner node has two outgoing edges one labeled by 0 and the other by 1. The edges between inner nodes have to respect the variable order π , i.e., if an edge leads from an xi -node to an x j -node, π −1 (i ) π −1 ( j ) (xi precedes x j in xπ (1) , . . . , xπ (n) ). Each node v represents a Boolean function f v : {0, 1}n → {0, 1} defined in the following way. In order to evaluate f v (b), b ∈ {0, 1}n , start at v. After reaching an xi -node choose the outgoing edge with label b i until a sink is reached. The label of this sink defines f v (b). The size of a π -OBDD G is equal to the number of its nodes and the π -OBDD size of a function f , denoted by π -OBDD( f ), is the size of the minimal π -OBDD representing f .
SBDDs (shared binary decision diagrams) are an extension of OBDDs that can express multiple functions. An SBDD represents a Boolean function f ∈ B n,m : {0, 1}n → {0, 1}m by representing simultaneously the output functions f 1 , f 2 , . . . , f m of f , where the representations for the different coordinate functions f 1 , f 2 , . . . , f m may share nodes. The size of the reduced π -SBDD representing f is described by the following structure theorem [13].
500
B. Bollig / Information Processing Letters 109 (2009) 499–503
Theorem 3. The number of xπ (i ) -nodes of the π -SBDD for f = ( f 1 , . . . , f m ) is the number si of different subfunctions f j |xπ (1) =a1 ,...,xπ (i−1) =ai−1 , 1 j m, and a1 , . . . , ai −1 ∈ {0, 1}, essentially depending on xπ (i ) (a function g depends essentially on a Boolean variable z if g |z=0 = g |z=1 ). It is well known that the size of an OBDD or an SBDD representing a function f depends on the chosen variable order and may vary between linear and exponential size. Since in applications the variable order π is not given in advance we have the freedom (and the problem) to choose a good order for the representation of f . Definition 4. The OBDD size or OBDD complexity of f (denoted by OBDD( f )) is the minimum of all π -OBDD( f ). Analogously the SBDD size or SBDD complexity of a multiple output function is defined. Read-once branching programs, denoted BP1s, also sometimes called free binary decision diagrams, are a more general model where the variable orders on different paths may be different. Threshold functions are the basic functions for discrete neural networks. Definition 5. The threshold function T w 1 ,..., w n ,t ∈ B n with integer weights w 1 , . . . , w n and threshold value t computes 1 on input b iff b1 w 1 + · · · + bn w n t. The sum n i =1 b i w i is called the weight of the input b. Obviously, the output of a threshold function depends on a partial input (bπ (1) , . . . , bπ (i ) ) only via the partial sum bπ (1) w π (1) + · · · + bπ (i ) w π (i ) and O (n( w 1 + · · · + w n )) is an upper bound on the OBDD size for the representation of T w 1 ,..., w n ,t according to an arbitrary variable order. Because of the importance of threshold functions several questions like the number of different threshold functions, the maximum weight of threshold functions, and the realization of general Boolean functions by a network of threshold functions have been investigated (see, e.g., [10]). Furthermore, for the analysis of the runtime of an OBDD-based algorithm for topological sorting generalized threshold functions called multivariate threshold functions have been defined in [15,16]. Later on multivariate threshold functions have been used to design and analyze symbolic graph algorithms (see, e.g., [11,12]). Another motivation for the investigation of threshold functions represented by BDDs is the following one. Many combinatorial problems can be formulated as 0/1 integer programs (0/1 IPs). Obviously, a linear constraint can be seen as a threshold function. In [1] a new approach is presented how to solve combinatorial problems using BDDs. An SBDD is used to represent a set of inequalities, afterwards the single output functions represented in the SBDD are combined by conjunction such that the final OBDD represents all 0/1 solutions of a linear program. Obviously, one aim is to find an SBDD of small size for the representation of all inequalities.
1.2. Results and related work Although many exponential lower bounds on the OBDD size of Boolean functions are known and the method how to obtain such bounds is simple, there are only few functions where the OBDD size is asymptotically known exactly (see, e.g., [2,3]). In Section 2 we prove a nontrivial asymptotically optimal bound of Θ(n3 ) on the size of OBDDs representing a threshold function. 1/ 2 In [7] the first exponential lower bound of Ω(n2n /2 ) on the OBDD size of a threshold function is proved. Later 1 −ε on this lower bound has been improved up to Ω(n2cn ), where c is an appropriate constant and ε is an arbitrary small constant (see [14]). Section 3 contains (to the best of our knowledge) the first exponential lower bound of 1/ 2 Ω(n−1/4 2n ) on the size of read-once branching programs (BP1s) for a threshold function on n variables. For this result, we use the fact that threshold functions with nonnegative weights are monotone functions and some of the smallest 1-inputs of our function correspond to the 1-inputs of a function with large read-once branching program size called permutation test function PERM (see [8, 9]). (The smallest 1-inputs b = (b1 , . . . , bn ) of a monotone function are 1-inputs for which the function value for each input b = (b1 , . . . , bn ), b = b and bi b i , is 0.) 2. An asymptotically optimal bound on the OBDD complexity of a threshold function In this section we prove an asymptotically optimal lower bound of Ω(n3 ) on the size of a threshold function. The corresponding upper bound follows from the observation that there can be at most t nodes labeled by the same variable. The following lemma will be crucial for our lower bound proof. Lemma 6. Let i 1 , i 2 , . . . , ik be different positive integers in N k and S := {s | s = j =1 a j i j , a j ∈ {0, 1} for 1 j k}. The size of S is at least k(k + 1)/2 + 1. Proof. We prove by induction that the cardinality of S is at least k(k + 1)/2 + 1. For k = 1 there are two elements in S: 0 and i 1 . Since i 1 is positive and 2 = 2/2 + 1 we are done. Now, without loss of generality let i 1 < i 2 < · · · < k−1 ik−1 < ik . The size of S := {s | s = j =1 a j i j , a j ∈ {0, 1} for 1 j k − 1} is at least (k − 1)k/2 + 1. We consk in S , sider the k different elements k−1 s1 < s2 · · · < k−1 k−1 where s := j =1 a j i j and j =1 a j = k − 2 or j =1 a j =
k − 1, 1 k. S contains all elements in S and also s1 + ik , s2 + ik , . . . , sk + ik which are different and cannot be in S since sk is the largest element in S and s1 + ik > sk . Therefore, there are at least (k − 1)k/2 + 1 + k = k(k + 1)/2 + 1 elements in S. 2 Theorem 7. The OBDD complexity of the threshold function f n := T 1,2,...,n,n(n+1)/4 is Θ(n3 ).
B. Bollig / Information Processing Letters 109 (2009) 499–503
In the following for the sake of simplicity we do not apply floor or ceiling functions to numbers even when they need to be integers whenever this is clear from the context and has no bearing on the essence of the proof. Proof. The upper bound on the OBDD complexity of f n is n · t = O (n3 ) for t = n(n + 1)/4. In the rest of the proof let π be an arbitrary but fixed variable order and j be an arbitrary but fixed integer in {0, 1, 2, . . . , (n/8) − 1}. Our aim is to prove that there are at least j ( j + 1)/2 + 1 different subfunctions f n|xπ (1) =a1 ,...,xπ ( j) =a j , a1 , . . . , a j ∈ {0, 1}, that essentially depend on xπ ( j +1) . Therefore, we can conclude that the OBDD complexity of f n is at least Ω(n3 ). Let U be the set of variables {xπ (1) , . . . , xπ ( j ) } and L be Xn \ U . Using Lemma 6 we know that there are at least j ( j + 1)/2 + 1 different partial assignments to the variables in U that lead to different partial sums. In the following we investigate these different partial assignments with different partial weights and show that they lead to different subfunctions that essentially depend on the variable xπ ( j +1) . Let w b be the weight of a partial input b. It is not difficult to see that two partial assignments b and b where w nw+b1 = n+b1 correspond to different subfunctions. With-
nw+b1
w n+b1 .
out loss of generality, let < We can choose an assignment br to the variables in L where w br = n(n + w 1)/4 − n+b1 . Therefore, we assume that w b = w b and w
nw+b1 = n+b1 . Moreover, let w b = p (n + 1) + r1 , w b = p (n + 1) + r2 , and r1 < r2 < n + 1. If there exists an integer , where r1 r2 − 1 and xn− ∈ L, it is easy to see that b and b correspond to dif-
ferent subfunctions. By replacing the variable xn− by 1 we w w can argue similarly to the case where n+b1 = n+b1 . Since |U | = j, there exists a variable xn− ∈ L, r1 r2 − 1, if the difference between r2 and r1 is greater than j. Therefore, we assume that r2 − r1 j. Because j < n/8 and r2 − r1 j it is n + 1 − r2 > j or r1 > j. We assume that n + 1 − r2 > j (the other case can be handled similarly). Since there are only j variables in U , there exists a variable xn−r2 − j +1 , 0 j j, in L. Our aim is to construct an assignment to the variables in L whose partial sum is n(n + 1)/4 − w b = n(n + 1)/4 − ( p + 1)(n + 1) + n + 1 − r2 , in order to prove that the assignments b and b correspond to different subfunctions. We call (xi , xn−i +1 ) an x-pair, 1 i n/2. The sum of an x-pair is n + 1. An x-pair is destroyed with respect to U and L if one of its variables is in U . There are at least n/2 − j > (3/8)n x-pairs that are not destroyed in L. The x-variables (x2i −1 , xn−(2i −1)+1 , x2i , xn−2i +1 ), 1 i n/4, are called 1-tuples. Note, that by setting two appropriate variables of a 1-tuple to 1 it is possible to obtain the sum 2i + n − (2i − 1) + 1 = n + 2 and the sum 2i − 1 + n − 2i + 1 = n. A 1-tuple is called destroyed with respect to U and L if one of its variables is in U . There are at least n/4 − j > n/8 1-tuples that are not destroyed in L. Since j < n/8 we know that p is less than n/8. We choose a variable xn−r2 − j +1 ∈ L, where j n/8. Since there are more than n/8 not destroyed 1-tuples in L, we can choose j not destroyed 1-tuples and furthermore,
501
(n/4 − p − 1 − j ) x-pairs in L, whose variables do not belong to the chosen 1-tuples. The variable xn−r2 − j +1 and the chosen x-variables that do not belong to the chosen 1-tuples are set to 1. For each chosen 1-tuple we replace two of the corresponding variables by 1 such that their partial sum is n + 2, the other 2 variables are set to 0. The remaining variables in L are set to 0. Altogether the partial sum of the considered assignment is (n/4 − p − 1 − j )(n + 1) + (n − r2 − j + 1) + j (n + 2) = (n/4 − p − 1)(n + 1) + n − r2 + 1 and we are done. Until now we have shown that there are at least j ( j + 1)/2 + 1 different subfunctions obtained by replacing the variables in U by constants. In order to prove that there are at least j ( j + 1)/2 + 1 nodes labeled by the variable xπ ( j +1) , we have to show that the considered subfunctions essentially depend on the variable xπ ( j +1) . Therefore, we consider an arbitrary partial sum s1 (n + 1) + s2 , 0 s1 < n/8 and 0 s2 < n + 1. Our aim is to construct an assignment br to the variables in L \ {xπ ( j +1) } whose partial sum is w br and s1 (n + 1) + s2 + w br
< t = n(n + 1)/4 s1 (n + 1) + s2 + w br + π ( j + 1), in order to prove that the considered subfunction essentially depends on xπ ( j +1) . (Note, that π ( j + 1) is the weight of the variable xπ ( j +1) .) Case 1.
π ( j + 1) + s2 n + 1
We consider the following assignment to the variables in L \ {xπ ( j +1) }. Variables of (n/4 − s1 − 1) x-pairs are set to 1, the remaining variables are set to 0. Iff xπ ( j +1) = 1 the functions value of f n is 1. Case 2.
π ( j + 1) + s2 < n + 1
We know that n + 1 − (π ( j + 1) + s2 ) < n/8 or there is at least one variable x in L where n + 1 − (π ( j + 1) + s2 ) − n/8 < n + 1 − (π ( j + 1) + s2 ). In the later case we consider the following assignment to the variables in L \ {xπ ( j +1) }. – The variable x is set to 1. – Half of the variables of (n + 1) − (π ( j + 1) + s2 ) − 1-tuples are set to 1 such that their corresponding sum is (n + 2)(n + 1 − (π ( j + 1) + s2 ) − ). The remaining variables of the considered 1-tuples are set to 0. – Moreover, the variables of exactly n/4 − s1 − (n + 1 − (π ( j + 1) + s2 ) − ) − 1 x-pairs are set to 1. – The remaining variables are set to 0. If n + 1 − (π ( j + 1) + s2 ) = j n/8, we consider the following assignment.
502
B. Bollig / Information Processing Letters 109 (2009) 499–503
– Half of the variables of j 1-tuples are set to 1 such that their corresponding sum is (n + 2) j = (n + 2)(n + 1 − (π ( j + 1) + s2 )). The remaining variables of the considered 1-tuples are set to 0. – Moreover, the variables of exactly n/4 − s1 − (n + 1 − (π ( j + 1) + s2 )) − 1 x-pairs are set to 1. – The remaining variables are set to 0. The function value of f n is 1 iff xπ ( j +1) is set to 1. Therefore, there are at least j ( j + 1)/2 + 1 nodes labeled by xπ ( j +1) , j < n/8, in the π -OBDD representing f n . Altogether we have shown that there are at least n/8−1
j ( j + 1)/2 + 1 = Θ(n3 )
j =0
different subfunctions that have to be represented in an OBDD for f n . 2 Note, that we have shown that for every variable order π .
rows to the indices of the columns. Therefore, there is a set P of different initial paths from the source to the cut, | P | nn/2 , such that for two different paths p and p we know that R p = R p or C p = C p . Since the weight of the inputs corresponding to the investigated computation paths is t we can conclude that two different initial paths p and p in P cannot lead to the same node in G. The reason is the following one. The weight of a path p is the sum of the weights of the variables set to 1 on p. Let w p be the weight of p and w p be the weight of p , without loss of generality w p < w p . Due to our construction we know that there is an extension of p with weight t − w p and an extension of p with weight t − w p leading to the 1-sink. Since w p + t − w p < t the subfunctions of T n corresponding to p and p are different and the paths cannot lead to the same node in G. Hence, the size of the set P is a lower bound on the size of G. Using Stirling’s formula we obtain a lower bound of Ω(n−1/2 2n ). 2
π -OBDD( f n ) = Θ(n3 )
3. An exponential lower bound on the BP1 complexity of a threshold function In this section we present to the best of our knowledge the first exponential lower bound on the size of read-once branching programs for a threshold function. Definition 8. The threshold function T n is defined on n2 variables xi j , 0 i , j n − 1, for n ∈ N. The threshold value t is 22n − 1 and the weights w i j are defined as 2i + 2n+ j . Theorem 9. The read-once branching program complexity of the function T n is at least Ω(n−1/2 2n ).
4. Concluding remarks Until now it is open, whether there exists a threshold function whose OBDD complexity is exponential but its BP1 complexity is polynomial. It is not clear whether the freedom to choose different variable orders on different paths may really help to reduce the size for the representation of threshold functions. Acknowledgement The author would like to thank Sándor Fekete for an easier proof of Lemma 6. References
Proof. In [8,9] exponential lower bounds on the size of so-called nondeterministic BP1s representing the function PERMn , the test, whether a Boolean matrix contains exactly one 1-entry in each row and in each column, are presented. Here for the choice of the considered subpaths and for the estimation of the number of different chosen subpaths some of their ideas are used. Let G be a read-once branching program for the threshold function T n . We consider 1-inputs of the function T n with weight t and exactly n variables set to 1. It is easy to see that these 1-inputs have the property that for each index i or j, 0 i , j n − 1, there is exactly one variable xi ∗ or x∗ j set to 1. Next, we investigate the computation paths for these inputs, i.e., the corresponding paths to the 1-sink in G. The number of these paths is n!. Note, that there are exactly n 1-edges, i.e., variables set to 1, on these paths but there can be less than n2 edges altogether because variables may be left out. Now, we separate each investigated computation path p into its initial path until there are n/2 1-edge on the subpath for the first time and into the rest. Let R p (C p ) be the set of indices i for which a variable xi ∗ (x∗i ) is set to 1 on p. If n/2 rows and columns have been chosen, there are n/2 ! possibilities to map the indices of the
[1] M. Behle, On threshold BDDs and the optimal variable ordering problem, in: Proc. of COCOA 2007, in: LNCS, vol. 4616, 2007, pp. 124–135. [2] B. Bollig, N. Range, I. Wegener, Exact OBDD bounds for some fundamental functions, in: Proc. of SOFSEM 2008, in: LNCS, vol. 4910, 2008, pp. 174–185. [3] B. Bollig, I. Wegener, Asymptotically optimal bounds for OBDDs and the solution of some basic OBDD problems, Journal of Computer and System Sciences 61 (2000) 558–579. [4] R.E. Bryant, Graph-based algorithms for Boolean function manipulation, IEEE Trans. Comput. 35 (1986) 677–691. [5] R. Gentilini, C. Piazza, A. Policriti, Computing strongly connected components in a linear number of symbolic steps, in: Proc. of SODA 2003, ACM Press, 2003, pp. 573–582. [6] R. Gentilini, C. Piazza, A. Policriti, Symbolic graphs: linear solutions to connectivity related problems, Algorithmica 50 (2008) 120–158. [7] K. Hosaka, Y. Takenaga, T. Kaneda, S. Yajima, Size of ordered binary decision diagrams representing threshold functions, Theoretical Computer Science 180 (1997) 47–60. [8] S. Jukna, The effect of null-chains on the complexity of contact schemes, in: Proc. of FCT, in: LNCS, vol. 380, 1989, pp. 246–256. [9] M. Krause, C. Meinel, St. Waack, Separating the eraser Turing machine classes L e , N L e , co-N L e and P e , Theoretical Computer Science 86 (1991) 267–275. [10] S. Muroga, Threshold Logic and its Application, Wiley, New York, 1971. [11] D. Sawitzki, Experimental studies of symbolic shortest-path algorithms, in: Proc. of WEA 2004, in: LNCS, vol. 3059, 2004, pp. 482– 497.
B. Bollig / Information Processing Letters 109 (2009) 499–503
[12] D. Sawitzki, On symbolic scheduling independent tasks with restricted execution times, in: Proc. of WEA 2005, in: LNCS, vol. 3503, 2005, pp. 277–289. [13] D. Sieling, I. Wegener, NC-algorithms for operations on binary decision diagrams, Parallel Processing Letters 48 (1993) 139–144. [14] Y. Takenaga, M. Nozoe, S. Yajima, Size and variable ordering of OBDDs
503
representing threshold functions, in: Proc. of COCOON 1997, in: LNCS, vol. 1276, 1997, pp. 91–100. [15] P. Woelfel, Symbolic topological sorting with OBDDs, in: Proc. of MFCS 2003, in: LNCS, vol. 2747, 2003, pp. 671–680. [16] P. Woelfel, Symbolic topological sorting with OBDDs, Journal of Discrete Algorithms 4 (1) (2006) 51–71.