New width parameters for SAT and #SAT ✩

We study the parameterized complexity of the propositional satisﬁability (SAT) and the more general model counting (#SAT) problems and obtain novel ﬁxed-parameter algorithms that exploit the structural properties of input formulas. In the ﬁrst part of the paper, we parameterize by the treewidth of the following two graphs associated with CNF formulas: the consensus graph and the conﬂict graph. Both graphs have as vertices the clauses of the formula; in the consensus graph two clauses are adjacent if they do not contain a complementary pair of literals, while in the conﬂict graph two clauses are adjacent if they do contain a complementary pair of literals. We show that #SAT is ﬁxed-parameter tractable when parameterized by the treewidth of the former graph, but SAT is W[1]-hard when parameterized by the treewidth of the latter graph. In the second part of the paper, we turn our attention to a novel structural parameter we call h-modularity which is loosely inspired by the well-established notion of community structure. The new parameter is deﬁned in terms of a partition of clauses of the given CNF formula into strongly interconnected communities which are sparsely interconnected with each other. Each community forms a hitting formula, whereas the interconnections between communities form a graph of small treewidth. Our algorithms ﬁrst identify the community structure and then use them for an eﬃcient solution of SAT and #SAT, respectively. © 2021 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/)


Algorithmically useful graphical models
In the first part of the paper, we consider the treewidth of two further graphical models: the consensus graph and the conflict graph, giving rise to the parameters consensus treewidth and conflict treewidth, respectively. Both graphs have as their vertices the clauses of the formula. In the consensus graph two clauses are adjacent if they do not contain a complementary pair of literals; in the conflict graph, two clauses are adjacent if they do contain a complementary pair of literals (see Fig. 1 later for examples). Here, we study the parameterized complexity of #SAT with respect to the new parameters and provide a comparison to known parameters under which #SAT is fixed-parameter tractable.
We remark that related notions have been studied in previous works. For instance, Kullmann [34] considered the symmetric conflict matrix of a CNF formula om m clauses, which is an m × m matrix where the entry at row i and column j gives the number of conflicts between the i-th and the j-th clause. This matrix is the adjacency matrix of the conflict multigraph [17], which arises from the conflict graph by adding as many parallel edges between two clauses as the clauses have conflicts. Scheder and Zumstein [52] considered conflict graphs in our sense, without parallel edges. The cited works [17,34,52] mainly focused on structural results on special classes of formulas and less on algorithms.
Our main result regarding consensus treewidth is a novel fixed-parameter algorithm for model counting (Theorem 1). The algorithm is based on dynamic programming along a tree decomposition of the consensus graph. This result is particularly interesting as none of the known parameters under which #SAT is fixed-parameter tractable dominates consensus treewidth, in the sense that there are instances of small consensus treewidth where all other known parameters (that yield the fixed-parameter tractability of #SAT) can be arbitrarily large (Proposition 3). Hence consensus treewidth pushes the state of the art for fixed-parameter tractability of #SAT further, and moreover does so via a parameter that forms a natural counterpart to the already established primal, dual and incidence treewidth parameters. We also note that the presented fixed-parameter algorithm generalizes the polynomial-time algorithm on hitting formulas [28][29][30]40] (see Subsection 2.2 in the preliminaries).
This positive result is complemented by our results on conflict treewidth: we show that conflict treewidth in its general form does not provide a parameter under which #SAT is fixed-parameter tractable, even for formulas without pure literals (subject to the well-established complexity theoretic assumption W [1] = FPT [13]). In fact, we show that already the decision problem SAT for formulas without pure literals is W[1]-hard when parameterized by conflict treewidth, or even by a weaker parameter, the size of a smallest vertex cover of the conflict graph (Proposition 1).

An algorithmically applicable notion of modularity
The presence of a community structure with low modularity as exhibited in the mentioned studies [1,38] is not a guarantee for an instance to be easy; instead, the correlation between modularity and solving time is of statistical nature.
In fact, it is not difficult to show that SAT remains NP-hard for highly modular instances. More specifically, given any SAT formula F , one can use a padding process (i.e., the addition of multiple variable-disjoint dense satisfiable subformulas) to create an equisatisfiable formula F whose size is linear in F and whose modularity can be better than any arbitrarily fixed threshold.
Here, we introduce the notion of h-modularity for CNF formulas and show that, when used as a parameter, it gives rise to a single-exponential fixed-parameter algorithm for SAT and a double-exponential fixed-parameter algorithm for #SAT. h-modularity is designed to naturally exhibit the core properties of modularity (i.e., having variables clustered into communities with strong connections inside each community but less connections between different communities) while also ensuring that formulas of small h-modularity have structural properties that can be used to obtain good worst-case runtime guarantees (the padding argument mentioned above shows that density of clauses or connections is not sufficient).
In particular, h-modularity is defined based on the partition of the set of clauses into subsets, which we call hcommunities. Each h-community forms a strongly interconnected set of clauses. This is ensured by the requirement that any two clauses of an h-community "clash" in at least one variable (i.e., h-communities are hitting formulas, cf. Subsection 2.2). Furthermore, the h-communities are sparsely interconnected with each other, which is ensured by the requirement that a certain graph which represents the interaction between h-communities has small treewidth as well as h-communities are of small degree (graphs of small treewidth are sparse [45,31]). A formal definition of h-modularity is given in Section 5. Somewhat related to h-modularity is the notion of modular incidence treewidth of a CNF formula [42], which is the treewidth of the incidence graph after contraction of modules (i.e., sets of vertices with the same neighborhood). SAT is not fixedparameter tractable parameterized by the modular treewidth of the input formula (unless W [1] = FPT). However, if the modular treewidth is bounded by a constant, then the number of satisfying assignments can be computed in polynomial time [42].
We show that h-modularity is incomparable with the parameters signed clique-width and clustering-width, hence hmodularity is not dominated by any well-known parameter that admits fixed-parameter tractability of SAT or #SAT. As a consequence, our algorithms which use h-modularity also push the frontiers of tractability for SAT and #SAT. We remark that our algorithms do not assume that the relevant "decompositions" (i.e., a suitable partitioning into h-communities) are provided on the input.
The connections between the newly introduced parameters with previously studied structural parameters that yield tractability for SAT and #SAT are summarized in Section 6.

Preliminaries
The set of natural numbers (that is, positive integers) will be denoted by N. For i ∈ N we write [i] to denote the set {1, . . . , i}.

SAT and #SAT
We consider propositional formulas in conjunctive normal form (CNF), represented as sets of clauses. That is, a literal is a (propositional) variable x or a negated variable x; a clause is a finite set of literals not containing a complementary pair x and x; a formula is a finite set of clauses.
For a literal l = x we write l = x; for a clause C we set C = { l : l ∈ C }. For a clause C , var(C ) denotes the set of variables x with x ∈ C or x ∈ C , and the width of C is |var(C)|. Similarly, for a formula F we write var(F ) = C ∈F var(C ). The length of a formula F is the total number of literals it contains, i.e., C ∈F |var(C)|. We say that two clauses C , D overlap if C ∩ D = ∅; we say that C and D clash if C and D overlap. Note that two clauses can clash and overlap at the same time. Two clauses C , D are adjacent if var(C ) ∩ var(D) = ∅. A variable is pure if it only occurs as either a positive literal or as a negative literal; the literals of a pure variable are then called pure literals.
The dual graph of a formula F is the graph whose vertices are clauses of F and whose edges are defined by the adjacency relation of clauses. We will also make references to the primal graph and the incidence graph of a formula F . The former is the graph whose vertices are the variables of F and where two variables a, b are adjacent if and only if there exists a clause C such that a, b ∈ var(C ), while the latter is the graph whose vertices are the variables and clauses of F and where two vertices a, b are adjacent if and only if a is a clause and b ∈ var(a) (see Fig. 1 for an illustration).
A truth assignment (or assignment, for short) is a mapping τ : X → {0, 1} defined on some set X of variables. We extend τ to literals by setting τ (x) = 1 − τ (x) for x ∈ X . F [τ ] denotes the formula obtained from F by removing all clauses that contain a literal x with τ (x) = 1 and by removing from the remaining clauses all literals y with τ (y) = 0; F [τ ] is the restriction of F to τ . Note that var(F [τ ]) ∩ X = ∅ holds for every assignment τ : X → {0, 1} and every formula F . An assignment τ : In the SAT problem, we are given a formula F and the task is to determine whether F is satisfiable. In the #SAT problem, we are also given a formula F and the task is to compute #(F ).

Hitting formulas
A hitting formula is a CNF formula with the property that any two of its clauses clash (see [28,29,40]). The same notion for DNF formulas is termed orthogonality [10]. The following result makes hitting formulas particularly attractive in the context of SAT and #SAT.
The following observation will be implicitly used in several of our proofs.

Fact 2.
Let F be a hitting formula, and let F be obtained from F by an arbitrary sequence of clause deletions and restrictions under truth assignments. Then F is also a hitting formula.

Parameterized complexity
Next we give a brief and rather informal review of the most important concepts of parameterized complexity. For an in-depth treatment of the subject we refer the reader to other sources [13,39].
The instances of a parameterized problem can be considered as pairs (I, k) where I is the main part of the instance and k is the parameter of the instance; the latter is usually a non-negative integer. A parameterized problem is fixed-parameter tractable (FPT) if instances (I, k) of size n (with respect to some reasonable encoding) can be solved in time f (k)n c where f is a computable function and c is a constant independent of k. Such algorithms are called fixed-parameter algorithms, and the function f is called the parameter dependence.
To obtain our lower bounds, we will need the notion of a parameterized reduction. Let L 1 , L 2 be parameterized problems. A parameterized reduction (or fpt-reduction) from L 1 to L 2 is a mapping P from instances of L 1 to instances of L 2 such that 1. (x, k) ∈ L 1 if and only if P (x, k) ∈ L 2 , 2. the mapping can be computed by a fixed-parameter algorithm w.r.t. parameter k, and 3. there is a computable function g such that k ≤ g(k), where (x , k ) = P (x, k).
The class W [1] captures parameterized intractability and contains all parameterized decision problems that are fptreducible to Multicolored Clique (defined below) [13]. Showing W[1]-hardness for a problem rules out the existence of a fixed-parameter algorithm under the well-established assumption that W[1] = FPT.

Multicolored Clique
Parameter: The integer k.
Question: Are there vertices v 1 , . . . , v k such that v i ∈ V i and {v i , v j } ∈ E for all i and j with 1 ≤ i < j ≤ k (i.e. the subgraph of G induced by {v 1 , . . . , v k } is a clique of size k)?

Treewidth
Let G be a simple, undirected, finite graph with vertex set V = V (G) and edge set T is a tree, and I = V (T ) such that: The width of a tree decomposition is max i∈I |B i | − 1. The treewidth [31,44] of G is the minimum width taken over all tree decompositions of G and it is denoted by tw(G). We call the elements of I nodes and B i bags. As an example, consider the graphs depicted in Fig. 1: graphs (b), (d), (e) have treewidth 2, while graphs (a) and (c) have treewidth 3.
While it is possible to compute the treewidth exactly using a fixed-parameter algorithm [8], the asymptotically best running time is achieved by using the recent state-of-the-art 5-approximation algorithm of Bodlaender et al. [6]. We summarize below.

Fact 3 ([6]
). There exists an algorithm which, given an n-vertex graph G and an integer k, in time 2 O(k) · n either outputs a tree decomposition of G of width at most 5k + 4 and O(n) nodes, or correctly determines that tw(G) > k. Moreover, in time k O(k 3 ) · n it is possible to either output a tree decomposition of G of width at most k and O(n) nodes, or correctly determine that tw(G) > k.
For other standard graph-theoretic notions not defined here, we refer to a standard textbook [12]. It is well known that, for every clique over Z ⊆ V (G) in G, it holds that every tree decomposition of G contains an element B i such that Z ⊆ B i [31]. Furthermore, if i separates a node j from another node l in T , then B i separates B j \ B i from B l \ B i in G [31]; this inseparability property will be useful in some of our later proofs.
A tree decomposition (T , B) of a graph G is nice if the following conditions hold: 1. T is rooted at a specifically marked node r, and B r = ∅.
2. Every node of T has at most two children.
3. If a node t of T has two children t 1 and t 2 , then B t = B t 1 = B t 2 ; in that case we call t a join node.
4. If a node t of T has exactly one child t , then exactly one of the following holds: (a) |B t | = |B t | + 1 and B t ⊂ B t ; in that case we call t an introduce node. (b) |B t | = |B t | − 1 and B t ⊂ B t ; in that case we call t a forget node.
5. If a node t of T is a leaf, then |B t | = 1; we call these leaf nodes.
The main advantage of nice tree decompositions is that they allow the design of much more transparent dynamic programming algorithms, since one only needs to deal with four very specific types of nodes. It is well known (and easy to see) that for every fixed k, given a tree decomposition of a graph G = (V , E) of width at most k and with O(|V |) nodes, one can construct in linear time a nice tree decomposition of G with O(|V |) nodes and width at most k [5]. We say that a vertex v was forgotten below a node t ∈ V (T ) if the subtree rooted at t contains a (forget) node s with a child s such that B s \ B s = {v}.
Finally, we summarize known algorithms for SAT and #SAT when parameterized by the treewidth of the three natural graph representations discussed in previous Subsection 2.1; we note that the original results assumed that a tree decomposition is supplied as part of the input, and we can obtain one using Fact 3 (even while retaining the running time bounds). Fact 4 ( [49,25]). #SAT is FPT when parameterized by the treewidth of any of the following graphical models of the formula: the incidence graph, the primal graph, or the dual graph.

Other structural parameters of CNF formulas
The signed incidence graph of a CNF formula F is the incidence graph of F where additionally each edge between a variable x and a clause c is associated with the label "+" if x occurs as a positive literal in c, and analogously each edge between a variable x and a clause c is associated with the label "-" if x occurs as a negative literal in c.
Let k be a positive integer. A signed k-graph is a graph whose vertices are labeled by [k]; formally, the graph is equipped with a labeling function γ : V (G) → [k]. We consider an arbitrary signed graph as a signed k-graph with all vertices labeled by 1. We call the signed k-graph consisting of exactly one vertex v (say, labeled by i) an initial signed k-graph and denote it by i(v). The signed clique-width of a signed graph G is the smallest integer k such that G can be constructed from initial signed k-graphs by means of repeated application of the following three operations: 1. Disjoint union (denoted by ⊕); 2. Relabeling: changing all labels i to j (denoted by p i→ j ); 3. "+"-edge insertion: adding an edge labeled "+" between each vertex labeled by i and each vertex labeled by j, where i = j; 4. "-"-edge insertion: adding an edge labeled "-" between each vertex labeled by i and each vertex labeled by j, where The signed clique-width of a CNF formula F is the signed clique-width of its signed incidence graph [54,9]. We also note that a decomposition for signed clique-width can be approximated by using signed rank-width [21].
The clustering-width [40] of a CNF formula F is the smallest number of variables whose deletion results in a variabledisjoint union of hitting formulas.

Consensus treewidth
Recall that the consensus graph of a CNF formula F is the graph G whose vertices are the clauses of F and which contains an edge ab if and only if clauses a and b do not clash. Observe that the consensus graph of a hitting formula is edgeless. The consensus treewidth of F , denoted contw(F ), is then the treewidth of its consensus graph.
We now proceed to the main algorithmic result of this section. Our algorithm will in certain cases invoke the previously known algorithm [49] for #SAT parameterized by dual treewidth as a subroutine, and so we provide the full statement of its runtime below. We note that the runtime of that algorithm depends on the time required to multiply two n-bit integers, denoted δ.

Fact 5 ([49]). Given a nice tree decomposition (T , B) of the dual graph of a formula F , #SAT can be solved in time
where N is the number of nodes of T , k is its width, and is the maximum width of a clause in F .
In the literature there exist several algorithms for multiplying two n-bit integers; we refer the interested reader to Knuth's in-depth overview [32]. One of the most prominent of these algorithms is due to Schönhage and Strassen [32] and runs in time O(n log n log log n). An even faster algorithm was later obtained by Fürer [16].
where L is the length of the formula, δ is the time required to multiply two L-bit integers, and k is the consensus treewidth. 1 Proof. Let F be an input formula over n variables, and let G be its consensus graph. Let (T , B) be a nice tree decomposition of G of width at most 5k + 4; recall that such (T , B) can be computed in time 2 O(k) by Fact 3. For brevity, we will use the following terminology: for a node t with bag B t and a clause set X ⊆ B t , we say that an assignment is X t -validating if it satisfies all clauses in X but does not satisfy any clause in B t \ X . For instance, if X = ∅ then a X t -validating assignment cannot satisfy any clause in B t , while if X = B t then a X t -validating assignment must satisfy every clause in B t .
Consider the following leaf-to-root dynamic programming algorithm A on T . At each bag B t associated with a node t of T , A will compute two mappings ϕ + t , ϕ ∼ 1. Leaf nodes. Since σ t is empty, ϕ ∼ t will map each subset of B t to 0. As for ϕ + t , we observe that there are precisely 2 n−|c| many assignments which invalidate a clause c ∈ B t . Hence we correctly set ϕ + t (c) = 2 n−|c| and ϕ + t (∅) = 2 n − 2 n−|c| .
2. Forget nodes. Let t be a forget node with child p and let B p \ B t = {c}. We begin by observing that the number of X tvalidating assignments which satisfy all clauses in σ t is precisely equal to the number of (X ∪{c}) p -validating assignments which satisfy all clauses in σ p . In other words, for each X ⊆ B t we correctly set ϕ + On the other hand, X t -validating assignments which do not satisfy at least one clause in σ t are partitioned into the following mutually exclusive cases: (a) (X ∪ {c}) p -validating assignments which do not satisfy at least one clause in σ p ; (b) X p -validating assignments which do not satisfy at least one clause in σ p ; (c) X p -validating assignments which satisfy all clauses in σ p .
3. Join nodes. Let t be a join node with children p, q. Recall that σ p ∩ σ q = ∅ and σ t = σ p ∪ σ q due to the properties of tree decompositions. Furthermore, an assignment satisfies all clauses in σ t if and only if it satisfies all clauses in both σ p and σ q . In other words, X t -validating assignments which do not satisfy at least one clause in σ t are partitioned into the following mutually exclusive cases (recall that B p = B q by the definition of join nodes): (a) X p -validating assignments which do not satisfy at least one clause in σ p but satisfy all clauses in σ q ; (b) X p -validating assignments which do not satisfy at least one clause in σ q but satisfy all clauses in σ p ; (c) X p -validating assignments which invalidate at least one clause in σ p and also at least one clause in σ q .
Recall that B t is a separator between σ p and σ q , which means that every clause in σ p clashes with every clause in σ q .
That in turn implies that the number of assignments covered by point 3c must be equal to 0: every assignment that does not satisfy at least one clause in one of σ p , σ q must satisfy all clauses in the other set. Since we now know that every assignment which does not satisfy a clause in σ p must satisfy all clauses in σ q and vice-versa, we can correctly assignments (which is equal to the sum of ϕ + p (X) and ϕ ∼ p (X) and hence is known to us), i.e., we set ϕ +

Conflict treewidth
The algorithmic application of the consensus graph, as detailed above, gives rise to a natural follow-up question: what can we say about its natural counterpart, the conflict graph? Recall that the conflict graph of a CNF formula F is the graph G whose vertices are the clauses of F and which contains an edge ab if and only if clauses a and b clash. Observe that the conflict graph of a hitting formula is a complete graph, and that the conflict graph is the complement graph of the consensus graph. The conflict treewidth of F is then the treewidth of its conflict graph.
Since the conflict graph is a subgraph of the dual graph, conflict treewidth can be much (and in fact arbitrarily) smaller than the dual treewidth. However, unlike the case of dual treewidth, we will show that SAT does not admit a fixedparameter algorithm parameterized by conflict treewidth (unless W[1] = FPT). Proof. We provide a parameterized reduction from Multicolored Clique. Given an instance G of Multicolored Clique over vertex set V = V 1 ∪ · · · ∪ V k , we construct a formula F over the variable set V (i.e., each vertex in G is a variable in F ). We add the following clauses to F (observe that F contains no pure literals): 1. for each i ∈ [k], we add one clause containing one positive literal of each variable x ∈ V i ; 2. for each i ∈ [k] and each distinct x, y ∈ V i , we add one clause {x, y}; 3. for each non-edge between distinct vertices x, y in G, we add one clause {x, y}.
F can clearly be constructed from G in polynomial time. The intuition behind the construction is the following: variables set to true correspond to the vertices of a multicolored clique, clauses in groups 1 and 2 enforce the selection of a single vertex from each color class, and the remaining clauses ensure that the result is a clique.
To formally prove that the reduction is correct, consider a solution X to G, and consider the assignment α which sets variables in X to true and all other variables to false. Since X contains precisely one vertex from each color class V i , α clearly satisfies all clauses in groups 1 and 2. Now consider any clause in group 3, and observe that it can only be invalidated if both of its variables are set to true. However, since X is a clique it must hold that for each pair of distinct variables x, y ∈ C we'll never have a clause in group 3 between x and y, and hence in particular each such clause will always contain at least one variable that is set to false and that therefore satisfies it.
On the other hand, consider a satisfying assignment α for F . Then clauses in group 1 ensure that at least one variable is set to true in each color class, and clauses in group 2 ensure that at most one variable is set to true in each color class. Finally, clauses in group 3 prevent α from setting two variables to true if they are the endpoints of a non-edge in G. Consequently, the variables set to true by α must form a solution to the multicolored clique instance G.
Finally, we argue that the parameter values are bounded by k, as claimed by the hardness result. Observe that all literals in clause groups 2 and 3 are negative, which means that whenever two clauses clash, at least one of them must be in group 1. Furthermore, recall that there are precisely k clauses in group 1. Hence the clauses in group 1 form a vertex cover of size k in the conflict graph of F . It is well known (and easy to verify) that the vertex cover is an upper bound on the treewidth of a graph.
Observe that Proposition 1 implies that there exist instances where the conflict treewidth is arbitrarily smaller than the incidence treewidth (since SAT is known to be FPT when parameterized by the latter). In fact, it is not difficult to also directly construct a class of formulas with this behavior: consider an arbitrary SAT instance containing only positive literals of variables x 1 , . . . , x n , plus a single clause (x 1 , x 2 , . . . , x n )-graphs in this class may have arbitrarily large incidence treewidth, but their conflict graphs will be stars. On the other hand, we can show that in the case of formulas of bounded clause width and without pure literals, conflict treewidth (denoted conflict-tw) is dominated by incidence treewidth.

Proposition 2. For any formula F with clauses of width at most d and without pure literals, it holds that
Proof. Let G be the conflict graph of F and (T , B) be a tree decomposition of G of width k. Consider the structure (T , B ) obtained as follows: Informally, the set B is obtained by extending the bags in (T , B) by the variables that occur in the clauses of that bag. We claim that (T , B ) is a tree decomposition of the incidence graph G of F .
Towards proving this claim, first observe that T is still a tree and each B i ∈ B is a subset of V (G ). Furthermore, for any edge ab of G between a clause a and variable b, it must hold that a ∈ B i for some B i ∈ B. By construction, B i must then contain both a and b and so condition 1 of the definition of tree decompositions is satisfied. As for condition 2, assume first for a contradiction that some vertex v ∈ G is not contained in any bag of (T , B ). This clearly cannot happen if v is a clause, and so v must be a variable; furthermore, since F contains no pure literals, v must occur in at least two clauses.
It remains to show that all bags containing v induce a connected subtree of T . So, let us assume once more for a contradiction that this is not the case. By construction of (T , B ) this implies that (T , B) must contain a node t such that B t separates some set of clauses containing v, say X 1 , from all remaining clauses containing v, say X 2 . Next, observe that X 1 ∪ X 2 forms a complete bipartite graph in G: indeed, one side consists of all clauses containing v as a literal, while the other side consists of all clauses containing v . But these two facts together contradict the inseparability property of tree decompositions: X 1 ∪ X 2 induce a connected subgraph of G , and yet they are supposedly separated by B t which does not intersect X 1 ∪ X 2 . Hence we conclude that no such node B t exists and that the bags containing v indeed induce a connected subtree of T .
We conclude the proof by observing that the size of each bag B i ∈ B is equal to d + 1 times |B i |, since we added at most d extra vertices for each vertex in B i .
As a consequence of Proposition 2, restricted to formulas of bounded clause width, #SAT is FPT when parameterized by conflict treewidth, since in this case the parameter is dominated by incidence treewidth [49]. We note that the domination is strict: for each i ∈ N there exists a formula F i of clause width 2 and without pure literals such that itw(F i ) = 1 and contw(F i ) ≥ i. Indeed, one such example is the formula

h-Communities and h-modularity
Let F be a formula. We call a hitting formula H ⊆ To measure the treewidth of an h-structure P, we construct a community graph G as follows. The vertices of G are hcommunities in P, and two vertices A, B in G are adjacent if and only if there exist clauses C ∈ A and D ∈ B which are adjacent. Then we let tw(P) = tw(G).
We define the term h-modularity to measure how "well-structured" a particular h-structure is. The h-modularity h-mod(P) of an h-structure P is max{deg(P), tw(P)}. The h-modularity h-mod(F ) of a formula F is then defined as the minimum h-mod(P) over all h-structures P of F .
An h-structure P of F is called a witness of h-mod(F ) ≤ k if h-mod(P) ≤ k. Given an h-structure P of F and a subformula F ⊆ F , we denote by P[F ] the h-structure induced by P on F ; observe that h-mod(P[F ]) ≤ h-mod(P).
We introduce some additional notation which will be useful later, always w.r.t. a fixed h-structure. A clause C ∈ H is a bridge clause if there exists a clause outside of H adjacent to C . A variable x is a bridge variable if it occurs in a clause in one h-community and at least one other clause in another h-community. Notice that every clause containing a bridge variable is a bridge clause, and that h-structures of low h-modularity can still contain a large number of bridge variables, even in a single h-community. We now formally state the main algorithmic results of this section. Our approach for proving Theorem 2 can be separated into two main tasks: first, we compute an h-structure P of small h-modularity, and then we use P to solve the problem. Our techniques to achieve this are discussed in detail in the following two subsections.

Finding h-structures
Our approach for finding h-structures of small h-modularity consists of two steps. Generally speaking, we introduce a preprocessing procedure which we exhaustively apply until all clauses have a sufficiently small degree (Lemma 1), and once the degree of all clauses is sufficiently small we compute a tree decomposition of the dual graph and use it to find a suitable h-structure (Lemma 2). One of the technical obstacles we have to overcome is that the preprocessing procedure given by Lemma 1 only guarantees the preservation of h-modularity up to a certain bound; this effectively means that the h-structure obtained by Lemma 2 cannot overapproximate the optimal h-modularity by too much, as otherwise the preprocessing step would be invalidated.

Lemma 1.
There exists an algorithm which, given q ∈ N and a formula F of length L containing a clause C such that deg(C ) > 3q + 2, runs in time O(L 2 ) and either correctly determines that h-mod(F ) > q, or outputs a strictly smaller subformula F with the following property: if h-mod(F ) ≤ q, then h-mod(F ) = h-mod(F ). Furthermore, a witness P of h-mod(F ) ≤ q can be computed from F , F and a witness P of h-mod(F ) ≤ q in linear time.
Proof. Let Z 0 be the set containing C and all clauses which are neighbors of C , let Z 1 be the subset of Z 0 containing clauses which have a neighbor outside of Z 0 , and let Z = Z 0 \ Z 1 . Let W be the subset of Z containing clauses which have at least q + 2 neighbors in Z . We now make a series of tests: if W is not a hitting formula, then h-mod(F ) > q; 4. if Z contains a clause which clashes with exactly |W | − 1 clauses in W , then h-mod(F ) > q; 5. let B ∈ W be a clause with no neighbors outside W ; if no such B exists, then h-mod(F ) > q.
We prove correctness. Observe that if |Z 1 | > q then there exists no P of h-modularity at most q. Indeed, for each neighbor D of Z 1 outside of Z 0 , it holds that D and C cannot be in the same h-community, since they are not adjacent. Hence each element of Z 1 increases the degree of the h-community containing C by at least 1; either due to the edge between C and that element, or the edge between D and that element. Hence we can assume that |Z | ≥ 2q + 3.
For the second test, observe that if |W | < q + 3 then there exists no P of h-modularity at most q. Indeed, since the number of neighbors of C in Z is at least 2q + 2, at least q + 2 of these neighbors must be in the same h-community as C if h-mod(P) ≤ q. This implies that at least q + 2 of these neighbors would have to be pairwise-adjacent, and in particular would each have at least q + 2 neighbors in Z . Then W necessarily must contain C and at least q + 2 neighbors of C .
For the third test, if W is not a hitting formula, then any h-structure P of h-modularity at most q would need to partition W into (subsets of) at least two h-structures; let H C be the hypothetical h-community containing C , and let D ∈ W \ H C . Since D has q + 2 neighbors in Z , there are at least q + 2 edge-disjoint paths between D and C , and each of these paths contributes at least 1 to the degree of H C . But then it follows that deg(H C ) ≥ q + 2, which would contradict h-mod(P) ≤ q, and hence W must be a hitting formula. Observe that this argument also implies that every clause in W is in fact adjacent to every other clause in W , and that every P of h-modularity at most q must contain an h-community H C which contains W .
For the fourth test, assume there exists a clause D which clashes with exactly |W | − 1 clauses in W . Consider any witness P of h-mod(F ) ≤ q, and let H C be the h-community containing C . Since D / ∈ H C and there are at least q + 1 edge-disjoint paths between D and C , the existence of D would imply that deg(H C ) ≥ q + 1.
For the fifth test, recall that for any clause Q ∈ Z \ W it holds that W ∪ {Q } cannot be a hitting formula because Q cannot be adjacent to every clause in W . Hence every clause in W with a neighbor outside of W contributes at least 1 to the degree of any h-community containing W . Together with |W | > q + 2 this implies that if no clause B exists, then h-mod(F ) > q. Finally, assume there exists a clause B ∈ W with no neighbors outside of W and let F = F \ B. If h-mod(F ) > q then the lemma already holds, so assume there exists a witness P of h-mod(F ) ≤ q. Let W = W \ B. Observe that W must be contained in a single h-community H ∈ P , since otherwise the fact that each clause of W is adjacent to every other clause of W would contradict the degree bound given by h-mod(P ) ≤ q. Then let P be obtained from P by adding B to H . Observe that there cannot exist a clause D ∈ H such that D and B do not clash; since D clashes with every other clause in W , it follows that D would clash with |W | − 1 clauses in W . Hence B ∪ H is still an h-community. Furthermore, by our choice of B it holds that B contains no neighbors outside of W , and hence deg(H ) = deg(H ∪ {B}) and in turn deg(P ) = deg(P).
Finally, observe that, if we are given a witness P of h-mod(F ) ≤ q, we can construct a witness of h-mod(F ) by adding B back into the unique h-community in P containing the neighbors of B (i.e., W ).

Lemma 2. There exists an algorithm which, given k ∈ N and a formula F of length L such that deg(F ) ≤ 12k 2 + 2, runs in time k O(k 3 ) · L, and either outputs an h-structure P of F such that h-mod(P) ≤ k 2 + k, or correctly determines that h-mod(F ) > k.
Proof. We first test whether the treewidth of the dual graph G of F is at most k · (12k 2 + 3); if not, then h-mod(F ) > k, and if yes, we compute a tree decomposition of F . This can be achieved in time at most k O(k 3 ) · L by Fact 3. Next, we enumerate every inclusion-maximal clique in G of cardinality at least k + 2 in time O(k 3 ) · L by a simple traversal of the tree decomposition. Let U be the set of all such cliques. For each clique K ∈ U we test whether K is a hitting formula and whether deg(K ) ≤ k; if not, then h-mod(F ) > k. For each pair of cliques K 1 , K 2 ∈ U we test that they are pairwise disjoint; if not, then h-mod(F ) > k. Let G be the graph obtained from G by contracting each clique in U into a single vertex; that is, each K ∈ U is replaced by a vertex adjacent to all neighbors of K . We test that deg(G ) ≤ 2k and tw(G ) ≤ k 2 + k; if not, then h-mod(F ) > k. Finally, let P be the vertex set of G . Then P is an h-structure witnessing h-mod(F ) ≤ k 2 + k.
We prove correctness. First, assume for a contradiction that tw(G) > k · (12k 2 + 3) and that there exists a witness P of h-mod(F ) ≤ k. Since deg(F ) ≤ 12k 2 + 2, every h-community in P must have size at most 12k 2 + 3. Let (β, T ) be a width-k tree decomposition of the community graph of P , and let β be obtained by replacing each h-community H ∈ P with Next, assume that there exists a clique K ∈ U which is not a hitting formula. Then any hypothetical h-structure P of F must partition K into several h-communities. Let C , D ∈ K and H ∈ P be such that C ∈ H and D / ∈ H . Since there exist k + 1 edge-disjoint paths between C and D, this implies that deg(H) ≥ k + 1 and hence h-mod(P) > k.
Similarly, assume that there exist inclusion-maximal cliques K 1 , K 2 ∈ U which intersect in some clause C . Then any hypothetical h-structure P must contain an h-community H containing C , and there must exist a clause D ∈ K 1 ∪ K 2 such that D / ∈ H . As in the previous case, this gives rise to at least k + 1 edge-disjoint paths between C and D and hence h-mod(P) > k. In particular, we conclude that each element of U must form an h-community in any hypothetical witness of h-mod(F ) ≤ k. This in turn implies that if there exists an h-community K ∈ U of degree at least k + 1, then h-mod(F ) > k.
We proceed by considering the graph G . Assume it contains a vertex v of degree at least 2k + 1. If v is a clause in F , then at most k neighbors of v can form an h-community with v (since we have contracted all cliques of cardinality at least k + 2). This means that at least k + 1 neighbors of v would contribute to the degree of the h-community containing v, which guarantees h-mod(F ) > k. On the other hand, if v is an element of U , then we already know that v itself must be an h-community in any witness of h-mod(F ) ≤ k, and hence v having more than k neighbors also implies h-mod(F ) > k.
Next, consider the case tw(G ) > k 2 + k. Observe that each hitting subformula of F not contained in U contains at most k + 1 clauses. Consider a width-k tree decomposition (β, T ) of the community graph Q of a hypothetical witness of h-mod(F ) ≤ k. By replacing, in β, each h-community H ∈ V (Q ) \ U with the set of clauses contained in H , we would obtain a tree decomposition of G of width at most k · (k + 1), contradicting our assumption. Hence we conclude that h-mod(F ) > k.
Finally, we summarize why P is indeed an h-structure of G such that h-mod(P ) ≤ k 2 + k. The fact that P is an h-structure follows by construction; indeed, each element in P is either a single clause, or an element of U which is guaranteed to be a hitting formula. Regarding the h-modularity of P , recall that G is the community graph of P and that tw(G ) ≤ k 2 + k. As for the degree bound, each vertex v in G is either a clause C in F , which means that deg(v) ≤ 2k, or an element of K , in which case we have already tested that deg(v) ≤ k.

Theorem 3. There exists an algorithm which, given k ∈ N and a formula F of length L, runs in time O(L 3 ) + k O(k 3 ) · L, and either outputs an h-structure P of F such that h-mod(P) ≤ k 2 + k, or correctly determines that h-mod(F ) > k.
Proof. We begin by exhaustively applying Lemma 1 on F for q = 4k 2 ; let us denote the resulting formula F . Then we apply Lemma 2 on F to find an h-structure P of F such that h-mod(P ) ≤ k 2 + k ≤ q. Finally, we use Lemma 1 to convert P into an h-structure P of F . Correctness follows from the correctness of Lemmas 1 and 2.

Using h-structures
With Theorem 3 in hand, we proceed to show how the identified h-structure of small h-modularity can be used to obtain fixed-parameter tractability of SAT and #SAT. The general strategy is to replace each h-community by a suitable object that represents all the satisfying assignments of this h-community. This way, variables only appearing in a single h-community are eliminated. In case of SAT, we represent an h-community by a set of clauses over the bridge variables of the h-community, and in the case of #SAT, we represent an h-community by a so-called valued constraint. This way, we reduce the problems SAT and #SAT parameterized by h-modularity to certain problems (SAT and SumProd, respectively) parameterized by primal treewidth. For solving the latter problems we can use known algorithms.
For making this general strategy work, we have to overcome the difficulty that the number of bridge variables of a single h-community can be arbitrarily large even when the input formula has small h-modularity. In the case of SAT we can handle this by replacing the input formula with a satisfiability-equivalent "matching-lean" subformula (we postpone the definition of this property to the proof of Theorem 4). This approach does not work for #SAT since this replacement does not preserve the number of models. However, by replacing equivalence classes of variables that appear in the same way in all clauses by 3-valued variables (which represent the three possibilities that all variables in the module are set to true, all are set to false, or some are set to true and some to false, respectively), we can reduce the number of variables for a single valued constraint so that we can make our overall strategy work.
We begin with the conceptually simpler case of SAT, which can not only be viewed as a way to gently introduce some of the considerations that will later be used for the more general #SAT, but is also of independent interest due to it having a significantly better running time than the #SAT algorithm (which will be provided in Theorem 6). Our solution relies on the following well-known result.

Fact 6 ([25]
). There exists an algorithm which takes as input a formula F of length L and a tree decomposition of the primal graph of F of width k, runs in time 2 O(k) · L 2 , and determines whether F is satisfiable.

Theorem 4. Given a formula F of length L and an h-structure P of F , we can decide in time
Proof. Our algorithm has three steps. First, we compute an equisatisfiable subformula F of F where F has the following property: for every nonempty set X of variables of F there are at least |X| + 1 clauses C of F such that some variable in X occurs in C . Formulas with this property are called 1-expanding or matching-lean, and it is known that for any formula F of length L, an equisatisfiable 1-expanding subformula F can be computed in time O(L 3/2 ) [15,33,53]. We set P = P [F ] and k = h-mod(P ); note that h-mod(P) = h-mod(P [F ]) ≤ h-mod(P ) = k. Observe that since each H ∈ P satisfies deg(H)≤k, it follows that the number of bridge variables which occur in any clause in H is upper-bounded by k.
For the second step, we construct a formula I as follows. The variable set of I consists of all the bridge variables of P.
For each h-community H ∈ P containing bridge variables X H = {x 1 , . . . , x p } and for each assignment α of variables in X H , we test whether α satisfies H ; if it does not, we add the clause C α over X α into I , where C α is the unique clause which is not satisfied by α.
For the final third step, we compute a tree decomposition of the primal graph of I with width at most k 2 + k by Fact 3, and then decide whether I is satisfiable by Fact 6. If it is, we output "YES", and otherwise we output "NO". The rest of the proof is dedicated to verifying the bound on the treewidth of I and arguing correctness.
We argue that the treewidth of the primal graph of I at most k 2 +k. Let (β, T ) be a tree decomposition of the community graph G of P of width at most k. Consider the tree decomposition (γ , T ) obtained from (β, T ) by replacing each hcommunity H in β by X H . Since F is 1-expanding and the variables of X H only appear in at most k + 1 clauses of F due to the degree bound, the cardinality of each X H is upper-bounded by k + 1. Consequently, the cardinality of each element in γ is at most k 2 + k.
Next, we show that (γ , T ) is indeed a tree decomposition of the primal graph of I . For every edge ab in this graph, there exists at least one clause C ∈ H which contains both variable a and variable b in its scope, and hence a, b are both bridge variables for H , which in turn means that a, b will both be present in every element of γ which used to contain H ; this proves that the first property of tree decompositions is satisfied. For every bridge variable a, let D a denote the set of h-communities which contain a. Since each pair of h-communities containing a are adjacent in the community graph of P, D a forms a clique in the community graph of P and hence there must exist an element θ a of β which contains every h-community in D a . Since a occurs in an element of γ if and only if this originated from an element of β containing an h-community in D a , and since all h-communities in D a occur in θ a , we conclude that the nodes of T containing a are connected in (γ , T ); this proves that the second property of tree decompositions is satisfied.
Finally, we argue that I is satisfiable if and only if F is satisfiable. Let τ I be a satisfying assignment for I , and consider the assignment τ which assigns each bridge variable in F based on τ I . The resulting instance, say F , consists of variabledisjoint h-communities. Furthermore, by the construction of each constraint in I , it holds that each h-community in F is satisfiable, and hence both F and F are satisfiable. On the other hand, let τ F be a satisfying assignment for F , and consider the restriction τ of τ F to the set of bridge variables. Then applying τ on F once again results in a satisfiable formula F consisting of variable-disjoint h-communities. Furthermore, since each such h-community is satisfiable, it follows that τ also satisfies every clause in I .
Our next goal is to show how h-structures of low h-modularity can be used to solve #SAT. To this end, we will make use of a reduction to the SumProd problem [3] (sometimes also called Valued #CSP [57]), which can be viewed as a generalization of the Constraint Satisfaction problem. An instance I of SumProd is a triple (V , D, C), where V is a finite set of variables, D is a finite set of domain values, and C is a finite set of valued constraints. Each valued constraint C in C is a tuple (S C , f C ), where S C , the constraint scope, is a non-empty sequence s 1 , s 2 , . . . , s r of distinct variables of V , and f C , the cost function, is a function from D r to N 0 .
An assignment is a mapping ψ : V → D. Each assignment ψ results in a cost, f C (ψ), being assigned to each constraint C , where f C (ψ) = f C ((ψ(s 1 ), ψ(s 2 ), . . . , ψ(s r ))). The task in the SumProd problem is to compute the value cost(I), defined as the sum over all assignments of the products of cost functions for that assignment. In other words, The primal graph G of a SumProd instance I is defined as follows. The vertices of G are the variables of I , and two vertices a, b of G are adjacent if and only if there exists a constraint whose scope contains both a and b. The primal treewidth of I , denoted ptw(I), is the treewidth of the primal graph of I . The crucial property which we exploit is that primal treewidth allows a straightforward dynamic programming FPT algorithm for SumProd. Proof. Overview. We begin by informally outlining the idea of the algorithm, then provide a formal construction, and finally prove the runtime bounds and correctness.
Our goal is to capture the contribution of an h-community H to the total number of models of F by using only a small number of variables in I ; specifically, the number of these variables should depend only on h-mod(P). Unlike in Theorem 4, here we cannot directly use 1-expanding subformulas, since these do not preserve the number of models. So instead we group bridge variables into modules, where two bridge variables are in the same module if and only if they occur in the same way in the same clauses; crucially, the number of modules which intersect with each H is bounded by a function of h-mod(P). Furthermore, every "mixed" assignment (mapping at least one variable to 0 and at least one to 1) of a module satisfies the same clauses as any other mixed assignment of that module, allowing us to aggregate all such assignments without loss of information. Then we construct our instance I so that each of its variables represents one module, and each constraint represents one h-community H . An assignment ψ of I then corresponds to determining whether all bridge variables of F in each module are assigned to 0, to 1, or mix.
Generally speaking, the cost function is then constructed so as to capture the contribution of each h-community to the total number of models. However, since many assignments in F can be aggregated into a single assignment in I due to the mix value, the cost function also needs to reflect this. To this end, each module is assigned (arbitrarily) to some valued constraint C and whenever that module is mapped to mix, f C is increased by a factor corresponding to the number of assignments in F aggregated into this mixed assignment. We note that if there is no a such that α(a) = H , then f C H (ψ) = sat ψ C H · 1.
Properties of the construction. The running time follows from two observations. First, the equivalence classes of ≡ can be computed in at most O(L 3 ) time, assuming that arithmetic operations take constant time. Second, the number of modules which occur in any h-community H ∈ P is upper-bounded by 3 h-mod(P)+1 . Indeed, since each clause containing a bridge variable is a bridge clause and each such bridge clause after the first corresponds to at least one edge between H and F \ H in the dual graph of F , the number of clauses where the modules in S C occur is upper-bounded by h-mod(P) + 1.
Moreover, if two bridge variables occur positively in the same clauses, occur negatively in the same clauses and are not contained in the same clauses, then they are equivalent and hence belong to the same module.
Since the number of modules which occur in any h-community H ∈ P is at most 3 h-mod(P)+1 , it follows that the scope of each constraint C in I has cardinality at most 3 h-mod(P)+1 . Let G be the primal graph of I , and let (β, T ) be a tree decomposition of the community graph G of F . Consider the tree decomposition (γ , T ) obtained from (β, T ) by replacing each h-community H in β by s∈S C H s. It follows that the cardinality of each element in γ is upper-bounded by k · 3 h-mod(P)+1 .
Next, we show that (γ , T ) is indeed a tree decomposition of the primal graph of I . For every edge ab in this graph, there exists at least one valued constraint C H which contains both variable a and variable b in its scope, and hence a, b are both bridge variables for H , which in turn means that a, b will both be present in every element of γ which used to contain H ; this proves that the first property of tree decompositions is satisfied. For every bridge variable a, let D a denote the set of h-communities which contain a. Since each pair of h-communities containing a are adjacent in the community graph G of P, D a forms a clique in G and hence there must exist an element θ a of β which contains every h-community in D a .
Since a occurs in an element of γ if and only if this originated from an element of β containing an h-community in D a , and since all h-communities in D a occur in θ a , we conclude that the nodes of T containing a are connected in (γ , T ); this proves that the second property of tree decompositions is satisfied.
Correctness of the construction. Finally, we argue that cost(I) is the number of models of F . From now on, we let τ denote an assignment of bridge variables in F , we use c(τ ) to denote the number of models of F [τ ], and we let ψ : V → {0, 1, mix} denote an assignment of all variables in I ; to distinguish these two types of assignments, we will refer to assignments in I as pseudoassignments. We say that an assignment τ is associated with a unique pseudoassignment ψ if, for each s ∈ V , it holds that ψ(s) = • 0 if for each x ∈ s it holds that τ (x) = 0, • 1 if for each x ∈ s it holds that τ (x) = 1, • mix if there exist x, y ∈ s such that τ (x) = 0 and τ (y) = 1.
Observe that if two assignments τ 1 , τ 2 of bridge variables are both associated with the same ψ , then τ 1 satisfies exactly the same clauses as τ 2 and hence F [τ 1 ] = F [τ 2 ]; indeed, any bridge clause containing a variable which is assigned positively in τ 1 and negatively in τ 2 must also contain a variable which is assigned negatively in τ 1 and positively in τ 2 , and hence must be satisfied by both assignments. We will denote by F [ψ] the formula F [τ ] where τ is any assignment associated with ψ , and we remark that F [ψ] is uniquely defined for each ψ by the above observation (however, several distinct ψ may still have the same F [ψ]). In particular, this implies that if τ 1 and τ 2 are associated with the same ψ , then c(τ 1 ) = c(τ 2 ); we denote this value c(ψ).
We now propose the following way of counting the models of F : instead of computing the number of all models of F , we aggregate the models into "groups", compute the number of models in each group, and output the sum. In our case, these "groups" are defined based on the assignments τ of the bridge variables; the restriction of each model of F to the bridge variables results in a unique τ . At this point, we can say that the number of models of F is equal to τ c(τ ). Now we apply this aggregation strategy once more, this time by grouping assignments τ based on their association with ψ . Hence Finally, we decompose q ψ into a product of factors capturing the number of possible ways one can obtain τ from ψ by turning each "mixed" value in ψ into a specific "mixed" assignment of a module within τ ; here, each module a contributes by a multiplicative factor of 2 |a| − 2 (all possible assignments of |a| variables, except for the all-0 and all-1 assignment).
For instance, modules containing two variables result in a multiplicative factor of 2, since there are 2 mixed assignments of these two variables, while modules containing a single variable result in a multiplicative factor of 0, since a single variable can never lead to a mixed assignment. The factors of this product are then arbitrarily mapped (by α) to individual h-communities in F [ψ] so that we may capture them by the cost functions on individual valued constraints, and we observe that each factor of this product is captured by a unique value of fac We now have all the ingredients necessary to prove the main theorem stated at the beginning of this section.
Proof of Theorem 2. Let F be the given CNF formula and k the parameter. First we apply Theorem 3 to either find an h-structure P of F of h-modularity at most k 2 + k, or correctly determine that h-mod(F ) > k. To decide whether F is satisfiable, we now use Theorem 4. This results in a fixed-parameter algorithm for SAT parameterized by h-mod where the parameter dependence is dominated by the time needed to apply Theorem 3 for computing P. To compute the number of models of F , we follow up on Theorem 3 by using Theorem 6. This results in a fixed-parameter algorithm for #SAT parameterized by h-mod with a double-exponential parameter dependence, where the dependence is dominated by the time needed to apply Theorem 6.

Comparison to other parameters
Here, we compare the structural parameters investigated in this paper which give rise to new fixed-parameter algorithms to previously studied and established structural measures of CNF formulas.
We say that parameter X dominates parameter Y if there exists a computable function f such that for each formula F we have X(F ) ≤ f (Y (F )) [48]. In particular, if X dominates Y and SAT is FPT parameterized by X , then SAT is FPT parameterized by Y [48]. We say that two parameters are incomparable if neither dominates the other. We note that in our comparison, we only consider parameters which are known to give rise to fixed-parameter algorithms for SAT (i.e., not incidence cliquewidth [41]) and can be used without requiring additional information from an oracle (i.e., not PS-width [47]). 2 We begin by showing that consensus treewidth is incomparable with the signed clique-width, the clustering-width and h-modularity. The former claim implies that consensus treewidth is not dominated by the primal, dual, or incidence treewidth; indeed, all of these parameters are dominated by signed clique-width [54]. Furthermore, consensus treewidth is also not dominated by signed rank-width [21], which both dominates and is dominated by signed clique-width. Proof. We prove these claims by showing that there exist classes of formulas such that each formula in the class has one parameter bounded while the other parameter can grow arbitrarily. For a formula F , let scw(F ) and clw(F ) denote its signed clique-width and clustering width, respectively.
Let us choose an arbitrary positive integer i ∈ N. For the first claim, it is known that already the class of all hitting formulas has unbounded scw [40]. In particular, this means that there exists a hitting formula F 1 such that scw(F 1 ) ≥ i. Observe that the consensus graph of F 1 is edgeless, and hence contw(F 1 ) = 0.
Conversely, consider the following formula F 2 = {c 1 , . . . , c i }. The formula contains variables x 1 , . . . x i , and each variable x occurs only in clause c . Since the incidence graph of F 2 is just a matching, its signed clique-width is bounded by a constant (in particular, it will be 2). However, the consensus graph of F 2 is a complete graph on i vertices, and it is known that such graphs have treewidth precisely i − 1, hence contw(F 2 ) = i − 1.
We proceed similarly for the second and third claims; in fact, we can use a single construction to deal with both hmodularity and clustering width. Let us once again fix some i ∈ N, let F 1 be the union of two variable-disjoint hitting formulas each containing i clauses. Both h-modularity and clustering width have a value of 0 for variable-disjoint hitting formulas. However, the consensus graph of F 1 is a complete bipartite graph with each side containing precisely i vertices, and it is well-known that such graphs have treewidth i; hence, contw(F 1 ) = i.
Conversely, consider the formula F 2 over variable sets Y = {y 1 , . . . , y i } and X = {x 1 , . . . , x i }. For each subset α of X , we will add two clauses to F 2 : • c α contains α as positive literals and X \ α as negative literals; • c y α contains α as positive literals, X \ α as negative literals, and all variables in Y as positive literals.
We observe that for each α, clause c y α clashes with all other clauses except for c α (and vice-versa for c α ). This implies that the consensus graph of F 2 is a matching, and hence contw(F 2 ) = 1. On the other hand, note that for each distinct pair of subsets α, β ⊆ X , the clauses c α , c β , c y α , c y β form a formula which is not a variable-disjoint union of hitting formulas.
However, deleting a subset of X from F 2 will only resolve this obstruction for choices of α and β which differed in X ; for instance, even if we deleted all of X except for a single variable (w.l.o.g. say x 1 ), the resulting formula would still not be a disjoint union of hitting formulas (it would contain clauses {x 1 } ∪ Y , {x 1 }, {x 1 } ∪ Y , {x 1 }). Similarly, deleting any proper subset Y ⊂ Y will also clearly not result in a disjoint union of hitting formulas (it would, in fact, not change the consensus graph at all), and the same goes for any combination of deleting Y along with a proper subset of X . Hence we conclude that clw(F 2 ) ≥ i.
Finally, we argue that F 2 has h-modularity at least i, and we will do so by following the arguments presented in the proof of Lemma 1. In particular, closely following that proof, let us fix q = i and a clause c ∈ F 2 . Then: 1. the set Z 0 defined in the proof will be equal to F 2 ; 2. the set Z 1 defined in the proof will be empty; 3. the set Z defined in the proof will be equal to F 2 ; 4. the set W defined in the proof will be equal to F 2 ; 5. since W is not a hitting formula, by point 3 of the proof it holds that F 2 has h-modularity greater than q = i.
The above general constructions show that for any choice of i, one can produce formulas with a gap of at least i between consensus treewidth and any of the three other measures under consideration.
We now complete our comparison by contrasting h-modularity to signed clique-width and clustering-width. 2 SAT is not fixed-parameter tractable when parameterized by incidence clique-width, and SAT is only known to be fixed-parameter tractable when parameterized by PS-width when a suitable decomposition is provided as part of the input. Proposition 4. The following claims hold.

Signed clique-width and h-modularity are incomparable. 2. Clustering-width and h-modularity are incomparable.
Proof. We prove both claims by showing that there exist classes of formulas such that each formula in the class has one parameter bounded while the other parameter can grow arbitrarily. For a formula F , let scw(F ) and clw(F ) denote its signed clique-width and clustering width, respectively. Our proof does not require a formal definition of these parameters, as we refer to known properties of these notions.
Let us choose an arbitrary i ∈ N. For the first claim, it is known that already the class of all hitting formulas has unbounded scw [40]. In particular, this means that there exists a hitting formula F 1 such that scw(F 1 ) ≥ i. Recall that, since F 1 is a hitting formula, clearly h-mod(F 1 ) = 0.
Conversely, consider the following formula F 2 = {C, C 1 , . . . , C i+2 }. The formula contains variables x 1 , . . . x i+2 , and each variable x j occurs (either positively or negatively) in clause C and C j . Then the incidence graph of F 2 is a tree and hence has treewidth 1. Since signed clique-width dominates the treewidth of the incidence graph, it follows that there exists a constant c independent of i such that scw(F 2 ) ≤ c (in particular, one can check from the definition of scw that c ≤ 2). On the other hand, the degree of any h-community H containing C is at least i + 1, and hence h-mod(F 2 ) ≥ i + 1. We proceed similarly for the second claim; let i ∈ N. Let F 1 be a hitting formula, let F 1 be constructed by adding a variable z into an arbitrary clause in F 1 and adding a clause Z containing only z (both occurrences can either be positive or negative). Observe that clw(F 1 ) = h-mod(F 1 ) = 1. Let F 1 then contain i + 2 disjoint copies of F 1 ; clearly, clw(F 1 ) = i + 2.
However, since the h-modularity of a formula is equal to the maximum h-modularity over all of its connected components, it holds that h-mod(F 1 ) = 1. Conversely, let F 2 and F 2 be variable-disjoint hitting formulas containing at least i + 2 clauses each, and let F 2 be obtained from a disjoint union of F 2 and F 2 by adding a variable z which occurs (either positively or negatively) in i/2 clauses in F 2 and in i/2 clauses in F 2 . While F 2 is not a hitting formula, deleting z results in two variable-disjoint hitting formulas and hence clw(F 2 ) = 1. On the other hand, the three inclusion-maximal h-communities in F 2 are F 2 , F 2 and possibly the set of clauses where z occurs; each of these have a degree which is greater than i. Consequently, it holds that h-mod(F 2 ) ≥ i + 1.

Concluding remarks
We have introduced two novel structural parameters which give rise to fixed-parameter algorithms for counting the number of models of CNF formulas and provide worst-case performance guarantees for instances that are not accessible by known methods.
The introduced notion of consensus treewidth generalizes and, in some sense, builds upon the classical #SAT algorithm on hitting formulas [26], and our positive results for this parameter show that it is worthwhile to consider further graphical models in addition to the already established ones such as primal, dual, and incidence graphs.
Our investigation of h-modularity naturally leads to the question of how the notion of h-community structure can be further generalized, for example by using a suitably defined property for the communities that generalizes hitting formulas. This way, we hope that ultimately one can build bridges between empirically observed problem hardness and theoretical worst-case upper bounds.
Finally, we note that while we established the W[1]-hardness of SAT parameterized by conflict treewidth, to the best of our knowledge it remains open whether SAT and #SAT can be solved in polynomial time when the conflict treewidth is a fixed constant.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.