An exact tensor network for the 3SAT problem Artur García-Sáez and José I. Latorre \textlineskip
1
An exact tensor network for the 3SAT problem
Artur García-Sáez and José I. Latorre
Dept. d’Estructura i Constituents de la Matèria, Universitat de Barcelona
647 Diagonal, 08028 Barcelona, Spain
We construct a tensor network that delivers an unnormalized quantum state whose coefficients are the solutions to a given instance of 3SAT, an NP-complete problem. The tensor network contraction that corresponds to the norm of the state counts the number of solutions to the instance. It follows that exact contractions of this tensor network are in the #P-complete computational complexity class, thus believed to be a hard task. Furthermore, we show that for a 3SAT instance with bits, it is enough to perform a polynomial number of contractions of the tensor network structure associated to the computation of local observables to obtain one of the explicit solutions to the problem, if any. Physical realization of a state described by a generic tensor network is equivalent to finding the satisfying assignment of a 3SAT instance and, consequently, this experimental task is expected to be hard.
1 Introduction
The rational to develop a quantum computer follows from the fact that simulating quantum systems in a classical computer is a hard task [1]. Nonetheless, an enormous progress has been achieved to improve on the classical simulations of relevant quantum problems using Monte Carlo and Tensor Networks techniques. In particular, networks of tensors can be used to represent the coefficients of the wave function in a manner that faithfully represents the entanglement of the quantum state. The most relevant tensor networks geometries correspond to one dimensional Matrix Product States (MPS [2, 3]), to higher dimensional Projected Entangled Pair States (PEPS [4, 5]) and to Multiscale Renormalization Group Ansatz (MERA [6]). The limits for the efficiency of the tensor networks technology depends on the amount of entanglement pervading the system.
The main difficulty encountered in the application of tensor networks to simulate quantum states corresponds to computing observables, that is, to perform the contraction of all the indices in the tensor structure. Let us illustrate this point using the computation of the properties of the ground state of a given Hamiltonian. The tensor network approach needs two steps. First, it is necessary to find the individual tensors in the tensor network that give the approximation to the ground state. This can be done using different strategies. A possibility is to use local Euclidean evolution, based on the idea of using the Trotter expansion for the total Hamiltonian divided in local terms (see for instance ITEBD for infinite spin chains [7]). Second, once the tensor network has been constructed, a contraction of the tensor network is needed to perform the computation of an observable. This contraction can be shown to be efficient in one dimension but becomes unpractical in higher dimensions due to the typical area law scaling of the entropy found in any quantum system governed by local interactions. Approximate contractions of tensor networks do produce acceptable results, though the problem is worse and worse as the connectivity of the system increases.
In order to assess rigorously the complexity class associated to the problem of contracting arbitrary tensor networks, we here present an exact representation of the solutions of a 3SAT problem as an explicit tensor network. As we shall see, the tensor network that delivers the solutions to a 3SAT instance can be constructed analytically without the need of any minimization or training process. It is then possible to relate the problem of contraction of tensor networks to complexity classes associated to the 3SAT problem. As a matter of fact, the 3SAT problem has been addressed previously using quantum strategies [8]. In this context, the problem was analyzed using MPS in Ref. [9, 10] as an approximation technique to analyze the typical gap in an adiabatic computational approach to NP-complete problems. Big instances of the problem can be solved, however, using classical statistichal methods [11, 12].
3SAT is an NP-complete problem [13, 14], the complexity class of decision problems verifyable in polynomial time. Finding an explicit solution to an NP problem defines the FNP complexity class, while counting the number of solutions to a polynomially computable function defines the #P complexity class. For instance, counting the solutions of an instance of 3SAT is in #P, thus believed to be a hard task. We show that the contraction of tensor networks for the 3SAT problem is a #P problem, and obtaining an explicit solution to the problem and reducing the bond dimension of the tensor network, are both in FNP.
This paper is organized as follows: in Section 2 we present an explicit construction of the tensor network, used in Section 3 to analyze the complexity of the operations related to tensor network manipulation. In Section 4 we show that reducing the virtual index of a tensor network is a hard problem. Finally, we draw the conclusions in Section 5.
2 Explicit construction of a tensor network for 3SAT
Let us start by recalling the definition of a 3SAT problem. An instance of 3SAT corresponds to a decision problem, namely, determining whether there is an assignment of a set of bits that can take values , where such that a number of constraints are satisfied. These constraints are defined by the set of clauses (), where each clause involves three bits and rejects one of the eight possible assignments. To be more explicit, let us consider a clause involving bits , and and take the case where the assignment is excluded. This amounts to impose the boolean restriction . The 3SAT problem is defined as the problem of deciding whether there exists a string of bits satisfying all the clauses. As said, the 3SAT problem is NP-complete.
Given a 3SAT instance, we construct a graph adapted to this specific instance under consideration. The graph contains two kind of structures: one is associated to bits and another one to clauses. Each bit carries an open index related to and indices linking the bit to the clauses related to it. Clauses have no open index, they simply connect to the bits they relate. An example of such a graph is presented in Fig. 2. This kind of graph naturally represents the connectivity of the 3SAT instance and is common to many approaches to 3SAT as e.g. the belief propagation strategy [11, 12]. It is important to notice that not all instances of the 3SAT problem are hard. Considering a problem over variables and clauses, and defining , the problem is believed to be hard only in the critical range [11]. This constraint restricts the connectivity of tensor networks descriving hard instances of 3SAT, which are represented by tensor networks only slightly connected. In our construction we only require tensors and links. Notice that connectivity, throught the planarity of the network, identifies as well hard instances of the Ising model in higher dimensions [15].
Our next step is to construct an unnormalized quantum state based on this structure. The idea is to associate a tensor to each element of the connectivity graph presented above. Each bit is now associated to a tensor that describes qubit . The index can take values or , that is the two possible states of the qubit. The tensor for this qubit also carries ancillary indices that we have represented with Greek letter ’s connecting to different clauses. Each qubit will connect to a different number of clauses, so the total number of links will depend on the qubit we are considering. Every ancillary index runs up to a maximum value , . Then, we further introduce a tensor for each clause , that we represent as , where . Note that , and are ancillary indices that connect to three different qubits. The contraction of all ancillary indices define our global unnormalized state
(1) |
where the coefficients correspond to the contraction
(2) |
where the symbol represents the full contraction of all the ancillary indices that have been omitted in the above expression for the sake of simplicity.
The problem we are addressing is how to assign the tensors and such that the coefficients of the tensor are equal to for the solutions to the 3SAT instance represented by the graph and otherwise. That is,
(3) |
Then, it follows that the unnormalized state corresponds to the equally weighted superposition of all the solutions to the 3SAT instance.
It turns out that there is a very simple tensor network, with only , that carries all the solutions to a given 3SAT instance. The basic idea comes from the fact that such a tensor can be thought to be the ground state of a Hamiltonian made by the addition of 3-body Hamiltonians, each one associated to one of the clauses that define the instance,
(4) |
The 3-body Hamiltonian associated to the clause involving qubits is constructed as a projector on the wrong assignment to be rejected ,
(5) |
That is, for a given clause , its corresponding Hamiltonian penalizes with one unit of energy the wrong assignment to the clause and delivers a zero value for the rest of the allowed assignments. The relevant point is that this Hamiltonian is diagonal in the computational basis, and all the pieces do commute , that is, the Hamiltonian is frustration free, and local minimization provides a global minimum. Under some circumstances tensor networks i.e. PEPS have been identified as ground states of frustration-free Hamiltonians [16]. Therefore, we can look for a global tensor construction by just guaranteeing the correct local tensors clause by clause. Hence, we obtain our first and central result:
Result 1: The solutions to an instance of the 3SAT problem can be represented explicitly as an unnormalized quantum state which is encoded in a tensor network with .
The precise construction of the tensors that encode the solution of the 3SAT instance corresponds to
(6) |
and
(7) |
All qubit physical indices are locked to the ancillary ones , and the values of the qubit are neutral, taking the same value whether or . The tensor for the clauses reads the qubit value through the ancillary indices and simply provide a for all the allowed assignments but a for the rejected one. This structure is easily seen to minimize every and, thus, provides the global ground state which is the even superposition of all the global valid solutions to the set of clauses. That is, the contraction of tensor network we have constructed does fulfill Eq. 3.
From our construction it is clear that there is a degeneracy of the tensor networks delivering the same state . It is possible to multiply any coefficient of e.g. a qubit tensor by an arbitrary number, while dividing it in the associated clauses. It is also possible to assign different lockings between the variable tensors and the clause tensors so to produce the same solution. This freedom is reminiscent of the so-called gauge symmetry also present in other tensor network geometries [5]. Local changes in the tensor values produce a continuum of tensor network constructions leading to the same solution. Our choice in Eqs. 6, 7 can be understood as a canonical form for this tensor structure.
The assignment in Eqs. 6, 7 is also found when a numerical Euclidean evolution is performed to the flat distribution . The Euclidean minimization of the Hamiltonian produces the equally flat distribution of solutions. In some sense, this is surprising. It must be made clear that if a solution to the 3SAT instance exists, a simpler network with the qubit indices being locked to their solution values will deliver the correct solution. From an initial random assignment to the qubits, we recover as well all the solutions with different weights. In the case of a single satisfying assignment, a tensor of (a product state) also provides the solution. Yet, the Euclidean evolution keeps restoring symmetry on qubit assignments. As a consequence, the tensor network we have presented is obtained as an infrared fixed point of an Euclidean evolution minimization algorithm.
To further analyze the performance of the Euclidean evolution, we perform a numerical simulation of the tensor network subject to the evolution operator. In Fig.2 we show the overlap between the final state encoding the solution and the evolved state along the imaginary time evolution. We fix , resulting in steps to provide the exact answer. The commutation between different ensures that every step of the computation actually projects into the correct answer, identifying monotonically the right assignments already in the first steps of the evolution. This is reflected on an identical evolution for instances with the same number of variables and solutions.
3 Complexity class for the contraction of tensor networks
Note that the tensor network we have constructed is not normalized. Indeed, if the 3SAT instance associated to this tensor has no solutions, all the contractions leading to the computation of each will produce a zero value. Such a state would have zero norm. In the case that the 3-SAT instance has satisfying assignments we state the following:
Result 2: Given the above tensor network that encodes the solutions to a 3SAT instance in a state , the norm reads the number of solutions to the 3SAT instance. Hence, computing the norm of the tensor network explicitly corresponds to a #P-complete problem.
This result is derived from the tensor network construction we have presented. It shows that a contraction of the tensor network counts solutions of a 3SAT instance, which defines the #3SAT problem. Consequently, the problem of contraction of arbitrary tensor networks falls into the #P-complete complexity class. This result was derived in Ref. [17] in the contex of contracting PEPS with bond dimension .
Computing the number of solutions can be also reduced to the simpler case of contracting against a tensor network representing the unnormalized state . This contraction computes , with . That is, the simplest non-trivial contraction of a tensor network with with another with suffices to compute . Note that this problem can also be seen as finding the overlap of the 3SAT state with the neutral product state .
Let us emphasize further that the tensor network we have designed only uses tensors with rank. This shows indirectly the enormous representation power of tensor networks that use small rank individual tensors. Important resources for quantum information processing can be constructed as well with tensor networks with , such as the cluster state [18] or the toric code state [19]. It was known that tensor network provide good approximations to the ground states of relevant quantum interactions. PEPS with small rank for were shown to support area law scaling of entanglement and to be able to describe a scale invariant theory where all correlators decay polynomially [19].
In our case, the situation is more radical due to the fact that the connectivity is non-local. Then, the maximum entanglement support offered by the tensor network can obey a volume law. More precisely, we can take a 3SAT instance and produce a bipartition of qubits into two sets and . Consider the case where all qubits in are involved in a clause that further relates to qubits in . Our tensor network structure will then have at least ancillary indices connecting and . Thus, the amount of entropy which can be supported by the tensor network is , where is the von Neumann entropy of the reduced density matrix for the subsystem . This is the largest possible entropy. Thus, our tensor networks can support volume scaling for the entropy. Numerical evidence support this necessity [20, 21].
Let us now turn to the problem of finding an explicit solution to a 3SAT instance, which is a FNP problem. This can be achieved using contractions of the tensor network we have constructed. From the fact that the 3SAT problem is self-reducible [14], contractions of tensor networks deliver an actual solution, which leads to the following:
Corollary: An explicit solution to a 3SAT instance, encoded in a state , can be obtained by computing a polynomial number of successive expectation values on that state.
We now turn to present a method to extract one of the possible solutions, if any, of a 3SAT instance tensor network. The basic idea is to perform a series of contractions as follows. We first take any qubit and compute
(8) |
where , an operator that reads or for the elements of the basis of a qubit Hilbert space. This operation is only defined if the norm of the state is different from zero, that is, if there is at least one satisfying assignment solving the 3SAT instance. The computation of this expectation value amount to a new contraction of the tensor network that needs exactly the same amount of computational cost as finding the norm of the state. The result of the contraction can be any number between or . If the result is either one of the extremes, namely or , that means that the qubit must take such a value. The classical bit associated to this qubit is completely fixed. In contrast, the case where the solution is not one of the two extreme values corresponds to having more than one solution to the instance. In such a case, the state is a superposition of various solutions. The qubit which is being analyzed cannot commit itself since it takes different values for those different solutions. Consequently, we can take any of the two possibilities and construct a new tensor network where is fixed either to or , as we prefer. Both values will lead to a valid solution. We can now proceed to a second qubit and repeat the operation. In this way, contractions of tensor networks will suffice to deliver one of the possible solutions to the 3SAT instance.
It should be noted that our approach requires a polynomial number of calls to #P contractions. As a matter of fact, however, each call should only need to decide whether a solution exists, i.e. it would suffice to know if a certain assignment can be satisfied at each step. Thus, each call would only amount to solving a NP problem.
4 Reducing the rank of tensor networks
A problem common to all the available techniques to make a contraction of a tensor network corresponds to finding the best approximation of a tensor network with large using another one with a small . For instance, in two dimensions, the contraction of a tensor network accumulates open ancillary indices as dictated by the area law of entanglement. The contraction of a tensor network needs a larger and larger effective rank . To solve this problem, different reductions can be tried. It is, then, necessary to approximate large rank tensor networks by small rank ones.
The problem of reducing tensor networks is simpler in one dimension. For MPS, the optimization problem of finding an appropriate reduction of the ancillary indices requires polynomial resources [22], though the global optimization problem can be extremely hard even in 1D [23]. For the general of non-local tensor networks this task is out of reach. This can be expressed as an evident statement.
Result 3: The reduction of a tensor network that encodes a 3SAT instance to a tensor network is equivalent to finding the solution to that instance.
This limitation can be deduced from our above results. Let us illustrate this point in the following way. As mentioned above, given an instance of 3SAT with only one satisfying assignment, we know of at least two tensor networks that produce the correct identical state. One of them is the tensor construction with we have presented and a second one is a tensor network with corresponding to the product state. Both states are identical. Furthermore, we know a priori the first construction since it is neutral in all the tensor assignments. Then, the problem of finding the best product state approximation to the tensor network, that is finding
(9) |
is equivalent to finding the solution to the instance. But, it was shown that finding the solution to the 3SAT instance is in FNP. Thus, finding the optimal more economic tensor network construction of a state given a more costly one is also in FNP.
Let us briefly discuss the relation of this result with practical applications of tensor networks for condensed matter problems. The relevant point to note is the two different categories of exact contractions vs. approximate solutions. The reduction we have just discussed is an exact one. That is, given a tensor network discribing the unique solution to a 3SAT problem, there is a reduction problem to find the product state that delivers the same state. On the other hand, in condensed matter problems it is interesting to know whether a tensor network made of tensors of rank can be faitfully approximated by a similar tensor network of lower rank . This is not an exact contraction and depends on the targeted accuracy of the tensor representation. In general the larger is, the better the approximation becomes. A quantitative analysis and characterization of scaling properties of a tensor network approximation as a funtion of can be found in Ref. [24, 25]. Further research devoted to determining the complexity of reducing the rank of a tensor network for special cases with a lattice geometry, as the case of Ising of Potts models, are known to be NP-complete [26, 15, 27].
5 Conclusions
Tensor networks provide a set of techniques to study by classical means interesting quantum states. These include universal resources for quantum computation, which can be expressed as tensor networks with rank. Using a simple construction that encodes the solution of a 3SAT problem in a tensor network, , we have shown that contracting arbitrary tensor networks, however loosely connected, may require exponential resources. From our construction, the number of solutions to an instance of the 3SAT problem can be directly read from the normalization , hence the difficulty of this task is equivalent to a contraction of the network. The tensor network we have constructed is the ground state of a 3-local Hamiltonian. The hardness of finding its ground states implies the difficulty of cooling such a spin system.
Let us emphasize that the difficulty of finding a solution to a 3SAT instance is not related to the construction of a tensor network for the state that encodes it. There is no need to resort to complicate minimization techniques. Rather, the difficulty is attached to the contraction of the tensor network. The problem of counting solutions and of finding explicitly one of them are solved with a polynomial number of contractions of the tensor network. It tourns out that a single contraction of the network counts the number of solution to the problem, thus solving a #P problem. The FNP problem of providing a single solution can be solved with a controlled sequence of contractions. Moreover, since the exact solution can be encoded in a tensor network, finding a reduction in rank for the tensor network is also FNP.
Since other hard problems reduce to the 3SAT problem addressed here, this result can be extended easily to an explicit construction of solutions to other hard problems like e.g. Exact Cover. Our tensor network encodes the relation between clauses in a set of tensors, resembling the message passing structure of other approaches used to solve huge instances of the 3SAT problem [11]. This provides an important link between techniques of both disciplines, suggesting the use of schemes developed in the study of 3SAT to improve the performance of contracting arbitrary tensor networks in Quantum Mechanics.
Let us make a further link between the above result on computational complexity classes for the contraction of tensor networks and the possibility of constructing such tensor networks in the lab. In Ref. [28] a practical protocol was presented to create Matrix Product States in the laboratory. This idea has been further pursued in Ref. [29] in the context of PEPS. Our results show that the solution to 3SAT can be reduced to create the tensor network we have presented plus a set of measurements. The solution to the problem would be read from the collapse of the state to one of the solutions which are superposed in . As a consequence, it is expected that creating the quantum state representing the tensor network we have presented would require an exponentially long time. This shows that only tensor networks that capture some special symmetry in the geometrical connectivity of the problem might be amenable to experimental realization.
Acknowledgements We thank R. Orús for discussions. Financial support from MICINN (Spain), Grup consolidat (Generalitat de Catalunya), and QOIT Consolider-Ingenio 2010 is acknowledged.
References
References
- [1] R. P. Feynman, Int. J. Theor. Phys. 21, 467 (1982).
- [2] M. Fannes, B. Nachtergaele and R. F. Werner, Commun. Math. Phys. 144, 143 (1992).
- [3] S. Östlund and S. Rommer, Phys. Rev. Lett. 75, 3537 (1995).
- [4] F. Verstraete and J. I. Cirac, arXiv:cond-mat/040766 (2004).
- [5] N. Schuch, J. I. Cirac and D. Perez-Garcia, Annals of Physics 325, 2153 (2010).
- [6] G. Vidal, Phys. Rev. Lett. 101, 110501 (2008).
- [7] G. Vidal, Phys. Rev. Lett. 98, 070201 (2007).
- [8] E. Farhi, J. Goldstone, S. Gutmann, J. Lapan, A. Lundgren and D. Preda, Science 292(5516), 472 (2001).
- [9] M. C. Bañuls, R. Orús, J. I. Latorre, A. Pérez and P. Ruiz-Femenía, Phys. Rev. A 73, 022344 (2006).
- [10] J. J. García-Ripoll and M. C. Bañuls, arXiv:0812.1760 (2008).
- [11] M. Mézard, G. Parisi and R. Zecchina, Science 297(5582), 812 (2002).
- [12] A. Braunstein, M. Mezard and R. Zecchina, Random Structures and Algorithms 27, 201-226 (2005).
- [13] S. Cook, Proc. 3rd Ann. ACM Symp. on Theory of Computing, ACM New York, p.151 (1971).
- [14] C. Papadimitriou, Computational complexity, Addison-Wesley (1994).
- [15] S. Istrail, Proc. of the Thirty-Second Annual ACM Symposium on Theory of Computing, 87, ACM, New York, 2000.
- [16] D. Perez-Garcia, F. Vertraete, M. M. Wolf and J.I. Cirac, Quantum Inf. and Comp., 8, 0650 (2008).
- [17] N. Schuch, M. M. Wolf, F. Verstraete and J. I. Cirac, Phys. Rev. Lett. 98, 140506 (2007).
- [18] F. Verstraete and J. I. Cirac, Phys. Rev. A 70, 060302(R) (2004).
- [19] F. Verstraete, M. M. Wolf, D. Pérez-García and J. I. Cirac, Phys. Rev. Lett. 96, 220601 (2006).
- [20] R. Orús and J. I. Latorre, Phys. Rev. A 69, 052308 (2004).
- [21] J. I. Latorre and R. Orús, Phys. Rev. A 69, 062302 (2004).
- [22] F. Verstraete, J. J. García-Ripoll and J. I. Cirac, Phys. Rev. Lett. 93, 207204 (2004).
- [23] J. Eisert, Phys. Rev. Lett. 97, 260501 (2006).
- [24] L. Tagliacozzo, Thiago. R. de Oliveira, S. Iblisdir and J. I. Latorre, Phys. Rev. B 78, 024410 (2008).
- [25] G. Refael and J. E. Moore, J. Phys. Math. and Th. 42 504010 (2009). F. Pollmann, S. Mukerjee, A. M. Turner and J. E. Moore, Phys. Rev. Lett. 102, 255701 (2009).
- [26] F. Barahona, J. Phys. A: Math. Gen. 15, 3241 (1982).
- [27] M. Van den Nest, W. Dür and H. J. Briegel, Phys. Rev. Lett. 100, 110501 (2008).
- [28] C. Schön, K. Hammerer, M. M. Wolf, J. I. Cirac and E. Solano, Phys. Rev. A 75, 032311 (2007).
- [29] M. Schwarz, K. Temme and F. Verstraete, arXiv:1104.1410 (2011).