BDDs Naturally Represent Boolean Functions, and ZDDs Naturally Represent Sets of Sets

# BDDs Naturally Represent Boolean Functions, and ZDDs Naturally Represent Sets of Sets

Kensuke Kojima
###### Abstract

This paper studies a difference between Binary Decision Diagrams (BDDs) and Zero-suppressed BDDs (ZDDs) from a conceptual point of view. It is commonly understood that a BDD is a representation of a Boolean function, whereas a ZDD is a representation of a set of sets. However, there is a one-to-one correspondence between Boolean functions and sets of sets, and therefore we could also regard a BDD as a representation of a set of sets, and similarly for a ZDD and a Boolean function. The aim of this paper is to give an explanation why the distinction between BDDs and ZDDs mentioned above is made despite the existence of the one-to-one correspondence. To achieve this, we first observe that Boolean functions and sets of sets are equipped with non-isomorphic functor structures, and show that these functor structures are reflected in the definitions of BDDs and ZDDs. This result can be stated formally as naturality of certain maps. To the author’s knowledge, this is the first formally stated theorem that justifies the commonly accepted distinction between BDDs and ZDDs. In addition, we show that this result extends to sentential decision diagrams and their zero-suppressed variant.

## 1 Introduction

In this paper, we study a difference between two types of decision diagrams: Binary Decision Diagrams (BDDs, for short) [5, 1], and Zero-suppressed BDDs (ZDDs, for short) [7]. It is commonly understood that a BDD is a representation of a Boolean function (a function that takes several, fixed number of Boolean values and returns a Boolean value), and a ZDD is that of a combination set (a family of subsets of a fixed set). This fact implies that Boolean functions and combination sets are considered different. However, it is easy to find a one-to-one correspondence between them, and by using this correspondence, one may regard a representation of a Boolean function as that of a combination set, and vice versa. This would mean that, contrary to the claim above, both BDDs and ZDDs can be used to represent both Boolean functions and combination sets. This argument leads to the following question: what distinguishes BDDs (or Boolean functions) and ZDDs (or combination sets)? Why are they considered different, despite the existence of the one-to-one correspondence? The aim of this paper is to answer this question from a conceptual point of view.

An informal explanation for this has already been given when ZDDs are proposed [7]. If a certain variable does not appear in a representation of a Boolean function, this variable is not used by the function, and therefore its value should be irrelevant to the output of the function. This means that, if a combination set is represented by a BDD by identifying it with the corresponding Boolean function, then the representation changes when we extend the set of elements (variables) being considered. This is because extra elements have to be explicitly excluded. For example, if and are the only elements being considered, a combination set can be expressed by the Boolean function (where is XOR), but if another element is present in the context, the same combination set should be represented by ; an extra element has to be excluded explicitly. Minato [7] pointed out that this dependence on extra elements as an inconvenience in representing a combination set using a BDD, and addressed this problem by introducing a new representation, a ZDD, that is not affected by extra elements.

The goal of this paper is to reformulate this explanation as a more formally stated theorem. Our formulation uses the language of category theory. We first observe that Boolean functions and combination sets are equipped with essentially different functor structures: although they are in one-to-one correspondence, the bijection cannot be a natural isomorphism. We next show that the difference between those functor structures are reflected in the definition of BDDs and ZDDs. This can be formally stated as the naturality of the semantics of BDDs and ZDDs (here, a semantics is given by a function that receives a decision diagram and returns the mathematical object it represents). In this sense, a BDD is a natural representation of a Boolean function (but not a combination set), whereas a ZDD is that of a combination set (but not a Boolean function). In addition, we also consider Sentential Decision Diagrams (SDDs) [4] and Zero-suppressed SDDs (ZSDDs) [9], which extend BDDs and ZDDs, respectively, and show that analogous result holds for these data structures as well. We believe that our results provide a better understanding of these data structures by uncovering a mathematical structure behind them.

The rest of this paper is organized as follows. Section 2 introduces several basic notions and notations. Section 3 introduces BDDs and ZDDs, their semantics, and shows that the semantics are natural with respect to appropriate functor structures. Both unordered and ordered cases are discussed. Section 4 discusses SDDs and ZSDDs. After introducing their definitions, a naturality result similar to the previous section is proved. The notions of vtrees and partition are also discussed. Finally, Section 5 concludes the paper.

## 2 Combination Sets and Boolean Functions

###### Definition 1.

Let be a set. A combination over is just a subset of , and a combination set over is a set of combinations over . In other words, a combination and a combination set are elements of and , respectively.

###### Example 2.

Let be a graph, and the set of all edges in . Then, the set of all paths between two fixed nodes and is an example of a combination set over , because a path is represented by a subset of . Similarly, the set of all spanning trees of and the set of all Hamiltonian circuits of are combination sets over .

If no confusion arises, we denote a combination by a sequence. For example, we write for , and for . We also use for the empty combination, although formally it is the same as , to emphasize that we regard it as a combination.

###### Definition 3.

Let be a set. A Boolean function over is an element of , where .

It is well-known that, for finite , a Boolean function over can always be represented by a Boolean formula whose atoms are taken from . For example, if , then denotes the function which takes and returns if and only if either or . Below we sometimes use formulas to represent Boolean functions.

There is a one-to-one correspondence between combination sets and Boolean functions.

###### Proposition 4.

A map defined below is a bijection:

 τX(P)(f)={1f−1(1)∈P,0f−1(1)∉P.

Despite the existence of a bijective correspondence, we distinguish combination sets and Boolean functions as essentially different objects, by introducing different functor structures.

Below we denote by and the covariant and contravariant power set functors, respectively (that is, for , their morphism parts are given by for , and for ).

We call the combination sets functor. It is easy to see that there is a natural isomorphism , and above is in fact induced from this isomorphism: . For this reason, we call the Boolean functions functor, and identify and from now on.

It is easy to check that above is not natural. Moreover, we can prove that there is no natural isomorphism between and . In this sense, combination sets and Boolean functions are equipped with different structures, and the difference originates from the two distinct functor structures on power sets.

###### Proposition 5.

and are not isomorphic as functors.

###### Proof.

Let (where ), and consider the inclusion and defined by . We prove that if is natural, then , and therefore is not injective. Consider the following commutative diagram.

Let and . By the naturality of and the definition of , we have

 P=P2(i)(P)=P2(i)(α∅({ε}))=αX(¯¯¯¯P2(i)({ε}))=αX(P(X)).

Similarly we have

 P2(r)(Q)=αX(¯¯¯¯P2(r)({ε,x,xy}))=αX(P(X)),

and thus . Therefore, to prove , it suffices to show that . From we obtain , and thus . This is possible only if , and in such a case, it is clear from the definition of that . ∎

## 3 Binary Decision Diagrams

### 3.1 Definition of BDDs and ZDDs

A BDD and a ZDD are both graph representations of a combination set (or a Boolean function, via the bijection in Proposition 4). We first introduce a class of directed graphs, which we call diagrams, and can be regarded as both BDDs and ZDDs. We define two interpretations of diagrams, one as BDDs and the other as ZDDs.

###### Definition 6.

A diagram over a set is a rooted, directed acyclic graph with labeled nodes and edges satisfying the following.

• There are two types of nodes: decision nodes and terminal nodes.

• Each decision node is labeled by an element of , and has two outgoing edges. One of the edges is labeled by and another is labeled by , and called a -edge and a -edge, respectively.

• Each terminal node is labeled by either or , and has no outgoing edges. A terminal node is called either a -terminal node or a -terminal node according to its label.

We write for the set of all diagrams over a set .

A diagram is often depicted as in Figure 1. For convenience, we write and for - and -terminal nodes, respectively, and for a decision node which is labeled by and has -edge and -edge pointing to and , respectively. For example, the diagram in Figure 1 is written as . Although this notation omits information about shared nodes (for example, from the notation above, we cannot know whether -terminal nodes pointed to by and are shared or not), this does not affect the argument below.

We next define interpretation functions and that transform a diagram into a combination set it represents as a BDD and a ZDD, respectively.

###### Definition 7.

Given a set , the interpretation of a diagram as a BDD is defined as follows:

 βX(0) =∅,βX(1)=P(X), βX((a,F,G)) ={C∈β(F)∣a∉C}∪{C∈β(G)∣a∈C}.

The characteristic function of is a function that receives and outputs either true or false, and the output can be computed by the following procedure. Starting from the root node of , in each step the procedure looks up the label of the current node, and if it explores the -edge, and the -edge otherwise. The procedure terminates when it reaches a terminal node, and returns true if its label is , and false otherwise.

###### Remark 8.

A BDD is often introduced as a representation of a Boolean function, rather than a combination set. In this case, the interpretation of the diagram in Figure 1 is represented by a formula (this corresponds to a combination set ; here, we used the convention introduced after Definition 1). In general, the above definition can be rephrased as follows: - and -terminal nodes represent and , respectively, and a decision node represents .

###### Definition 9.

Given a set , the interpretation of a diagram as a ZDD is defined as follows:

 ζX(0) =∅,ζX(1)={ε}, ζX((a,F,G)) =ζX(F)∪{A∪{a}∣A∈ζX(G)}.

This semantics is intuitively understood as follows. When a diagram is seen as a ZDD, each path from the root to designates a single combination. Such a path is called a -path. On each decision node , traversing its -edge means “include ,” and -edge means “do not include .” Any element not mentioned in is not included in the combination. Therefore, the combination a -path represents is

 {a∈X∣p contains a 1-edge of a decision node labeled by a}.

Finally, is defined to be the set of all combinations that can be written in this form for some -path . In particular, should be interpreted by the combination , because has only one, obvious -path corresponding to . This justifies the formal definition above. It is straightforward to check that the interpretation of a diagram in Figure 1 as a ZDD is . Unlike the case of BDD, the combination is not included.

In the rest of the paper, when no confusion arises, we omit subscripts of and .

### 3.2 Naturality of the Semantics

What distinguishes and is the treatment of elements that do not occur in a diagram. This difference can be formally captured by Theorem 10, but we first give a more intuitive explanation. This was essentially mentioned in the literature [7, § 2–3], but let us summarize the main points in our terminology.

Let and assume that there is an element that do not occur in . When regarded as a BDD, this means that it does not matter whether a combination contains the element or not; more formally, if and only if . In contrast, when is regarded as a ZDD, not occurring in never appear in combinations in , and therefore only if . For example, let be the diagram in Figure 1. Then can be regarded as a diagram of , rather than , and in this case we have

 βY(F)={a,b,ab,ac,bc,abc}, and ζY(F)={a,b}.

We can easily check that it is indeed the case that if and only if , and does not have any combination containing .

This behavior is nicely explained by the difference between the functor structures of and , and this is a formalized version of the assertion that “a BDD represents a Boolean function, and a ZDD represents a combination set.”

Before stating the theorem, let us defined a functor structure of . Given a map , the action of on is given by relabelling:

 D(f)(0)=0,D(f)(1)=1,D(f)((a,F,G))=(f(a),D(f)(F),D(f)(G)).

Then, we can state our first main theorem.

###### Theorem 10.

is a natural transformation from to , and is a natural transformation from to .

###### Remark 11.

is not a natural transformation from to , and is not a natural transformation from to . For example, let be a diagram in Figure 1, and consider , , and . Then we can easily check that and .

### 3.3 Ordered BDDs and ZDDs

We did not assume any structure on the set , but in practice, a total order on is often introduced, and the order of occurrence in a diagram is required to be the same as the order on (the advantage of this restriction is that it allows an efficient implementation of operations on Boolean functions [3]).

###### Definition 12.

Let be a totally ordered set. is said to respect if, for all , holds whenever occurs as a descendant of in .

For example, the diagram in Figure 1 respects a total order if and only if the order satisfies .

Let be the set of all diagrams over respecting . Then becomes a functor from the category of total order and strictly monotone maps. The functor structure of can be given by restricting that of : for strictly monotone . To check that is well-defined, it suffices to see that, for any strictly monotone , a diagram respecting is mapped by to a diagram respecting . Then and restricts to natural transformations from . To be more precise, we can state these as follows.

###### Lemma 13.

Let be the category of total order and strictly monotone maps. Then is a subfunctor of , where is the forgetful functor.

###### Theorem 14.

Let us define and . Then and are natural.

###### Proof.

Let be the inclusion. Then we can write (where denotes the whiskering by ). Then, the naturality of is an immediate consequence of that of , which follows from Theorem 10. The same argument works for , too. ∎

This proof is a special case of the following observation, which is used again in the next section. Theorem 14 is a direct consequence of Lemma 13 and this general fact (with , , , , and in the case of BDD, and and for ZDD).

###### Remark 15.

Consider the following data.

• a functor ,

• a functor (of diagrams without restriction) ,

• a natural transformation (giving an interpretation of diagrams) ,

• a category (of some structures) ,

• a (forgetful) functor , and

• a functor (of diagrams respecting the structure of -objects) such that .

Then the interpretation induces a natural transformation , where is the inclusion from into .

## 4 Sentential Decision Diagrams

In this section, we show that the results obtained in the previous section can be extended to Sentential Decision Diagrams (SDDs) [4] and Zero-suppressed SDDs (ZSDDs) [9], which generalize BDDs and ZDDs, respectively.

### 4.1 Sentential Decision Diagrams without Constraints

We first consider SDDs and ZSDDs that are not constrained in the sense that the occurrences of variables are not restricted in any way. An SDD is a representation of a decomposition of Boolean function [10] (satisfying a certain condition), so we begin with its definition.

###### Definition 16.

Let and be disjoint sets of variables, and a Boolean function over . An -decomposition of is a representation of by a Boolean formula of the form , where and depend only on variables in and , respectively. Each is called a prime, and each is called a sub of the decomposition.

In the original definition of SDDs, following the definition of a decomposition above, it is required that and have no common variable. This restriction is omitted in our first definition of SDDs and ZSDDs, and considered later in Section 4.2.

There is a well-known special case of decomposition, called Shannon decomposition, where consists of a single variable, , , and . This decomposition corresponds to a BDD, and in this sense, SDD is a generalization of BDD (and similarly for ZDD and ZSDD). The name sentential decision diagram comes from the fact that an SDD allows primes to be a general formula (sentence), rather than only literals [4].

We first define SDDs and their interpretation as combination sets.

###### Definition 17.

Let be a set. We define SDDs over and the interpretation inductively as follows.

• and are SDDs, and interpreted by and , respectively.

• and are SDDs for each , and interpreted by and , respectively.

• If are SDDs for , then is an SDD, and interpreted by .

An SDD of either the first or the second form is called a terminal, and the third a decomposition. We regard a decomposition as a set of pairs, and thus the order of pairs is irrelevant.

A zero-suppressed variant of SDDs, called ZSDDs, are defined as follows [9].

###### Definition 18.

Let be a set. We define ZSDDs over and the interpretation inductively as follows.

• and are ZSDDs, and interpreted by and , respectively.

• and are ZSDDs for each , and interpreted by and , respectively.

• If are ZSDDs for , then is a ZSDD, and interpreted by , where is defined by

 P⊔Q={A∪B∣A∈P,B∈Q}.

We can prove an analogue of Theorem 10. Let and be the set of SDDs and ZSDDs, respectively, over . Given a map , we define by relabeling:

 S(f)(⊤)=⊤,S(f)(⊥)=⊥,S(f)(x)=f(x),S(f)(¬x)=¬f(x), S({(pi,si)}ni=1)={(S(f)(pi),S(f)(si))}ni=1.

is defined similarly. Then and are functors from to , and we can prove the following.

###### Theorem 19.

is a natural transformation from to , and is a natural transformation from to .

We can prove this using the fact that preserves all Boolean operations, and preserves both and . In addition, an analogue of Remark 11 holds for SDDs and ZSDDs.

### 4.2 SDDs and ZSDDs Respecting Vtrees

In this section, we extend the result of Section 3.3 to SDDs and ZSDDs. A total order is replaced by a vtree defined below.

###### Definition 20.

A vtree for a set is a rooted, full binary tree whose leaves are in one-to-one correspondence with elements of .

Below, a leaf that corresponds to is denoted simply by , and a vtree with left and right children and is denoted by . We write for if is a vtree for .

###### Definition 21.

We define an SDD or a ZSDD respecting inductively as follows.

1. , , respect any vtree.

2. , , respect a leaf corresponding to .

3. If respects either or , then respects .

4. If respects and respects for each , then respects .

This definition is equivalent to that by Bova [2] (except that we do not require primes to form a partition), and relaxes the ones by Darwiche [4, Def. 5] and by Nishino et al. [9, Def. 1] (they do not allow rule 3).

We next define a category having vtrees as objects, and embeddings defined below as morphisms.

###### Definition 22.

Let and be vtrees. We define embeddings (of vtrees) from to inductively. Let be a map.

• is an embedding if is a leaf.

• is an embedding if , and is an embedding from to either or .

• is an embedding if , , and the restriction of to is an embedding from to for .

It is not difficult to check that embeddings are closed under composition. We write for the category of vtrees and embeddings.

###### Remark 23.

A vtree generalizes a finite total order: corresponds to a vtree . If and are finite totally ordered sets, and and are the corresponding vtrees, then is strictly monotone if and only if it is an embedding from to . Moreover, every BDD respecting the order of can be translated to an SDD respecting  [4], and similarly for ZDDs and ZSDDs [9].

Let be the set of SDDs respecting . Then, for an embedding , it is straightforward to check that restricts to a map , that is, is a functor from to . In the same manner, we can define a functor such that is the set of ZSDDs respecting . The following is an analogue of Lemma 13.

###### Lemma 24.

Let be the forgetful functor, which maps to . Then, and are subfunctors of and , respectively.

Then, similarly to Theorem 14, the following is an immediate corollary of Remark 15.

###### Corollary 25.

and restricts to natural transformations from and , respectively. Concretely, the restrictions are given by and for a vtree , and are natural transformations from to and from to , respectively.

### 4.3 Strong Determinism and Partition

The original definitions of SDDs and ZSDDs require primes to form a partition [4, 9]. Such a restriction can be treated in a similar manner to the previous section.

###### Definition 26.

Let be an SDD.

1. is strongly deterministic if every decomposition of has pairwise disjoint primes. More concretely, every decomposition in satisfies whenever . (A decomposition of a Boolean function having this property is said to be strongly deterministic [10].)

2. is a partition SDD if it is strongly deterministic and every decomposition in satisfies .

###### Definition 27.

A ZSDD is strongly deterministic if every decomposition of has pairwise disjoint primes.

Similarly to Sections 3.3 and 4.2, we have the following.

###### Lemma 28.

Let be a map.

1. preserves strongly deterministic SDDs and partition SDDs.

2. If is injective, then preserves strongly deterministic ZSDDs.

###### Proof.

By induction.

1. Let . We first show that if are pairwise disjoint, then so are . Let us assume . Then by naturality of we have

 σ(S(f)(pi))∩σ(S(f)(pj)) =¯¯¯¯P2(f)(σ(pi))∩¯¯¯¯P2(f)(σ(pj)) =¯¯¯¯P2(f)(σ(pi)∩σ(pj)) =∅.

Similarly we can easily check that implies .

2. Let . We show that are pairwise disjoint, then so are . This can be done in the same manner as above, except that and are replaced by and , respectively. Notice that preserves the intersection, which follows from the assumption that is injective. ∎

This means that there are subfunctors of taking only partition SDDs and strongly deterministic SDDs. Similarly for strongly deterministic ZSDDs, but the domain of the functor should be the subcategory of whose morphisms are injections. In the same manner as Theorem 14 and Corollary 25, and restrict to these subfunctors.

We could also define a partition ZSDD, but it appears that such a notion is, unlike strong determinism, not preserved by . By adapting the original definition of ZSDDs [9] to the current context, we could define: a ZSDD is a partition ZSDD with respect to a vtree if, for any of its decomposition , there is a subtree of respected by and the primes of form a partition of . However, such a notion would not be preserved by a vtree embedding. Indeed, consider . The primes and of denote and , whose union is . Therefore this is a partition ZSDD with respect to a vtree . However, if we consider a vtree , into which can be embedded, primes of do not form a partition. For this reason, we do not further consider partition ZSDDs in this paper.

From this observation, we can conclude that both partition and strong determinism of Boolean functions (or SDDs) are well-behaved, but only strong determinism is so for combination sets (or ZSDDs). Nishino et al. introduced a notion of implicit partition [9, Def. 7], which is roughly the same as strong determinism. The discussion above suggests that implicit partition would be a more sensible notion than partition, which was used in the first definition of ZSDDs.

## 5 Conclusion

We investigated the difference between BDDs and ZDDs, as well as their variants, and identified a formally stated theorem that captures the fact that a BDD represents a Boolean function and a ZDD represents a combination set. This is done by observing that their definitions reflect the actions on morphisms of two functors and , respectively. In addition, we have observed that similar result holds for SDD and ZSDD as well.

There are many other types of decision diagrams in the literature. For example, a sequence BDD [6] and DD [8] are proposed as representations of a set of sequences and a set of permutations, respectively. It would be interesting to consider whether these data structures have similar naturality property with respect to appropriate functors. It is also an interesting future work to investigate whether there exists a general principle to design a natural representation, when a class of data is specified as a functor.

## Acknowledgments

This work was supported by JST CREST Grant Number JPMJCR1401, Japan.

## References

• [1] Sheldon B. Akers. Binary decision diagrams. IEEE Transactions on Computers, C-27(6):509–516, June 1978.
• [2] Simone Bova. SDDs are exponentially more succinct than OBDDs. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16, pages 929–935. AAAI Press, 2016.
• [3] Randal E. Bryant. Graph-based algorithms for Boolean function manipulation. IEEE Trans. Comput., 35(8):677–691, August 1986.
• [4] Adnan Darwiche. SDD: A new canonical representation of propositional knowledge bases. In Proceedings of the Twenty-Second International Joint Conference on Artificial Intelligence - Volume Volume Two, IJCAI’11, pages 819–826. AAAI Press, 2011.
• [5] C. Y. Lee. Representation of switching circuits by binary-decision programs. The Bell System Technical journal, 38(4):985–999, July 1959.
• [6] Elsa Loekito, James Bailey, and Jian Pei. A binary decision diagram based approach for mining frequent subsequences. Knowledge and Information Systems, 24(2):235–268, Aug 2010.
• [7] Shin-ichi Minato. Zero-suppressed BDDs for set manipulation in combinatorial problems. In Proceedings of the 30th International Design Automation Conference, DAC ’93, pages 272–277, New York, NY, USA, 1993. ACM.
• [8] Shin-ichi Minato. DD: A new decision diagram for efficient problem solving in permutation space. In Karem A. Sakallah and Laurent Simon, editors, Theory and Applications of Satisfiability Testing - SAT 2011, pages 90–104, Berlin, Heidelberg, 2011. Springer Berlin Heidelberg.
• [9] Masaaki Nishino, Norihito Yasuda, Shin-ichi Minato, and Masaaki Nagata. Zero-suppressed sentential decision diagrams. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16, pages 1058–1066. AAAI Press, 2016.
• [10] Knot Pipatsrisawat and Adnan Darwiche. A lower bound on the size of decomposable negation normal form. In Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI’10, pages 345–350. AAAI Press, 2010.
You are adding the first comment!
How to quickly get a good reply:
• Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
• Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
• Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters