Skip to main content
Log in

Tensor Network Contractions for #SAT

  • Published:
Journal of Statistical Physics Aims and scope Submit manuscript

Abstract

The computational cost of counting the number of solutions satisfying a Boolean formula, which is a problem instance of #SAT, has proven subtle to quantify. Even when finding individual satisfying solutions is computationally easy (e.g. 2-SAT, which is in \(\mathsf{{P}}\)), determining the number of solutions can be #\(\mathsf{{P}}\)-hard. Recently, computational methods simulating quantum systems experienced advancements due to the development of tensor network algorithms and associated quantum physics-inspired techniques. By these methods, we give an algorithm using an axiomatic tensor contraction language for n-variable #SAT instances with complexity \(O((g+cd)^{O(1)} 2^c)\) where c is the number of COPY-tensors, g is the number of gates, and d is the maximal degree of any COPY-tensor. Thus, n-variable counting problems can be solved efficiently when their tensor network expression has at most \(O(\log n)\) COPY-tensors and polynomial fan-out. This framework also admits an intuitive proof of a variant of the Tovey conjecture (the r,1-SAT instance of the Dubois–Tovey theorem). This study increases the theory, expressiveness and application of tensor based algorithmic tools and provides an alternative insight on these problems which have a long history in statistical physics and computer science.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2

Similar content being viewed by others

References

  1. Barahona, F.: On the computational complexity of ising spin glass models. J. Phys. A 15(10), 3241 (1982)

    Article  MathSciNet  ADS  Google Scholar 

  2. Kirkpatrick, S., Gelatt, C.D., Vecchi, M.P.: Optimization by simulated annealing. Science 220(4598), 671–680 (1983)

    Article  MathSciNet  ADS  MATH  Google Scholar 

  3. Monasson, Rémi, Zecchina, Riccardo, Kirkpatrick, Scott, Selman, Bart, Troyansky, Lidror: Determining computational complexity from characteristic phase transitions. Nature 400(6740), 133–137 (1999)

    Article  MathSciNet  ADS  Google Scholar 

  4. Goerdt, Andreas: A threshold for unsatisfiability. J. Comp. Syst. Sci. 53(3), 469–486 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  5. Kirkpatrick, Scott, Selman, Bart: Critical behavior in the satisfiability of random boolean expressions. Science 264(5163), 1297–1301 (1994)

    Article  MathSciNet  ADS  MATH  Google Scholar 

  6. Nishimura, Naomi, Ragde, Prabhakar, Szeider, Stefan: Solving# sat using vertex covers. Acta Informa. 44(7–8), 509–523 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  7. Fischer, Eldar: Johann A Makowsky, and Elena V Ravve. Counting truth assignments of formulas of bounded tree-width or clique-width. Discrete. Appl. Math. 156(4), 511–529 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  8. Igor, L.: Markov and Yaoyun Shi. Simulating quantum computation by contracting tensor networks. SIAM J. Comput. 38(3), 963–981 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  9. Samer, M., Szeider, S.: A fixed-parameter algorithm for #SAT with parameter incidence treewidth (2006). arXiv:cs/0610174

  10. Bacchus, F., Dalmao, S., Pitassi, T.: Algorithms and complexity results for# sat and bayesian inference. In: Proceedings of 44th Annual IEEE Symposium on Foundations of Computer Science, 2003, pp. 340–351 (2003)

  11. Valiant, L.G.: The complexity of enumeration and reliability problems. SIAM J. Comput. 8(3), 410–421 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  12. Verstraete, F., Murg, V., Cirac, J.I.: Matrix product states, projected entangled pair states, and variational renormalization group methods for quantum spin systems. Adv. Phys. 57(2), 143–224 (2008)

    Article  ADS  Google Scholar 

  13. Johnson, T.H., Clark, S.R., Jaksch, D.: Dynamical simulations of classical stochastic systems using matrix product states. Phys. Rev. E 82(3), 036702 (2010)

    Article  MathSciNet  ADS  Google Scholar 

  14. Evenbly, G., Vidal, G.: Tensor network states and geometry. J. Stat. Phys. 145, 891–918 (2011)

    Article  MathSciNet  ADS  MATH  Google Scholar 

  15. Eisert, J.: Entanglement and tensor network states. Model. Simul. 3, 520 (2013). http://www.cond-mat.de/events

  16. Penrose, Roger: Applications of negative dimensional tensors. In: Welsh, D. (ed.) Combinatorial Mathematics and its Applications, pp. 221–244. Academic Press, New York (1971)

    Google Scholar 

  17. Griffiths, R.B.: Channel kets, entangled states, and the location of quantum information. PRA 71(4), 042337 (2005)

    Article  ADS  Google Scholar 

  18. Griffiths, R.B., Wu, S., Yu, L., Cohen, S.M.: Atemporal diagrams for quantum circuits. PRA 73(5), 052309 (2006)

    Article  MathSciNet  ADS  Google Scholar 

  19. Gross, D., Eisert, J.: Novel schemes for measurement-based quantum computation. Phys. Rev. Lett. 98(22), 220503 (2007)

    Article  ADS  Google Scholar 

  20. Biamonte, J.D., Clark, S.R., Jaksch, D.P.: Categorical Tensor Network States. AIP Advances 1(4), 042172 (2011). http://scitation.aip.org

  21. Johnson, T.H., Biamonte, J.D., Clark, S.R., Jaksch, D.: Solving search problems by strongly simulating quantum circuits. Sci. Rep. 3 (2013). http://www.nature.com/srep/

  22. Chamon, C., Mucciolo, E.R.: Virtual parallel computing and a search algorithm using matrix product states. Phys. Rev. Lett. 109(3), 030503 (2012)

    Article  ADS  Google Scholar 

  23. Morton, J., Turner, J.: Generalized counting constraint satisfaction problems with determinantal circuits. Linear Algebra Appl. 466, 357–381 (2015). doi:10.1016/j.laa.2014.09.050

  24. Kliesch, M., Gross, D., Eisert, J.: Matrix product operators and states—NP-hardness and undecidability. Phys. Rev. Lett. 113, 160503 (2014). doi:10.1103/PhysRevLett.113.160503

  25. Morton, J., Biamonte, J.: Undecidability in tensor network states. Phys. Rev. A 86(3), 030301(R) (2012)

    Article  ADS  Google Scholar 

  26. Wolf, M.M., Cubitt, T.S., Perez-Garcia, D.: Are problems in quantum information theory (un) decidable? (2011). arXiv:1111.5425

  27. Damm, C., Holzer, M., McKenzie, P.: The complexity of tensor calculus. Comput. Complex. 11(1), 54–89 (2003)

    MathSciNet  Google Scholar 

  28. Eisert, J., Müller, M.P., Gogolin, C.: Quantum measurement occurrence is undecidable. Phys. Rev. Lett. 108(26), 260501 (2012)

    Article  ADS  Google Scholar 

  29. Chamon, C., Mucciolo, E.R.: Rényi entropies as a measure of the complexity of counting problems. J. Stat. Mech. 4, 8 (2013)

    Google Scholar 

  30. Biamonte, J.D.: Nonperturbative k -body to two-body commuting conversion Hamiltonians and embedding problem instances into Ising spins. PRA 77(5), 052331 (2008)

    Article  ADS  Google Scholar 

  31. Denny, S.J., Biamonte, J.D., Jaksch, D., Clark, S.R.: Algebraically contractible topological tensor network states. J. Phys. A 45(1), 015309 (2012)

    Article  MathSciNet  ADS  Google Scholar 

  32. Whitfield, J.D., Faccin, M., Biamonte, J.D.: Ground-state spin logic. EPL (Europhys. Lett.) 99, 57004 (2012)

    Article  ADS  Google Scholar 

  33. Alsina, D., Latorre, J.I.: Tensor Networks for Frustrated Systems: Emergence of Order from Simplex Entanglement. ArXiv e-prints, December 2013

  34. Gharibian, S., Landau, Z., Shin, S.W., Wang, G.: Tensor network non-zero testing. ArXiv e-prints, June 2014

  35. Valiant, Leslie G.: The complexity of computing the permanent. Theor. Comput. Sci. 8(2), 189–201 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  36. García-Sáez, Artur, Latorre, José I.: An exact tensor network for the 3SAT problem. Quantum Inform. Comput. 12(3–4), 283–292 (2012)

    Google Scholar 

  37. Kempe, Julia, Kitaev, Alexei, Regev, Oded: The complexity of the local hamiltonian problem. SIAM J. Comput. 35(5), 1070–1097 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  38. Penrose, R.: The theory of quantized directions. Unpublished (1967)

  39. Lafont, Yves: Towards an algebraic theory of boolean circuits. J. Pure Appl. Algebr. 184, 2003 (2003)

    Article  MathSciNet  Google Scholar 

  40. Tovey, Craig A.: A simplified NP-complete satisfiability problem. Discrete. Appl. Math. 8(1), 85–89 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  41. Dubois, Olivier: On the r, s-SAT satisfiability problem and a conjecture of tovey. Discrete. Appl. Math. 26(1), 51–60 (1990)

    Article  MathSciNet  MATH  Google Scholar 

  42. Halin, Rudolf: S-functions for graphs. J. Geom. 8(1–2), 171–186 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  43. Lauritzen, S.L., Spiegelhalter, D.J.: Local computations with probabilities on graphical structures and their application to expert systems. J. R. Stat. Soc. B 50, 157–224 (1988)

    MathSciNet  MATH  Google Scholar 

  44. Xia, Mingji, Zhang, Peng, Zhao, Wenbo: Computational complexity of counting problems on 3-regular planar graphs. Theor. Comput. Sci. 384(1), 111–125 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  45. Rényi, A.:. On measures of entropy and information. In: Fourth Berkeley Symposium on Mathematical Statistics and Probability, pp. 547–561 (1961)

  46. Biamonte, J., Bergholm, V., Lanzagorta, M.: Tensor network methods for invariant theory. J. Phys. A Math. Gener. 46, 5301 (2013)

    MathSciNet  ADS  Google Scholar 

  47. Baez, J.C.: Renyi entropy and free energy (2011). arXiv:1102.2098

  48. Valiant, Leslie G., Vazirani, Vijay V.: NP is as easy as detecting unique solutions. Theor. Compu. Sci. 47, 85–93 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  49. Bravyi, Sergey: Contraction of matchgate tensor networks on non-planar graphs. Contemp. Math. 482, 179–211 (2009)

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgments

We thank Tobias Fritz and Eduardo Mucciolo for providing feedback. JDB acknowledges financial support from the Fondazione Compagnia di San Paolo through the Q-ARACNE project and the Foundational Questions Institute (FQXi, under Grant FQXi-RFP3-1322). JM and JT acknowledges the NSF (under Grant NSF-1007808) for financial support.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jacob D. Biamonte.

Appendix 1: Properties of Tensor Contraction

Appendix 1: Properties of Tensor Contraction

Although the graphical manipulation of tensors (e.g. algebraic rewrite rules) has been axiomatized by several communities, basic theorems and techniques of contraction are less systematically described. Networks have seen little effort toward their systematic formulation. Hence we present the minimal properties of tensor contraction we relied on to provide the main results in the paper.

We assume that the reader has some basic familiarly with tensor networks and thus focus on the properties of contraction properties which we used. This section should hopefully be self contained. For additional background information, see e.g. [46].

The value of a tensor network is obtained by performing all possible partial contractions diagrammed by the network (the order of contraction does not affect the value). If we allow one or more of the tensors in the network to vary, and the network has no dangling wires, we obtain a multilinear function from the direct sum over vertices of the spaces \(\bigotimes _{e\in \mathcal {N}(v)}{V(e)}\) to the complex numbers. When there are dangling wires, the multilinear function’s codomain is the tensor product of the vector spaces corresponding to the dangling edges.

We denote such a function by \(\mathcal {C}\) when the tensor network defining it is understood. Then multilinearity can be rephrased as follows.

Remark 27

(Linearity of tensor contraction) Tensor contraction is linear in its component tensors provided each appears only once: \(\mathcal {C}\{A_{v_1}, \ldots , \alpha A_{v_k}+A_{v_k}', \ldots , A_{v_n}\} = \alpha \mathcal {C}\{A_{v_1}, \ldots , A_{v_k}, \ldots , A_{v_n}\} + \mathcal {C}\{A_{v_1}, \ldots , A_{v_k}', \ldots , A_{v_n}\}.\) and then \(A\mapsto kA\) we readily find that the contraction becomes \(\mathcal {C}\{A'\}+\mathcal {C}\{B\}\) and \(k\cdot \mathcal {C}\{A\}\) respectively.

Several of our results rely on transforming contracted sub-networks, into a sum-over products, and vice versa. In other words, removing a contracted tensor (or part of a contracted tensor) and replacing it by a sum of contracted tensors, where each term contains contractions that are multiplied together. The stage for this can be set by stating several properties of tensor contractions. We will use these properties to reshape networks, such that their transformed geometry is known to be efficiently contractible.

Theorem 28

(COPY-tensors as a resolution of identity) The following sequence of graphical rewrites hold.

figure e

Proof

In the above figure, on the left, we abstractly depict a otherwise arbitrary tensor network, by showing only one single wire. The unit for the COPY-tensor is the plus state \(|+\rangle =\sum {|n\rangle }\). Contracting \(|+\rangle \) against the COPY-tensor therefore gives \(\sum _{i,n}{|i\rangle \langle i|\langle i|n\rangle }=\sum _{n}{|n\rangle \langle n|}\) which is precisely the identity. The last equality follows directly from the linearity of tensor contraction. \(\square \)

This procedure can be iterated over many wires. In particular, if we have a gate in a tensor network, we can remove it from the network by the above method resulting in a nested sum of tensor networks. Of course the number of tensor networks in the summand grows exponentially in the number of wires of the gate removed.

Some counting algorithms are only polynomial time on planar graphs, and this cutting procedure can be used to deal with handles, yielding a running time factor exponential in the genus of the graph [49].

Corollary 29

(Contraction to sum of products transform) Given a tensor \(\Gamma ^{\ldots ijk}_{~~~~lmn\ldots }\) in a fully contracted network (e.g. a network without open legs), the following graphical identities, which are equal, transforms the contraction, to a sum over products.

figure f

The comprising rectangle above is meant as an abstraction depicting a fully contracted but otherwise general tensor network.

As mentioned, the contraction to sum of products transform in Theorem 29 as well as the tensor network resolution of identity in Theorem 28 will be useful to transform networks into those known to be efficiently contractible.

Theorem 30

(The Cauchy–Schwarz inequality) Given a contracted network and a partition into two halves x, and y. Writing the contraction as \(\mathcal {C}\{x,y\}\) the following inequality holds.

$$\begin{aligned} \mathcal {C}\{x,y\}^2\le \mathcal {C}\{x,x\}\cdot \mathcal {C}\{y,y\} \end{aligned}$$

with graphical depiction.

figure g

Proof

By the linearity of tensor contraction, we arrive at an abstract form of the Cauchy–Schwarz inequality, with equality in the contraction if and only if \(x = \alpha \cdot y\). This leads directly to the concept of an angle between tensors,

$$\begin{aligned} \cos \theta _{xy} = \frac{\mathcal {C}\{x,y\}^2}{\mathcal {C}\{x,x\}\cdot \mathcal {C}\{y,y\}} \end{aligned}$$

where the right side is either real valued, or we take the modulus. \(\square \)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Biamonte, J.D., Morton, J. & Turner, J. Tensor Network Contractions for #SAT. J Stat Phys 160, 1389–1404 (2015). https://doi.org/10.1007/s10955-015-1276-z

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10955-015-1276-z

Keywords

Navigation