16
Theory Comput Syst (2009) 45: 27–42 DOI 10.1007/s00224-007-9067-9 Polynomial-Size Binary Decision Diagrams for the Exactly Half-d -Hyperclique Problem Reading Each Input Bit Twice Daniel Král’ Published online: 27 October 2007 © Springer Science+Business Media, LLC 2007 Abstract A binary decision diagram (BDD) is a graph-based data structure repre- senting Boolean functions; -BDDs are BDDs with an additional restriction that each input bit can be tested at most times. A d -uniform hypergraph H on N vertices is an exactly half-d -hyperclique if N/2 of its vertices form a hyperclique and the remain- ing vertices are isolated. Wegener [J. ACM 35(2), 461–471 (1988)] conjectured that there is no polynomial-size (d 1)-BDD for the Exactly half-d -hyperclique problem. We refute this conjecture by constructing polynomial-size (syntactic) 2-BDDs for the Exactly half-d -hyperclique problem for every d 2. Keywords Binary decision diagrams · Free binary decision diagrams 1 Introduction Binary decision diagrams (BDDs) form an important data structure for representation of Boolean functions that is often used in circuit verification algorithms [21]. Several variants of BDDs have been proposed in hope that they can provide compact rep- resentations of important Boolean functions such as integer multiplication. Since the sizes of BDDs and their variants are closely related to non-uniform space complexity, lower and upper bounds proven in this setting are also interesting from the complex- ity point of view. The reader is referred to the monographs [19, 21] by Wegener for a more detailed exposition. Institute for Theoretical Computer Science (ITI) is supported by Ministry of Education of Czech Republic as projects LN00A056 and 1M0545. D. Král’ ( ) Department of Applied Mathematics and Institute for Theoretical Computer Science (ITI), Faculty of Mathematics and Physics, Charles University, Malostranské námˇ estí 25, 118 00 Prague 1, Czech Republic e-mail: [email protected]

Polynomial-Size Binary Decision Diagrams for the Exactly Half-d-Hyperclique Problem Reading Each Input Bit Twice

Embed Size (px)

Citation preview

Theory Comput Syst (2009) 45: 27–42DOI 10.1007/s00224-007-9067-9

Polynomial-Size Binary Decision Diagramsfor the Exactly Half-d-Hyperclique ProblemReading Each Input Bit Twice

Daniel Král’

Published online: 27 October 2007© Springer Science+Business Media, LLC 2007

Abstract A binary decision diagram (BDD) is a graph-based data structure repre-senting Boolean functions; �-BDDs are BDDs with an additional restriction that eachinput bit can be tested at most � times. A d-uniform hypergraph H on N vertices is anexactly half-d-hyperclique if N/2 of its vertices form a hyperclique and the remain-ing vertices are isolated. Wegener [J. ACM 35(2), 461–471 (1988)] conjectured thatthere is no polynomial-size (d −1)-BDD for the Exactly half-d-hyperclique problem.We refute this conjecture by constructing polynomial-size (syntactic) 2-BDDs for theExactly half-d-hyperclique problem for every d ≥ 2.

Keywords Binary decision diagrams · Free binary decision diagrams

1 Introduction

Binary decision diagrams (BDDs) form an important data structure for representationof Boolean functions that is often used in circuit verification algorithms [21]. Severalvariants of BDDs have been proposed in hope that they can provide compact rep-resentations of important Boolean functions such as integer multiplication. Since thesizes of BDDs and their variants are closely related to non-uniform space complexity,lower and upper bounds proven in this setting are also interesting from the complex-ity point of view. The reader is referred to the monographs [19, 21] by Wegener for amore detailed exposition.

Institute for Theoretical Computer Science (ITI) is supported by Ministry of Education of CzechRepublic as projects LN00A056 and 1M0545.

D. Král’ (�)Department of Applied Mathematics and Institute for Theoretical Computer Science (ITI),Faculty of Mathematics and Physics, Charles University, Malostranské námestí 25, 118 00 Prague 1,Czech Republice-mail: [email protected]

28 Theory Comput Syst (2009) 45: 27–42

A binary decision diagram (BDD) is an acyclic directed graph with three specialnodes: the source, the 0-sink and the 1-sink. Each node v, except for the sinks, isassigned one of input variables and has out-degree two. One of the arcs leaving v islabeled with 0 and the other with 1. The out-degrees of both the sinks are zero. Thecomputation path for an input x1, . . . , xn is the path v1, . . . , vk where the node v1 isthe source, vk is a sink and the arc between vi and vi+1 is labeled by the value of thevariable xji

assigned to the node vi . The variable xjiis said to be tested at the node vi .

The input is accepted if the final node is the 1-sink, and it is rejected, otherwise.In this way, a Boolean function f (x1, . . . , xn) : {0,1}n → {0,1} represented by theBDD is defined. The size of an BDD is the number of its nodes. The sizes of BDDsfor naturally defined sequences of Boolean functions fn : {0,1}n → {0,1} are oftenexpressed as a function of the input length n.

We study a variant of BDDs where the number of tests of input bits is restricted.As noticed by Borodin et al. [9], there are actually two possible types of restrictions:if every path from the source to a sink contains at most � nodes labeled by any ofinput variables, the BDD is called a syntactic �-BDD. If the restriction holds onlyfor computation paths, i.e., the paths corresponding to inputs, the BDD is called asemantic �-BDD. Clearly, a syntactic �-BDD is also a semantic �-BDD for every� ≥ 1, but the converse need not be true (for � > 1). It is not hard to show that the twonotions coincide for � = 1.

The first results on BDDs with restricted number of input tests were lower boundson 1-BDDs. The first lower bound on the size of 1-BDDs that is exponential in theinput length for a function with polynomial-size BDDs was proved in [3] and oth-ers were obtained later, see, e.g., [10, 15–17]. The current best lower on the size of1-BDDs for a Boolean function in P is 2n−O(log2 n) [4]. The lower bound techniquesfor 1-BDDs are now considered to be well-understood. In 1998, Thathachar [18] con-structed explicit functions fn for every � ≥ 1 that can be represented by polynomial-size (in n) syntactic (� + 1)-BDDs but cannot be represented by polynomial-sizesyntactic �-BDDs. Beame et al. [7, 8] showed that there are functions that can berepresented by polynomial-size semantic 2-BDDs but cannot be represented by sub-exponential-size syntactic �-BDDs for � ≥ 2. Exponential lower bounds on semantic2-BDDs for functions with polynomial-size BDDs follow from work of Ajtai andBeame et al. [1, 2, 5, 6].

Historically, the first function suggested to separate the classes of polynomial-size�-BDDs and (� + 1)-BDDs was the function excldN [20]. The function excldN is afunction of

(Nd

)Boolean variables that represent possible edges of a d-uniform hy-

pergraph H with N vertices. Recall that a hypergraph is formed by vertices and edgeswhere edges are arbitrary (unordered) subsets of vertices. If all the edges consists of d

vertices, the hypergraph is said to be d-uniform, in particular, 2-uniform hypergraphsare ordinary graphs. The function excldN is true if there is a set A of N/2 vertices suchthat the edges of H are precisely the sets of

(Ad

), i.e., H is formed by a hyperclique

of order N/2 and the remaining vertices are isolated. Wegener [20] conjectured thefollowing (note that the following conjecture does not involve specifically semanticor syntactic �-BDDs since the distinction between the two notions appeared later):

Conjecture 1 For d ≥ 2, there is no polynomial-size (d − 1)-BDD for excldN .

Theory Comput Syst (2009) 45: 27–42 29

Conjecture 1 can also be found as Problem 7.7 in [21]. The question whetherexcldN has a polynomial-size (d − 1)-BDDs is still of some interest (see commentsafter Theorem 7.2.6 in [21]) though the original motivation dissolved.

We disprove Conjecture 1 by constructing polynomial-size syntactic 2-BDDs forexcldN for every d ≥ 2 (note that every syntactic 2-BDD is also semantic). If d = 2, alower bound of order 2�(N) on the size of 1-BDDs for excldN was proved by Žák [22].

The bound is of order 2�(n1/2) where n = (N2

)is the input length.

As announced, we refute Conjecture 1 by constructing syntactic 2-BDDs for excldNof size O(N(d2+3d−4)/2), i.e., of size O(n(d2+3d−4)/(2d)) where n = (

Nd

)is the input

length. We design a log-space algorithm for the function excldN which accesses eachinput bit at most twice. Since it is known that the logarithm of the BDD size is essen-tially the space needed by non-uniform Turing machines [11, 14], this already provesthe existence of polynomial-size semantic 2-BDDs. In order to construct syntactic2-BDDs, we show that the space complexity and the restriction on the number oftests of input bits is preserved for “faulty” inputs (see Sect. 2 for a definition). To ourbest knowledge, the upper bound technique for syntactic �-BDDs based on “faultyinputs” has not been used before though a similar notion has been considered in [12].For the sake of completeness, we also provide an exponential lower bound on thesizes of 1-BDDs for excldN for d ≥ 2.

2 Relation between Space Complexity and BDD Size

Our upper bound is based on the relation between the non-uniform space complexityand the sizes of BDDs. For ordinary BDDs, this relation were already observed byCobham [11] and by Pudlák and Žák [14]. However in our case, we deal with seman-tic and syntactic �-BDDs instead of ordinary BDDs, so an additional restriction onthe number of tests of each input bit has to be added.

We consider the following computational model: the algorithm can be in one offinitely many states. The number of states is independent of the input size. The con-figuration is determined by the state and the current content of memory. The amountof allocated memory may depend on the input size. The configuration determines thenext step of the algorithm which is either a change of the state and the content ofmemory or only a change of the state based on the read input bit. The step in whichthe new state depends on the i-th input bit is said to be a test of the i-th bit, or simply,the algorithm tests the i-th bit. The space complexity is the number of bits of allocatedmemory. The input size n is stored in additional logn bits of memory which cannotbe modified and thus not counted in the complexity. In this computational model,we access the input bits through a function that is assumed to require no additionalspace to retrieve the value of the read bit—this is consistent with our applicationssince in the proofs of Propositions 1 and 2, we only need that the read input bit isdetermined by a function of the configuration of our algorithm (and it does not needto be efficiently computable, in particular, it can be even non-recursive). This allowsus to omit (sometimes complex) computation of the index of the bit accessed in ouralgorithms.

30 Theory Comput Syst (2009) 45: 27–42

We first consider semantic �-BDDs. The proof of the next proposition follows thesame idea as in the case of ordinary BDDs (a similar proposition is also in [13]). Weremark that the bases of all logarithms are two.

Proposition 1 Let fn : {0,1}n → {0,1} be a sequence of Boolean functions and � ≥ 1an integer. If there exists an algorithm that for the input of length n:

• computes the function fn;• works in space k logn + O(1) for some k ≥ 0; and• accesses each bit of the input string at most � times;

then there exists a semantic �-BDD representing the function fn of size O(n2k).

Proof Consider a directed graph G whose vertices are the triples (s, σ, t) consistingof a state s and content of memory σ which can be reached after t ≥ 0 steps forsome input. If the algorithm at the configuration (s, σ ) does not test any input bits,the vertex (s, σ, t) is joined by two edges to the vertex (s′, σ ′, t + 1) where (s′, σ ′)is the configuration reached after (s, σ ) (the two edges leaving (s, σ, t) are labeledwith 0 and 1; the pair of edges is present to preserve that the out-degree of each vertexexcept for the sinks is two). If the algorithm reads an input bit xi at the configuration(s, σ ), the vertex (s, σ, t) is assigned xi and it is joined by an edge labeled with 0 tothe vertex (s′, σ ′, t + 1) where (s′, σ ′) is the configuration reached by the algorithmafter (s, σ ) if xi = 0 and by an edge labeled with 1 to the vertex (s′′, σ ′′, t + 1) where(s′′, σ ′′) is the configuration reached by the algorithm after (s, σ ) if xi = 1. Thereare no edges leaving the vertices corresponding to the halting configurations of thealgorithm. Note that the graph G is acyclic because a vertex (s, σ, t) is joined byedges only to vertices (s′, σ ′, t + 1).

Next, we modify G to a BDD. Contract all the halting configurations in which thealgorithm accepts to a single vertex. This vertex will be the 1-sink. Similarly, contractall the halting configurations in which the algorithm rejects to a single vertex whichwill be the 0-sink. If there is a single edge leaving a vertex (s, σ, t) (this may happenif one of the results of input tests is inconsistent with the previous computation) orthere are two edges leaving a vertex (s, σ, t) which lead to the same vertex of G,contract the vertex (s, σ, t) and its unique successor. The variable assigned to theresulting vertex is the variable assigned to the successor. Let G′ be the resultinggraph. Observe that each vertex of G′ except for the sinks has out-degree two and itis assigned one of the variables. In addition, the graph G′ is acyclic.

We claim that G′ is a semantic �-BDD representing the function fn if we set thesource of G′ to be the vertex (s, σ,0) where (s, σ ) is the initial configuration of thealgorithm. Consider the computation path for an input x1, . . . , xn in G′. If we expandthe edges of the path which were contracted, we obtain a sequence of configurationsreached by the algorithm, starting in the initial configuration and ending in a haltingconfiguration. If the algorithm accepts, the final node of the computation path is the1-sink. If the algorithm rejects, the final node is the 0-sink. Since the algorithm testseach variable at most � times, there are at most � nodes on the computation pathwhich are assigned a variable xi .

It remains to estimate the size of G′. The number of steps of the algorithm isbounded by the number of possible configurations. Since the number of possible

Theory Comput Syst (2009) 45: 27–42 31

configurations does not exceed S · 2k logn+O(1) = O(nk) where S is the number ofstates of the algorithm, the number of nodes of the original graph G is at most O(n2k).This also bounds the number of nodes of G′. �

We now consider syntactic �-BDDs. The input is said to be faulty if the test ofan input bit does not necessarily yield the correct value (results of tests of the samebit may be distinct). No probability distribution of good and bad answers is assumed.Considered algorithms are required to compute the correct result only if all input testsyielded correct values, but their space complexity and the restriction on the numberof tests of individual input bits must be preserved for faulty inputs.

Proposition 2 Let fn : {0,1}n → {0,1} be a sequence of Boolean functions and � ≥ 1an integer. If there exists an algorithm that for the input of length n:

• terminates even if the input is faulty;• computes the function fn (if the input is not faulty);• works in space k logn + O(1) even in the case of faulty inputs; and• accesses each input bit at most � times even in the case of faulty inputs;

then there exists a syntactic �-BDD representing the function fn of size O(nk).

Proof We proceed similarly as in the proof of Proposition 1, however, we utilize theassumption that the algorithm terminates even for faulty inputs, so we do not have toinclude time in the tuples corresponding to the vertices of our diagram and thus weobtain smaller BDDs. Consider a directed graph G whose vertices are the configura-tions (s, σ ) which can be reached for some possibly faulty input. If the algorithm atthe configuration (s, σ ) does not test any input bits, the vertex (s, σ ) is joined by twoedges to the vertex (s′, σ ′) where (s′, σ ′) is the configuration reached after (s, σ ).The two edges leaving (s, σ ) are labeled with 0 and 1. If the algorithm reads an inputbit xi at the configuration (s, σ ), the vertex (s, σ ) is joined by an edge labeled with 0to the vertex (s′, σ ′) where (s′, σ ′) is the configuration reached by the algorithm after(s, σ ) if xi = 0 and by an edge labeled with 1 to the vertex (s′, σ ′) where (s′, σ ′)is the configuration reached if xi = 1. There are no edges leaving the vertices corre-sponding to the halting configurations of the algorithm. Note that the out-degrees ofall the vertices except for those corresponding to the halting configurations are two.

We claim that the graph G is acyclic. If G contains a cycle C, consider an infinitetrail comprised of a path from the initial configuration to a vertex of C (such a pathexists since we included to G only the configurations reachable for some faulty input)and by infinite number of copies of the cycle C. The obtained trail corresponds toexecution of the algorithm for some faulty input which never terminates. However,this contradicts our assumption that the algorithm always terminates even for faultyinputs.

We now modify G to a BDD. Contract all the halting configurations in which thealgorithm accepts to a single vertex. This vertex will be the 1-sink. Similarly, thehalting configurations at which the algorithm rejects are contracted to a single vertexwhich will be the 0-sink. The initial configuration will be the source. If there are twoedges leaving a vertex (s, σ ) which lead to the same vertex of G, contract the vertex

32 Theory Comput Syst (2009) 45: 27–42

(s, σ ) and its unique successor. The variable assigned to the resulting vertex is thevariable assigned to the successor. Let G′ be the resulting graph. Observe that eachvertex of G′ except for the sinks has out-degree two and it is assigned one of thevariables. Moreover, since the graph G is acyclic, the graph G′ is also acyclic.

We claim that G′ is a syntactic �-BDD representing the function fn. Let P bea path from the source to a sink in G′. Note that each vertex of G′ lies on at leastone such path. The path P corresponds to execution of the algorithm for some faultyinput. Since the algorithm tests each variable at most � times for the considered faultyinput, each variable is assigned to at most � vertices of the path P . The proof that G′represents the function fn is the same as in Proposition 1.

Since the number of configurations is bounded by S · 2k logn+O(1) = O(nk), whereS is the number of possible states of the algorithm, the size of the syntactic �-BDDG′ does not exceed O(nk). �

3 Upper Bound for excldN

We design a logspace algorithm for excldN . The algorithm terminates and tests eachinput bit at most twice even if the input is faulty. The vertices of an input d-uniformhypergraph H are considered to be ordered and identified with the numbers 1, . . . ,N .The d-tuples (A1, . . . ,Ad) with A1 < A2 < · · · < Ad correspond to the edges. Theedges are considered to be lexicographically ordered and this order is denoted by �,i.e., (A1, . . . ,Ad) � (B1, . . . ,Bd) if Ai < Bi for the first index i such that Ai �= Bi .

We briefly sketch the main idea of the algorithm. The core of the algorithm pre-sented in Sect. 3.2 is a procedure CLIQUE which accepts a d-uniform hypergraph H

if and only if it is comprised of a hyperclique and isolated vertices, i.e., if there ex-ists a subset V ⊆ {1, . . . ,N} such that the edges of H are precisely all the d-elementsubsets of V . Note that if |V | < d , then such H contains no edges at all.

The main idea for d = 2 (the case of graphs) is the following: find the smallest non-isolated vertex X and its smallest neighbor Y (note Y > X) and verify that the verticesX and Y have the same neighbors except for themselves. The input graph H is formedby a clique and isolated vertices if and only if all the vertices X + 1, . . . , Y − 1 areisolated and the subgraph H ′ of H induced by the vertices Y, . . . ,N is formed bya clique and isolated vertices. After checking that the vertices X + 1, . . . , Y − 1 areisolated, we verify that H ′ is formed by a clique and isolated vertices in the sameway. In this way, each edge is tested at most twice.

If d ≥ 3, we proceed similarly but instead of a single vertex X we consider the(d − 1)-tuple of the smallest vertices contained in the clique. After the “neighbor-hood” of the (d − 1)-tuple is checked, the procedure CLIQUE is invoked for an ap-propriate induced subhypergraph of H .

3.1 Basic Case d = 2

We first design the procedure CLIQUE for d = 2, i.e., for graphs. The case d = 2is handled separately since in the general case the procedure for d-uniform hyper-graphs invokes the procedure for (d − 1)-uniform hypergraphs. In addition, this caseis conceptually simpler and thus it is easier to explain the main ideas.

Theory Comput Syst (2009) 45: 27–42 33

Lemma 3 There is an (3 logN + O(1))-space algorithm which accepts an N -vertexgraph and an integer V if and only if G consists of a clique whose smallest vertexis V and the remaining vertices of G are isolated. The algorithm has the followingproperties:

• each edge of G is tested at most twice; and• each edge e, e � (V ,N), is tested at most once.

The space complexity and the two properties are preserved and the algorithm termi-nates even if the input is faulty. Moreover, the algorithm can be modified to output thevertices of the clique different from V in the increasing order.

Proof When describing the algorithm, we often refer to Fig. 1 that contains thepseudocode. The algorithm uses two auxiliary variables A and B to store numbersbetween 1 and N (clearly, 2 logN + O(1) bits are needed to store their values).The bits of the input are accessed through the predicate edge. The algorithm firstchecks that the vertices 1, . . . , V − 1 are isolated (lines 1 and 2). Note that the macroindependent does not allocate space for any new variables and it only utilizes theauxiliary variables of the algorithm. In the main loop (lines 3–10), it verifies that thesubgraph G′ induced by the vertices V, . . . ,N is formed by a clique whose smallestvertex is V and the remaining vertices are isolated. The content of V is altered online 9. If the algorithm is supposed to output the vertices of the clique, it is doneso on line 10 (otherwise, the line is skipped). Let V 0 further denote the initial valueof V .

Let us describe the main loop in more detail. First, the smallest neighbor A of V inG′ is found (lines 3–5) and it is checked that the vertices V +1, . . . ,A−1 are isolated(line 5). If all the vertices of G′ are isolated, the while-cycle is left with A = N + 1

Input: a graph G of order Na vertex V

Auxiliary variables: A,Bmacro independent(A): Boolean;// tests that A is adjacent to none of the vertices A+1, ..., Nfor B:=A+1 to N doif edge(A,B) then return false;

return true;

1 for A:=1 to V-1 do2 if not independent(A) then reject;3 A:=V+1;4 while not edge(V,A) and A<=N do5 if not independent(A) then reject else A:=A+1;6 if A>N then accept;7 for B:=A+1 to N do8 if edge(V,B) xor edge(A,B) then reject;9 V:=A

10 output V11 goto 3

Fig. 1 The algorithm from Lemma 3

34 Theory Comput Syst (2009) 45: 27–42

and G is accepted (line 6). Otherwise, we test whether G′ has the following property(lines 7 and 8): each vertex B , A < B ≤ N , is adjacent to A if and only if it isadjacent to V . If G′ does not have this property, then it is not of required structureand we reject. If V and A have the same neighbors, then G′ is of required structureif and only if the subgraph G′′ induced by A,A + 1, . . . ,N consists of a clique withsmallest vertex A and its remaining vertices are isolated. So, V is replaced by A

(line 9) and the main loop is again executed.Clearly, the algorithm accepts if and only if G has the required structure. Besides

the two auxiliary variables A and B , the content of the variable V is also modified.Hence, the space complexity is 3 logN + O(1) bits. The space complexity is pre-served and the algorithm terminates even if the input is faulty. The termination fol-lows from the fact that whenever the values of A and B are modified, then either thevalue of A is increased or the value of A is preserved and the value of B is increased.

We now analyze the number of tests of the edges of G. The edges smaller than(V ,V + 1), i.e., those incident with the vertices 1, . . . , V − 1, are accessed only inthe function independent called on line 2 and each such edge is tested at mostonce. Fix V and let A be its smallest neighbor greater than V . The following edgesare tested in the main loop on lines 4–9:

• each edge between (V + 1,V + 2) and (A − 1,N) (inclusively) exactly once(line 5);

• each edge (V , x) for x = V + 1, . . . ,N exactly once (lines 4 and 8);• each edge (A,x) for x = A + 1, . . . ,N exactly once (line 8).

Each edge e, e ≥ (V ,V + 1), i.e., an edge between the vertices V, . . . ,N , incident toone of the vertices V, . . . ,A is tested exactly once in the main loop (for a fixed V ).Since in the next loop, V is replaced by A > V , the only edges tested twice in thealgorithm are those incident to a vertex V > V 0 for which the main loop is executed.In particular, all the edges e, e � (V 0,N), are tested at most once. The above reason-ing remains unchanged if the input is faulty (we can use the same reasons as we usedto argue that the algorithm terminates).

It remains to argue that the algorithm output exactly the clique vertices differentfrom V 0 and it is done so in the increasing order. This follows from the fact that thevertices of the clique are precisely those stored in V during the main loop and thevalue of V only increases during the execution of the algorithm. �

3.2 General Case d ≥ 3

We now design the general procedure CLIQUE. The procedure for d-uniform hyper-graphs invokes itself for (d −1)-uniform ones. In the proof of Lemma 4, the followingnotation is used: if H is a d-uniform hypergraph and V is a vertex of it, then H(V )

is the (d − 1)-uniform hypergraph whose vertex set is formed by the vertices greaterthan V and a (d − 1)-element subset A is an edge of H(V ) if and only if {V } ∪ A

is an edge of H . In the recursive instance, the vertices of H(V ) are considered to benumbered from 1 starting at the vertex V + 1 (recall that for our purposes, it is onlyenough that the accessed bit can be determined by the configuration of the algorithmand the actual cost of recomputing the indices after renumbering the vertices of H isnot important).

Theory Comput Syst (2009) 45: 27–42 35

Lemma 4 For d ≥ 2, there exists a procedure CLIQUE which accepts a d-uniformN -vertex hypergraph H together with a sequence V1, . . . , Vd−1 of its vertices if andonly if the hypergraph H is formed by a hyperclique whose smallest vertices areV1, . . . , Vd−1 and the vertices of H not contained in the hyperclique are isolated.Moreover, the procedure has the following properties:

• the procedure terminates;• each edge of H is tested at most twice;• each edge e of H , e � (V1, . . . , Vd−1,N), is tested at most once;

• the space complexity of the algorithm is d2+3d−42 logN + O(1) bits; and

• the hyperclique vertices larger than Vd−1 are output in the increasing order.

All the properties, except the last one, are preserved even if the input is faulty.

Proof As in the proof of Lemma 3, we first describe the procedure CLIQUE ford > 2 referring to its pseudocode in Fig. 2. Let us make few comments on thepseudocode. The input bits are accessed by the d-ary predicate edge. The macroindependent(A) returns true if H contains no edge whose smallest vertex is A

(note that H is allowed to contain edges in which A is not the smallest vertex). Thismacro can be easily implemented as d − 1 nested for-cycles.

Procedure CLIQUE( H, V[1], ..., V[d-1] );

Input: a d-uniform hypergraph H of order N, d>=3V[1], V[2], ..., V[d-1]

Auxiliary variables: V[d], Amacro independent(A): Boolean;

1 for A:=1 to V[1]-1 do2 if not independent(A) then reject;3 CLIQUE ( H(V[1]), V[2], ..., V[d-1] ) » PIPE;4 if PIPE.closed then5 for A:=V[1]+1 to N do6 if not independent(A) then reject;7 return;8 V[d]:=PIPE.head; PIPE.pop;9 A:=V[d]+1;

10 while not PIPE.closed do12 while A<PIPE.head do13 if edge( V[2], ..., V[d-1], V[d], A ) then reject;14 A:=A+1;15 if not edge ( V[2], ..., V[d-1], V[d], A ) then reject;16 A:=A+1; PIPE.pop;17 while A<=N do18 if edge( V[2], ..., V[d-1], V[d], A ) then reject;19 A:=A+1;20 while V[1]<V[2]-1 do21 V[1]:=V[1]+1;22 if not independent(V[1]) then reject;23 V[1]:=V[2]; V[2]:=V[3]; ...; V[d-2]:=V[d-1]; V[d-1]:=V[d];24 output V[d];25 goto 3;

Fig. 2 The procedure CLIQUE from Lemma 4

36 Theory Comput Syst (2009) 45: 27–42

Line 3 of the procedure is quite tricky: it is not a recursive call of the procedureCLIQUE but rather initiating an instance running in parallel (the reason for this isa reduction of the total space requirements) in such a way that their speeds are con-trolled by using their outputs as explained below. All the output of the new instance isredirected to a pipe PIPE which we explain in more detail below. The new instanceof the procedure CLIQUE is initiated for the (d − 1)-uniform hypergraph H(V1) to-gether with the vertices V2, . . . , Vd−1 (the vertices V2 − V1, . . . , Vd−1 − V1 in thenumbering of H(V1)). If d = 3, the procedure from Lemma 3 is initiated. The orig-inal instance and the new instance are connected through the pipe PIPE (a first-infirst-out queue). The output of the new instance is stored in the pipe and it is accessedby the original instance using the following methods (we view the pipe as a dataobject):

• PIPE.headThis method returns the value of the number stored at the head of the pipe.

• PIPE.popThis method removes from the pipe one element (the head of the pipe).

• PIPE.closedThis method returns true if all the elements have been popped out from the pipeand the new instance of the procedure has finished.

The two procedures run in parallel: the original one proceeds until a method of thepipe is called. The new procedure is then executed until the result of the method isknown. At this moment, the new one is interrupted and the original one proceedsuntil it reaches a method of the pipe which cannot be completed without continuingexecution of the new procedure. At this moment, the original one is interrupted andthe new one is resumed. The executions of the procedures alternate in this way untilthe new one is finished. If any of the procedures rejects during its execution, theentire algorithm rejects and the computation is finished. Since the value of the headof the pipe is determined by the state and memory content of the new procedure, noadditional space to maintain the pipe is needed if the two procedures run as described.Since the depth of the recursion is at most d − 1, the state of the computation can beviewed as a (d − 1)-ary vector of the states of the invoked procedures. In particular,the number of states of the procedure CLIQUE is independent of the input.

The procedure CLIQUE uses two auxiliary logN�-bit variables Vd and A. Atthe beginning, it checks that all the vertices 1, . . . , V1 − 1 are isolated (lines 1and 2). In the main loop (lines 3–25), the subhypergraph H ′ induced by the verticesV1, . . . ,N is verified to be formed by a hyperclique whose smallest d − 1 verticesare V1, . . . , Vd−1 and the remaining vertices are isolated. The content of the variablesV1, . . . , Vd−1 is replaced at the end of each iteration of the main loop. Similarly asin the proof of Lemma 3, let V 0

1 , . . . , V 0d−1 denote the initial values stored in the

variables V1, . . . , Vd−1.We first argue that the procedure CLIQUEworks correctly if the input is not faulty.

Suppose that the new instance of CLIQUE outputs no vertices. Since no vertices havebeen output, the hyperclique of H can contain only the vertices V1, . . . , Vd−1. If H

is of the required form, then H must be formed by isolated vertices only (there arenot enough potential vertices to form an edge of size d). This case is handled onlines 4–7.

Theory Comput Syst (2009) 45: 27–42 37

Suppose now that the new instance of the procedure outputs vertices of the (pos-sible) hyperclique of H greater than Vd−1 in the increasing order and it does notreject. The smallest hyperclique vertex greater than Vd−1 is stored in Vd (line 8). Letfurther � be the set of the vertices different from Vd which have been output. Onlines 9–19, we check for each vertex A, Vd < A ≤ N , that the hypergraph H con-tains the edge (V2, . . . , Vd,A) if and only if A ∈ �. Note that A ∈ �, A > Vd , if andonly if H(V1) contains an edge (V2, . . . , Vd−1,A) (which is the case if and only if(V1, . . . , Vd−1,A) is an edge of H ).

The hypergraph H has now the required form if and only if the following holds:

• the (d − 1)-uniform hypergraph H(V1) is formed by a hyperclique on the vertexset {V2, . . . , Vd} ∪ � and its remaining vertices are isolated;

• each vertex V , V1 < V < V2, is isolated in H ; and• the d-uniform subhypergraph H ′ of H induced by the vertices V2, . . . ,N consists

of a hyperclique on {V2, . . . , Vd} ∪ � and its remaining vertices are isolated.

The first condition is verified in the new instance of the procedure CLIQUE. The sec-ond condition is verified on lines 20–22. Since H ′ contains an edge (V2, . . . , Vd,A)

if and only if A ∈ � (we have verified this on lines 9–19), the third condition is equiv-alent to the following:

• H ′ is formed by the hyperclique whose smallest d − 1 vertices are V2, . . . , Vd andits remaining vertices are isolated.

This is verified by replacing the variables V1, . . . , Vd−1 by V2, . . . , Vd (line 23) andrunning the main loop again (line 25) for the new values of V1, . . . , Vd−1. Note thatthe loop starts on line 3 and the vertices are not renumbered at this point. On line 24,we output the vertex Vd which is the smallest vertex of the hyperclique larger thanVd−1 (if H has the required structure).

Based on the above, CLIQUE accepts H if and only if H is formed by a hyper-clique whose smallest vertices are V1, . . . , Vd−1 and the other vertices are isolated.The hyperclique vertices larger than Vd−1 are output in the increasing order.

We now analyze the numbers of tests of edges. The reader is asked to carefullyverify that we do not assume that outcomes of input tests performed in the recursivecalls are consistent with those performed in the procedure, i.e., all the claims are alsotrue for faulty input.

Let us recall the bounds from the statement of the lemma:

• each edge of H less or equal to (V 01 , . . . , V 0

d−1,N) is tested by CLIQUE includingthe recursive calls at most once; and

• any other edge of H is tested at most twice.

The proof of the bounds proceed by induction on d . The base case of d = 2 followsfrom Lemma 3. Hence, we assume d > 2 and that the bounds hold for d − 1 in therest.

The edges tested in a single run of the main loop (lines 3–24) started withV1, . . . , Vd−1, including those tested in the recursive calls of the procedure initiatedfrom the loop, are the following:

38 Theory Comput Syst (2009) 45: 27–42

• Edges e, (V1,V1 + 1, . . . , V1 + d − 1) � e � (V1, . . . , Vd−1,N).Each of them is tested at most once in the recursive call. This follows by our in-duction assumption.

• Edges e, (V1, . . . , Vd−1,N) ≺ e � (V1,N − (d − 2), . . . ,N).Each of them is tested at most twice in the recursive call. This also follows fromour induction assumption.

In addition to those, if the recursive call outputs no vertices, then each edge e, e ≥(V1 + 1, . . . , V1 + d), is tested exactly once (line 6) and there are no further runs ofthe main loop. Otherwise, the recursive call outputs some vertices and the followingedges are also tested:

• Edges e = (V2, . . . , Vd,A) with Vd < A ≤ N .Each of them is tested at most once on one of lines 13, 15 or 18.

• Edges e, (V1 + 1, . . . , V1 + d) � e ≺ (V2,V2 + 1, . . . , V2 + d − 1).Each of them is tested once on line 22.

We conclude that in a single run of the loop that is not final we test edges e,(V1,V1 + 1, . . . , V1 + d − 1) � e � (V1, . . . , Vd−1,N), at most once, the edges e,(V1, . . . , Vd−1,N) ≺ e � (V2 − 1,N − (d − 2), . . . ,N), at most twice, and the edgese = (V2, . . . , Vd,A), Vd < A ≤ N , at most once. In the final run of the loop, the edgese, (V1,V1 +1, . . . , V1 +d −1) � e � (V1, . . . , Vd−1,N), are tested at most once, andthe edges e, (V1, . . . , Vd−1,N) ≺ e, at most twice.

It can be established by induction on the number of main loops that remain to beexecuted that the edges tested in the run of the main loop started with V1, . . . , Vd−1and in all the subsequent runs, are the following:

• each edge e, (V1,V1 + 1, . . . , V1 + d − 1) � e � (V1, . . . , Vd−1,N), is tested atmost once; and

• each edge e, (V1, . . . , Vd−1,N) ≺ e, is tested at most twice.

Indeed, this exactly matches the estimates we have established for the final run. Ifthe run is not final, the next one is started with V ′

1 equal to V2, V ′2 equal to V ′

3,etc. By the induction, the next and all the following runs will test only edges e,(V2,V2 + 1, . . . , V2 + d − 1) � e. Such edges e are those we have to be careful about.However, the edges e tested both in the run started with V1,V2, . . . and the run startedwith V2,V3, . . . and subsequent runs are the edges e = (V2, . . . , Vd,A), Vd < A ≤ N ,which are tested at most once in the run started with V1,V2, . . . and at most once inthe subsequent runs. The claim now follows.

Hence, we have inferred that the tests performed in the main loop including thetests from the recursive calls are only the following (apply the claim proven by in-duction with Vi = V 0

i ):

• each edge e, (V 01 ,V 0

1 + 1, . . . , V 01 + d − 1) � e � (V 0

1 , . . . , V 0d−1,N) is tested at

most once; and• each edge e, e > (V 0

1 , . . . , V 0d−1,N) is tested at most twice.

Since the only edges tested before the main loop are the edges smaller than (V 01 ,

V 01 +1, . . . , V 0

1 +d −1) and each of them is tested at most once (line 6), the estimateon the number of tests from the statement of the lemma follows.

Theory Comput Syst (2009) 45: 27–42 39

Since the values of V1, . . . , Vd keep increasing during the execution of the proce-dure CLIQUE, the procedure always terminates regardless whether the input is faultyor not. Similarly, all our bounds on the number of tests were based on counting thetests using the induction hypothesis without any assumptions (as also emphasizedbefore) on consistency between bits tested in the procedure and its recursive calls.Hence, the bounds on the number of tests performed by CLIQUE hold for faultyinput.

We now bound the space complexity by computing the number ad of auxil-iary logN�-bit variables. If d = 2, Lemma 3 yields a2 = 3. For d ≥ 3, there ared + 1 auxiliary logN�-bit variables V1, . . . , Vd and A besides the auxiliary variablesneeded in the macro independent (since the variables V1, . . . , Vd−1 are changed,they must be counted in the space complexity). A subhypergraph of H passed to therecursive call is determined by the value of V1. Since the value of V1 is preserveduntil the pipe is closed, this does not result in additional space requirements. There isalso no additional space needed for the pipe. Since the macro independent is ex-ecuted when there is no recursive copy of CLIQUE running, we can utilize the spacededicated for the recursive calls of CLIQUE for storing d − 1 auxiliary logN�-bitvariables needed in the macro. This leads us to the following equality for ad (notethat ad ≥ d by the recursive definition and thus the second equality holds):

ad = (d + 1) + max{d − 1, ad−1} = (d + 1) + ad−1

= (d + 1) + (d − 1)2 + 3(d − 1) − 4

2= d2 + 3d − 4

2.

Hence, the space complexity of the procedure CLIQUE is d2+3d−42 logN + O(1)

bits (the factor O(1) represents possible effects of rounding of the logarithms duringour estimates and the constant it corresponds to may depend on d). The calculationremains correct for the case when the input is faulty, too. �

3.3 Main Result

We now design a log-space algorithm for excldN and the corresponding 2-BDDs:

Theorem 5 For every d ≥ 2, there is an algorithm which accepts a d-uniformN -vertex hypergraph H if and only if H is formed by a hyperclique of order N/2and the vertices of H not contained in the hyperclique are isolated. Moreover, thealgorithm has the following properties (even if the input is faulty):

• the algorithm terminates;• each edge of H is tested at most twice; and

• the space complexity of the algorithm is d2+3d−42 logN + O(1) bits.

In particular, there exists a syntactic 2-BDD for excldN of size at most

O(N(d2+3d−4)/2).

Proof The algorithm first finds the lexicographically smallest edge (V1, . . . , Vd)

of H . If H contains no edges at all, the algorithm rejects. Otherwise, the al-gorithm verifies that the number of vertices A such that H contains the edge

40 Theory Comput Syst (2009) 45: 27–42

(V1, . . . , Vd−1,A) is precisely N/2 − (d − 1). If this is not the case, the algorithmrejects. Finally, the procedure CLIQUE from Lemma 4 is applied for V1, . . . , Vd−1. IfCLIQUE rejects, then H has not the required form. If it accepts, then H is formed bya hyperclique containing the vertices V1, . . . , Vd−1 and the vertices not in the cliqueare isolated. Since there are exactly N/2 − (d − 1) vertices A such that the edge(V1, . . . , Vd−1,A) is contained in H , the order of the hyperclique is N/2 and thealgorithm should accept. Note that the vertices 1, . . . , V1 − 1 are tested twice to beisolated: for the first time when searching for the smallest edge, and for the secondtime in the procedure CLIQUE (this superfluous but harmless).

The only edges tested before the call of the procedure CLIQUE are those smalleror equal to (V1, . . . , Vd−1,N). Hence, each edge is tested at most twice by Lemma 4even for faulty inputs. Since the preprocessing steps requires only d + 1 auxiliarylogN�-bit variables, the space demands of the algorithm are dominated by spaceneeded for the procedure CLIQUE. Therefore, the space complexity does not exceedd2+3d−4

2 logN + O(1) bits by Lemma 4. Finally, the algorithm always terminates,again, by Lemma 4. The existence of 2-BDDs follows from Proposition 2. �

4 Lower Bound for excldN

We modify the lower bound proof (Theorem 6.2.6 of [21]) on the size of 1-BDDsrepresenting excl2N . The bound of Theorem 6 slightly improves the bound presentedin [21, 22] for d = 2.

Theorem 6 The size of a 1-BDD representing the function excldN is at least(

NN/2

)for

every d ≥ 2 and every even integer N ≥ 2d .

Proof Let N and d be fixed integers throughout the proof and G be a 1-BDD repre-senting the function excldN . Let H be the set of all the

(N

N/2

)hypergraphs H accepted

by G. For H ∈ H, we define vH to be the first node on the computation path for H

such that for each vertex x of the hyperclique of H , at least one edge containing x

has been tested (including the test at the node vH ).We claim that if H and H ′ are different hypergraphs from H, then vH �= vH ′ . As-

sume the opposite. Let P be the path in G comprised of the computation path forH to the node vH = vH ′ and the computation path for H ′ from the node vH = vH ′ .Since G is a free binary decision diagram, no edge can be tested twice on the path P .In particular, the path P corresponds to some hypergraph HP which is acceptedby G.

Let AH and AH ′ be the set of the vertices of the hyperclique in H and H ′, re-spectively. By the choice of the node vH , for each vertex x of AH , at least one edgecontaining x has been tested on P before vH (inclusively). Therefore, the degree ofeach vertex of AH in HP is at least one. Let x0 be the vertex of AH ′ such that thefirst edge containing x0 is tested at vH ′ . Because of the choice of vH ′ and x0, all theedges of H ′ containing x0 are tested on the path P from the node vH ′ (inclusively).In particular, the degree of each vertex of AH ′ in HP is at least one (because eachsuch vertex is contained together with x0 in at least one edge).

Theory Comput Syst (2009) 45: 27–42 41

We can now conclude that the degree of each vertex of AH ∪AH ′ in HP is at leastone. Therefore, HP has less than N/2 isolated vertices and it should be rejected byG—a contradiction. We have shown that all the nodes vH , H ∈ H, are different. Thisdirectly implies that the size of G is at least |H| = (

NN/2

). �

The presented lower bound is of order 2�(n1/d ) where n = (Nd

) = �(Nd) is the

number of input bits. Since the problem excldN has(

NN/2

)inputs that are accepted, the

size of a binary decision tree for it does not exceed n · (N

N/2

) = 2O(N) = 2O(n1/d ), a

significantly better bound cannot be established for excldN .

5 Related Open Problems

The function excldN is not the only hypergraph function which was suggested as a pos-sible candidate for separation of polynomial-size �-BDDs and (�+1)-BDDs. In [21],the function exregd

N is also proposed (Problem 7.7): the input of exregdN is formed by(

Nd

)bits corresponding to possible edges of a d-uniform hypergraph H on N ver-

tices. The function exregdN(H) is true if the hypergraph H is �( N

d−1

)/2�-regular, i.e.,

each vertex of H is contained in exactly �( Nd−1

)/2� edges. It is not hard to construct a

polynomial-size d-BDD for exregdN , but the existence of a polynomial-size (d − 1)-

BDDs for exregdN is unsettled:

Problem 1 Are there polynomial-size (d − 1)-BDDs representing exregdN ?

The exponential lower bound on the size of 1-BDDs for exreg2N is in [17].

Another Boolean function of the similar kind defined for d-uniform hypergraphs isa “perfect matching” function. Again, the input is formed by

(Nd

)bits corresponding

to possible edges of a d-uniform hypergraph H . The function matchdN(H) is true if

H is 1-regular, i.e., each vertex is contained in exactly one edge of H . It is not hardto prove an exponential lower bound on the size of 1-BDDs for the function match2

N .However, if d ≥ 3, the situation becomes more difficult:

Problem 2 Are there polynomial-size (d − 1)-BDDs representing matchdN ?

Acknowledgement This research was conducted while the author was visiting Simon Fraser Universityin May 2004. The author would like to thank his hosts, Ladislav Stacho, and Veselin Jungic for providingan excellent atmosphere during his stay in Burnaby, BC. He also likes to thank Ondrej Pangrác and theanonymous referees for careful reading a preliminary version of the manuscript and their comments toimprove the clarity of the arguments.

References

1. Ajtai, M.: Determinism versus non-determinism for linear time RAMs with memory restrictions. In:31st Annual ACM Symposium on Theory of Computing (STOC), pp. 632–641 (1999)

42 Theory Comput Syst (2009) 45: 27–42

2. Ajtai, M.: A non-linear time lower bound for boolean branching programs. In: 40th Annual Sympo-sium on Foundations of Computer Science (FOCS), pp. 60–70 (1999)

3. Ajtai, M., Babai, L., Hajnal, P., Komlós, J., Pudlák, P., Rödl, V., Szemerédi, E., Turán, G.: Two lowerbounds for branching programs. In: Proceedings of the 18th ACM Symposium on Theory of Comput-ing (STOC), pp. 30–38 (1986)

4. Andreev, A.E., Baskakov, J.L., Clementi, A.E.F., Rolim, J.D.P.: Smal pseudo-random sets yield hardfunctions: new tight explicit lower bounds for branching programs. In: Proceedings of the 26th In-ternational Colloquium on Automata, Languages and Programming (ICALP). Lecture Notes in Com-puter Science, vol. 1644, pp. 179–189. Springer, Berlin (1999)

5. Beame, P., Saks, M., Sun, X., Vee, E.: Super-linear time-space tradeoff lower bounds for randomizedcomputation. In: 41th Annual Symposium on Foundations of Computer Science (FOCS), pp. 169–179(2000)

6. Beame, P., Saks, M., Sun, X., Vee, E.: Time-space trade-off lower bounds for randomized computationof decision problems. J. ACM 50(2), 154–195 (2003)

7. Beame, P., Saks, M., Thathachar, J.S.: Time-space tradeoffs for branching programs. In: 39th AnnualSymposium on Foundations of Computer Science (FOCS), pp. 254–263 (1998)

8. Beame, P., Saks, M., Thathachar, J.S.: Time-space tradeoffs for branching programs. J. Comput. Syst.Sci. 63(4), 542–572 (2001)

9. Borodin, A., Razborov, A.A., Smolensky, R.: On lower bounds for read-k-times branching programs.Comput. Complex. 3, 1–18 (1993)

10. Bryant, R.: On the complexity of VLSI implementations and graph representations of Boolean func-tions with application to integer multiplication. IEEE Trans. Comput. 40(2), 205–213 (1991)

11. Cobham, A.: The recognition problem for the set of perfect squares. In: Proceedings of the 7th IEEESymposium on Foundations of Computer Science (FOCS), pp. 78–87 (1966)

12. Jukna, S., Razborov, A.: Neither reading few bits twice nor reading illegally helps much. ECCC reportTR96-037

13. Kára, J., Král’, D.: Optimal free binary decision diagrams for computation of EARn. In: Proceed-ings of the 27th International Symposium Mathematical Foundations of Computer Science (MFCS).Lecture Notes in Computer Science, vol. 2420, pp. 411–422. Springer, Berlin (2002)

14. Pudlák, P., Žák, S.: Space complexity of computations. Math. Inst., CSAV, Prague (1983) 30 pp.15. Razborov, A.A.: Lower bounds for deterministic and nondeterministic branching programs. In: Lec-

ture Notes in Computer Science, vol. 529, pp. 47–61. Springer, Berlin (1991)16. Sauerhoff, M.: On nondeterminism versus randomness for read-once branching programs. Technical

report in Electronic Colloquium on Computational Complexity (ECCC), TR97-030 (1997)17. Simon, J., Szegedy, M.: A new lower bound theorem for read only once branching programs and its

applications. In: Cai, J. (ed.) Advances in Computational Complexity. DIMACS Series in DiscreteMathematics, vol. 13, pp. 183–193. Am. Math. Soc., Providence (1993)

18. Thathachar, J.S.: On separating the read-k-times branching program hierarchy. In: Proceedings of the30th ACM Symposium on Theory of Computing (STOC), pp. 653–662 (1998)

19. Wegener, I.: The Complexity of Boolean Functions. Teubner, Stuttgart (1987)20. Wegener, I.: On the complexity of branching programs and decision trees for clique functions. J. ACM

35(2), 461–471 (1988)21. Wegener, I.: Branching Programs and Binary Decision Diagrams—Theory and Applications. SIAM

Monographs on Discrete Mathematics and Applications, vol. 4. SIAM, Philadelphia (2000)22. Žák, S.: An exponential lower bound for one-time-only branching programs. In: Proceedings of the

11th International Symposium on Mathematical Foundations of Computer Science (MFCS). LectureNotes in Computer Science, vol. 176, pp. 562–566. Springer, Berlin (1984)