A Complexity Trichotomy for k-Regular Asymmetric Spin Systems Using Number Theory

Suppose φ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varphi$$\end{document} and ψ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\psi$$\end{document} are two angles satisfying tan(φ)=2tan(ψ)>0\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\tan(\varphi) = 2 \tan(\psi) > 0$$\end{document}. We prove that under this condition φ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varphi$$\end{document} and ψ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\psi$$\end{document}cannot be both rational multiples of π. We use this number theoretic result to prove a classification of the computational complexity of spin systems on k-regular graphs with general (not necessarily symmetric) real valued edge weights. We establish explicit criteria, according to which the partition functions of all such systems are classified into three classes: (1) Polynomial time computable, (2) #P-hard in general but polynomial time computable on planar graphs, and (3) #P-hard on planar graphs. In particular, problems in (2) are precisely those that can be transformed by a holographic reduction to a form solvable by the Fisher-Kasteleyn-Temperley algorithm for counting perfect matchings in a planar graph.


Introduction
Spin systems are well-studied models in statistical physics, starting with the Ising model almost 100 years ago by Ising (1925). The model consists of a discrete set of variables, called spins, which can be assigned one of two values (states). These spins are usually placed on a lattice structure or a graph, and each spin interacts with its nearest neighbors. Given a spin assignment σ, an aggregate, called the Hamiltonian H(σ), is defined to be the sum over the energies associated with the different interactions. Then the partition function Z = ∑ σ e −H(σ)/kT is defined to be an exponential sized sum of products, where k is the Boltzmann constant and T is the (absolute) temperature. (Note that as H(σ) is a sum, e −H(σ)/kT is a product.) This partition function encodes a great deal of information about the physical system, and one of the central questions in statistical physics is to decide what systems have partition functions that can be "exactly solved". There is a wealth of information on the subject in Baxter (1982). One landmark achievement in this area is the Fisher-Kasteleyn-Temperley algorithm (FKT) for the dimer problem (counting perfect matchings) on any planar graph using Pfaffians by Kasteleyn (1961Kasteleyn ( , 1967 and Temperley & Fisher (1961). The study of approximate algorithms and complexity for spin systems has been an exciting area of research, e.g., see ; Goldberg & Jerrum (2007); Jerrum & Sinclair (1993); Li et al. (2013); Lu & Yin (2016).
In this paper we consider spin systems on finite k-regular graphs G = (V, E), and prove a complexity theory classification. We define the problem formally: Every vertex v ∈ V has degree k, and every edge (u, v) ∈ E is assigned a constraint function f ∶ {0, 1} 2 → R. The function f is not assumed to be symmetric, and one of u or v is specified as the first input variable of f and the other one the second. Equivalently one can think of G as a directed graph, and as such the edge (u, v) is viewed as an ordered pair. Define the partition function on G as Z f (G) = cc A Complexity Trichotomy Page 3 of 37 4 ∑ σ∶V →{0,1} ∏ (u,v)∈E(G) f (σ(u), σ(v)). Depending on the nature of the edge function f , we show that the problem Z f (⋅) is either computable in polynomial time (denoted as P-time) or #P-hard. Furthermore, for those problems Z f (⋅) that are #P-hard in general, if the input is restricted to planar graphs, then some of them become computable in P-time. We prove that for all such problems, there is a further exact classification into P-time computable or #P-hard on planar graphs. Furthermore, the former are all computable in P-time by a universal algorithm that is a holographic reduction to the FKT algorithm (this is Holographic Algorithm by Valiant (2008)), and all other problems remain #P-hard on planar graphs. 2 To prove our classification theorem, we will make an unexpected detour into number theory. To state it in general terms, this came about as follows: In our attempt to prove #P-hardness for some particularly tricky cases, we found a pair of constructions. Each is controlled by a pair of eigenvalues of equal norm. If the ratio of the two eigenvalues is a root of unity then an iteration of the construction will end up repeating after a fixed number of steps (up to a scalar). This is undesirable because the Vandermonde matrix corresponding to the construction will have bounded rank, making it unable to perform polynomial interpolation for arbitrarily large instance graphs. On the other hand, if the ratio of eigenvalues is not a root of unity then the Vandermonde matrix corresponding to the construction will have full rank, and we can successfully interpolate, and thus prove #P-hardness for those tricky cases.
These eigenvalues and their ratios are expressible in terms of the function values of the edge constraint function f . Depending on specific f , unfortunately it is indeed possible that the ratio of eigenvalues for either of the two constructions is a root of unity. The eigenvalues have equal norm, thus their ratio has unit norm. Then this ratio is a root of unity iff the complex argument is a rational multiple of π. As it turns out, the pair of constructions we found has the following surprising property: If the complex 4 Page 4 of 37 Cai et al. cc arguments (of the ratios of eigenvalues) of the two constructions are ϕ and ψ, respectively, then the tangent values of ϕ and ψ satisfy the equation tan(ϕ) = 2 tan(ψ) > 0, in all settings of f . So if we can show, given that tan(ϕ) = 2 tan(ψ) > 0, it is impossible that both ϕ and ψ are rational multiples of π, then we will have proved that in all cases at least one of the two constructions succeeds. This is indeed true and we prove it in Theorem 2.2.
Proving this rational incommensurability of, on the one hand two tangent values, and on the other hand two angles measured as multiples of π, and then using this theorem to prove the complexity classification is a surprising aspect of this paper. For any fixed n, questions regarding Q-linear independence among cotangent values of the form cot(kπ/n) (for 1 ≤ k < n/2 and gcd(k, n) = 1) were first suggested by proved by Siegel in 1949 (reported by Chowla (1964); see also Chowla (1970)). For any fixed prime p, theorems of this type were found for tangent values tan(kπ/p) by Hasse (1971), and for cosecant values csc(2kπ/p) by Lenstra & Jager (1975) (1 ≤ k ≤ (p − 1)/2), although linear dependence for the latter case is possible. For any n, Girstmair (1987) gave a representation theoretic treatment to the problem of determining Q-linear relations among numbers of the form, respectively, cot(kπ/n), tan(kπ/n), csc(2kπ/n) or sec(2kπ/n), for gcd(k, n) = 1. These results do not directly imply what we need (Theorem 2.2). (Note that Siegel's theorem (see Chowla (1964)) does not, in view of the requirement gcd(k, n) = 1, imply Theorem 2.2 because there may not be a common primitive order n for ϕ and ψ; furthermore, cot(π/6) = 3 cot(π/3) provides a counter example to the more general statement of Q-linear independence.) Our first proof of Theorem 2.2, contained in the extended abstract of the conference version Cai et al. (2018), uses a crucial formula by Girstmair (1987) (Theorem 2, p. 380) regarding Leopoldt's character coordinates of numbers in a number field (that proof does not use Siegel's theorem). In this journal version, we present two simplified proofs without using the more elaborate machinery of Leopoldt's character coordinates (but uses Siegel's theorem).
There have been a number of classification theorems for counting constraint satisfaction problems (#CSP) and related problems cc A Complexity Trichotomy Page 5 of 37 4 (see Backens (2017);; Cai & Chen (2017); Cai & Fu (2017); Cai et al. (2015Cai et al. ( , 2022Cai et al. ( , 2021Cai et al. ( , 2014; Dyer et al. (2009);Guo & Williams (2020); Huang & Lu (2016); Lin & Wang (2018)). Spin systems are special cases of #CSP (with a single edge function), and #CSP are special cases of Holant problems in which Equality functions of all arities are assumed to be present. The problem addressed in this paper can be viewed as only allowing Equality function of a fixed arity (regular graphs). Thus, the #P-hardness part of general dichotomy theorems does not apply. Without all Equality functions present, some #Phard cases can become P-time computable, and for those cases that remain #P-hard the reduction proofs become more challenging. The immediate predecessors to the present work are the classification for Z f (⋅) for k-regular graphs where f is a symmetric edge function by Cai & Kowalczyk (2012), and the classification for Z f (⋅) for 3-regular graphs where f is not necessarily symmetric by Cai et al. (2019). There are technical difficulties generalizing the proof in Cai & Kowalczyk (2012) and Cai et al. (2019) to 4regular graphs with an asymmetric edge function. On the other hand, aside from its intrinsic interest, spin systems on k-regular graphs for even k have another technical raison d'être. Although we do not intend to elaborate it here, the result in this paper fits in a bigger classification program for sum-of-product computations. In particular, to classify all Holant problems, a natural process is arity reduction by taking self-loops and some similar operations. This reduces the arity by two, and thus there are two base cases in an inductive proof, arity 3 and arity 4. Often one can holographically transform such a constraint function to Equality of arity 3 or 4, respectively, which gives rise to a spin system on 3or 4-regular graphs. After a preliminary version of this paper appeared in ITCS 2018 (Cai et al. (2018)), there is further progress in the complexity trichotomy classification for counting problems. In particular, a trichotomy theorem for the Six-Vertex Model, which is a Holant problem but cannot be expressed as #CSP, was given by Cai et al. (2021).
There is a long history in statistical physics to study "Exactly Solved Models"(see Baxter (1982)) for these partition functions 4 Page 6 of 37 Cai et al. cc where the edge function values f (σ(u), σ(v)) correspond to local interactions between particles. A rough correspondence exists between P-time computability and physicists' notion of an "Exactly Solvable" system. A central question is to identify which "systems" can be solved "exactly" and which "systems" are "difficult". While in physics there is no rigorous definition of being "difficult", complexity theory proposes that this corresponds to hardness in computational complexity, in particular #P-hardness. Literally thousands of papers have been written on spin systems (a search on google scholar for "spin systems" returns an enormous number of hits). A substantial proportion of the research concerns computational aspects of these spin systems. However, to the best of our knowledge, this paper is the first to employ an interesting number theoretic result to prove a computational complexity classification. This paper is organized as follows: In Section 2 we prove Theorem 2.2 to establish the incommensurability of (co)tangent values and angle values over π. In Section 3 we state some definitions and needed results. In Section 4 we prove the classification theorem for 4-regular graphs. In Section 5 we prove the classification theorem for k-regular graphs, for all k.

A theorem in number theory
Let 0 < ϕ < ψ < π/2 denote two angles. Then 0 < cot(ψ) < cot(ϕ) < ∞. Is it possible that (2.1) cot(ϕ) = 2 cot(ψ), and yet ϕ and ψ are both rational multiples of π? We prove the following theorem. It says that, with exactly one obvious exception, it is not possible that both the ratio of the cotangent values of ϕ and ψ is rational, and the two angles are rational multiples of π.
In particular (2.1) is not possible when both ϕ and ψ are rational multiples of π. This incommensurability will be used to prove a key complexity reduction to reach our complexity trichotomy classification.
The case n = n ′ follows from Siegel's theorem (see Chowla (1964)). Now we consider the case where exactly one of {n, n ′ } is odd. Switching the roles of ϕ and ψ if necessary, we assume n is odd, n ′ = 2n, and investigate the identity where r ∈ Q, r / = 1/3 or 3, n is odd, 1 ≤ k ≤ n/2, (k, n) = 1, and 1 ≤ k ′ ≤ n, (k ′ , 2n) = 1. Since these values of cot are positive, r is positive. This leads to the identity where ζ is a primitive n-th and η a primitive 2n-th root of unity. Note that since n is odd, we have Φ 2n = Φ n . We observe that η ′ = −ζ is a primitive 2n-th and ζ ′ = −η a primitive n-th root of unity.
First suppose that n is not a prime power. In particular, 2n is not a prime power. Then the numbers 1 − η ′ , 1 − ζ, 1 − ζ ′ , 1 − η 4 Page 8 of 37 Cai et al. cc are (algebraic) units (in the number field Φ 2n = Φ n ). 3 Accordingly, r is a unit and, since r > 0, r = 1, which is impossible. Next suppose n = p t for some prime p ≥ 3 and t > 0. Here the ideal ⟨1 − ζ ′ ⟩ = ⟨1 − ζ⟩ generated by 1 − ζ ′ and 1 − ζ is the same and is the prime ideal p that gives the unique prime ideal factorization ⟨p⟩ = p φ(n) , where φ(⋅) is the Euler totient function. On the other hand, 1 − η ′ and 1 − η are units. Hence, the p-exponent of the left hand side of (2.4) equals −1, whereas that of the right hand side equals mφ(n) + 1 for an integer m ∈ Z. Therefore, mφ(n) = −2, which implies m = −1, φ(n) = 2 or m = −2, φ(n) = 1. The latter case is impossible since p ≥ 3. The first case yields p = n = 3, and t = k = k ′ = 1. This corresponds to the only exceptional case r = 1/3 in (2.3) when n is odd and n ′ = 2n. ◻ We will use Theorem 2.2 to prove a key complexity reduction, stated in Lemma 4.1, after we formally define Holant problems and reductions in Section 3. We give another proof of Theorem 2.2 in the Appendix which is elementary but uses the Q-linear independence part of Siegel's theorem.

Definitions and known results
In order to prove our classification theorem for spin systems on k-regular graphs (which is formally stated as Theorem 5.1 in Section 5) we need some more definitions and state some known results. In particular, the proof will be carried out in the Holant framework.

cc A Complexity Trichotomy
Page 9 of 37 4 A constraint function, or signature, f of arity n is a map The counting problem on the instance Ω is to compute We also denote this quantity by Holant Ω when F is clear from the context. The Holant problem parameterized by the set F is denoted by Holant(F). If the underlying graph is a planar graph, then we denote the problem by Pl-Holant(F). Replacing f by c ⋅ f for any c / = 0 only changes the value Holant Ω by c m where m is the number of times f appears in Ω. Thus, it does not change its complexity, therefore we can ignore such constant factors. We also write Holant(F, f) for Holant(F ∪ {f }). We use Holant(F|G) to denote the Holant problem over signature grids with a bipartite graph G = (U, V, E), where each vertex in U or V is assigned a signature in F or G, respectively.
A signature f of arity n can be represented by listing its values in lexicographical order as in a truth table, which is a vector in C 2 n , or a tensor in where the rows are indexed by x 1 and the columns indexed by x 2 . A function is symmetric if its value depends only on the Hamming weight of its input. A symmetric function f on n Boolean variables can be expressed as [f 0 , f 1 , . . . , f n ], where f w is the value of f on inputs of Hamming weight w. For example, we denote by (= n ) the Equality signature [1, 0, . . . , 0, 1] (with n − 1 0's) of arity n.
In this paper, we consider the complexity of spin systems on kregular graphs (k ∈ Z + ) with real-valued edge functions. This can be defined as Holant problems of the form Holant(= k |f ), where f (x 1 , x 2 ) = (f 00 , f 01 , f 10 , f 11 ) ∈ R 4 is a binary signature. If k = 1, the spin system is a union of disjoint edges (the bipartite vertexedge incidence graph form for Holant(= k |f ) is a union of disjoint 4 Page 10 of 37 Cai et al. cc 2-paths). If k = 2, the spin system is a union of disjoint cycles. Thus, for k ≤ 2, the Holant is trivially computable in polynomial time. We assume k ≥ 3. For T ∈ GL 2 (C) and a signature f of arity n, written as a column vector f ∈ C 2 n , we denote by For signatures written as row vectors we define FT similarly.
The holographic transformation defined by T is the following operation: given a signature grid Ω = (H, π) of Holant (F | G), for the same bipartite graph H, we get a new signature grid Ω ′ = (H, π ′ ) of Holant (FT | T −1 G) by replacing each signature in F or G with the corresponding signature in FT or T −1 G.
Theorem 3.1 (Holant Theorem (Valiant 2008)). For any T ∈ GL 2 (C), Therefore, a holographic transformation does not change the value, and so it does not change the complexity of the Holant problem in the bipartite setting.

Gadget Construction.
One basic notion used throughout the paper is realization. If f is realizable from a set F, then we can freely add f into F while preserving the complexity. This notion is defined by an F-gate. An F-gate (G, π) is similar with a signature grid for Holant(F) except that G = (V, E, D) is a graph with some dangling edges D. The dangling edges define external variables for the F-gate. We name the regular edges in E by 1, 2, . . . , m and the dangling edges in D by m + 1, . . . , m + n. Then we can define a function f for this F-gate as where (y 1 , . . . , y n ) ∈ {0, 1} n is an assignment on the dangling edges and H(x 1 , . . . , y n ) is the value of the signature grid on an assignment of all edges in G, which is the product of evaluations at all vertices in V . We also call this function f the signature of the F-gate. If f is a binary signature, and g has arity n > 2, we may connect f to two consecutive variables x i and x i+1 (where x n+1 denotes x 1 ) of g. We call this operation "adding a loop to g using f ". This produces a signature of arity n − 2. Note that this {f, g}-gate (a gadget construction) is planar.
In an instance of Holant(F | G), if we have (= 2 ) on both sides, then we can move any signature f on one side to another side by connecting one copy of (= 2 ) to each variable of f . So in this case, we can ignore the bipartite restriction when constructing gadgets.

Tractable Signature Sets.
We define some sets of signatures that are known to define polynomial time computable problems (we call them tractable).

Affine Signatures A
Definition 3.2. Let f be a signature of arity n. We say f has affine support of dimension k if the support of f is an affine subspace of dimension k over Z 2 .
x n ] is a quadratic (total degree at most 2) multilinear polynomial with the additional requirement that the coefficients of all cross terms are even, i.e., Q has the form and χ is a 0-1 indicator function such that χ AX=0 is 1 iff AX = 0 over Z 2 . We use A to denote the set of all affine signatures.
The following lemma is an easy criterion for binary signatures in A .
Proof. It is easy to check that f (x 1 , The lemma follows. For example, the binary signatures (w, 0, 0, z) and (0, x, y, 0) are in P for any w, x, y, z ∈ C. If det [ w x y z ] = 0, then f = (w, x, y, z) ∈ P and we say that f is degenerate. Moreover, we have the following lemma. Lemma 3.6. Let f = (w, x, y, z) be a binary signature, where w, x, y, z ∈ C.

Matchgate Signatures
Proof. Note that H −1 = 1 2 H. Ignoring a constant factor, Then H ⊗2 f satisfies the parity constraint (item 1. above for the properties of M ) and is therefore in 4 Page 14 of 37 Cai et al. cc 3.3. Some results. The following trichotomy theorem for kregular symmetric spin systems is given by Cai & Kowalczyk (2012).
is a symmetric binary signature (w, x, z ∈ C), is Ptime computable in the following cases: In all other cases the problem Holant(= k |f ) is #P-hard. If the input is restricted to planar graphs, then another class becomes tractable, but everything else remains #P-hard: By Theorem 3.8, we have the following corollary. A trichotomy theorem for 3-regular asymmetric spin systems is given by Cai et al. (2019).
Theorem 3.10. Suppose w, x, y, z ∈ C. Then Holant(= 3 |(w, x, y, z)) is P-time computable in the following cases: In all other cases Holant(= 3 |(w, x, y, z)) is #P-hard. If the input is restricted to planar graphs, then another class becomes tractable, but everything else remains #P-hard: By Theorem 3.10, we have the following corollary. Corollary 3.11. Let f = (w, x, y, z) be a binary signature, where w, x, y, z ∈ C and f ∉ P, i.e., wz ≠ xy and there is at most one zero in {w, x, y, z}. If |w| ≠ |z| or |x| ≠ |y|, then Pl-Holant(= 3 |f ) is #P-hard.
We use the notation ≤ p T for Cook reduction, i.e., polynomialtime Turing reduction. In Lemma 3.12, Lemma 3.13 and Corollary 3.14, we use standard polynomial interpolation to realize polynomial Turing reduction.
Lemma 3.12. Let g be a complex-valued binary signature with the signature matrix N = P [ λ 0 0 μ ] P −1 , where P is an invertible 2 × 2 matrix. Suppose λμ ≠ 0 and λ μ is not a root of unity, then for any F, G and any a, b ∈ C, if h has signature matrix P [ a 0 0 b ] P −1 , then The same is true for Holant.
Proof. We will just prove it for Pl-Holant; the same proof works for Holant. Let l be any positive integer. In the setting of Pl-Holant(F, = 2 |G, g), if we connect l copies of g on the RHS via (= 2 ) on the LHS, we can realize g l on the RHS with the signature matrix N l = P [ λ l 0 0 μ l ] P −1 . Since λ μ is not a root of unity, for any positive integer l, ( λ μ ) l ≠ 1. Consider an instance Ω of Holant(F, = 2 |G, g, h). Suppose that h appears t times. We obtain Ω l , a signature grid in Pl-Holant(F, = 2 |G, g), from Ω by replacing each occurrence of h with g l . Since g l has the signature matrix N l , we can view Ω l equivalently by replacing g l with the binary signature obtained by sequentially connecting three binary signatures, which have signature matrices P , [ λ l 0 0 μ l ], and P −1 , respectively. We stratify the assignments in Ω l with nonzero evaluations based on the assignments to the t occurrences of the signature with the signature matrix [ λ l 0 0 μ l ]. Suppose there are i times it was assigned 00 with function value λ l , and j times 11 with function value μ l . To have a nonzero evaluation clearly i + j = t. Let c ij be the sum over all such assignments of the 4 Page 16 of 37 Cai et al. cc products of evaluations of all signatures (including the signatures corresponding to matrices P and P −1 ) in Ω l except [ λ l 0 0 μ l ]. Then By oracle calls to Pl-Holant(F, = 2 |G, g), we can get the values Holant Ω l for all 1 ≤ l ≤ t + 1. Since ( λ μ ) l ≠ 1 for l ≥ 1, we have ( λ μ ) u ≠ ( λ μ ) v , for any two distinct integers u, v ≥ 0. Therefore we get a non-singular Vandermonde system. In polynomial time we can solve for all c i,t−i , where 0 ≤ i ≤ t. Then we can compute ∑ i+j=t c ij a i b j , which is the desired Holant value Holant Ω . Hence,
The same is true for Holant.
Proof. Since f is non-degenerate, by the Jordan normal form, there exists a non-singular matrix P such that the signature matrix of f takes the form [ f 00 f 01 f 10 f 11 ] = P [ λ 0 0 μ ] P −1 with λμ ≠ 0 or, up to a nonzero constant multiple, [ f 00 f 01 f 10 f 11 ] = P [ 1 λ 0 1 ] P −1 with λ ≠ 0. In the first case, if there is a positive integer j such that λ j = μ j , then we may directly implement (= 2 ) on the RHS by connecting j copies of f via (= 2 ) on the LHS. Otherwise, λ μ is not a root of unity and we get (= 2 ) on the RHS by Lemma 3.12.
In the second case P [ 1 λ 0 1 ] P −1 , by connecting l copies of f on the RHS via (= 2 ) on the LHS, where l is a positive integer, we can implement f l with the signature matrix P [ 1 lλ 0 1 ] P −1 .

cc A Complexity Trichotomy
Page 17 of 37 4 The following proof is similar to Lemma 3.12. Consider an instance Ω of the problem Pl-Holant(F, = 2 |f, = 2 ). Suppose the signature (= 2 ) on the RHS appears t times. We obtain a planar signature grid Ω l , a problem in Pl-Holant(F, = 2 |f ), by replacing each occurrence of (= 2 ) on the RHS with f l . We can view our construction of Ω l as replacing f l with the binary signature obtained by sequentially connecting three binary signatures, which have signature matrices P , [ 1 lλ 0 1 ], and P −1 , respectively. We stratify the assignments in Ω l with nonzero evaluations based on the assignments to the t occurrences of the signature with the signature matrix [ 1 lλ 0 1 ]. Suppose there are i times it was assigned 00, 11 with function value 1, and j times 01 with function value lλ. Then i + j = t. Let c ij be the sum over all such assignments of the products of evaluations of all signatures (including the signatures corresponding to matrices P and P −1 ) in Ω l except [ 1 lλ By oracle calls to Pl-Holant(F, = 2 |f ), we can get the values Pl-Holant Ω l (F, = 2 |f ) for all 1 ≤ l ≤ t + 1. For any two distinct integers l, l ′ ≥ 0, lλ ≠ l ′ λ since λ ≠ 0. Therefore we get a nonsingular Vandermonde system. We can solve for all c ij (i + j = t).
The following lemma is a bipartite version of Lemma 3.1 by Lin & Wang (2018) with (= 4 ) on the LHS, and will be used in Lemma 4.19. We give a proof here for completeness although the idea totally belongs to Lin & Wang (2018). Proof. We prove the lemma by induction on d. The base case d = 1 is trivial. Let d ≥ 2, and assume the lemma holds for all d ′ < d. We prove (3.16) for d.
In case (1), we get (3.16) as follows: For every instance Ω of Holant(= 4 |F, f), let k be the number of occurrences of f . If k / ≡ 0 mod d, then return the value Holant Ω = 0. If k ≡ 0 mod d, then replace every d occurrences of f in Ω by one copy of f ⊗d , and we get an instance Ω ′ of Holant(= 4 |F, f ⊗d ). Then we return the value Holant Ω ′ .
In case (2), let k be the number of occurrences of f in Ω 0 , then k = qd + r, where 0 < r < d, q ≥ 0. We can use Ω 0 to derive a reduction Holant(= 4 |F, f ⊗(d−r) ) ≤ p T Holant(= 4 |F, f ⊗d ). Then by induction the proof is completed.
Suppose Ω 1 is an instance of Holant(= 4 |F, f ⊗(d−r) ). For each occurrence of f ⊗(d−r) , we append a copy of Ω 0 , and we group d copies of f in Ω 0 (there are q such groups) and replace each group by a copy of f ⊗d , and take the r remaining copies of f in Ω 0 together with one occurrence of f ⊗(d−r) in Ω 1 and replace them by a copy of f ⊗d . This creates an instance Ω 2 in Holant(= 4 |F, f ⊗d ). Its value Holant Ω 2 is the product of Holant Ω 1 and (Holant Ω 0 ) k ≠ 0. From this we can get Holant Ω 1 . ◻ cc A Complexity Trichotomy Page 19 of 37 4 Remark 3.17. The proof of Lemma 3.15 is non-constructive. In case (2), we do not know how to find Ω 0 and constructively produce the reduction. As Ω 0 exists in case (2), it has a constant size independent of the size of the input instance Ω 1 , and the induction gives an iteration at most d times. So, the proof establishes the existence of a polynomial time reduction.
The proof of Lemma 3.15 is non-planar. Thus, it cannot be applied directly to planar Holant problems. We give the following lemma for planar graphs. Given any instance Ω of Pl-Holant(= 4 |F, f, [1, 1]), we may assume the planar graph of Ω is connected, since the Holant value on Ω is the product over its connected components. Moreover, since all signatures in F have even arities, the number of occurrences of [1, 1] must be even.
Let T be a spanning tree of the dual graph of Ω, and pick any node as the root of T . For definiteness we pick the node of T that corresponds to the external face of Ω as root. Let F be a leaf node of T , corresponding to a face F of Ω. Suppose there are an even number of [1, 1] inside F , then we can connect them in pairs within the face F by copies of [1, 1] ⊗2 , maintaining planarity. Suppose there are an odd number of [1, 1] in the face F and suppose F is not the root of T . Let the parent node of F correspond to the face F ′ of Ω, and F and F ′ share the edge e in Ω. Then we replace 4 Page 20 of 37 Cai et al. cc  e by a path of length 2, put (= 4 ) on the new node, and connect two input variables of (= 4 ) each to a copy of [1, 1], one inside F and one inside F ′ . This operation effectively changes the new (= 4 ) to (= 2 ), thus not changing the Holant value, while at the same time changing the parity of the numbers of [1, 1]'s inside F and F ′ . This is illustrated in Figure 3.1.

Trichotomy for Spin Systems on 4-regular Graphs
In this section, we prove Theorem 5.1 for the special case k = 4. This is stated as Theorem 4.29. We say a non-singular M has infinite projective order if M n is not a scalar multiple of I for any n ≥ 1. Let y ∈ R.
The ratio of the two eigenvalues is 1+yi 1−yi . Therefore this M has infinite projective order iff 1+yi 1−yi is not a root of unity. The following lemma is a reduction that follows from Theorem 2.2. Lemma 4.1. Let F be any signature set containing a binary signature (1, x, −x, 1), where x ∈ R and x ≠ 0, ±1. Then, Holant(= 4 |F, (1, y, −y, 1)) ≤ p T Holant(= 4 |F), for some y ∈ R satisfying the property that the ratio 1+yi 1−yi of the eigenvalues 1 ± yi of the signature matrix [ 1 y −y 1 ] is not a root of unity. Thus, [ 1 y −y 1 ] has infinite projective order.
Proof. In Holant(= 4 |F), by adding a loop to (= 4 ) using (1, x, −x, 1) ∈ F, we have (= 2 ) on the LHS. Since (1, x, −x, 1) is non-degenerate, by Lemma 3.13 we obtain (= 2 ) on the RHS. Once we have (= 2 ) on both sides we can freely move signatures from either side, and so we can ignore the bipartite restriction. By the construction in Figure 2, Recall that this means, if we assign (b 1 , b 2 ) ∈ {0, 1} 2 to the two external edges and form the sum over all 0-1 assignments on internal edges, of the product values of signature evaluations, we get the value in the matrix in row b 1 and column b 2 .
The matrix [ 1−x 2 x −x 1−x 2 ] has two nonzero eigenvalues 1 − x 2 ± xi, with ratio a+bi a−bi , where a = 1 − x 2 and b = x. This ratio is a root of unity iff the complex argument ϕ of a + bi = |a + bi|e iϕ is a rational multiple of π, where cot(ϕ) = a b . Similarly, [ 1−x 2 2x −2x 1−x 2 ] has two nonzero eigenvalues 1 − x 2 ± 2xi, with ratio a+2bi a−2bi . This ratio is a root of unity iff the complex argument ψ of a + 2bi = |a + 2bi|e iψ is a rational multiple of π, where cot(ψ) = a 2b . By Theorem 2.2 these cannot both happen. Therefore at least one of the two constructions defines a matrix that has infinite projective order. ◻ Let f = (w, x, y, z) be a binary signature where w, x, y, z ∈ R. If wz = xy or there are two or more zeros in {w, x, y, z}, then f ∈ P and Holant(= 4 |f ) can be computed in polynomial time. Moreover, if x = y, then f is symmetric and Theorem 5.1 follows from Theorem 3.8. Thus we now assume the following for the remainder of Section 4:

Assumption:
The binary signature f = (w, x, y, z) satisfies wz ≠ xy, x ≠ y and there is at most one zero in {w, x, y, z}.
First, we consider the case that there is exactly one zero in {w, z}. (w, x, y, z), where w, x, y, z ∈ R. If there is exactly one zero in {w, z} and xy ≠ 0, then Pl-Holant(= 4 |f ) is # P-hard.