{'fraction_non_alphanumeric': 0.043834182095093044, 'fraction_numerical': 0.005996858788253772, 'mean_word_length': 4.27674535409342, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Classical spin models and the quantum stabilizer formalism

We relate a large class of classical spin models, including the inhomogeneous Ising, Potts, and clock models of q-state spins on arbitrary graphs, to problems in quantum physics. More precisely, we show how to express partition functions as inner products between certain quantum stabilizer states and product states. This connection allows us to use powerful techniques developed in quantum information theory, such as the stabilizer formalism and classical simulation techniques, to gain general insights into these models in a unified way. We recover and generalize several symmetries and high-low temperature dualities, and we provide an efficient classical evaluation of partition functions for all interaction graphs with a bounded tree-width.

We relate a large class of classical spin models, including the inhomogeneous Ising, Potts, and clock models of q-state spins on arbitrary graphs, to problems in quantum physics. More precisely, we show how to express partition functions as inner products between certain quantum stabilizer states and product states. This connection allows us to use powerful techniques developed in quantum information theory, such as the stabilizer formalism and classical simulation techniques, to gain general insights into these models in a unified way. We recover and generalize several symmetries and high-low temperature dualities, and we provide an efficient classical evaluation of partition functions for all interaction graphs with a bounded tree-width. Classical spin models, such as the Ising, Potts and clock models [1], are widely studied in statistical physics. Despite of their simplicity, these models show a number of highly non-trivial features, which is e.g. apparent in their rich phase structure and critical behavior. These models are considered in the context of (anti)ferromagnetism and are related to a number of central problems in lattice statistics. A quantity of fundamental interest is the partition function, from which other physically relevant quantities can be derived. General symmetry and duality relations, as well as the efficient evaluation of the partition function are important problems in this context. In particular, it is known that for general interaction patterns the evaluation of the partition function of e.g. the Potts model is NP-hard [2], rendering the problem highly non-trivial.
In this letter, we relate general classical spin models of qstate spins that interact pairwise according to some arbitrary interaction pattern, to problems in quantum theory, thereby obtaining a novel approach to tackle these problems. More precisely, we establish a correspondence between, one the one hand, classical partition functions, and, on the other hand, overlaps between certain quantum states-known as stabilizer states [3,4]-and complete product states of N qdimensional quantum systems; here N is the number of pairwise interactions. The stabilizer states encode the interaction pattern of the model, while the product states encode the details of the interaction. This correspondence allows us to use a whole body of powerful results obtained in the context of quantum information theory regarding the classical description of such quantum states, including the stabilizer formalism [3,4,5] and the classical simulation of quantum systems [6,7]. Conversely, the vast knowledge on classical spin models yields insights in the possible use of the corresponding states in quantum information tasks.
We emphasize that the current approach allows one to investigate classical spin models by virtually going to quantum systems-this is not be to confused with the solution of classical problems by implementing quantum algorithms on a quantum computer. Despite of the fact that the formulation of the problem in terms of quantum theory appears to increase the complexity and the number of involved parameters, this approach, as we will show, leads to a fruitful way to gain insights in spin models. For example, recently established classical algorithms [6,7] that allow one to describe and locally manipulate certain quantum systems in an efficient way, can be utilized to efficiently evaluate the partition functions of these models for all interaction patterns corresponding to graphs with a (logarithmically) bounded tree-width [8]. Furthermore, our approach leads to a simple way of recovering and extending general symmetry and duality relations of the above models in a unified way. For instance, using the fact that the corresponding states are stabilizer states, one can relate the stabilizer groups of the states to symmetry groups of the corresponding partition functions. In the following we will first describe the general class of classical spin models we consider, and then formulate the problem in a quantum language and apply techniques established in the context of quantum mechanics to gain insight in the classical models.
2.-Classical spin models. We will consider a general class of classical spin models on arbitrary graphs. We consider n classical spins {s i } that can assume q possible states, s i ∈ {0, . . . , q − 1}, and which interact pairwise according to an interaction pattern specified by a graph. More precisely, let G = (V, E) be a (connected) graph with vertex set V associated to the spins, and edge set E. Further, let G σ be an oriented version of G, where, for every edge e, one end-vertex v + e is assigned to be the head of e , and the other end-vertex v − e is the tail of e. The Hamiltonian of the system is given by the general expression Here every h e is a local Hamiltonian defined on the edge e with the only restriction that the interaction strength between the spins on the endpoints v + e and v − e is a function of the difference between s v + e and s v − e modulo q, denoted by Thus, a general inhomogeneous model on an arbitrary graph is obtained.
Note that this general model specializes to known and widely studied statistical mechanics models such as the standard Potts model, the Ising model and the clock model [1]. For example, the q-state Potts model (which specializes to the Ising model when q = 2) is obtained by taking h e (j) := −J e δ(j, 0), for every j ∈ {0, . . . , q − 1} and for every e ∈ E, where the J e are real coefficients. The central quantity in this context is the partition function, where β = (k B T ) −1 , with k B the Boltzmann constant and T the temperature, from which other relevant physical quantities such as e.g. free energy can be derived.

3.-Quantum formulation.
We now reformulate the partition function Z G in terms of a quantum physics language. To this aim, we will associate with the oriented graph G σ a quantum state of N q-dimensional systems, where N := |E| is the total number of edges of G, in the following way. Consider the incidence matrix B σ of the oriented graph G σ [10]. This is the matrix with entries 0 and ±1 where the rows are indexed by the vertices of G, and the columns by the edges, such that (B σ ) a,e = 1 if the vertex a is the head of the edge e, (B σ ) a,e = −1 if a is the tail of e, and (B σ ) a,e = 0 otherwise. Let C G (q, σ) be the row space of B σ when arithmetic is performed over Z q . This space is a linear subspace of Z E q := e∈E Z q . We now associate to C G (q, σ) the quantum state where the |v are basis states of (C q ) ⊗N obtained by taking tensor products of a local basis {|0 , . . . , |q − 1 }. Note that we have omitted the dependence of |ψ G on q and σ to keep notation simple. An interesting property is that the state |ψ G is a stabilizer state, i.e., it is the unique joint eigenstate of q N commuting Pauli operators [5,11]. More specifically, defining the operators X and Z by for every j = 0, . . . , q − 1, one finds that |ψ G is invariant under the q N local operations for every u ∈ C G (q, σ) and v ∈ C G (q, σ) ⊥ . It is important to remark that the above construction of associating a quantum stabilizer state |ψ G to a graph G is entirely different from the standard way of defining a graph state, usually denoted by |G [3]. While for |ψ G the edges of G are identified with quantum systems and the incidence matrix of G is used, yielding an N -particle state (where N = |E|), in the construction of |G the vertices are identified with quantum systems and the adjacency matrix is used, leading to a state on n = |V | particles.
We can now relate the partition function Z G to the state |ψ G , and obtain the first main result of this letter: The partition function Z G (q, σ, {h e }) on an arbitrary graph G with N edges can be written as the overlap between a quantum stabilizer state on N q-dimensional systems, and a complete product state. More precisely, we find where |α e := q−1 j=0 e −βhe(j) |j is a q-dimensional vector associated to the edge e, specifying the interaction [12].
Note that, whereas the states |ψ G encode interaction patterns, the product states |α e encode the details of the interactions. For example, in the case of the Potts model one has |α e = e −βJe |0 + (|1 + · · · + |q − 1 ).
Examples of states |ψ G are obtained as follows. First, if G is a tree graph-for example, a 1D chain with open boundary conditions-it is easy to show that C G (q, σ) is the complete space Z E q (independent of the orientation σ). One then finds that the corresponding quantum state is a product state, namely |ψ G = |+ ⊗N , where |+ := |0 + · · · + |q − 1 . Hence, the partition function Z G on trees can easily be evaluated, and one has Z G ∼ e +|α e . Second, a 1D chain with periodic boundary conditions corresponds for q = 2 to a Greenberger-Horne-Zeilinger (GHZ) state where |− = |0 − |1 , and also this result leads to the well known closed formula for the partition function. Finally, the 2D rectangular lattice with open (periodic) boundary conditions leads for q = 2 to a planar (toric) code state as introduced in the context of topological quantum error-correction [13]. We remark that the connection between the 2D Ising model and planar (toric) code states was first proven and utilized in Ref. [14].

3.-Solutions using quantum techniques.
Having established the above formulation of the partition function Z G in a quantum language, we now show how to use powerful techniques established in quantum information theory to study Z G . Our general approach will be to translate insights regarding the states |ψ G into insights regarding the partition functions Z G . We remark that it is not obvious that the formulation in a quantum language simplifies the problem, in particular as it involves quantum states of N q-dimensional systems, which are described by q N -dimensional vectors and thus have an increased number of parameters. However, we can make use of the following two advantageous features of the correspondence (6). First, as pointed out above, the states |ψ G belong to the class of stabilizer states, which are in general a highly manageable family of multi-particle quantum states which has been extensively studied, and of which many properties are known. Second, it follows from (6) that the state |ψ G is only used to obtain an encoding of the interaction pattern of the model-i.e., the (oriented) graph G-and that all information regarding the specifics of the interactions-i.e., the Hamiltonians h e -is encoded into the single particle states |α e . Translating properties of the states |ψ G into properties of the corresponding partition functions thus yields a way of unifying properties of models which are specializations of the current model (such as the Ising, Potts and clock models-see above), as one simply needs to consider different local states |α e for the same state |ψ G .
Next we give three illustrations how to use stabilizer techniques to investigate the partition function Z G .

Efficient evaluation of Z G .
First we consider the problem of evaluating Z G in a given set of hamiltonians {h e }. This problem is known to be NP-hard on general graphs. Efficient algorithms for special instances of graphs do exist, e.g., for the Ising model on planar graphs [2]. Here we show that: The partition function Z G can be evaluated efficiently (i.e., in polynomial time in the number of edges N ) on all graphs G of logarithmically bounded tree-width [8]. Moreover, we provide an explicit algorithm based on the efficient classical description of quantum states in terms of tree tensor networks.
To obtain this result, we use that any quantum state can be represented by a tree tensor network (TTN) [6], i.e., as a collection of tensors of rank χ i that are arranged according to a tree structure. In general, the maximal rank χ := max χ i of the tensors in the network grows exponentially with the number of systems N . As shown in Ref. [6], using the TTN description one can extract information from the quantum state with overhead O (N ·poly(χ)). In particular, one can calculate overlaps with product states. For stabilizer states on qubits (q = 2), it was shown how to obtain the optimal TTN (i.e. with minimal χ) in Ref. [7], and this method can be extended to arbitrary q [19]. It was shown in Ref. [7] that, for a given stabilizer state |ψ , the optimal χ is obtained by computing the (exponential of the) Schmidt-rank width of |ψ . Moreover, the optimal TTN description of the state |ψ can explicitly be computed in poly(N, χ) steps on a classical computer. Evaluation of overlaps with product states, and, hence, specializing to the case of |ψ G , evaluation of partition functions Z G corresponds to a simple contraction of tensors, which can be done in O(N · χ 3 ) steps [6]. For |ψ G , one shows that the optimal χ scales as the exponential of the tree-width t(G) of the graph G, by using that the Schmidt-rank width of |ψ G is proportional to the branch-width b(G) [15] of the underlying code C G (σ, q) [19]; further, one uses the inequalities where f 1 , f 2 are linear functions [15]. It follows that whenever t(G) grows at most logarithmically with N , then χ scales polynomially with N , and hence the partition function Z G can be evaluated efficiently.
Note that the computationally hardest part in the above algorithm is to obtain the TTN description of |ψ G , while the calculation of overlaps with arbitrary product states, and hence the variation of coupling strengthes or different models for a fixed geometry, only scales linearly with N . We also emphasize that nonplanar graphs (of logarithmically bounded tree-width), as well as non-local interactions, are covered by this result. Results regarding efficient computation of homogeneous Potts model partition functions on graphs of (logarithmically) bounded tree-width have been obtained before [16], though with entirely different methods. We emphasize that our approach, in contrast to previous approaches, can handle without difficulty also inhomogeneous models. Moreover, our method leaves a lot of space for generalizations.

Dualities for planar graphs.
Next we show how the partition function Z G of a planar graph G can be related to the partition function Z D of its dual graph D [10]. First, note that every orientation σ of G induces an orientation of its dual D, which we also denote by σ. We refer to Ref. [10] (p. 168) for details. Letting B(G σ ) and B(D σ ) be the incidence matrices of G σ and D σ , respectively, one then has B(G σ )B(D σ ) T = 0 [10] (p. 169), which implies that the spaces C G (σ, q) and C D (σ, q) are each other's duals, i.e., C G (σ, q) ⊥ = C D (σ, q). Now, let F be the quantum Fourier transform, or generalized Hadamard operation, defined on C q . This operator satisfies F XF † = Z and F ZF † = X, where Z and X are defined in (4). Using this property and the duality of C G (σ, q) and C D (σ, q), one finds that In other words, the states |ψ G and |ψ D are equal up to a Hadamard operation applied simultaneously on all local Hilbert spaces in the system. This result immediately relates the partition functions Z G and Z D , as one finds that where now |α ′ e := H † |α e . This leads to Z G (q, σ, for every j = 0, . . . , q − 1. As an example, consider the Potts model on the graph G, which is obtained by putting h e (0) := −J e and h e (j) = 0 whenever j = 0, for every e ∈ E. The identity (13) then yields Defining interaction strengths J ′ e through e βJ ′ e := e βJe + q − 1 e βJe − 1 , or, equivalently, (e βJ ′ e − 1)(e βJe − 1) = q, one recovers the well know high-low temperature duality relation for the Potts model partition function [1], where the partition function on the graph G with interaction strengths {J e } is related to the partition function on the dual graph D with interactions {J ′ e }.

Symmetries.
Finally, general symmetries can easily be obtained. Here the essential observation is the following: any local unitary operator U := e∈E U e having |ψ G as an eigenstate with eigenvalue λ, yields a symmetry where |α ′ e :=λU e |α e . A symmetry is obtained in the sense that different configurations of interactions (which are encoded in the |α e ) on the same graph G yield the same partition function [17]. Here again the fact that the states |ψ G are stabilizer states is particularly advantageous, as every |ψ G is the joint eigenstate of the q N local Pauli operators X(u)Z(v) (see (4) and below), which constitute the stabilizer group of |ψ G . Thus, this stabilizer group corresponds to a group of q N symmetries of Z G . Let us give an example of such a symmetry for q = 2. Let G be an arbitrary graph, let a be one of its vertices, and let E(a) be the set of edges incident with a. Let X[a] be the N -qubit correlation operator on such that the the eth tensor factor is equal to the Pauli matrix X if e ∈ E(a), and equal to I otherwise. Then X[a] stabilizes |ψ G,2 and, using the relation with Z G , one obtains a relation between Z G (2; {J e }) and Z G (2; {J ′ e }), where J ′ e := −J e if e ∈ E(a), and J ′ e := J e otherwise.
4.-Relation to measurement based quantum computation. So far we have used stabilizer techniques to study the partition function Z G , using the relation (6). Here we remark that this connection can also naturally be invoked to gain insights in the opposite direction-i.e., insights in Z G can be used to understand the properties of the states |ψ G and their possible role in quantum information tasks. In particular, one may consider the question whether the states |ψ G are useful resources for measurement based quantum computation (MQC), similar to the 2D cluster state, which in fact allows universal computation by local measurements only [18]. Like all stabilizer states, the |ψ G are natural candidates for resources for MQC, as these states are generally highly entangled and as they can be produced efficiently by a poly-sized quantum circuit. The connection with the partition function immediately relates the difficulty of evaluating Z G with the difficulty of classically simulating local measurements on the state |ψ G . In particular, one finds that all (classes of) graphs for which the computation of Z G is hard, give rise to resource states for which simulation of MQC is a hard problem. For example, nonplanar graphs of large tree-width would typically give rise to states where MQC is NP-hard to simulate classically. Conversely, known results regarding efficient evaluation of Z G on certain graphs-e.g., planar graphs for the Ising model (q = 2)-may lead to states |ψ G on which MQC can be simulated efficiently classically. We refer to Ref. [14], where this approach was first adopted to show that MQC on Kitaev's planar code states can be simulated efficiently classically.

5.-Summary and outlook.
We have related the evaluation of the partition function on a general class of classical spin models to the calculation of overlaps between quantum stabilizer states encoding the interaction pattern, and product states encoding the details of the interaction. This allowed us to use powerful techniques established in quantum information theory to obtain novel classical algorithms to evaluate the partition function, and to investigate general symmetries and duality relations. We emphasize that in all cases we consider, the reformulation in terms of a quantum problem is virtual, in the sense that we provide an alternative way to obtain a classical solution of the initial classical problem by making use of techniques established to describe and simulate quantum systems by classical means.
Finally, we note that other classical combinatorial problems can be formulated in the language of quantum physics using a similar construction as outlined above. As an example, we mention that the weight enumerator of a classical code-a central quantity in classical coding theory-can be evaluated with similar methods [19]. Further, as the Potts model partition function is intimately related to problems in graph and knot theory through the relation with the Tutte polynomial, the present results also have implications in these fields.