Revisiting Graph Width Measures for CNF-Encodings

05/09/2019 ∙ by Stefan Mengel, et al. ∙ 0

We consider bounded width CNF-formulas where the width is measured by popular graph width measures on graphs associated to CNF-formulas. Such restricted graph classes, in particular those of bounded treewidth, have been extensively studied for their uses in the design of algorithms for various computational problems on CNF-formulas. Here we consider the expressivity of these formulas in the model of clausal encodings with auxiliary variables. We first show that bounding the width for many of the measures from the literature leads to a dramatic loss of expressivity, restricting the formulas to such of low communication complexity. We then show that the width of optimal encodings with respect to different measures is strongly linked: there are two classes of width measures, one containing primal treewidth and the other incidence cliquewidth, such that in each class the width of optimal encodings only differs by constant factors. Moreover, between the two classes the width differs at most by a factor logarithmic in the number of variables. Both these results are in stark contrast to the setting without auxiliary variables where all width measures we consider here differ by more than constant factors and in many cases even by linear factors.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Graph width measures like treewidth and cliquewidth have been studied extensively in the context of propositional satisfiability. The general idea is to assign graphs to CNF-formulas and compute their width with respect to different width measures. Then, if the resulting width is small, there are algorithms that solve SAT, but also more complex problems like #SAT or MAX-SAT or even QBF efficiently, see e.g. [35, 16, 38, 31, 34, 11]

for this line of work. There is also a considerable body of work on reasoning problems from artificial intelligence restricted to knowledge encoded by CNF-formulas with restricted underlying graphs: for example, treewidth restrictions have been studied for abduction, closed world reasoning, circumscription, disjunctive logic programming 

[22] and answer set programming [23]. There is thus by now a large body of work on how problems can be solved on bounded width CNF-formulas for different graph width measures.

Curiously, however, there seems to be very little work on the natural question what we can actually encode with these restricted CNF-formulas. This question is pertinent because good algorithms for problems are less attractive if they cannot deal with interesting instances. We make two main contributions on the expressivity of bounded width CNF-formulas here.

First, we show one can give lower bounds for the width of any encoding of a function by means of communication complexity. This was known for treewidth [9], but we extend it for many different width measures, in particular (signed and unsigned) cliquewidth [16, 38], modular treewidth [31] and MIM-width [34]. As a consequence, in a sense, for all these measures, formulas of bounded width can only encode simple functions.

All these lower bounds do not only work for representations of functions as CNF-formulas but also on clausal encodings, i.e. CNF-formulas using auxiliary variables. It is folklore that adding auxiliary variables can decrease the size of an encoding: for example the parity function has no subexponential CNF-representations but there is an easy linear size encoding using auxiliary variables. We here observe a similar effect for the example of treewidth: we show that any CNF-representation of the AtMostOne-function of inputs without auxiliary variables has primal treewidth which is the highest possible. But when authorizing the use of auxiliary variables, AtMostOne can be computed with formulas of bounded treewidth easily. This shows that lower bounds for clausal encodings are far stronger than those of CNF-representations. Considering that AtMostOne is arguably a very easy function, we feel that encodings with auxiliary variables are the more interesting notion in our setting so we focus on them here.

In a second main contribution, we focus on the relative expressive power of different graph width measures for clausal encodings. For the graph width measures studied in the literature, it is known that without auxiliary variables the expressivity of bounded width CNF-formulas is different for all notions and they form a partial order with so-called MIM-width as the most general notion, see e.g. [8, Section 5]. Somewhat surprisingly, the situation changes completely when one allows auxiliary variables: in this setting, the commonly considered width notions are all up to constant factors either equivalent to primal treewidth or to incidence cliquewidth. This is true for every individual function. We remark that for the parameters primal treewidth, dual treewidth and incidence treewidth, it was already known that the width of encodings minimizing the respective width measures differs only by constant factors [36, 9, 27]. All other relationships are new.

We also show that, assuming that an optimal encoding of a function has at least primal treewidth where is the number of variables, incidence cliquewidth and primal treewidth differ exactly by a factor of for optimal encodings. So, up to a logarithmic scaling, in fact all the width measures in [35, 16, 38, 31, 34] coincide when allowing auxiliary variables. Note that this scaling exactly corresponds to the runtime differences of many algorithms: while treewidth based algorithms often have runtimes of the type for treewidth  and a constant , cliquewidth based algorithms typically give runtimes roughly for cliquewidth . These runtimes coincide exactly when treewidth and cliquewidth differ by a logarithmic factor which, as we show here, they do generally for encodings with auxiliary variables.

We finally use our main results for several applications. In particular, we answer an open question of [9] on the cliquewidth of the permutation function PERM and generalize a classical theorem on planar circuits from [28], see Section 6 for details.

Most of our results use machinery recently developed in the area of knowledge compilation. In particular, we use a combination of the algorithm in [5], the width notion for DNNF developed in [10] and the lower bound techniques from [33, 6]. Relying on these building blocks, most of our proofs become rather simple.

2 Preliminaries

2.1 CNF-Formulas and their Graphs

We use standard notations for CNF-formulas as it can e.g. be found in [4]. Let  be a set of variables. A representation of a Boolean function in variables  is a CNF-formula on the variable set  that has as models exactly the assignments on which evaluates to true. A clausal encoding of is a CNF-formula on a variable set such that

  • for every assignment on which evaluates to true, there is an extension of to that is a model of , and

  • for every assignment on which evaluates to false, no extension of to is a model of .

The variables in are called auxiliary variables. An auxiliary variable is called dependent if and only if in the first item above all extensions satisfying take the same value on  [20]. We say that a clausal encoding has dependent auxiliary variables if all its auxiliary variables are dependent. Note that for such an encoding the extension is unique.

We use standard notations from graph theory and assume the reader to have a basic background in the area [15]. By we denote the open neighborhood of a vertex in a graph.

We will also in some parts of this paper deal with Boolean circuits. We assume that the reader is familiar with basic definitions in the area. As it is common when considering circuits with structurally restricted underlying graphs, we assume that every input variable appears in only one input gate. This property is sometimes called the read-once property.

To every CNF-formula , we assign two graphs. The primal graph of has as vertices the variables of and two variables are connected by an edge if and only if there is a clause such that a literal in and a literal in appear in . The incidence graph of has as vertex set the union of the variable set and the clause set of . Edges in the incidence graph are exactly the pairs where is a variable and a clause that contains a literal in .

A tree decomposition of a graph consists of a tree  and, for every node of , a set called bag such that:

  • ,

  • for every edge there is a bag such that , and

  • for every , the set is connected in .

The width of a tree decomposition is defined as . The treewidth of is defined as the minimum width taken over all tree decompositions of . The primal treewidth of a CNF-formula is defined as the treewidth of its primal graph and the incidence treewidth of is defined as that of the incidence graph.

We say that two vertices , in a graph have the same neighborhood type if and only if . It can be shown that having the same neighborhood type is an equivalence relation on . A generalization of treewidth is modular treewidth which is defined as follows: from a graph we construct a new graph by contracting all vertices sharing a neighborhood type, i.e., from every equivalence class we delete all vertices but one. The modular treewidth of is then defined to be the treewidth of . The modular treewidth of a CNF-formula is defined as the modular treewidth of its incidence graph.

We will deal with several other graph width measures for a CNF-formula in the remainder of this paper, in particular dual treewidth , signed incidence cliquewidth , incidence cliquewidth , and MIM-width . Since for those notions we will only use some of their properties, we will refrain from overwhelming the reader by giving their definitions and refer to the literature, e.g. [35, 16, 39, 34, 38].

We also consider the treewidth and the cliquewidth of Boolean circuits .

2.2 Communication Complexity

We here give a very basic introduction to communication complexity. For more details, the reader is referred to the very readable textbook [26].

Let be a set of variables and a partition of . A combinatorial rectangle respecting is a function . For a Boolean function on , a rectangle cover of size respecting is defined to be a representation

where all are combinatorial rectangles respecting . The non-deterministic communication complexity of is defined as where is the minimum size of any rectangle cover of respecting .

The best-case non-deterministic communication complexity with -balance is defined as where the minimum is over all partitions of with .

2.3 Structured deterministic DNNF

Out of the rich landscape of representations from knowledge compilation, see e.g. [13, 32], we only introduce one that we will use in the remainder of this paper. For all circuits in this section, we assume that -gates have exactly two inputs while the number of -gates may be arbitrary.

A v-tree for a variable set is a full binary tree whose leaves are in bijection with . We call the variable assigned by this bijection to a leaf the label of . For a node , we denote by the subtree of that has as its root and by the variables that are labels of leaves in .

We give some definitions from [10]. A complete structured DNNF structured by a v-tree is a Boolean circuit with the following properties: there is a labeling of the nodes in with subsets of gates of such that:

  • For every gate of there is a unique node of with .

  • If is a leaf labeled by a variable , then may only contain and . Moreover, for every input gate , the node is a leaf.

  • For every -gate , all inputs are -gates in .

  • Every -gate has exactly two inputs that are both -gates or input gates. Moreover, and are the children of in and in particular .

The width of is defined as the maximal number of -gates in any set .

We often speak of complete structured DNNF without mentioning the v-tree by which it is structured in cases where the form of the v-tree is unsubstantial.

Intuitively, a complete structured DNNF is a Boolean circuit in negation normal form in which the gates are organized into blocks which form a tree shape. In every block one then computes a 2-DNF whose inputs are gates from the blocks that are the children of in the tree shape.

A complete structured DNNF is called deterministic if and only if for every assignment and for every -gate, at most one input evaluates to true.

Note that we do not allow constant input gates here. We remark that if we allowed those, we could always get rid of them in the circuit by propagation without changing any other properties of the circuit, see [10, Section 4]. We also remark that in a complete structured DNNF , we can forget a variable , i.e., construct a complete structured DNNF computing , by setting all occurrences of and to and propagating the constants in the obvious way. This operation does not increase the width, see [10]. However, if is deterministic, this is generally not the case for .

3 The Effect of Auxiliary Variables

In this section, we will show that introducing auxiliary variables may arbitrarily reduce the treewidth of encodings. Note that this is not very surprising since it is not too hard to see that CNF-representations of, say, the parity function, are of high treewidth. However, in this case the size of the representation is exponential, so in a sense parity is a hard function for CNF-representations anyway. Here we will show that even for functions that have small CNF-representations there can be a large gap between the treewidth of representations and clausal encodings with auxiliary variables. To this end, consider the AtMostOne-function on variables which accepts exactly those assignments in which at most one variable is assigned to . There is an obvious quadratic size representation as

However, this representation has as primal graph the clique which is of treewidth . In the next lemma, we will see that in fact there is no representation of AtMostOne that is of smaller primal treewidth.

Lemma 1.

Any CNF-representation of the AtMostOne-function of inputs without auxiliary variables has primal treewidth .


Let be the variables of AtMostOne. We proceed with two claims.

Claim 1.

Every non-tautological clause of any CNF representation of AtMostOne must contain at least the negation of two variables from .


Suppose that a clause does not contain two such literals. Then, there are two possible cases: either contains no negated variables or exactly one.

In the first case, the model of AtMostOne setting all variables to does not satisfy , so cannot be part of the CNF representation.

In the second case, let be the (only) variable of AtMostOne appearing negatively in . Then, the model of AtMostOne setting only to and all other variables to does not satisfy , so cannot be part of the CNF representation, either.

Hence, at least two negated variables must appear in . ∎

From Claim 1, we will deduce that all pairs of variables must appear conjointly in at least one clause.

Claim 2.

For each pair of variables from with , there is a clause in the CNF representation of AtMostOne containing both and .


Suppose that, for a pair such a clause does not exist. Let be the assignment that sets exactly the variables to and all other variables to .

Let be a clause from the CNF representation. By our previous claim, contains two negated variables from . Because of our assumption, at least one of these literals is neither nor , and this literal is satisfied by . Thus is satisfied by .

Since this is true for every clause , it follows that satisfies all the clauses of the representation, so it is one of its models. However, is not a model of AtMostOne. As a consequence, a clause containing both and must exist, which is also true for every pair . ∎

Claim 2 shows that for each pair of variables, there is a clause containing both of them. It follows that all variables are connected to all other variables in the primal graph of the representation. So the primal graph is a clique which has treewidth . ∎

If we allow the use of auxiliary variables, we may decrease the treewidth dramatically.

Lemma 2.

There is a clausal encoding of AtMostOne of primal treewidth .


We use the well-known ladder encoding from [19], see also [4, Section 2.2.5]. We introduce the auxiliary variables . The encoding consists of the following clauses:

  • the validity clauses , and

  • clauses representing the constraint

for every . It is easy to see that this encoding is correct.

Concerning the treewidth bound, we construct for every index the bag . Then where has nodes and edges is a tree decomposition of width . ∎

4 Width vs. Communication

In this section, we show that from communication complexity we get lower bounds for the various width notions of Boolean functions. The main building block is the following result that is an application of the main result of [33] to complete structured DNNF.

Theorem 1.

Let be a complete structured DNNF structured by a v-tree computing a function in variables . Let be a node of and let and . Finally, let be the number of -gates in . Then there is a rectangle cover of respecting of size at most .

Note that in [33] the considered models are structured DNNF that are not necessarily complete, a slightly more general model than ours. Thus the statement in [33] is slightly different. However, it is easy to see that in our restricted setting, their proof shows the statement we give above, see also the discussion in [6, Section 5].

Since Theorem 1 is somewhat technical, it will be more convenient here to use the following easy consequence that one gets directly with the definitions.

Proposition 1.

Let be a complete structured DNNF structured by a v-tree computing a function in variables . Let be a node of and let and . Then

In many cases, instead of considering explicit v-trees, it is more convenient to simply use best-case communication complexity.

Corollary 1.

Let be a Boolean function in variables . Then, for every complete structured DNNF computing , we have


Note that for every v-tree with on the leaves, there is a node such that . Plugging this into Proposition 1 directly yields the result. ∎

We will use Corollary 1 to turn compilation algorithms that produce complete structured DNNF based on a parameter of the input as in [2, 7] into inexpressivity bounds based on this parameter. We first give an abstract version of this result that we will instantiate for concrete measures later on.

Theorem 2.

Let be a (fully expressive) representation language for Boolean functions. Let be a parameter . Assume that there is for every Boolean function and every that encodes a complete structured DNNF with

Then we have


From the assumption, we get . Then we apply Corollary 1 to directly get the result. ∎

Intuitively, it is exactly the algorithmic usefulness of parameters that makes the resulting instances inexpressive. Note that it is not surprising that instances whose expressiveness is severely restricted allow for good algorithmic properties. However, here we see that the inverse of this statement is also true in a quite harsh way: if a parameter has good algorithmic properties allowing efficient compilation into DNNF, then this parameter puts strong restrictions on the complexity of the expressible functions.

Note that instead of Corollary 1 we could have used Proposition 1 in the proof of Theorem 2 to get a slightly stronger result. We chose to go with a simpler statement here but note that we will use the extended strength of Proposition 1 later on in Section 6.

From Theorem 2, we directly get lower bounds for the width measures studied in [30, 35, 16, 38, 34]. The first result considers the parameters with respect to which SAT is fixed-parameter tractable.

Corollary 2.

There is a constant such that for every Boolean function and every CNF encoding we have


This follows directly from Theorem 2 and the fact that for all these parameters we have compilation algorithms of width . ∎

Using the compilation algorithm from [2, 3], we get essentially the same result for circuit representations.

Corollary 3.

There is a constant such that for every Boolean function and every circuit encoding we have

We remark that for treewidth the circuits of Corollary 3 boil down to so-called read-once functions which have been studied extensively, see e.g. [21].

Finally, we give a version for parameters that allow polynomial time algorithms when fixed but no fixed-parameter algorithms.

Corollary 4.

There is a constant such that for every Boolean function in variables and every CNF encoding we have


All of the width measures in the statement allow compilation into complete structured DNNF of size – and thus also width – for parameter value  and variables [5]. Thus, with Theorem 2, for each measure there is a constant with which completes the proof. ∎

Note that the bounds of Corollary 4 are lower by a factor of than those of Corollary 2. We will see in the next section that in a sense this difference is unavoidable.

5 Relations between Different Width Measures of Encodings

In this section, we will show that the different width measures for optimal clausal encodings are strongly related. We will start by proving that primal treewidth bounds imply bounds for modular treewidth and cliquewidth.

Theorem 3.

Let be a positive integer and be a Boolean function of variables that has a CNF-encoding of primal treewidth at most . Then also has a CNF-encoding of modular incidence treewidth and cliquewidth . Moreover, if has dependent auxiliary variables, then so has .

Before we prove Theorem 3, let us here discuss this result a little. It is well known that the modular treewidth and the cliquewidth of a CNF formula can be much smaller than its treewidth [38]. Theorem 3 strengthens this by saying essentially that for every function we can gain a factor logarithmic in the number of variables.

In particular, this shows that the lower bounds we can show with Corollary 4 are the best possible: the maximal lower bounds we can show are of the form and since there is always an encoding of every function of treewidth , by Theorem 3 there is always an encoding of cliquewidth roughly . Thus the maximal lower bounds of Corollary 4 are tight up to constants.

Note that for Theorem 3, it is important that we are allowed to change the encoding. For example, the primal graph of the formula has the -grid as a minor and thus treewidth , see e.g. [15, Chapter 12]. But the incidence graph of has no modules and also has the -grid as a minor, so has modular incidence treewidth at least as well. So we gain nothing by going from primal treewidth to modular treewidth without changing the encoding. What Theorem 3 tells us is that there is another formula that encodes the function of , potentially with some additional variables, such that the treewidth of is at most .

Let us note that encodings with dependent auxiliary variables are often useful, e.g. when considering counting problems. In fact, for such clausal encodings the number of models is the same as for the function they encode. It is thus interesting to see that dependence of the auxiliary variables can be maintained by the construction of Theorem 3. We will see that this is also the case for most other constructions we make.

Proof (of Theorem 3).

The basic idea is that we do not treat the variables in the bags of the tree decomposition individually but organize them in groups of size . We then simulate the clauses of the original formula by clauses that work on the groups. Since for every group there are only a linear number of assignments, all encoding sizes stay polynomial. We now give the details of the proof.

Let be a tree decomposition of of width at most . For every clause of there is a bag that contains the variables of . By adding some copies of bags, we may assume w.l.o.g. that for every bag there is at most one clause with and call this clause .

In a first step, we construct a coloring such that in every bag there are at most variables of every color. This can be done iteratively as follows: first split the bag at the root into color classes as required. Since there are at most variables in by assumption, we can split them into color classes of size at most arbitrarily. Now let be a node of with parent . By the coloring of the variables in , some of the variables in are already colored. We simply add the variables not appearing in arbitrarily to color classes such that no color class is too big. Again, since contains at most variables, this is always possible. Moreover, due to the connectivity condition, there is for every variable a unique node that is closest to the root under the bags containing . Consequently, we can make no contradictory decisions during this coloring process, so is well-defined.

We now construct . To this end, we first introduce for every variable and every node such that a new variable . Now for every node with parent and every color , we add a set of clauses in all variables with . We construct these clauses in such a way that they are satisfied by exactly the assignments in which for each pair such that both these variables exist both variables take the same value. Note that the clauses in have at most variables, so there are at most of them. Moreover, they contain all the same variables. The result is a formula in which all for a variable take the same value in all satisfying assignments.

In a next step, we do for each clause the following: let . For every color , we define to be the set of variables such that . We add a fresh variable and clauses in the variables that accept exactly the assignments with

  • and there is an such that setting to satisfies , or

  • and if there is no such that setting to satisfies .

Next, we add the clause . Finally, for every variable , rename one arbitrary variable to . This completes the construction of .

We claim that is an encoding of . To see this, first note that, as discussed before, for every variable of , in the satisfying assignments of , all and take the same value. So, we define for every assignment of a partial assignment of as an extension of by setting for every . satisfies a clause if and only if there is at least one variable of such that makes true. Let , then satisfies if and only if is satisfied by the extension of that sets to . So satisfies if and only if there is an extension of that satisfies . Consequently, satisfies if and only if there is an extension of that satisfies , so is an encoding of as claimed.

To observe that the modular treewidth of is at most , note that all sets are modules as are the clause sets and . W.l.o.g. we may assume that for every , there is at most one clause with and that is a binary tree. We construct a tree decomposition as follows: we put a representant of , , and into . Moreover, we add and to . It is easy to see that constructed like this, is a tree decomposition of width at most .

The argument for clique-width is similar; we give a proof in Appendix A.

Finally, to see that the construction maintains dependence of auxiliary variables, observe first that the auxiliary variables already present in are still in  and they are still dependent. We claim that all the new variables depend on those of . For the variables , this is immediate since they must take the same value as in every model. Moreover, the variables depend on the by definition. As a consequence, all auxiliary variables are dependent which completes the proof. ∎

We now show that the reverse of Theorem 3 is also true: upper bounds for many width measures imply also bounds for the primal treewidth of clausal encodings. Note that this is at first sight surprising since without auxiliary variables many of those width measures are known to be far stronger than primal treewidth.

Theorem 4.

Let be a Boolean function of variables.

  1. If has a clausal encoding of modular treewidth, cliquewidth or mim-width then also has a clausal encoding of primal treewidth with auxiliary variables and clauses.

  2. If has a clausal encoding of incidence treewidth, dual treewidth, or signed incidence cliquewidth , then also has a clausal encoding of primal treewidth with auxiliary variables and clauses.

Theorem 4 is a direct consequence of the following result:

Lemma 3.

Let be a Boolean function in variables that is computed by a complete structured DNNF of width . Then has a clausal encoding of primal treewidth with variables and clauses. Moreover, if is deterministic then has dependent auxiliary variables.

The proof of Lemma 3 will rely on so-called proof trees in DNNF, a concept that has found wide application in circuit complexity and in particular also in knowledge compilation. To this end, we make the following definition: a proof tree of a complete structured DNNF is a circuit constructed as follows:

  1. The output gate of belongs to .

  2. Whenever contains an -gate, we add exactly one of its inputs.

  3. Whenever contains an -gate, we add both of its inputs.

  4. No other gates are added to .

Note that the choice in Step 2 is non-deterministic, so there are in general many proof trees for . Observe also that due to the structure of given by its v-tree, every proof tree is in fact a tree which justifies the name. Moreover, letting be the v-tree of , every proof tree of has exactly one -gate and one -gate in the set for every non-leaf node of . For every leaf , every proof tree contains an input gate or where is the label of in .

The following simple observation that can easily be shown by using distributivity is the main reason for the usefulness of proof trees.

Observation 1.

Let be a complete structured DNNF and an assignment to its variables. Then satisfies if and only if it satisfies one of its proof trees. Moreover, if is deterministic, then every assignment that satisfies satisfies exactly one proof tree of .

Proof (of Lemma 3).

Let be the complete structured DNNF computing and let be the v-tree of . The idea of the proof is to use auxiliary variables to guess for every an -gate and an -gate. Then we use clauses along the v-tree  to verify that the guessed gates in fact form a proof tree and check in the leaves of if the assignment to the variables of satisfies the encoded proof tree. We now give the details of the construction.

We first note that it was shown in [10] that in complete structured DNNF of width one may assume that every set contains at most -gates so we assume this to be the case for . For every node of , we introduce a set of auxiliary variables to encode one -gate and one -gate of if is an internal node. If is a leaf, encodes one of the at most input gates in . We now add clauses that verify that the gates chosen by the variables encode a proof tree by doing the following for every that is not a leaf: first, add clauses in that check if the chosen -gate is in fact an input of the chosen -gate. Since has at most variables, this introduces at most clauses. Let and be the children of in . Then we add clauses that verify if the -gate chosen in has as input either the -gate chosen in if is not a leaf, or the input gate chosen in if is a leaf. Finally, we add analogous clauses for . Each of these clause sets is again in variables, so there are at most clauses in them overall. The result is a CNF-formula that accepts an assignment if and only if it encodes a proof tree of .

We now show how to verify if the chosen proof tree is satisfied by an assignment to . To this end, for every leaf of labeled by a variable , add clauses that check if an assignment to satisfies the corresponding input gate of . Since contains at most gates, this only requires at most clauses. This completes the construction of the clausal encoding. Overall, since has internal nodes, the CNF has variables and clauses.

It remains to show the bound on the primal treewidth. To this end, we construct a tree decomposition with the v-tree as underlying tree as follows: for every internal node , we set where and are the children of . Note that for every clause that is used for checking if the chosen nodes form a proof tree, the variables are thus in a bag . For every leaf , set where is the variable that is the label of . This covers the remaining clauses. It follows that all edges of the primal graph are covered. To check the third condition of the definition of tree decompositions, note that every auxiliary variables in a set appears only in and potentially in where is the parent of in . Thus constructed in this way is a tree decomposition of the primal graph of . Obviously, the width is bounded by since every has size , which completes the proof. ∎

Proof (of Theorem 4).

We first show a). By [5], whenever the function has a clausal encoding with one of the width measures from this statement bounded by , then there is also a complete structured DNNF of width computing . Now forget all auxiliary variables of to get a DNNF representation of . Note that since forgetting does not increase the width, see [10], also has width at most . We then simply apply Lemma 3 to get the result.

To see b), just observe that, following the same construction, the width of is for all considered width measures [5]. ∎

Remark one slightly unexpected property of Theorem 4: the size and the number of auxiliary variables of the constructed encoding does not depend on the size of the initial encoding at all. Both depend only on the number of variables in and the width.

To maintain dependence of the auxiliary variables in the above construction, we have to work some more than for Theorem 4.

We start with some definitions. We call a complete structured DNNF reduced if from every gate there is a directed path to the output gate. Note that every complete structured DNNF can be turned into a reduced DNNF in linear time by a simple graph traversal and that this transformation maintains determinism and structuredness by the same v-tree. The following property will be useful.

Lemma 4.

Let be a reduced complete structured DNNF and let be a gate in . Let be an assignment to , the variables in the sub-circuit rooted in , that satisfies , then can be extended to an assignment that satisfies .


We use the fact that an assignment to is satisfying if and only if there is a proof-tree that witnesses this. So let be a proof tree that witnesses satisfying . We extend it to a proof tree for an extension of as follows: first add a path from to the output gate to and then iteratively add more gates as required by the definition of proof trees where the choices in -gates are performed arbitrarily. The result is an extension of which witnesses that an assignment that extends satisfies . ∎

Let be a function in variables . Then we say that is definable in with respect to  if there is a function such that for all assignments with we have where is the restriction of to .

Lemma 5.

Let be a function in variables such that is definable in with respect to . Let be a reduced complete structured deterministic computing . Then the complete structured DNNF we get from by forgetting is deterministic as well.


By way of contradiction, assume this were not the case. Then there is a -gate in and an assignment to such that two children and are satisfied by . By Lemma 4, we may assume that satisfies . Then there are extensions and of that assign a value to such that satisfies and satisfies in . Note that both and satisfy and thus, by definability, and assign the same value to . So and hence satisfies both and in which contradicts the determinism of . ∎

Theorem 5.

Let be a Boolean function of variables.

  1. If has a clausal encoding with dependent auxiliary variables of modular treewidth, cliquewidth or mim-width then also has a clausal encoding with dependent auxiliary variables of primal treewidth with auxiliary variables and clauses.

  2. If has a clausal encoding with dependent auxiliary variables of incidence treewidth, dual treewidth, or signed incidence cliquewidth , then also has a clausal encoding with dependent auxiliary variables of primal treewidth with auxiliary variables and clauses.

Proof (sketch).

The proof is essentially the same as that of Theorem 4 with some additional twists. First observe that the complete structured DNNF constructed with [5] is deterministic. Then we use Lemma 5 when forgetting the auxiliary variables and get a that is deterministic without increasing the width. Then, since is deterministic, we can construct a clausal encoding with dependent auxiliary variables using Lemma 3. ∎

We now can state the main result of this section.

Theorem 6.

Let and . Let be a Boolean function in variables.

  • Let and . Then there are constants and such that the following holds: let and be clausal representations for with minimal -width and -width, respectively. Then


  • Let and or and . Then there are constants and such that the following holds: let and be clausal representations for of minimal -width and -width, respectively. Then



Assume first that . For a) we get the second statement directly from Theorem 4 a). For and we get the first statement by Theorem 3. For it follows by the fact that for every graph for some absolute constant , see [39, Section 4].

For b), the second statement is Theorem 4 b). Since for every formula we have , see e.g. [16], the first statement for is immediate. For it is shown in Appendix B, while for it can be found in [36].

All other combinations of and can now be shown by an intermediate step using . ∎

6 Applications

6.1 Cardinality constraints

In this section, we consider cardinality constraints, i.e., constraints of the form in the Boolean variables . The value is commonly called the degree or the threshold of the constraint. Let us denote by the cardinality constraint with variables and degree . Cardinality constraints have been studied extensively and many encodings are known, see e.g. [37]. Here we add another perspective on cardinality constraint encodings by determining their optimal treewidth. We remark that we could have studied cardinality constraints in which the relation is instead of with essentially the same results.

We start with an easy observation:

Observation 2.

has an encoding of primal treewidth

Proof (sketch).

First assume that . We iteratively compute the partial sums of and code their values in bits . We cut these sums off at (if we have seen at least variables set to , this is sufficient to compute the output). In the end we code a comparator comparing the last sum to .

Since the computation of can be done from and , we can compute the partial sums with clauses containing only the variables in , so variables. The resulting CNF-formula can easily be seen to be of treewidth .

If , we proceed similarly but count variables assigned to instead of those set to . ∎

We now show that Observation 2 is essentially optimal.

Proposition 2.

Let . Then


Let . Consider an arbitrary partition with . We show that every rectangle cover of must have rectangles. To this end, choose assignments such that assigns variables to and assigns variables to . Note that every satisfies . We claim that no rectangle in a rectangle cover of can have models and for . To see this, assume that such model exists and that . Then the assignment is also a model of the rectangle since satisfies and satisfies . But contains more than variables assigned to , so the rectangle cannot appear in a rectangle cover of . Thus, every rectangle cover of must have a different rectangle for every model and thus at least rectangles. This completes the proof for this case. ∎

A symmetric argument shows that for we have the lower bound Observing that for non-trivial cardinality constraints, we get the following from Theorem 1.

Corollary 5.

Clausal encodings of smallest primal treewidth for have primal treewidth for . The same statement is true for dual and incidence treewidth and signed incidence cliquewidth.

For incidence cliquewidth, modular treewidth and mim-width, there are clausal encodings of of constant width.

6.2 The permutation function

We now consider the permutation function PERM which has the input variables thought of as a matrix in these variables. PERM evaluates to on an input if and only if is a permutation matrix, i.e., in every row and in every column of there is exactly one . PERM is known to be hard in several versions of branching programs, see [40]. In [9], it was shown that clausal encodings of PERM require treewidth . We here give an improvement by a logarithmic factor.

Lemma 6.

For every v-tree on variables , there is a node of such that

where and .


The proof is a variation of arguments in [9] and in [25], see also [40, Section 4.12]. Since all models of PERM assign exactly variables to , for every model of PERM there is a node in such that contains between and variables assigned to by . Since has internal nodes and PERM has models, there must be a node such that for at least of the models we have . We will show in the remainder that has the desired property.

Denote by the set of models of PERM for which . Let and as in the statement of the lemma. Every model of PERM corresponds to a permutation on that assigns every to the such that . Note that because of the properties of , is well-defined and indeed a permutation.

Let be rectangle in a rectangle cover of PERM with partition . We will show that contains few models from . To this end, fix a model of and define . Note that is the number of variables in that are assigned to by and thus . Let be another model of . Then because otherwise does not encode a permutation where denotes the restriction of to and that of to . Letting we get similarly that for all models of we have . It follows that the models of are all bijections between and and thus has at most models.

By a symmetric argument, one sees that has at most models. Thus overall the number of models of is bounded by . As a consequence, to cover all models in , one needs at least

rectangles which completes the proof. ∎

As a consequence of Lemma 6, we get an asymptotically tight treewidth bound for encodings of PERM.

Corollary 6.

Clausal encodings of smallest primal treewidth for have primal treewidth .

Proof (sketch).

The lower bound follows by using Lemma 6 and Proposition 1 and then arguing as in the proof of Theorem 2.

For the upper bound, observe that checking if out of variables exactly one has the value can easily be done with variables. We apply this for every row in a bag of a tree decomposition. We perform these checks for one row after the other and additionally use variables for the columns that remember if in a column we have seen a variables assigned so far. Overall, to implement this, one needs auxiliary variables and gets a formula of treewidth . ∎

From Corollary 6 we get the following bound by applying Theorem 3. This answers an open problem from [9] who showed only conditional lower bounds for the incidence cliquewidth of encodings of PERM.

Corollary 7.

Clausal encodings of smallest incidence cliquewidth for have width .

6.3 Improved Lower Bounds for Minor-Free Graphs

In this section, we show how our approach can be used to improve lower bounds for structurally restricted classes of circuits. We recall that a minor of a graph is a graph that we can get from by deleting vertices, deleting edges and contracting edges. For a graph , the class of -minor-free graphs is defined as the class of graphs consisting of all graphs that do not have as a minor. -minor-free graphs have been studied extensively. In particular, it is known that for planar graphs, and more generally for all graphs embeddable in a fixed surface, there is a graph such that those graphs are -minor free. For example, planar graphs are -minor-free and -minor-free.

We say that a Boolean circuit is -minor-free if the underlying undirected graph of is -minor-free. Remember that we assume that every input variable is the label of at most one input gate. There have long been quadratic lower bounds for planar circuits [28]. Those were generalized to almost quadratic lower bounds of the order  for -minor-free circuits in [14]. We show here that with our techniques it is easy to improve these bounds to quadratic lower bounds.

As in [14], the basic building block for our lower bound will be the following result on the treewidth of -minor-free graphs.

Theorem 7 ([1]).

For every graph there is a constant such that every -minor-free graph has treewidth at most .

Corollary 8.

For every graph there is a constant such that for every function , every -minor-free circuit computing has at least gates.


By Corollary 3 any circuit computing must have treewidth . By Theorem 7, the treewidth of is at most where is the number of gates in . Thus and the claim follows. ∎

To show a quadratic lower bound, consider the function -free in variables with which is defined as follows: interpret the input as the adjacency matrix of a graph and return if and only if does not have a triangle as a subgraph. We note that -free is a classical function, considered in communication complexity essentially since the creation of the field [29]. Here, we will use the following result:

Theorem 8 ([24]).

We directly get the following generalization of the quadratic lower bound in [28], which improves that in [14].

Theorem 9.

For every fixed graph there is a constant such that every -minor-free circuit computing -free has gates, i.e., quadratic in the number of inputs.

7 Conclusion

We have shown several results on the expressivity of clausal encodings with restricted underlying graphs. In particular, we have seen that many graph width measures from the literature put strong restrictions on the expressivity of encodings. We have also seen that, contrary to the case of representations by CNF-formulas, in the case where auxiliary variables are allowed, all width measures we have considered are strongly related to primal treewidth and never differ by more than a logarithmic factor. Moreover, most of our results are also true while maintaining dependence of auxiliary variables.

To close the paper, let us discuss several questions. First, the number of clauses of the encodings guaranteed by Theorem 4 is very high. In particular, it is exponential in the width . It would be interesting to understand if this can be avoided, i.e., if there are encodings of roughly the same primal treewidth whose size is polynomial in .

It would also be interesting to see if our results can be extended to other classes of CNF-formulas on which SAT is tractable. Interesting classes to consider would e.g. be the classes in [17]. In this paper, the authors define another graph for CNF-formulas for which bounded treewidth yields tractable model counting. It is not clear if the classes characterized that way allow small complete structured DNNF so our framework does not apply directly. It would still be interesting to see if one can show similar expressivity results to those here. Other interesting classes one could consider are those defined by backdoors, see e.g. [18].


The authors are grateful to the anonymous reviewers for their comments, which greatly helped to improve the presentation of the paper. The first author would like to thank David Mitchell for asking the right question at the right moment. This paper grew largely out of an answer to this question.


  • [1] N. Alon, P. D. Seymour, and R. Thomas. A separator theorem for graphs with an excluded minor and its applications. In

    Proceedings of the 22nd Annual ACM Symposium on Theory of Computing, STOC 1990

    , 1990.
  • [2] A. Amarilli, F. Capelli, M. Monet, and P. Senellart. Connecting knowledge compilation classes and width parameters. CoRR, abs/1811.02944, 2018.
  • [3] A. Amarilli, M. Monet, and P. Senellart. Connecting width and structure in knowledge compilation. In 21st International Conference on Database Theory, ICDT 2018, March 26-29, 2018, Vienna, Austria, 2018.
  • [4] A. Biere, M. Heule, H. van Maaren, and T. Walsh, editors. Handbook of Satisfiability, volume 185 of Frontiers in Artificial Intelligence and Applications. IOS Press, 2009.
  • [5] S. Bova, F. Capelli, S. Mengel, and F. Slivovsky. On compiling cnfs into structured deterministic dnnfs. In Theory and Applications of Satisfiability Testing - SAT 2015 - 18th International Conference, 2015.
  • [6] S. Bova, F. Capelli, S. Mengel, and F. Slivovsky. Knowledge compilation meets communication complexity. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, 2016.
  • [7] S. Bova and S. Szeider. Circuit treewidth, sentential decision, and query compilation. 2017.
  • [8] J. Brault-Baron, F. Capelli, and S. Mengel. Understanding model counting for -acyclic CNF-formulas. CoRR, abs/1405.6043, 2014.
  • [9] I. Briquel, P. Koiran, and K. Meer. On the expressive power of CNF formulas of bounded tree- and clique-width. Discrete Applied Mathematics, 159(1):1–14, 2011.
  • [10] F. Capelli and S. Mengel. Tractable QBF by knowledge compilation. In 36th International Symposium on Theoretical Aspects of Computer Science, STACS 2019, volume 126, pages 18:1–18:16, 2019.
  • [11] H. Chen. Quantified constraint satisfaction and bounded treewidth. In Proceedings of the 16th Eureopean Conference on Artificial Intelligence, ECAI 2004, 2004.
  • [12] B. Courcelle. On the model-checking of monadic second-order formulas with edge set quantifications. Discrete Applied Mathematics, 160(6):866–887, 2012.
  • [13] A. Darwiche and P. Marquis. A knowledge compilation map. J. Artif. Intell. Res., 17:229–264, 2002.
  • [14] M. de Oliveira Oliveira. Size-treewidth tradeoffs for circuits computing the element distinctness function. Theory Comput. Syst., 62(1):136–161, 2018.
  • [15] R. Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012.
  • [16] E. Fischer, J. Makowsky, and E. Ravve. Counting truth assignments of formulas of bounded tree-width or clique-width. Discrete Applied Mathematics, 156(4):511–529, 2008.
  • [17] R. Ganian and S. Szeider. New width parameters for model counting. In 20th International Conference Theory and Applications of Satisfiability Testing, SAT 2017, 2017.
  • [18] S. Gaspers and S. Szeider. Strong backdoors to bounded treewidth SAT. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 2013.
  • [19] I. P. Gent and P. Nightingale. A new encoding of alldifferent into sat. In International Workshop on Modelling and Reformulating Constraint Satisfaction Problems, 2004.
  • [20] E. Giunchiglia, M. Maratea, and A. Tacchella. Dependent and independent variables in propositional satisfiability. In Logics in Artificial Intelligence, JELIA 2002, 2002.
  • [21] M. C. Golumbic and V. Gurvich. Read-once functions. Boolean Functions: Theory, Algorithms and Applications, pages 519–560, 2011.
  • [22] G. Gottlob, R. Pichler, and F. Wei. Bounded treewidth as a key to tractability of knowledge representation and reasoning. Artif. Intell., 174(1):105–132, 2010.
  • [23] M. Jakl, R. Pichler, and S. Woltran. Answer-set programming with bounded treewidth. In Proceedings of the 21st International Joint Conference on Artificial Intelligence, IJCAI 2009, 2009.
  • [24] S. Jukna and G. Schnitger. Triangle-freeness is hard to detect.

    Combinatorics, Probability & Computing

    , 11(6):549–569, 2002.
  • [25] M. Krause. Exponential lower bounds on the complexity of local and real-time branching programs. Elektronische Informationsverarbeitung und Kybernetik, 24(3):99–110, 1988.
  • [26] E. Kushilevitz and N. Nisan. Communication complexity. Cambridge University Press, 1997.
  • [27] M. Lampis, S. Mengel, and V. Mitsou. QBF as an alternative to courcelle’s theorem. In 21st International Conference Theory and Applications of Satisfiability Testing, SAT 2018, 2018.
  • [28] R. J. Lipton and R. E. Tarjan. Applications of a planar separator theorem. SIAM J. Comput., 9(3):615–627, 1980.
  • [29] C. H. Papadimitriou and M. Sipser. Communication complexity. J. Comput. Syst. Sci., 28(2):260–269, 1984.
  • [30] D. Paulusma, F. Slivovsky, and S. Szeider. Model Counting for CNF Formulas of Bounded Modular Treewidth. In 30th International Symposium on Theoretical Aspects of Computer Science, STACS 2013, 2013.
  • [31] D. Paulusma, F. Slivovsky, and S. Szeider. Model counting for CNF formulas of bounded modular treewidth. Algorithmica, 76(1):168–194, 2016.
  • [32] K. Pipatsrisawat and A. Darwiche. New compilation languages based on structured decomposability. In Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence, AAAI 2008, 2008.
  • [33] T. Pipatsrisawat and A. Darwiche. A lower bound on the size of decomposable negation normal form. In Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2010, 2010.
  • [34] S. H. Sæther, J. A. Telle, and M. Vatshelle. Solving #SAT and MAXSAT by dynamic programming. J. Artif. Intell. Res., 54:59–82, 2015.
  • [35] M. Samer and S. Szeider. Algorithms for propositional model counting. J. Discrete Algorithms, 8(1):50–64, 2010.
  • [36] M. Samer and S. Szeider. Constraint satisfaction with bounded treewidth revisited. J. Comput. Syst. Sci., 76(2):103–114, 2010.
  • [37] C. Sinz. Towards an optimal CNF encoding of boolean cardinality constraints. In Principles and Practice of Constraint Programming - CP 2005, 11th International Conference, CP 2005, 2005.
  • [38] F. Slivovsky and S. Szeider. Model counting for formulas of bounded clique-width. In Algorithms and Computation - 24th International Symposium, ISAAC 2013, 2013.
  • [39] M. Vatshelle. New Width Parameters of Graphs. PhD thesis, University of Bergen, 2012.
  • [40] I. Wegener. Branching Programs and Binary Decision Diagrams. SIAM, 2000.

Appendix A The Cliquewidth Bound for Theorem 3

Let us first recall the definition of cliquewidth. The cliquewidth of a graph is defined as the minimum number of labels needed to construct with the following operations:

  • creation of a new vertex with label ,

  • disjoint union of two labeled graphs,

  • joining all vertices with a label to all vertices with a label for , and

  • renaming a label to for .

We will show that the incidence graph of the formula can be constructed with