# Model Counting for CNF Formulas of Bounded Modular Treewidth

## Abstract

We define the modular treewidth of a graph as its treewidth after contraction of modules. This parameter properly generalizes treewidth and is itself properly generalized by clique-width. We show that the number of satisfying assignments can be computed in polynomial time for CNF formulas whose incidence graphs have bounded modular treewidth. Our result generalizes known results for the treewidth of incidence graphs and is incomparable with known results for clique-width (or rank-width) of signed incidence graphs. The contraction of modules is an effective data reduction procedure. Our algorithm is the first one to harness this technique for #SAT. The order of the polynomial bounding the runtime of our algorithm depends on the modular treewidth of the input formula. We show that it is unlikely that this dependency can be avoided by proving that SAT is W[1]-hard when parameterized by the modular incidence treewidth of the given CNF formula.

## Keywords

Propositional Satisfiability Model Counting Algorithms## References

- 1.Bacchus, F., Dalmao, S., Pitassi, T.: Solving #SAT and Bayesian inference with backtracking search. J. Artif. Intell. Res.
**34**, 391–442 (2009)MathSciNetzbMATHGoogle Scholar - 2.Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput.
**25**(6), 1305–1317 (1996)MathSciNetCrossRefzbMATHGoogle Scholar - 3.Courcelle, B.: The monadic second-order logic of graphs XIV: uniformly sparse graphs and edge set quantifications. Theor. Comput. Sci.
**299**(13), 1–36 (2003)MathSciNetCrossRefzbMATHGoogle Scholar - 4.Courcelle, B., Engelfriet, J., Rozenberg, G.: Handle-rewriting hypergraph grammars. J. Comput. Syst. Sci.
**46**(2), 218–270 (1993)MathSciNetCrossRefzbMATHGoogle Scholar - 5.Courcelle, B., Makowsky, J.A., Rotics, U.: Linear time solvable optimization problems on graphs of bounded clique-width. Theory Comput. Syst.
**33**(2), 125–150 (2000)MathSciNetCrossRefzbMATHGoogle Scholar - 6.Courcelle, B., Makowsky, J.A., Rotics, U.: On the fixed parameter complexity of graph enumeration problems definable in monadic second-order logic. Discr. Appl. Math.
**108**(1–2), 23–52 (2001)MathSciNetCrossRefzbMATHGoogle Scholar - 7.Courcelle, B., Olariu, S.: Upper bounds to the clique-width of graphs. Discr. Appl. Math.
**101**(1–3), 77–114 (2000)MathSciNetCrossRefzbMATHGoogle Scholar - 8.Fischer, E., Makowsky, J.A., Ravve, E.R.: Counting truth assignments of formulas of bounded tree-width or clique-width. Discr. Appl. Math.
**156**(4), 511–529 (2008)MathSciNetCrossRefzbMATHGoogle Scholar - 9.Ganian, R., Hlinený, P., Obdrzálek, J.: Better algorithms for satisfiability problems for formulas of bounded rank-width. Fund. Inform.
**123**(1), 59–76 (2013)MathSciNetzbMATHGoogle Scholar - 10.Gomes, C.P., Sabharwal, A., Selman, B.: Handbook of Satisfiability. In: Biere, A., Heule, M., van Maaren, H., Walsh, T. (eds.) Model Counting, pp. 633–654. IOS Press, Amsterdam (2009)Google Scholar
- 11.Gottlob, G., Pichler, R.: Hypergraphs in model checking: acyclicity and hypertree-width versus clique-width. SIAM J. Comput.
**33**(2), 351–378 (2004)MathSciNetCrossRefzbMATHGoogle Scholar - 12.Habib, M., Paul, C.: A survey of the algorithmic aspects of modular decomposition. Comput. Sci. Rev.
**4**(1), 41–59 (2010)CrossRefzbMATHGoogle Scholar - 13.Kaski, P., Koivisto, M., Nederlof, J.: Homomorphic hashing for sparse coefficient extraction. In: 7th International Symposion on Parameterized and Exact Computation (IPEC 2012),
*LNCS*, vol.**7535**, pp. 147–158. Springer (2012)Google Scholar - 14.Kloks, T.: Treewidth: Computations and Approximations. Springer, Berlin (1994)CrossRefzbMATHGoogle Scholar
- 15.Ordyniak, S., Paulusma, D., Szeider, S.: Satisfiability of acyclic and almost acyclic CNF formulas. Theor. Comput. Sci.
**481**, 85–99 (2013)MathSciNetCrossRefzbMATHGoogle Scholar - 16.Oum, S., Seymour, P.: Approximating clique-width and branch-width. J. Combin. Theory Ser. B
**96**(4), 514–528 (2006)MathSciNetCrossRefzbMATHGoogle Scholar - 17.Pietrzak, K.: On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. J. Comput. Syst. Sci.
**67**(4), 757–771 (2003)MathSciNetCrossRefzbMATHGoogle Scholar - 18.Robertson, N., Seymour, P.D.: Graph minors X. Obstructions to tree-decomposition. J. Combin. Theory Ser. B
**52**(2), 153–190 (1991)MathSciNetCrossRefzbMATHGoogle Scholar - 19.Roth, D.: On the hardness of approximate reasoning. Artif. Intell.
**82**(1–2), 273–302 (1996)MathSciNetCrossRefGoogle Scholar - 20.Samer, M., Szeider, S.: Algorithms for propositional model counting. J. Discrete Algorithms
**8**(1), 50–64 (2010)MathSciNetCrossRefzbMATHGoogle Scholar - 21.Sang, T., Beame, P., Kautz, H.A.: Performing Bayesian inference by weighted model counting. In: Proceedings, The Twentieth National Conference on Artificial Intelligence and the Seventeenth Innovative Applications of Artificial Intelligence Conference, July 9–13, 2005, Pittsburgh, Pennsylvania, USA, pp. 475–482. AAAI Press/The MIT Press (2005)Google Scholar
- 22.Schönhage, A., Strassen, V.: Schnelle multiplikation großer zahlen. Computing
**7**(3–4), 281–292 (1971)MathSciNetCrossRefzbMATHGoogle Scholar - 23.Szeider, S.: On fixed-parameter tractable parameterizations of SAT. In: Giunchiglia, E. Tacchella, A. (eds.) Theory and Applications of Satisfiability, 6th International Conference, SAT 2003, Selected and Revised Papers,
*Lecture Notes in Computer Science*, vol.**2919**, pp. 188–202. Springer (2004)Google Scholar - 24.Valiant, L.G.: The complexity of computing the permanent. Theor. Comput. Sci.
**8**(2), 189–201 (1979)MathSciNetCrossRefzbMATHGoogle Scholar