The complexity of approximating the complex-valued Potts model

We study the complexity of approximating the partition function of the $q$-state Potts model and the closely related Tutte polynomial for complex values of the underlying parameters. Apart from the classical connections with quantum computing and phase transitions in statistical physics, recent work in approximate counting has shown that the behaviour in the complex plane, and more precisely the location of zeros, is strongly connected with the complexity of the approximation problem, even for positive real-valued parameters. Previous work in the complex plane by Goldberg and Guo focused on $q=2$, which corresponds to the case of the Ising model; for $q>2$, the behaviour in the complex plane is not as well understood and most work applies only to the real-valued Tutte plane. Our main result is a complete classification of the complexity of the approximation problems for all non-real values of the parameters, by establishing \#P-hardness results that apply even when restricted to planar graphs. Our techniques apply to all $q\geq 2$ and further complement/refine previous results both for the Ising model and the Tutte plane, answering in particular a question raised by Bordewich, Freedman, Lov\'{a}sz and Welsh in the context of quantum computations.


Introduction
The q-state Potts model is a classical model of ferromagnetism in statistical physics [35,44] which generalises the well-known Ising model. On a (multi)graph G = (V, E), configurations of the model are all possible assignments σ : V → [q] where [q] = {1, . . . , q} is a set of q spins with q ≥ 2. The model is parameterised by y, which is a function of the temperature of the model and is also known as the edge interaction. Each configuration σ is assigned weight y m(σ) where m(σ) denotes the number of monochromatic edges of G under σ. The partition function of the model is the aggregate weight over all configurations, i.e., y m(σ) , When q = 2, this model is known as the Ising model, and we sometimes use the notation Z Ising (G; y) to denote its partition function.
The Ising/Potts models have an extremely useful generalisation to non-integer values of q via the so-called "random-cluster" formulation and the closely related Tutte polynomial. In particular, for numbers q and γ, the Tutte polynomial of a graph G is given by where k(A) denotes the number of connected components in the graph (V, A) (isolated vertices do count). When q is an integer with q ≥ 2, we have Z Potts (G; q, y) = Z Tutte (G; q, y − 1), see, for instance, [37]. The Tutte polynomial on planar graphs is particularly relevant in quantum computing since it corresponds to the Jones polynomial of an "alternating link" [44,Chapter 5], and polynomial-time quantum computation can be simulated by additively approximating the Jones polynomial at a suitable value, as we will explain later in more detail, see also [6] for details.
In this paper, we study the complexity of approximating the partition function of the Potts model and the Tutte polynomial on planar graphs as the parameter y ranges in the complex plane. Traditionally, this problem has been mainly considered in the case where y is a positive real, however recent developments have shown that for various models, including the Ising and Potts models, there is a close interplay between the location of zeros of the partition function in the complex plane and the approximability of the problem, even for positive real values of y.
The framework of viewing partition functions as polynomials in the complex plane of the underlying parameters has been well-explored in statistical physics and has recently gained traction in computer science as well in the context of approximate counting. On the positive side, zero-free regions in the complex plane translate into efficient algorithms for approximating the partition function [1,32] and this scheme has lead to a broad range of new algorithms even for positive real values of the underlying parameters [29,34,31,30,33,2,18,19,20]. On the negative side, the presence of zeros poses a barrier to this approach and, in fact, it has been demonstrated that zeros mark the onset of computational hardness for the approximability of the partition function [16,12,5,4]. These new algorithmic and computational complexity developments stemming from the complex plane mesh with the statistical physics perspective where zeros have long been studied in the context of pinpointing phase transitions, see e.g., [37,44,21,28,45,3].
For the problem of exactly computing the partition function of the Potts model, Jaeger, Vertigan and Welsh [23], as a corollary of a more general classification theorem for the Tutte polynomial, established #P-hardness unless (q, y) is one of seven exceptional points, see Section 6.3 for more details; Vertigan [42] further showed that the same classification applies on planar graphs with the exception of the Ising model (q = 2), where the problem is in FP.
For the approximation problem, the only known result that applies for general values y in the complex plane is by Goldberg and Guo [12], which addresses the case q = 2; the case q ≥ 3 is largely open apart from the case when y is real which has been studied extensively even for planar graphs [24,13,14,16,27,12]. We will review all these results more precisely in the next section, where we also state our main theorems.

Our main results
In this work, we completely classify the complexity of approximating Z Potts (G; q, y) for q ≥ 2 and non-real y, even on planar graphs G; in fact, our results also classify the complexity of the Tutte polynomial on planar graphs for reals q ≥ 2 and non-real γ. Along the way, we also answer a question for the Jones polynomial raised by Bordewich, Freedman, Lovász, and Welsh [6].
To formally state our results, we define the computational problems we consider. Let K and ρ be real algebraic numbers with K > 1 and ρ > 0. We investigate the complexity of the following problems for any integer q with q ≥ 2 and any algebraic number y. 1 Theorem 1. Let q ≥ 3 be an integer, y ∈ C\R be an algebraic number, and K > 1. Then, the problems Factor-K-NormPlanarPotts(q, y) and Distance-π/3-ArgPlanarPotts(q, y) are #P-hard, unless q = 3 and y ∈ {e 2πi/3 , e 4πi/3 } when both problems can be solved exactly in polynomial time.
We remark that, for real y > 0, the complexity of approximating Z Potts (G; q, y) on planar graphs is not fully known, though on general graphs the problem is #BIS-hard [14] and NPhard for y ∈ (0, 1) [13], for all q ≥ 3. For real y < 0, the problem is NP-hard on general graphs when y ∈ (−∞, 1 − q] for all q ≥ 3 ([16]) 2 and #P-hard on planar graphs when y ∈ (1 − q, 0) and q ≥ 5 ( [27], see also [15]). Our techniques for proving Theorem 1 allow us to resolve the remaining cases q = 3, 4 for y ∈ (1 − q, 0) on planar graphs, as a special case of the following theorem that applies for general q ≥ 3. This is our second main result.
Our third main contribution is a full classification of the range of the parameters where approximating the partition function of the Ising model is #P-hard. Note, on planar graphs G, Z Ising (G; y) can be computed in polynomial time for all y. For general (non-planar) graphs and non-real y, Goldberg and Guo show #P-hardness on the non-real unit circle (|y| = 1) with y = ±i, and establish NP-hardness elsewhere. Our next result shows that the NP-hardness results of [12] for non-real y can be elevated to #P-hardness.
Theorem 3. Let y ∈ C\R be an algebraic number, and K > 1. Then, Factor-K-NormIsing(y) and Distance-π/3-ArgIsing(y) are #P-hard, unless y = ±i when both problems can be solved exactly in polynomial time.

Consequences of our techniques for the Tutte/Jones polynomials
While our main results are on the Ising/Potts models, in order to prove them it is convenient to work in the "Tutte world"; this simplifies the proofs and has also the benefit of allowing us to generalise our results to non-integer q. The following result generalises Theorem 1 to non-integer q > 2.
Our techniques can further be used to elevate previous NP-hardness results of [16,13] in the Tutte plane to #P-hardness for planar graphs, and answer a question for the Jones polynomial raised by Bordewich et al. in [6]. A more detailed discussion can be found in Section 7.

Proof outline
In this section we provide some insight on the proofs of our main results. As mentioned earlier, the proofs are performed in the context of the Tutte polynomial.
In previous #P-hardness results [16,12] for the Tutte polynomial, the main technique was to reduce the exact counting #MinimumCardinality (s, t)-Cut problem to the problem of approximating Z Tutte (G; q, γ) using an elaborate binary search based on suitable oracle calls. Key to these oracle calls are gadget constructions which are mainly based on seriesparallel graphs which "implement" points (q ′ , γ ′ ); this means that, by pasting the gadgets appropriately onto a graph G, the computation of Z Tutte (G; q ′ , γ ′ ) reduces to the computation of Z Tutte (G; q, γ). Much of the work in [16,12], and for us as well, is understanding what values (q ′ , γ ′ ) can be implemented starting from (q, γ).
For planar graphs, while the binary-search technique from [12] is still useful, we have to use a different overall reduction scheme since the problem #MinimumCardinality (s, t)-Cut is not #P-hard when the input is restricted to planar graphs [36]. To obtain our #P-hardness results our plan instead is to reduce the problem of exactly evaluating the Tutte polynomial for some appropriately selected parameters q ′ , γ ′ to the problem of computing its sign and the problem of approximately evaluating it at parameters q, γ; note, this gives us the freedom to use any parameters q ′ , γ ′ we wish as long as the corresponding exact problem is #P-hard. Then, much of the work consists of understanding what values (q ′ , γ ′ ) can be implemented starting from (q, γ), so we focus on that component first.
We first review previous constructions in the literature, known as shifts, and then introduce our refinement of these constructions, which we call polynomial-time approximate shifts, and state our main result about them.

Shifts in the Tutte plane
We say that that there is a shift from (q, γ 1 ) to (q, γ 2 ) if there is a graph H = (V, E) and vertices s, t such that where Z st (H; q, γ 1 ) is the contribution to Z Tutte (H; q, γ 1 ) from configurations A ⊆ E in which s, t belong to the same connected component in (V, A), while Z s|t (H; q, γ 1 ) is the contribution from all other configurations A. In the following, we will usually encounter shifts in the (x, y)-parametrisation of the Tutte plane, rather than the (q, γ)-parameterisation which was used for convenience here. To translate between these, set y = γ + 1 and (x − 1)(y − 1) = q, see [44,Chapter 3]. We denote by H q the hyperbola {(x, y) ∈ C 2 : (x − 1)(y − 1) = q}, and we will use both parametrisations as convenient. Section 3.2 has a more detailed description of shifts that apply to the multivariate Tutte polynomial.
As described earlier, shifts can be used to "move around" the complex plane. If one knows hardness for some (x 2 , y 2 ) ∈ H q , and there is a shift from (x 1 , y 1 ) ∈ H q to (x 2 , y 2 ), then one also obtains hardness for (x 1 , y 1 ). This approach has been very effective when attention is restricted to real parameters [13,15,16], however, when it comes to non-real parameters, the success of this approach has been limited. To illustrate this, in [12], the authors established #P-hardness of the Ising model when y 2 ∈ (−1, 0), and used this to obtain #P-hardness for y 1 on the unit circle by constructing appropriate shifts. However, their shift construction does not extend to general complex numbers, and this kind of result seems unreachable with those techniques.

Polynomial-time approximate shifts
To obtain our main theorems, we instead need to consider what we call polynomial-time approximate shifts; such a shift from (x 1 , y 1 ) ∈ H q to (x 2 , y 2 ) ∈ H q is an algorithm that, for any positive integer n, computes in time polynomial in n a graph G n that (x 1 , y 1 )-implements (x 2 ,ŷ 2 ) with |y 2 −ŷ 2 | ≤ 2 −n . In fact, our constructions need to maintain planarity, and we will typically ensure this by either making every G n a series-parallel graph, in which case we call the algorithm a polynomial-time approximate series-parallel shift, or by making every G n a theta graph, in which case we call the algorithm a polynomial-time approximate theta shift. 4 These generalised shifts allow us to overcome the challenges mentioned above and are key ingredients in our reduction. Our main technical theorem about them is the following.
Theorem 5. Let q ≥ 2 be a real algebraic number. Let x and y be algebraic numbers such Then, for any pair of real algebraic numbers (x ′ , y ′ ) ∈ H q there is a polynomial-time approximate series-parallel shift from (x, y) to (x ′ , y ′ ).
3 ), (ω 2 3 , ω 3 )} are precisely the non-real points of the (x, y) plane where the Tutte polynomial of a graph can be evaluated in polynomial time (see Section 6.3). As we will see, being able to (x, y)-implement approximations of any number in (−1, 0) is essentially the property that makes the approximation problem #P-hard at (x, y).
We remark that the idea of implementing approximations of a given weight or edge interaction has been explored in the literature, though only when all the edge interactions involved are real. We review these results in Section 4.
We study the properties of polynomial-time approximate shifts in Section 4 and prove Theorem 5 in Section 5. In the next section, we describe some of the techniques used.

Proof Outline of Theorem 5
Shifts, as defined in Section 2.1, have a transitivity property: if there is a shift from (x 1 , y 1 ) to (x 2 , y 2 ) and from (x 2 , y 2 ) to (x 3 , y 3 ), then there is a shift from (x 1 , y 1 ) to (x 3 , y 3 ), see Section 3.2 for more details.
The polynomial-time approximate shift given in Theorem 5 is constructed in a similar way. First, we construct a polynomial-time approximate shift from (x, y) to some (x 2 , y 2 ) such that y 2 ∈ (−1, 0), where x 2 and y 2 depend on x, y. Then, we construct a polynomialtime approximate shift from (x 2 , y 2 ) to (x ′ , y ′ ). Finally, we combine both polynomial-time approximate shifts using an analogue of the transitivity property.
However, when this approach is put into practice, there is a difficulty that causes various technical complications: we only have mild control in our constructions over the intermediate shift (x 2 , y 2 ). In particular, even if the numbers x and y are algebraic, we cannot guarantee that x 2 and y 2 are algebraic, and this causes problems with obtaining the required transitivity property. Instead, we have to work with a wider class of numbers, the set P C of polynomialtime computable numbers. These are numbers that can be approximated efficiently, i.e., for y ∈ P C there is an algorithm that computesŷ n ∈ Q[i] with |y −ŷ n | ≤ 2 −n in time polynomial in n [26, Chapter 2]. We denote by P R = R ∩ P C the set of polynomial-time computable real numbers.
Our polynomial-time approximate shifts are constructed in Section 5. The first of these polynomial-time approximate shifts is provided by Lemma 6. Lemma 6. Let q be a real algebraic number with q ≥ 2. Let x and y be algebraic numbers Then there is a polynomial-time approximate series-parallel shift from (x, y) to (x ′ , y ′ ) for some (x ′ , y ′ ) ∈ H q with x ′ , y ′ ∈ P R and y ′ ∈ (0, 1).
The construction in Lemma 6 is obtained using a theta graph and trying to get a shift that is very close to the real line. However, we cannot control the point (x ′ , y ′ ) that we are approximating, and as mentioned, x ′ , y ′ might not be algebraic. The proof of Lemma 6 requires the most technical work in the paper and is given in Section 5.4.
Using Lemma 6, we have a series-parallel polynomial-time approximate shift from (x, y) to some (x ′ , y ′ ) ∈ H q with x ′ , y ′ ∈ P R and y ′ ∈ (0, 1). Next, we have to construct a polynomialtime approximate shift from (x ′ , y ′ ) to (x,ŷ), where (x,ŷ) is the point that we want to shift to in Theorem 5. In fact, we actually use a theta shift, which also facilitates establishing the required transitivity property later on. Note that since y ′ is not necessarily algebraic, we can not directly apply the results that have already appeared in the literature on implementing approximations of edge interactions. In the next lemma, we generalise these results to the setting of polynomial-time computable numbers, where we need to address some further complications that arise from computing with polynomial-time computable numbers instead of algebraic numbers. The proof of the lemma is given in Section 5.5. Lemma 7. Let q, x, y ∈ P R such that q > 0, (x, y) ∈ H q , y is positive and 1 − q/2 < y < 1. There is a polynomial-time algorithm that takes as an input: • two positive integers k and n, in unary; • a real algebraic number w ∈ [y k , 1].
The algorithm produces a theta graph J that (x, y)-implements (x,ŷ) such that ŷ − w ≤ 2 −n . The size of J is at most a polynomial in k and n, independently of w.
Then, we are able to combine the shifts in Lemmas 6 and 7 via a transitivity property for polynomial-time approximate shifts (see Lemma 17 in Section 4), and therefore prove Theorem 5, see Section 5 for the details.

The reductions
In Section 6.6 we show how to use a polynomial-time approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ) to reduce the problem of approximating the Tutte polynomial at (x 2 , y 2 ) to the same problem at (x 1 , y 1 ). The following lemma gives such a reduction for the problem of approximating the norm, we also give an analogous result for approximating the argument. Lemma 8. Let q = 0, γ 1 and γ 2 = 0 be algebraic numbers, and K > 1. For j ∈ {1, 2}, let y j = γ j + 1 and x j = 1 + q/γ j . If there is a polynomial-time series-parallel approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ), then we have a reduction from Factor-K-NormTutte(q, γ 2 ) to Factor-K-NormTutte(q, γ 1 ). This reduction also holds for the planar version of the problem.
In order to prove Lemma 8, we need some lower bounds on the norm of the partition function Z Tutte (G; q, γ). This kind of lower bound plays an important role in several hardness results on the complexity of approximating partition functions [12,4]. Here, we have to work a bit harder than usual since we have two (algebraic) underlying parameters (in the case of Tutte), and we need to use results in algebraic number theory, see Section 6.1 for details.
By combining Theorem 5 and Lemma 8 with existing hardness results, we obtain our hardness results for non-real edge interactions in Section 6.8. On the way, we collect some hardness on real parameters as well that strengthen previous results in the literature, and part of Section 6 is devoted to this. The main reason behind these improvements is that previous work on real parameters used reductions from approximately counting minimum cardinality (s, t)-cuts [16,12], the minimum 3-way cut problem [13], or maximum independent set for planar cubic graphs [15], which are either easy on planar graphs or the parameter regions they cover are considerably smaller or cannot be used to conclude #P-hardness. We instead reduce the exact computation of Z Tutte (G; q, γ) to its approximation, which has the advantage that the problem that we are reducing from is #P-hard for planar graphs [42]. Interestingly, our reduction requires us to apply an algorithm of Kannan, Lenstra and Lovász [25] to reconstruct the minimal polynomial of an algebraic number from an additive approximation of the number. The lower bounds on the partition function Z Tutte (G; q, γ) that are gathered in Section 6.1 also play a role in this reduction, the details will be given in Section 6.5.

The multivariate Tutte polynomial
The random cluster formulation of the multivariate Tutte polynomial is particularly convenient when working with implementations (as we will see in Section 3.2), and is defined as follows. Let G = (V, E) be a graph. For any γ : E → C and q ∈ C, the multivariate Tutte We will make use of the following notation. Let s and t be two distinct vertices of G. We define Z st (G; q, γ) = A⊆E: s and t in the same component Analogously, let Z s|t be the contribution to Z Tutte (G; q, γ) from the configurations A ⊆ E such that s and t are in different connected components in (V, A). That is, Z s|t (G; q, γ) = Z Tutte (G; q, γ) − Z st (G; q, γ).

Implementing weights, series compositions and parallel compositions
In this section, we define implementations, shifts, series compositions and parallel compositions. The definitions and results that we give are standard and can also be found, for instance, in [23,Section 4], [15,Section 2.1] or [37,Section 4].
Let q ∈ C with q = 0. The value of q is fixed across all this section. Let H be a weighted graph with weight functionγ. Let s and t be two distinct vertices of H, which are usually referred to as terminals. We say that the graph Hγ-implements the weight w with respect to the terminals s and t if We say that Hγ-implements the weight w if there are terminals s and t such that Hγimplements the weight w with respect to s and t. These definitions are motivated by Lemma 9, whose proof is a straightforward computation involving the definitions of implementations and the multivariate Tutte polynomial.

Lemma 9 ([15, Equation 2.2]).
Let G and H be two graphs with weight functions γ andγ respectively. Let f be an edge of G with weight γ f such that Hγ-implements γ f with respect to terminals s and t. Let G f be the graph constructed by considering the union of G and H, identifying the terminals s and t with the endpoints of f in G and removing f . Let γ ′ be the weight function on G f that inherits the weights from γ andγ. Then In particular, we have Z Tutte (G f ; q, γ ′ ) = Z s|t (H;q,γ) q 2 Z Tutte (G; q, γ). Moreover, if G γ-implements a weight w, then G f also γ ′ -implements w.
Therefore, if we can compute Z s|t (H; q,γ) efficiently, then computing Z Tutte (G; q, γ) is as hard as computing Z Tutte (G f ; q, γ ′ ). This observation leads to some of the reductions that appear in this paper.
In the remaining sections we usually assume that the weights are constant, that is, each edge of the graph has the same weight, and we will make it clear when this is not the case. In the constant weight function case Lemma 9 can be applied to each edge of the graph constructed by copying G and substituting each edge f in G by a copy of H (identifying the endpoints of f with s and t). Let α 1 , α 2 ∈ C. We say that there is a shift from (q, α 1 ) to (q, α 2 ) if there is a graph H that α 1 -implements α 2 . An important property of shifts is transitivity; if there are shifts from (q, α 1 ) to (q, α 2 ) and from (q, α 2 ) to (q, α 3 ), then there is a shift from (q, α 1 ) to (q, α 3 ). This is a consequence of Lemma 9. Let y 1 = α 1 + 1 and y 2 = α 2 + 1. We define x 1 and x 2 by q = (x 1 − 1)(y 1 − 1) = (x 2 − 1)(y 2 − 1), which is the change of variables that relates the Tutte polynomial and Z Tutte . We equivalently refer to the shift from (q, α 1 ) to (q, α 2 ) as a shift from (x 1 , y 1 ) to (x 2 , y 2 ), and we also say that H (x 1 , y 1 )-implements (x 2 , y 2 ). This notation is convenient to express many of the shifts considered in this paper.
To conclude this section we introduce two tools that will provide us with many examples of implementations and shifts: parallel compositions and series compositions. For each j ∈ {1, 2}, let G j be a graph, let s j and t j be two terminals of G j , and let γ j be a weight function such that G j γ j -implements a weight w j with respect to s j and t j .
Parallel compositions. The parallel composition of (G 1 , s 1 , t 1 ) and (G 2 , s 2 , t 2 ) is the graph G constructed by considering the union of G 1 and G 2 and identifying s 1 with s 2 and t 1 with t 2 . Letγ be the weight function on G inherited from γ 1 and γ 2 . It is well-known and easy to check that Gγ-implements the weight w = (1 + w 1 )(1 + w 2 ) − 1 with respect to the terminals s 1 and t 1 . Let (x 1 , y 1 ) and (x 2 , y 2 ) be the Tutte coordinates of (q, w 1 ) and (q, w 2 ) respectively (so y j = w j + 1 and (x j − 1)(y j − 1) = q). Then the Tutte coordinates of (q, w) are (x, y) with y = y 1 y 2 and (x − 1)(y − 1) = q. Let Υ be a graph with two vertices s, t and one edge joining them, and let Υ n be the parallel composition of n copies of (Υ, s, t) (so Υ n has two vertices and n edges joining them). Then Υ n (x, y)-implements (x ′ , y ′ ) with y ′ = y n and (x ′ − 1)(y ′ − 1) = q. This is known as an n-thickening of (x, y) and it yields a shift from (x, y) to (x ′ , y n ).
Series compositions. The series composition of (G 1 , s 1 , t 1 ) and (G 2 , s 2 , t 2 ) is the graph G constructed by considering the union of G 1 and G 2 and identifying t 1 with s 2 . Letγ be the weight function on G inherited from γ 1 and γ 2 . It is well-known and easy to check that Ĝ γ-implements the weight w = w 1 w 2 w 1 + w 2 + q with respect to the terminals s 1 and t 2 . Note that w satisfies Let (x 1 , y 1 ) and (x 2 , y 2 ) be the Tutte coordinates of (q, w 1 ) and (q, w 2 ) respectively (so y j = w j + 1 and (x j − 1)(y j − 1) = q). Then, in view of (3), the Tutte coordinates of (q, w) are (x, y) with x = x 1 x 2 and (x − 1)(y − 1) = q. Let Υ be a graph with two vertices s, t and one edge joining them, and let Υ n be the series composition of n copies of (Υ, s, t) (so Υ n is a path graph with n edges). Then Υ n (x, y)-implements (x ′ , y ′ ) with x ′ = x n and (x ′ − 1)(y ′ − 1) = q. This is known as an n-stretching of (x, y) and it yields a shift from (x, y) to (x n , y ′ ). For series-parallel and theta graphs (see Footnote 4), these constructions give that either Z s|t (G; q, γ) = 0, or the series-parallel graph G (with terminals s and t) γ-implements a weight w(G, s, t; q, γ) that can be computed from the recursive definition of series-parallel graphs in polynomial time. In particular, let Θ (l 1 ,...,lm) be the theta graph with m internal paths of lengths l 1 , . . . , l m . In this case, 5 we have that where x = 1 + q/γ. Series-parallel graphs can be built using series and parallel compositions.
The following definition is equivalent to the one in Footnote 4. A graph G is series-parallel (with terminals s and t) if either G is the graph with two vertices s and t and one edge joining them, or G is the parallel or series composition of (G 1 , s 1 , t 1 ) and (G 2 , s 2 , t 2 ), where s = s 1 , t = t 2 and G j is a series-parallel graph with terminals s j and t j [8, Chapter 11]. Finally, the size of a graph G = (V, E) is the integer size(G) = |V | + |E|. Note that the size of Θ (l 1 ,...,lm) is 2 m j=1 l j − m + 2.

Polynomial-time approximate shifts
Implementing a specific weight cannot always be achieved. Nonetheless, sometimes we can implement an approximation of the desired weight with as much precision as we need. These implementations have been exploited several times in the literature on Tutte polynomials and the Ising model; see [13,15,16,17]. Here we collect some of these results appearing in [16], which in turn are based on arguments in [15]; here, we follow the presentation in [17] (that was stated for q = 2).
This algorithm produces a theta graph G that (x, y)-implements (x,ŷ) such that y ′ −ŷ ≤ 2 −n . The size of G is at most a polynomial in n and k, independently of y ′ .
In Lemma 7 (Section 5), we give a similar result to Lemma 10 where the numbers x and y may not be algebraic. The fact that the graph G computed in Lemma 10 is a theta graph is not directly stated in the statement of [16,Lemma 5] but it can easily be inferred from the proof. This also applies to Lemma 11.
This algorithm produces a theta graph G = (V, E) and a weight functionγ : E → {y 1 −1, y 2 −1} such that Gγ-implements (x,ŷ) with y ′ −ŷ ≤ 2 −n . The size of G is at most a polynomial in n and k, independently of y ′ . Moreover, if either y 1 < 0 or y 2 < 0, then the restriction that y ′ is positive can be replaced with a restriction that y ′ is non-zero.
Proof. This result easily follows from Lemmas 10 and 11 by an argument of Goldberg and Jerrum (see the proof of [16,Lemma 2]). We include here their argument for completeness. The case when y ′ ≥ 1 has been covered in Lemmas 10 and 11. First, let us assume that y ′ ∈ (0, 1). We have 1 ≤ y ′ · y −2k 1 ≤ |y 1 | −2k and using Lemmas 10 and 11 we can implementỹ with |ỹ − y ′ · y −2k 1 | ≤ 2 −n . We have |y 2k 1ỹ − y ′ | ≤ 2 −n , so we setŷ = y 2k 1ỹ . The graph G is the parallel composition of the graph used to implementỹ and 2k edges with weight y 1 . Finally, let us assume that there is i ∈ {1, 2} such that y i < 0, and let us consider the case where y ′ is negative. We implement an approximationŷ ′ of y ′ /y i > 0, and returnŷ =ŷ ′ y i . The graphs G produced by the algorithms given in Lemma 10, Lemma 11 and Corollary 12 are theta graphs. One may wonder which weights can be approximated as in these results. This leads to the following definition. Let (x 1 , y 1 ), (x 2 , y 2 ) ∈ H q . Let γ 1 = y 1 − 1 and γ 2 = y 2 − 1. We say that there is a polynomial-time approximate shift from (q, γ 1 ) to (q, γ 2 ) or, equivalently, from (x 1 , y 1 ) to (x 2 , y 2 ), if there is an algorithm that, for any positive integer n, computes in polynomial time in n a graph G n that (x 1 , y 1 )-implements (x 2 ,ŷ 2 ) with |y 2 −ŷ 2 | ≤ 2 −n . If the graph G n computed by this algorithm is always a theta graph (resp. a series-parallel graph), then we say that this is a polynomial-time approximate theta shift (resp. polynomial-time approximate series-parallel shift). Lemma 10 gives polynomialtime approximate theta shifts from (x 1 , y 1 ) to (x 2 , y 2 ) when the considered numbers are real algebraic, y 1 ∈ [−1, 1], y 2 ∈ [1, ∞) and q > 0. Note that shifts are a particular case of polynomial-time approximate shifts. Moreover, due to the transitivity property of shifts, if there is a shift from (x 1 , y 1 ) to (x 2 , y 2 ) and there is a polynomial-time approximate shift from (x 2 , y 2 ) to (x 3 , y 3 ), then there is a polynomial-time approximate shift from (x 1 , y 1 ) to (x 3 , y 3 ). In fact, polynomial-time approximate shifts exhibit some of the properties of shifts; in Lemma 13 we show that they behave well with respect to parallel and series compositions and in Lemma 17 we show that they are transitive under certain conditions. In Section 5 we give more examples of polynomial-time approximate shifts, some of which will be constructed by transitivity. These approximate shifts play an important role in our hardness proofs.
Moreover, if the polynomial-time approximate shifts from (x 1 , y 1 ) to (x 2 , y 2 ) and (x 3 , y 3 ) are series-parallel, then the obtained polynomial-time approximate shifts are also series-parallel.
Proof. For j ∈ {2, 3}, let G n,j be the graph computed by the polynomial-time approximate shift from (x 1 , y 1 ) to (x j , y j ), so G n,j (x 1 , y 1 )-implements (x j ,ŷ j ) with |y j −ŷ j | ≤ 2 −n , for certain terminals t j and s j .
Therefore, for k large enough, the graphs P n+k give a polynomial-time approximate shift from (x 1 , y 1 ) to (x 4 , y 4 ) with y 4 = y 2 y 3 .
For Item 2, the proof is analogous but now we define the graph S n as the series composition of (G n,2 , s 2 , t 2 ) and (G n,3 , s 3 , t 3 ), which gives a shift from (x 1 , y 1 ) to (x 2x3 ,ŷ 4 ) ∈ H q .
Note that if the original polynomial-time approximate shifts are series-parallel, then the obtained ones are also series-parallel by the definition of series-parallel graphs.
When it comes to hardness results, we are only interested in algebraic numbers. However, we will have to consider polynomial-time approximate shifts from (x 1 , y 1 ) to (x 2 , y 2 ) such that the numbers involved are not algebraic. This is due to the fact that, even if x 1 and y 1 are algebraic, x 2 and y 2 might not be. Nonetheless, in that case we can ensure that x 2 and y 2 are polynomial-time computable. A real number x is polynomial-time computable if there is a function φ : N → Q that is computable in polynomial time (with the input written in unary notation, i.e., 0 n ) such that |x − φ(n)| ≤ 2 −n for all n ∈ N [26, Chapter 2]. The definition given in [26,Chapter 2] uses dyadic rational numbers instead of rational numbers, but these two definitions are easily seen to be equivalent. We denote the set of polynomial-time computable real numbers by P R . One can easily show that the set P R is a field. Real algebraic numbers are in P R because we can approximate them as closely as we want by applying Sturm sequences and binary search [11]. We say that a complex number z is polynomial-time computable if z = x + iy for some x, y ∈ P R . We denote the set of polynomial-time computable complex numbers by P C . Algebraic numbers are in P C (their real and imaginary parts are real algebraic numbers). It turns out that P C is an algebraically-closed field [26,Chapter 2]. In particular, for z ∈ P C , we have |z| ∈ P R .
If there is a polynomial-time approximate theta shift from (x 1 , y 1 ) to (x 2 , y 2 ) and x 1 and y 1 are algebraic, then we can compute in polynomial time in n an algebraic number that additively approximates y 2 up to an additive error 2 −n . Since we can approximate algebraic numbers by rational numbers efficiently, it follows that x 2 and y 2 are polynomialtime computable. However, if we only know that x 1 and y 1 are polynomial-time computable, then it is not clear if x 2 and y 2 are polynomial-time computable or not. Lemma 16 gives a partial answer to this question and plays a key role in our transitivity result for polynomialtime approximate shifts (Lemma 17). First, we need to prove some lemmas on polynomialtime computable numbers. Lemma 14. Let z ∈ P C . There is an algorithm that computes b 1 ∈ Q with |z| ≤ b 1 . Moreover, if z = 0, then there is an algorithm that computes b 2 ∈ Q with 0 < b 2 ≤ |z|.
. This computation for n = 1 gives the upper boundx 1 + 1/2. Note that the sequencesx n − 2 −n andx n + 2 −n converge to x. Hence, if x = 0, then there must be n such that 0 <x n − 2 −n ≤ x. We computex n until this inequality happens, obtaining the desired lower bound.
Lemma 15. Let z ∈ P C with |z| = 1. There is a polynomial-time algorithm that takes as inputs two positive integers n and k and computes a positive integer r(n, k) such that 1. r(n, k) is increasing in k; 2. r(n, k) = n + Θ(k); Proof. By Lemma 14, we can compute an integer t ≥ 0 such that 2 −t ≤ ||z| − 1| and |z| ≤ 2 t . Note that for every integer k ≥ 1 we have the bound z k − 1 ≥ 2 −t . Indeed, if |z| < 1, then and when |z| > 1, we analogously find that Let n and k be the inputs of our algorithm. Let r(n, k) = n + (t + 1)(k + 1), and note that r is increasing in k and r(n, k) = n + Θ (k), establishing Items 1 and 2.
This algorithm computes f (n, G) such that Proof. Let y = γ + 1 and x = 1 + q/γ. Note that |x| = 1 if and only if |γ + q| = |γ|. By basic geometry, the latter statement is equivalent to γ ∈ −q/2 + iqR. Hence, by hypothesis, |x| = 1. There are two cases: • |x| < 1. Then for any positive integer k we have • |x| > 1. Then for any positive integer k we have Since q, x ∈ P C , we can apply Lemma 14 along with the above bounds to compute a nonnegative integer t x such that 1 + q/(x k − 1) ≤ 2 tx for every positive integer k. Lemma 14 also allows us to compute non-negative integers t q and t γ such that |q| ≤ 2 tq and 2 −tγ ≤ |γ|. Let n and G = Θ (l 1 ,...,lm) be the inputs of our algorithm. Let k = max{l 1 , . . . , l m }. Since |x| = 1, we can compute g(n, G) = r(n + (t x + 1)(m + 1) + t q , k), where r is as in Lemma 15 for the polynomial-time computable number x. We compute f (n, G) = g(n, G) + t q + 2t γ + 1.
We claim that f satisfies the statement. In view of the properties of r, we have f (n, G) = g(n, G) + Θ (1) = n + Θ (size(G)) .
We now prove the main transitivity property of polynomial-time approximate shifts that we will use in our constructions.
Lemma 17. Let q ∈ P C with q = 0 and let (x j , y j ) ∈ H q for each j ∈ {1, 2, 3}. Let us assume that the following hypotheses hold: 1. x 2 and y 2 are polynomial-time computable; 3. there is a polynomial-time approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ); 4. there is a polynomial-time approximate theta shift from (x 2 , y 2 ) to (x 3 , y 3 ).
Then there is a polynomial-time approximate shift from (x 1 , y 1 ) to (x 3 , y 3 ). Moreover, if the polynomial-time approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ) is series-parallel, then the polynomial-time approximate shift from (x 1 , y 1 ) to (x 3 , y 3 ) is also series-parallel.
Proof. Let γ j = y j − 1 for every j ∈ {1, 2, 3}. Let n be a positive integer. We give an algorithm that constructs a graph J n , in polynomial time in n, such that J n γ 1 -implementŝ γ 3 with |γ 3 −γ 3 | ≤ 2 −n . This algorithm is as follows. First, we use the approximate theta shift from (x 2 , y 2 ) to (x 3 , y 3 ) to compute a theta graph G 2 with terminals s 2 and t 2 such that The size of G 2 is at most polynomial in n. In light of Lemma 16, we can compute, in polynomial time in n, a positive integer f (n + 1, We also have f (n + 1, (5) and (6) with the triangle inequality, we obtain Finally, we construct a graph J n as a copy of G 2 where every edge is substituted by a copy of G 1 as in Lemma 9. Since the sizes of G 1 and G 2 are polynomial in n, the size of J n also is polynomial in n. Recall that G 2γ2 -implementsγ 3 = w(G 2 , s 2 , t 2 ; q,γ 2 ) and G 1 γ 1 -implementŝ γ 2 . Therefore, the graph J n γ 1 -implementsγ 3 , and |γ 3 −γ 3 | ≤ 2 −n , as we wanted to obtain. Finally, if the polynomial-time approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ) is series-parallel, then the graphs J n are easily seen to be series-parallel, and the result follows.

Polynomial-time approximate shifts with complex weights
In this section we show how to implement approximations of real weights when the original weight is a non-real algebraic number. As a consequence of our results, for any real algebraic number q with q ≥ 2 and any pair of algebraic numbers (x, y) ∈ H q with y ∈ R and (x, there is a polynomialtime approximate shift from (x, y) to any pair of real algebraic numbers (x ′ , y ′ ) ∈ H q (see Theorem 5). Our approach to prove Theorem 5 is as follows. First, we show that there is (x ′ , y ′ ) ∈ H q with y ′ ∈ (0, 1) such that there is a polynomial-time approximate theta shift from (x, y) to (x ′ , y ′ ) (see Lemma 33). Since x and y are algebraic, it follows that x ′ and y ′ are polynomial-time computable. Secondly, we extend part of Lemma 10 to the case where the numbers involved are only known to be polynomial-time computable (see Lemma 7). Finally, we use the transitivity property given in Lemma 17 to combine both results in the proof of Theorem 5.

Computing with algebraic numbers
In our proofs we use and develop some algorithms on algebraic numbers. We gather these algorithms in this section. We represent an algebraic number z as its minimal polynomial p and a rectangle R of the complex plane such that z is the only root of p in R. We can compute the addition, subtraction, multiplication, division and conjugation of algebraic numbers in polynomial time in the length of their representations, see [40] for details. As a consequence, we can also compute the real and imaginary parts of z and the norm of z, which are algebraic numbers themselves, in polynomial time. Note that an algebraic number is 0 if and only if its minimal polynomial is x, which can be easily checked in this representation. Hence, we can also determine in polynomial time whether two algebraic numbers z 1 and z 2 are equal by checking if z 1 − z 2 is 0.
When z is a real algebraic number, we can simply represent it as its minimal polynomial p and an interval I with rational endpoints such that z is the only root of p in I. If we are given a real algebraic number z with this representation, then we can approximate it as closely as we want by applying Sturm sequences and binary search [11]. In fact, for z 1 and z 2 real algebraic numbers, Sturm sequences also allow us to check whether z 1 ≥ z 2 in time polynomial in the length of the representations of z 1 and z 2 . See [11] for more details and complexity analysis.
A root of unity is a complex number z such that z k = 1 for some positive integer k. The smallest positive integer n such that z n = 1 is the order of z. Note that roots of unity are algebraic numbers. The roots of unity of order n share the same minimal polynomial, known as the n-th cyclotomic polynomial, whose degree is ϕ(n), the Euler phi function. We can determine whether an algebraic number z is a root of unity by checking whether its minimal polynomial is cyclotomic, see [7] for a polynomial-time algorithm. If z is a root of unity, then we can easily compute its order from its representation; we compute the smallest n such that the minimal polynomial of z divides z n − 1. This computation runs in polynomial time in the length of the representation of z as a consequence of the elementary bound ϕ(n) ≥ n/2.
Another operation that we can perform in polynomial time is checking if the argument of an algebraic number is in a fixed interval.
Then for any algebraic number z we can check whether Arg(z) ∈ [2πa, 2πb] in time polynomial in the length of the representation of z.
Proof. We can split the interval [2πa, 2πb] into intervals of length at most π/2 and check if Arg(z) belongs to any of those intervals. Hence, let us assume for the sake of simplicity that [2πa, 2πb] ⊆ [0, π/2]. The other cases are analogous. Note that e 2πia and e 2πib are roots of unity and, in particular, algebraic. Thus, we can compute z a = ze −2πia and Finally, note that, for any algebraic number y, since Re(y) and Im(y) are algebraic, we can determine if Arg(y) ∈ [0, π/2] or not by checking the inequalities Re(y) ≥ 0 and Im(y) ≥ 0.
In the rest of this section we show how to efficiently compute a sequence σ(n) such that Arg(z σ(n) ) ∈ [2πa, 2πb] for every n. We will use the following well-known result, see, e.g., [9, Section 1.2]: if z ∈ C is not a root of unity and |z| = 1, then {z j : j ∈ N} is dense in the unit circle.
Let z be an algebraic number such that |z| = 1 and z is not a root of unity. Then there exists a sequence of positive integers {σ(n)} and a positive integer k such that such that: 1. k can be computed from z; 2. σ(n) can be computed in polynomial time in n; 3. n ≤ σ(n) ≤ n + k − 1 for every positive integer n; 4. Arg(z σ(n) ) ∈ [2aπ, 2bπ] + 2πZ for every positive integer n.
We conclude that σ(n) is well-defined and n ≤ σ(n) ≤ m n ≤ n + k − 1, so our algorithm computes σ(n) in polynomial time in n.
Lemma 20. Let z be a root of unity of order k with k ∈ {1, 2, 4}. Then there exists a sequence of positive integers {σ(n)} and an integer l such that: 1. σ(n) can be computed in polynomial time in n; 2. n ≤ σ(n) ≤ n + k − 1 for every positive integer n; 3. z σ(n) = e 2πil/k for every positive integer n; Proof. Let θ = Arg(z). Since θ = 0, we can write θ = 2πj/k for some integer j coprime with k. We consider two cases.
Corollary 21. Let z be an algebraic number such that z ∈ R ∪ iR. Let θ = Arg(z). Then there exists a sequence of positive integers {σ(n)}, a positive integer k and a positive rational number C such that such that: 1. k and C can be computed from z; 2. σ(n) can be computed in polynomial time in n; 3. n ≤ σ(n) ≤ n + k − 1 for every positive integer n; 4. cos(σ(n)θ) ≤ −C and sin(σ(n)θ) ≤ −C for every positive integer n.
Proof. We may assume that |z| = 1 since, otherwise, we can compute the algebraic number z/|z| and apply the following algorithm to this quantity. We invoke either Lemma 19 for a = 7/12 and b = 8/12 or Lemma 20, depending on whether z is a root of unity or not, which can be checked as explained at the beginning of this section. In any case, we find a sequence σ and a positive integer k that satisfy the first three assertions announced in the statement. In the non-root of unity case, we have cos(σ(n)θ) ≤ cos(2πb) < 0 and sin(σ(n)θ) ≤ sin(2πa) < 0 for every positive integer n. In the root of unity case, the sequences cos(σ(n)θ) and sin(σ(n)θ) are negative constants. In any case, we can compute a positive rational number C such that cos(σ(n)θ) ≤ −C and sin(σ(n)θ) ≤ −C for every positive integer n.

Corollary 22.
Let z be an algebraic number with |z| > 1. Then for any x ∈ Q with x > 0, we can compute n such that Proof. Let z = Re iθ for some θ ∈ [0, 2π) and R > 1. We determine if z/|z| = e iθ is a root of unity or not, and compute its order as explained before. If e iθ is a root of unity of order k, then z k ∈ (1, ∞), so computing n is straightforward. If e iθ is not a root of unity, then, in view of Lemma 20 for a = 1/12 and b = 1/6, we can compute a sequence σ such that σ(j) ≥ j and σ(j)θ ∈ [π/6, π/3] + 2πZ for every positive integer j. We find that Re(z σ(j) ) ≥ R σ(j) cos(π/3) ≥ R j /2. Hence, we can compute j large enough such that Re(z σ(j) ) ≥ x and we choose n = σ(j). Now let us assume that z ∈ [0, ∞). Note that e iθ = 1. If e iθ is a root of unity of order 2 or 4, then the result is trivial. If θ ∈ {0, π/2, π, 3π/2}, then, by invoking Corollary 21, we compute σ and a positive rational number C such that σ(j) ≥ j and cos(σ(j)θ) ≤ −C for every positive integer j. We find that Re(z σ(j) ) ≤ −CR σ(j) ≤ −CR j . Hence, we can compute j large enough such that Re(z σ(j) ) ≤ −x and we choose m = σ(j).

Some shifts for non-real algebraic numbers
In this section we gather some of the shifts that we use in our proofs. Let q be a real algebraic number with q ≥ 2 and let (x, y) ∈ H q be a pair of algebraic numbers. We are interested in computing a shift from (x, y) to (x 1 , y 1 ) ∈ H q with x 1 ∈ R and |x 1 | > 1 whenever possible. The existence of this shift turns out to be closely related to the hardness of approximating |Z Tutte (G; q, γ)| with γ = y − 1; when we can compute such a shift the approximation problem is #P-hard, as we will see in Section 6. Recall that one can evaluate the Tutte polynomial of a graph in polynomial time at any of the points in 3). These are the points for which our results fail to construct the desired shift.
The results of this section involve computations that might not run in polynomial time in the length of the representation of the algebraic numbers q, x and y involved. However, when applying these results, the numbers q, x and y are constants and, hence, this will not affect the complexity of our algorithms.
Remark 23. Let q be a positive real number and let (x, y) ∈ H q . From (x − 1)(y − 1) = q it follows that x is real if and only if y is real. Note that x = 1 + q/(y − 1) = (y + q − 1)/(y − 1). As noted in the proof of Lemma 16, we find that |x| = 1 if and only if |y Note that when q ≥ 2 and Re(y) > 0, we have Re(y) > 1 − q/2 and, thus, |x| > 1. These observations will be applied several times in this section.
Proof. We show how to compute n such that Re(y n ) > 0 and Im(y n ) > 0. For such a n, we let y 1 = y n and x 1 = 1 + q/(y 1 − 1), so Remark 23 ensures that |x 1 | > 1 and x 1 ∈ R. Hence, we can return J as the graph with two vertices and n edges joining them. Since y and |y| are algebraic numbers, we can compute the algebraic number y/ |y|. We can detect if y/ |y| is a root of unity or not as explained in Section 5.1. There are two cases: (i) y/ |y| is not a root of unity. Then we can apply Lemma 19 with a = 1/12, b = 1/6 and z = y n to compute the smallest positive integer n such that Arg(y n ) ∈ [π/6, π/3].
(ii) y/ |y| is a root of unity of order r with r ≥ 5. Recall that we can compute r by sequentially computing the powers of y/ |y| until we obtain 1. Then we have (y/ |y|) r+1 = e i2π/r . Note that the real and imaginary parts of e i2π/r = cos(2π/r) + i sin(2π/r) are positive.
Note that the argument given in Lemma 24 strongly uses the fact that q ≥ 2, that is, 1 − q/2 ≤ 0. A proof of a version of Lemma 24 with q ∈ (0, 2) is unknown to us. Now we deal with the cases Arg(y) ∈ {π/2, 2π/3, 4π/3, 3π/2}, where the exemptions In fact, one can easily check that these are the only pairs (x, y) such that |y| = 1 and q ∈ {2, 3}.
Case I: Re(y) > 1 − q/2. Then, by Remark 23, |x| > 1. We return J as the graph with 2 vertices and one edge joining them.
Case III: Re(y) = 1 − q/2. Note that q > 2 because for q = 2 we would obtain Re(y) = 0. We distinguish three subcases: • |y| > 1. We compute the smallest positive integer n such that Arg(y n ) = 2π/3 and Re(y n ) = − |y| n /2 < 1 − q/2. The proof is concluded by applying Case II to (x n , y n ), where x n = 1 + q/(y n − 1), the transitivity property of shifts and noticing that the obtained graph is series-parallel.
• |y| < 1. We compute the smallest positive integer n such that |y| n < q − 2 and Arg(y n ) = 2π/3. We have Re(y n ) > 1 − q/2 (otherwise by applying Re(y n ) = − |y| n /2 we would find that |y| n ≥ q − 2), so |x n | > 1 for x n = 1 + q/(x n − 1). We return J as the graph with two vertices and n edges joining them.
This finishes the proof.
Corollary 27. Let q be a real algebraic number with q ≥ 2. Let x and y be algebraic numbers where ω 3 = exp(2πi/3). Then we can compute (x 2 , y 2 ) ∈ H q and a series-parallel graph J such that |x 2 | < 1 and J (x, y)-implements (x 2 , y 2 ).
•ŷ ∈ R. Hence, we haveŷ ∈ (1, ∞). We can compute a positive integer l such that the norm of y ′ =ŷ l y is larger than 1. Note that y ′ =ŷ l y ∈ R. A parallel composition yields a shift from (x, y) to (x ′ , y ′ ), where x ′ = 1 + q/(y ′ − 1). We compute the graph J by applying the previous case to (x ′ , y ′ ).

An approximate shift to (0, 1 − q)
In Lemma 28 and Corollary 29 we give a polynomial-time approximate series-parallel shift from (x, y) to (0, 1 − q) under certain conditions. Lemma 28. Let q ∈ P R with q > 0. Let (x, y) ∈ H q such that x, y ∈ P C and Re(y) < 1 − q/2. Then there is a polynomial-time approximate theta shift from (x, y) to (0, 1 − q).
Proof. Let x = 1 + q/(y − 1). In light of Remark 23, we have |x| < 1. Therefore, the weight y j = 1 + q/(x j − 1) implemented by an j-stretch converges to 1 − q as j → ∞. We have We use (7) to give a a polynomial-time approximate theta shift from (x, y) to (0, 1 − q). Let n be a positive integer, so the desired accuracy of the quantity in (7) is 2 −n . We are going to return a path graph with j edges for j large enough. It remains to show how to compute j from n. Since q, |x| ∈ P R , we can compute b, c ∈ Q such that q ≤ c and 0 < b ≤ 1 − |x| (Lemma 14). Hence, |x| ≤ 1−b < 1, and it suffices to compute j with j ≥ log 1−b (2 −n b/c). Proof. From Corollary 27 we obtain a shift from (x, y) to (x 2 , y 2 ) with |x 2 | < 1 or, equivalently, Re(y 2 ) < 1 − q/2. The result follows from applying Lemma 28 to (x 2 , y 2 ) and the transitivity property of shifts.

5.4
An approximate shift to (x ′ , y ′ ) with y ′ ∈ (0, 1) In Lemma 32 we show that if a sequence z n of complex numbers has certain properties, then there is w ∈ (0, 1) ∩ P R that is the limit of n j=1 z e j j for some non-negative integers e 1 , e 2 , . . . that we can compute. Then we apply this result to a subsequence of {y n }, where (x n , y n ) is the pair implemented by an n-stretch of (x, y), obtaining a polynomial-time approximate theta shift from (x, y) to some (x ′ , y ′ ) with y ′ ∈ (0, 1) (Lemma 33). First, we need the following elementary results.
Then z ∈ P C , i.e., z is polynomial-time computable.
Proof. Let n be an arbitrary positive integer. For j = ⌈log R 2 −n−1 /C ⌉ we have |z − z j | ≤ 2 −n−1 . Note that j = Θ(n) and hence z j is an algebraic number whose representation we can compute in time polynomial in n. So, we can also computeẑ j ∈ Q[i] such that |z j −ẑ j | ≤ 2 −n−1 in time polynomial in n. Then, we have that |z −ẑ n | ≤ |z n − z| + |z n −ẑ n | ≤ 2 −n .
Since n was arbitrary, we have that z is polynomial-time computable.
Then there is w ∈ (0, 1) and a bounded sequence of positive integers {e n } such that r n for every positive integer n. Moreover, if the representation of the algebraic number z n can be computed in polynomial time in n, then w ∈ P R and e n can be computed in polynomial time in n.
As a consequence, we find that, for any integer n with n ≥ 2, where we used the fact that cr n ≤ g(n) ≤ r n /2. The bounds (8), (9) and (10) will be used several times in this proof. Let τ 0 = 0. We define τ n and e n by induction on n. Let e n be the largest integer such that τ n−1 + e n θ n ≤ 2π and let τ n = τ n−1 + e n θ n . By definition, {τ n } is an increasing sequence that is bounded above by 2π. Moreover, we have 2π − θ n < τ n , since τ n + θ n ≤ 2π contradicts the definition of e n . That is, we have 0 ≤ 2π − τ n < θ n . We show that e n is bounded. Note that e 1 ≤ 2π/θ 1 ≤ 2π/(cr), where we used that cr ≤ g(1) ≤ θ 1 (recall (9)). For n ≥ 2 we have where we applied (10). By combining the latter inequality with the case n = 1 we conclude that 0 ≤ e n ≤ 2π cr (11) for every positive integer n.
The sequence {e iτn } converges to 1. In fact, we show that it does so exponentially fast. Note that the derivative of e it has constant norm 1. Therefore, e it is a Lipschitz function with constant 1, that is, e it − e is ≤ |s − t| for every s, t ∈ R. It follows that for every positive integer n, where we applied (9). Now we study the sequence {x n } for x n = n j=1 ρ e j j . Since ρ j ∈ (0, 1), {x n } is decreasing and has a limit w ∈ [0, 1). We claim that this is the real number in (0, 1) announced in the statement. First, we prove that w > 0. Let b = ⌈2π/(cr)⌉. In view of (11), we have Recall that a product of the form n j=1 (1 − a n ) with a n ∈ [0, 1) converges to a positive number if and only if n j=1 a n converges [38, and, thus, n j=1 (1 − h(j)) converges to a real number L with L > 0. We conclude that w ≥ L b > 0, as we wanted to prove. Now we show that {x n } converges exponentially fast to w. Note that x n = (1 − h(n)) en x n−1 and, thus, for n ≥ 2, we have where we used the fact that (1 − x) k ≥ 1 − kx for every x ∈ (0, 1) and k ∈ Z + , and the bounds on h(n) and e n (see (8) and (11)). We obtain for any positive integers n and q. Hence, by making q tend to ∞ we conclude that for every positive integer n.
In light of (12) and (13), we obtain for every positive integer n that Finally, we argue that if the representation of z n can be computed in polynomial time in n, then e n can be computed in polynomial time in n and we have w ∈ P R . Note that e 1 is the smallest positive integer such that Arg (z e 1 1 ) ∈ [3π/2, 2π) ∪ {0} and Arg(z e 1 +1 1 ) ∈ (0, π/2] and, thus, e 1 can be computed by sequentially applying Lemma 18 with intervals [3π/2, 2π] and [0, π/2], with the z of Lemma 18 equal to z k for every positive integer k ≤ e 1 + 1. This takes constant time since the quantities and objects involved are constant. For n ≥ 2, let us assume that we have computed e 1 , . . . , e n−1 , and let y n−1 = n−1 j=1 z e j j (so τ n−1 = Arg (y n−1 )). Since the sequence {e n } is bounded and the length of the representation of z n is bounded by a polynomial in n, the computation of y n−1 takes polynomial time in n. Then e n is the smallest non-negative integer such that Arg (y n−1 z en n ) ∈ [3π/2, 2π) ∪ {0} and Arg y n−1 z en+1 n ∈ (0, π/2], and we can compute e n again by sequentially applying Lemma 18 with intervals [3π/2, 2π] and [0, π/2], with the z of Lemma 18 equal to z k for every positive integer k ≤ e n + 1. There is a bounded number of applications of Lemma 18 because e n is bounded, and each application takes polynomial time in n because the length of the representation of y n−1 z k n is polynomial in n for any k ∈ {1, 2, . . . , e n }. We conclude that w is the limit of a sequence of algebraic numbers that converges exponentially fast and the representation of its n-th element can be computed in polynomial time in n. As a consequence, we have w ∈ P R by Lemma 31. Lemma 33. Let q be a real algebraic number with q > 0. Let x and y be algebraic numbers such that (x, y) ∈ H q , y ∈ R and |x| > 1. Then there is a polynomial-time approximate theta shift from (x, y) to (x ′ , y ′ ) for some (x ′ , y ′ ) ∈ H q with y ′ ∈ (0, 1) ∩ P R .
In the rest of the proof we assume that θ ∈ {π/2, 3π/2}. We are going to apply Lemma 32 to a subsequence of y m . First, we invoke Corollary 21 with z = x in order to find a sequence σ(m), a positive integer k and a positive rational C that satisfies: • σ(m) can be computed in polynomial time in m; • k and C can be computed in constant time from x; • m ≤ σ(m) ≤ m + k − 1 for every positive integer m; • sin(σ(m)θ) ≤ −C and cos(σ(m)θ) ≤ −C for every positive integer m. It follows that Since R > 1, we can compute a positive integer m 1 such that for m ≥ m 1 we have Re(x σ(m) ) < 1 − q/2 and, thus, y σ(m) < 1 (recall that y m = (x m + q − 1) / (x m − 1) and Remark 23). Let Therefore, we obtain We compute a positive integer m 2 such that m 2 ≥ log R (4q) and m 2 ≥ m 1 . We also compute a rational number c with c ∈ (0, qCR −m 2 −k−1 /4). Note that computing these quantities takes constant time. Let f (m) = a σ(m+m 2 ) and g(m) = b σ(m+m 2 ) . In view of (15) and the inequalities R −m−k+1 ≤ R −σ(m) ≤ R −m , we find that for any positive integer m. The sequence {z m } = {y σ(m+m 2 ) } satisfies • z m < 1 for every positive integer m; • z m = 1 − f (m) + ig(m) with f, g : Z + → (0, 1); • f and g are bounded as in (16).
• z m is an algebraic number whose representation can be computed in polynomial time in m. This is due to the facts that z m = (x σ(m+m 2 ) + q − 1)/( This gives the following polynomial-time approximate theta shift from (x, y) to (x ′ , y ′ ), where x ′ = 1 + q/(y ′ − 1). For each positive integer n we return a graph J n that is the parallel composition of the path graphs that are used to implement the weights y σ(j+m 2 ) , each one repeated e j times, for j ∈ {1, . . . , m}. The graph J n (x, y)-implements (x,ŷ) ∈ H q for y = m j=1 z e j j = m j=1 y e j σ(j+m 2 ) .
Proof. If y ∈ (−1, 0), then a 2-thickening of (x, y) gives the result. Hence, let us assume that y ∈ (−1, 0) in the rest of the proof. There are two cases: • q = 2 or y ∈ iR. We apply either Lemma 24, Lemma 25 or Lemma 26, depending on Arg(y), to find a shift from (x, y) to (x 1 , y 1 ) ∈ H q with y 1 ∈ R and |x 1 | > 1. The graph of this shift is series-parallel. Then we apply Lemma 33 to obtain a polynomial-time approximate theta shift from (x 1 , y 1 ) to some (x ′ , y ′ ) ∈ H q with y ′ ∈ (0, 1) ∩ P R . The result follows from the transitivity property of shifts.

Approximate shifts for polynomial-time computable real numbers
In this subsection we show how we can obtain a polynomial-time approximate shift from (x, y) to (x ′ , y ′ ) for any (x, y), (x ′ , y ′ ) ∈ H q when q ≥ 2, y ∈ (0, 1) ∩ P R and y ′ is a positive real algebraic number (Lemma 7). This extends a particular case of Lemma 10 to polynomial-time computable numbers. Our proof follows the same approach as that of [17, Lemma 22] but we have to overcome some difficulties that arise when working with the class of numbers P R . These difficulties will become apparent in the proof, but the reader that is familiar with the literature might want to skip the proof. Then we combine this result and Lemma 6 to prove Theorem 5, the main result of Section 5.
There is a polynomial-time algorithm that takes as an input: • two positive integers k and n, in unary; • a real algebraic number w ∈ [y k , 1].
The algorithm produces a theta graph J that (x, y)-implements (x,ŷ) such that ŷ − w ≤ 2 −n . The size of J is at most a polynomial in k and n, independently of w.
Proof. If w = 1, then J is the graph with vertices s and t and no edges. In the rest of the proof we focus on the case w ∈ (0, 1).
First, we define a sequence {d j } that will be related to the exponents e 1 , . . . , e m . Since q, x ∈ P R , we can compute rational upper bounds of q and x (Lemma 14) and, with the help of these bounds, a positive integer j 0 such that j 0 > log |x| q. Let d j = 0 for every positive integer j with j < j 0 and let d j = 0 for every even positive integer j. For j odd with j ≥ j 0 we define d j recursively as the largest non-negative integer such that y (d 1 ,...,d j ) ≥ w. The integer d j is well-defined because 0 < y j < 1 when j is odd and j ≥ j 0 . An equivalent definition is that {d j } satisfies y j < w/y (d 1 ,...,d j ) ≤ 1 for every odd integer j with j ≥ j 0 . A similar sequence {d j } is used in the proofs of [17, Lemma 22] and [15,Lemma 3.28]. For any odd integer m with m ≥ log |x| (q2 n − 1) we have 0 ≤ 1 − y m ≤ 2 −n and, in light of (17), Since 1 ≥ y (d 1 ,...,dm) ≥ w, it follows that Now we study the size of the integers d 1 , . . . , d m . We bound d j using an argument given in [15,Lemma 3.28]. First, we show that d j 0 is O(k). We have y Since w ∈ [y k , 1) and log y j 0 (y) > 0, it follows that 0 < log y (w) ≤ k and d j 0 ∈ O(k). Now we show that d j is bounded for any j > j 0 . By applying (17) twice, we find that for every odd integer j with j > j 0 . It follows that d j ≤ log(y j−2 )/ log(y j ) (here and in the rest of this paper log is taken in base e). For every x ∈ (1, 5/4), we have 3(x−1)/4 ≤ log(x) ≤ x−1. Hence, we obtain where the last inequality is a consequence of |x| 2 (|x| j−2 +1) ≥ |x| j +1. Since y j /y j−2 converges to 1 and, thus, is bounded, it follows that d j is bounded. We conclude that Let us assume that we can compute d 1 , . . . , d m for m = ⌈1 + log |x| (q2 n − 1)⌉. In light of (18), we can return J as the theta graph that implements the weight w(J; q, y − 1) = y (d 1 ,...,dm) − 1. Since m j=1 d j = O(k + m) and m = Θ(n), the size of J is at most a polynomial in k and n.
If y were algebraic, computing d 1 , . . . , d m in polynomial time would be straightforward from their definition because we can efficiently check inequalities between real algebraic numbers as explained in Section 5.1. This is the approach followed in [17, Lemma 22]. However, we only know that y ∈ P R and, thus, it is not clear how to efficiently determine whether y (d 1 ,...,d m−1 ,d) ≥ w or not for any given d. In the rest of this proof, we show how to overcome this difficulty.
Let n be a positive integer, so 2 −n is the desired accuracy for our algorithm. Let us assume that we have computed the integers d 1 , . . . , d j−1 and we want to compute d j for an odd positive integer j with j ≥ j 0 . We are going to sequentially try all the values d = 0, 1, . . . until we have y j < w y (d 1 ,...,d j−1 ,d) ≤ 1, in which case we have found the value d j (see (17)). Recall that y (d 1 ,...,d j−1 ,d) − 1 is the weight implemented by a theta graph J d whose size is bounded by a polynomial in k and j. Therefore, by applying Lemma 16 with G = J d and γ = y − 1, we can compute in polynomial time in n and the size of J d , a positive integer f (n + 2, J d ) with f (n + 2, J d ) = n + Θ(size(J d )) such that if |γ −γ| ≤ 2 −f (n+2,J d ) , then |w(G; q, γ) − w(G; q,γ)| ≤ 2 −n−2 . Since y ∈ P R , we can compute a rational numberγ such that |γ −γ| ≤ 2 −f (n+2,J d ) in polynomial time in n and the size of J d . Letŷ (d 1 ,...,d j−1 ,d) = w(G; q,γ) + 1. Then we have computed in polynomial time in k, j and n a rational numberŷ (d 1 ,...,d j−1 ,d) such that Because ŷ (d 1 ,...,d j−1 ,d) − w is a real algebraic number, we can check if the following inequality holds in polynomial time, If that is the case, then We repeat this procedure to compute d j sequentially until (19) holds, in which case we stop and return the graph J associated to y (d 1 ,...,d j−1 ,d) .
It remains to show that this procedure always halts and runs in polynomial time. In light of (18), we find that, for odd m ≥ log |x| (q2 n+2 − 1), that is, (19) holds. Therefore, our procedure that computes non-negative integers d 1 , . . . , d m−1 , d with y (d 1 ,...,d m−1 ,d) − w ≤ 2 −n halts for m = O(n). As a consequence, the whole procedure runs in polynomial time in k and n.
The proof of Lemma 7 can be adapted to to the case w ∈ (1, y −k ]. The main difference is that this time we work with the decreasing sequence {y 2j }. We set d j = 0 for odd j and, for even j, we define d j recursively as the largest non-negative integer such that y (d 1 ,...,d j ) ≤ w. The details of the proof are left to the reader. When studying the hardness of approximating Z Tutte (G; q, γ) we only need the version stated in Lemma 7.

Hardness results
We begin with obtaining lower bounds on Z Tutte (G; q, γ) for algebraic numbers q and γ. In Section 6.2, we review the algorithm of [25] for computing algebraic representations, and in Section 6.3 the exact #P-hardness results that we will use. The rest of the section gives various ingredients that are needed in the reduction, which are put together in Section 6.8 where we prove all of our main theorems.
6.1 Properties of Z Tutte (G; q, γ) for algebraic numbers q and γ In this section we give a lower bound on Z Tutte (G; q, γ) and study the degree and height of Z Tutte (G; q, γ) when q and γ are algebraic numbers. First, we have to introduce some concepts and results from algebraic number theory. The degree of an algebraic number γ is the degree of its minimal polynomial p, and we denote it by d(γ). Recall that the degree of a field extension F/K is the dimension of F as a K-vector space, and it is denoted by where f (x) = d j=0 a j x j , a d = 0, and α 1 , . . . , α d are the roots of f . It is well-known that Corollary 35. Let q and γ be algebraic numbers. We can compute a rational number C q,γ with C q,γ > 1 such that, for any graph G, either Z Tutte (G; q, γ) = 0 or |Z Tutte (G; q, γ) Proof. Recall that we represent an algebraic number γ as its minimal polynomial p and a rectangle of the complex plane where γ is the only root of p. Let G = (V, E) be a graph. Let n = |V | and m = |E|. Let us assume that Z Tutte (G; q, γ) = 0. We can apply Lemma 34 for f (q, γ) = Z Tutte (G; q, γ) to find that |Z Tutte (G; q, γ)| ≥ e −cT , where c and T are as in Lemma 34. We have c = D(2 + h(q) + h(γ)) and D = [Q(q, γ) : Q], so c ≥ 2. Note that, by definition of Z Tutte , we have H(f ) ≤ 2 m and deg f ≤ n + m. Hence, we find that |Z Tutte (G; q, γ)| ≥ e −2c size(G) . It remains to compute a rational number C q,γ in (e 2c , ∞) to conclude the result. From D = [Q(q, γ) : Q], we can compute D exactly. Moreover, we can apply (20) to upper bound h(q) and h(γ) in terms of the usual heights and degrees of q and γ, and compute an appropriate rational number C q,γ with the help of these upper bounds.
The case q = 2 (Ising model) of Corollary 35 has previously been shown in [12,Lemma 6.4]. Note that the approach followed in this section can be applied to obtain lower bounds for other partition functions.
In the rest of this section we upper bound the degree and the usual height of the algebraic number Z Tutte (G; q, γ) in terms of the usual heights and degrees of q and γ. We will make use of these bounds in the proof of Lemma 42.
Let q and γ be two algebraic numbers. By the tower law, we have [Q(q, γ) : Q] = [Q(q, γ) : where we used that the degree of the minimal polynomial of γ over Q(q) is bounded by d(γ). Since Z Tutte (G; q, γ) is in Q(q, γ), it follows that its degree is bounded by d(q)d(γ).
Lemma 36 ([43, Lemma 3.7]). Let f ∈ Z[x 1 , . . . , x t ] be a non-zero polynomial in t variables with integer coefficients. Let γ 1 , . . . , γ t be algebraic numbers. Then where L(f ) is the sum of the absolute values of the coefficients of f and deg x j (f ) is the degree of f with respect to the j-th variable. Proof. The degree bound on Z s|t (G; q, γ)/Z st (G; q, γ) follows from the fact that that it is in Q(q, γ). For its absolute logarithmic height, we have Note that L(Z st (G; q, γ)) + L(Z s|t (G; q, γ)) = 2 m . As a consequence of Lemma 36, we find that h (Z st (G; q, γ)) + h Z s|t (G; q, γ) ≤ 2 (m log 2 + nh(q) + mh(γ)) .

Computing representations of algebraic numbers via approximations
Kannan, Lenstra and Lovász [25] showed how to reconstruct the minimal polynomial of an algebraic number from a certain number of digits of its binary expansion, and we will use their algorithm as a black-box in our reduction of Section 6.5, in the following form. Theorem 1.19]). Let α be an algebraic number and let d and U be upper bounds on the degree and usual height, respectively, of α. Suppose that we are given a rational approximation α to α such that |α − α| ≤ 2 −b /(12d), where b is the smallest positive integer such that Then the minimal polynomial of α can be determined in O(d 5 (d+log U )) arithmetic operations on integers having O(d 2 (d + log U )) binary bits.
The algorithm in Lemma 38 is based on the Lenstra-Lenstra-Lovász lattice basis reduction algorithm, we refer the reader to [46] for more details.
In [42], Vertigan studied the complexity of the problem PlanarTutte(q, γ), which also turns out to be hard for most parameters q and γ.

Computational problems
In this section, we define a few computational problems that will be useful in our reductions; these were also considered in [12]. Let q be a real algebraic number, γ 1 , . . . , γ k be algebraic numbers, and K, ρ be real numbers with K > 1, ρ > 0.
We also consider these problems for the Potts model (with parameters q and y = γ + 1), and we write Potts instead of Tutte in the name of these problems when we refer to the Potts ones. We also consider all these problems restricted to planar graphs, in which case we write PlanarTutte instead of Tutte in the name of the problem. It is a trivial observation that the planar case reduces to the general case.

Reducing exact computation to sign and approximate computation
In this section, we first review the binary search technique of [12], which we will refer to as "interval-shrinking". Then, we use this to obtain several of our inapproximability theorems.
There are two possibilities. The first one is that s 0 , s 1 , s 2 , s 3 are all positive, in which case ε 2 < ε * and we can recurse on (ε 2 , ε 10 ). The second possibility is that s 6 , s 7 , s 8 , s 9 are all negative, in which case ε * < ε 8 and we can recurse on (ε 0 , ε 8 ). In any of these two cases, we can shrink the interval (ε ′ , ε ′′ ) to at most 9/10 of its original length. Again using binary search it is possible to find a small open subinterval containing the zero of f . Let us now assume that A < 0. In this case, one can analogously prove that the sign s i is positive when ε i < ε i+1 < ε * and negative when ε * < ε i < ε i+1 , so the same procedure allows us to shrink (ε ′ , ε ′′ ). Let q and γ be real algebraic numbers with q ∈ {0, 1} and γ > 0. Let H be a graph and let s and t be two distinct connected vertices of H. We are going to apply these interval stretching techniques to the linear function f (ε; H, γ) = Z s|t (H; q, γ) 1 − 1 q + ε Z st (H; q, γ) + 1 q Z s|t (H; q, γ) .
Under certain hypotheses, we are going to prove that f (0; H, γ)f (1−q; H, γ) < 0, so A(H, γ) = 0 and f (−; H, γ) has a zero between 0 and 1 − q. This allows us to find a suitable interval where we can perform interval-shrinking. For this purpose we will also need Lemma 41, that tells us that the zero of f (−; H, γ) is not close to either 0 or 1 − q. Proof. In view of the definition of f (ε; H, γ) and equation (22), we have Moreover, we have |Z st (H; q, γ)| ≥ c −r by hypothesis, so we conclude that |1 − q − ε * | ≥ |1 − q|c −2r . Analogously, we find that Lemma 42. Let K be a real number with K > 1. Let q, γ 1 and γ 2 be real algebraic numbers such that q > 1, γ 1 ∈ (−2, −1) and γ 2 > 0. Let us assume that we have access to an oracle for Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ). Then there exists an algorithm that takes as input a positive integer ρ and a planar graph H along with two distinct connected vertices s and t of H, and, for γ = (γ 2 + 1) ρ − 1, this algorithm computes a representation of the algebraic number Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Moreover, if we have access to the more powerful oracle Factor-K-NormTutte(q, γ 1 , γ 2 ), then we can remove the constraint that H is planar.
Let τ be the weight function on H ′ that assigns the weight γ to the edges of H and the weight γ ′ to the new edge. Then, as was observed in [16, Lemma 2], we have where f (ε; H, γ) was introduced in ( (H; q, γ). This construction will be used several times in this section. Now we analise f (−; H, γ) for our particular setting (q > 1). Since q and γ are positive, the quantities Z st (H; q, γ) and Z s|t (H; q, γ) are positive, so A(H, γ) is negative. From q > 1 and (22), it follows that f (0; H, γ) = B(H, γ) > 0 and f (1 − q; H, γ) < 0, so f (0; H, γ)f (1 − q; H, γ) < 0 as we wanted. We conclude that the zero ε * of f (ε; H, γ) is in (1 − q, 0). Note that ε ∈ (1 − q, 0) if and only if γ ′ ∈ (−q, −1). Moreover, we have This allow us to apply Lemma 41. Once we have all these properties of f (ε; H, γ) at our disposal, we can proceed to describe our algorithm. Our algorithm also works for q ∈ (−∞, 0) ∩ (0, 1) as long as f (0; H, γ)f (1 − q; H, γ) < 0 and the hypotheses of Lemma 41 hold. In the rest of the proof we will only use the fact that q > 1 one more time, but this will be made explicit and can easily be adapted to the case q < 1 as we will explain in Lemma 44.
Our algorithm computes a positive integer j 0 such that c −j 0 ≤ |q−1|/2. Let j be an integer with j ≥ j 0 . We will first show how to additively approximate Z s|t (H; q, γ)/Z st (H; q, γ) with error at most 2|q|c −j /|q − 1|.
To guarantee that this interval-shrinking technique computes an interval of length at most c −j−4r , it suffices to subdivide the original interval ⌈(j + 4r) log 10/9 (c) + log 10/9 |1 − q|⌉ times due to the fact that each iteration shrinks the interval to 9/10 of its size. In [16] and [12] the authors used the information provided by this interval-shrinking procedure to solve the problem #Minimum Cardinality (s, t)-Cut for arbitrary graphs (not-necessarily planar). Here we follow a different approach that allows us to compute the representation of Z s|t (H; q, γ)/Z st (H; q, γ).
We have shown that α is a real algebraic number that we can additively approximate up to an error at most 2|q|c −j /|1 − q| in polynomial time in j and the size of H. Technically, our approximationεq/(1 − q −ε) is another algebraic number. For this reason, our algorithm approximatesεq/(1 − q −ε) by a rational number α (with additive error at most 2|q|c −j / |q − 1|) and uses this rational number as our approximation of α. The overall error that we make is then |α − α| ≤ 4|q|c −j / |1 − q|.
Since h(γ) = h((γ 2 − 1) ρ − 1) ≤ ρ(1 + h(γ 2 )) by Lemma 36, our algorithm can compute a rational number D q,γ 2 with D q,γ 2 > 1 such that . The only non-trivial step of this computation is upper bounding h(q) and h(γ 2 ) in terms of the degrees and usual heights of q and γ 2 as in (20). (H)). By choosing j appropriately, we can use the algorithm that we have developed in this proof to find a rational approximation α with |α − α| ≤ 2 −b /(12d). As we have argued, this takes polynomial time in b and size(H). Since b = O(ρ size(H)), we conclude that the computation of α runs in polynomial time in ρ and size(H). Once we have computed this approximation, our algorithm invokes the algorithm given in Lemma 38 to determine the minimal polynomial of α in time O(d 5 (d + log U )) = O(ρ size(H)). Finally, it remains to compute an interval of the real line where α is the only root of its minimal polynomial. Since α is a real algebraic number and we know its minimal polynomial, our algorithm can use Sturm sequences to isolate the real roots of this minimal polynomial. Then, by approximating α it decides which one of the computed intervals corresponds to α.
Finally, note that our algorithm also works for arbitrary graphs (not-necessarily planar) as long as our oracle provides us with reliable answers for any graph.
Lemma 43. Let q, γ 1 and γ 2 be real algebraic numbers such that q > 1, γ 1 ∈ (−2, −1) and γ 2 > 0. Let us assume that we have access to an oracle for the computational problem Sign-PlanarTutte(q, γ 1 , γ 2 ). Then there exists an algorithm that takes as input a positive integer ρ and a planar graph H along with two distinct connected vertices s and t of H, and, for γ = (γ 2 + 1) ρ − 1, this algorithm computes a representation of the algebraic number Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Moreover, if we have access to the more powerful oracle Sign-Tutte(q, γ 1 , γ 2 ), then we can remove the constraint that H is planar.
Proof. The algorithm is exactly the same one of Lemma 42. The proof is analogous too. The only difference is in the interval-shrinking technique, where we split (ε ′ , ε ′′ ) into 4 intervals instead of 10 (so p = 4 in the proof), but this has been discussed at the beginning of this section. Lemma 44. Let K be a real number with K > 1. Let q, γ 1 and γ 2 be real algebraic numbers such that 0 < q < 1, γ 1 ∈ (−1, 0) and γ 2 > 0. Let us assume that we have access to an oracle for Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ). Then there exists an algorithm that takes as input a positive integer ρ and a planar graph H along with two distinct connected vertices s and t of H, and, for γ = (γ 2 + 1) ρ − 1, this algorithm computes a representation of the algebraic number Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Moreover, if we have access to the more powerful oracle Factor-K-NormTutte(q, γ 1 , γ 2 ), then we can remove the constraint that H is planar.
Lemma 45. Let q, γ 1 and γ 2 be real algebraic numbers such that 0 < q < 1, γ 1 ∈ (−1, −0) and γ 2 > 0. Let us assume that we have access to an oracle for the computational problem Sign-PlanarTutte(q, γ 1 , γ 2 ). Then there exists an algorithm that takes as input a positive integer ρ and a planar graph H along with two distinct connected vertices s and t of H, and, for γ = (γ 2 + 1) ρ − 1, this algorithm computes a representation of the algebraic number Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Moreover, if we have access to the more powerful oracle Sign-Tutte(q, γ 1 , γ 2 ), then we can remove the constraint that H is planar.
Proof. The algorithm is exactly the same the one of Lemma 44, the only difference being in the interval-stretching technique as we have already explained. Lemma 46. Let K be a real number with K > 1. Let q, γ 1 and γ 2 be real algebraic numbers such that q < 0, γ 1 ∈ (−1, 0) and γ 2 > 0. Let us assume that we have access to an oracle for Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ). Then there exists an algorithm that takes as input: • a positive integer ρ ; • a planar graph H = (V, E) such that, for γ = (γ 2 +1) ρ −1, we have γ ≥ (8 max{|q|, 1/|q|}) r , where r = max{|V |, |E|}; • two distinct connected vertices s and t of H.
In particular, Z st (H; q, γ) = 0. It also follows that which is one of the conditions of Lemma 41. Recall that an (s, t)-cut of H is a subset A of edges of H such that any path from s to t in H has an edge in A. The size of this (s, t)-cut is the cardinality of A. Let k be the size of a minimum cardinality (s, t)-cut in H, and let C be the number of (s, t)-cuts of size k. We study the terms q k(A) γ |A| appearing in Z s|t (H; q, γ), so A is a subset of E such that s and t are not connected in (V, A). Note that such an A is the complement of an (s, t)-cut and, hence, |A| ≤ m − k. Moreover, if A is not the complement of an (s, t)-cut of size k, then the absolute value of q k(A) γ |A| is at most γ m−k−1 q 2 max{1, |q|} n−2 ≤ δ2 −m γ m−k q 2 . Thus, we have the inequalities The inequalities (28) and (29) have been previously given in the proof of [16, Lemma 2]. As a consequence, we find that which is another one of the conditions of Lemma 41. In view of (22) and the facts that q < 0 and we know the signs of Z s|t (H; q, γ) and Z st (H; q, γ), it follows that f (0; H, γ) > 0 and f (1 − q; H, γ) < 0. Hence, we find that f (0; H, γ)f (1 − q; H, γ) < 0, as we wanted. Note that A(H, γ) has to be non-zero because f (−; H, γ) is non-constant as f (0; H, γ)f (1 − q; H, γ) < 0. This is the last condition of Lemma 41 that we had to check. We conclude that we can apply the algorithm given in the proof of Lemma 44 to compute Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Finally, we show that Z Tutte (H; q, γ) = 0. This is not needed for the algorithm of Lemma 44, but is part of the statement of the current lemma. In light of (28) and (29), we have |Z st (H; q, γ)| ≥ γ m |q|(1 − δ) and Z s|t (H; q, γ) ≤ Cγ m−k q 2 (1 + δ). Note that where we used that γ ≥ (8 max{|q|, 1/|q|}) r ≥ 8 · 2 m |q| > 5C|q| since r ≥ 2. Therefore, we find that |Z st (H; q, γ)| > Z s|t (H; q, γ) . We conclude that It remains to consider the case where H is not connected. Let H 1 , . . . , H l be the connected components of H, and let us assume that the vertices s and t are in H 1 without loss of generality. We have We have already shown that Z st (H 1 ; q, γ), Z st (H 1 ; q, γ) and Z Tutte (H j ; q, γ) are non-zero for all j. Hence, we obtain Z s|t (H; q, γ)/Z st (H; q, γ) = Z s|t (H 1 ; q, γ)/Z st (H 1 ; q, γ), and we can apply our algorithm to H 1 instead of H. Moreover, we have Z st (H; q, γ) = 0 and Z Tutte (H; q, γ) = 0 as we wanted. This finishes the proof.
This algorithm computes a representation of the algebraic number Z s|t (H; q, γ)/Z st (H; q, γ) in polynomial time in ρ and the size of H. Moreover, for such inputs ρ, H and s, t, we have Z st (H; q, γ) = 0 and Z Tutte (H; q, γ) = 0. If we have access to the more powerful oracle Sign-Tutte(q, γ 1 , γ 2 ), then we can remove the constraint that H is planar.
Proof. The algorithm is the same one as that of Lemma 46, the only difference being in the interval-stretching technique, as we have already explained.
Now we deal with the last part of our reduction, where we reduce the computation of Z Tutte (G; q, γ) to the computation of Z s|t (H; q, γ)/Z st (H; q, γ) on the subgraphs H of G. First, let us introduce some notation.
Definition 48. We say that a pair (q, γ) of algebraic numbers is zero-free for a graph G if q = 0 and, for every subgraph H of G and every pair of distinct vertices s and t in the same connected component of H, the quantities Z st (H, q, γ) and Z Tutte (H, q, γ) are non-zero.
Note that if (q, γ) is zero-free for G, then (q, γ) is also zero-free for any subgraph of H. We consider the following computational problems.
Name: RatioTutte(q, γ). Instance: A (multi)graph G = (V, E) such that (q, γ) is zero-free for G and two distinct vertices s and t in the same connected component of G. Output: A representation of the algebraic number Z s|t (G; q, γ)/Z st (G; q, γ).
We also consider the planar versions of these problems, RatioPlanarTutte(q, γ) and ZeroFreePlanarTutte(q, γ). Then we can express the last part of our reduction as a reduction between these two computational problems.
Lemma 49. Let q and γ be algebraic numbers with q = 0. Then we have the reductions Proof. First, we show ZeroFreePlanarTutte(q, γ) ≤ T RatioPlanarTutte(q, γ). Let G be the input of ZeroFreePlanarTutte(q, γ). The reduction computes a representation of Z Tutte (G; q, γ) as follows. We assume that G is not a tree since it is known how to compute the Tutte polynomial of a tree in polynomial time [37, Example 2.1]. Then we can find an edge e = (s, t) of G that is not a bridge. We are going to use the oracle for RatioPlanarTutte(q, γ) to reduce the computation of Z Tutte (G; q, γ) to that of Z Tutte (G \ e; q, γ), where G \ e is formed from G by deleting e. Note that if G is planar, then G \ e is also planar. Since (q, γ) is zero-free for G, we have Z st (G; q, γ) = 0. Let α = Z s|t (G; q, γ)/Z st (G; q, γ). First, note that Z Tutte (G; q, γ) = Z st (G; q, γ) + Z s|t (G; q, γ) = Z st (G; q, γ) (1 + α) .
By calling the oracle the algorithm obtains a representation of the factor 1 + α. Since e is not a bridge, s and t are connected in G \ e, so, by calling the oracle again, the algorithm has access to a representation of the algebraic number β = Z s|t (G \ e; q, γ)/Z st (G \ e; q, γ). We have where we multiplied and divided by Z Tutte (G \ e; q, γ) = Z st (G \ e; q, γ)(1 + β), which is nonzero since (q, γ) is zero-free for G. Note that the fact that Z Tutte (G \ e; q, γ) = 0 is equivalent to β = −1. We obtain Z Tutte (G; q, γ) = Z Tutte (G \ e; q, γ) 1 + γ + γq −1 β 1 + α 1 + β .
The algorithm then computes a representation of Z Tutte (G \ e; q, γ) recursively. Note that this reduction also works between the non-planar versions of the problems.
In the rest of this section we put our reduction together. There is one result for each one of the cases q > 1, 0 < q < 1 and q < 0 (see Lemmas 50, 51 and 54).
Lemma 50. Let K be a real number with K > 1. Let q, γ 1 and γ 2 be real algebraic numbers such that q > 1, γ 1 ∈ (−2, −1) and γ 2 > 0. Then we have the following reductions: where ≤ T denotes a Turing reduction. Moreover, these reductions also hold for the analogous non-planar problems.
Proof. We claim that the problems PlanarTutte(q, γ 2 ) and ZeroFreePlanarTutte(q, γ 2 ) are equivalent. This follows from the fact that (q, γ 2 ) is zero-free for every graph G. Lemma 49 gives us a reduction from ZeroFreePlanarTutte(q, γ 2 ) to RatioPlanarTutte(q, γ 2 ). Recall that we have q > 0, γ 1 ∈ (−2, −1) and γ 2 > 0. Thus, we can apply Lemma 42 with ρ = 1 to obtain a reduction from the problem RatioPlanarTutte(q, γ 2 ) to the problem Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ), which gives the first reduction of the statement. The second reduction is derived analogously, but this time we apply Lemma 43 instead of Lemma 42. Finally, note that our reductions also hold for the non-planar version of the problems since the algorithms given in Lemma 42 and Lemma 43 work for arbitrary graphs (non-necessarily planar) as long as the oracle does.
Moreover, these reductions also hold for the analogous non-planar problems.
Proof. The proof is analogous to that of Lemma 50; now, we instead combine Lemmas 49, 44 and 45.
So far we have obtained reductions when q > 1 or 0 < q < 1. To obtain a similar result when q < 0 we have to introduce the following variant of Tutte(q, γ), where q is an algebraic number and γ is a positive real algebraic number.
We also consider the planar version of this problem, ThickenedPlanarTutte(q, γ), where the input graph is promised to be planar.
Lemma 52. Let q be an algebraic number and let γ be a real algebraic number with γ > 0. Then the problem ThickenedPlanarTutte(q, γ) is #P-hard unless q ∈ {1, 2}, and the problem ThickenedTutte(q, γ) is #P-hard unless q = 1.
The reduction constructs G 1 , . . . , G m and computes Z Tutte (G; q, γ j ) using the oracle for ThickenedPlanarTutte(q, γ) with input G j . By interpolation, we then recover the polynomial Z Tutte (G; q, x), whose degree is m when q is viewed as a constant, in time polynomial in the size of G. The reduction is then completed by evaluating Z Tutte (G; q, x) at x = 2.
Finally note that this reduction also works from Tutte(q, 2) to ThickenedTutte(q, γ). The only difference is that Tutte(q, 2) is also #P-hard for q = 2 (see Theorem 39), so we also get #P-hardness in this case.
We are going to reduce the problem ThickenedPlanarTutte(q, γ 2 ) to the problem Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ) for appropriate γ 1 and γ 2 . In order to do so, we need to adapt Lemma 49 to this context. For this purpose, we consider the following computational problems.
Proof. The reduction is almost exactly the one explained in Lemma 49. The only difference is that, for an input (G, ρ), each call to the oracle has as parameters a subgraph H of G, two vertices s and t determined in the reduction, and the same positive integer ρ.
Moreover, these reductions also hold for the analogous non-planar problems.
Proof. Let G and ρ be the inputs of ThickenedPlanarTutte(q, γ 2 ). Let H be a subgraph of G and let s and t be two distinct connected vertices of H. By applying Lemma 46 we find that Z st (H; q, (γ 2 + 1) ρ − 1) and Z Tutte (H; q, (γ 2 + 1) ρ − 1) are non-zero. Hence, (q, (γ 2 + 1) ρ − 1) is zero-free for G. This shows that ThickenedPlanarTutte(q, γ 2 ) reduces to ZeroFreeThickenedPlanarTutte(q, γ 2 ). Lemma 53 gives us a reduction from ZeroFreeThickenedPlanarTutte(q, γ 2 ) to RatioThickenedPlanarTutte(q, γ 2 ). Recall that we have q < 0, γ 1 ∈ (−1, 0) and γ 2 > 0. Thus, Lemma 46 gives a reduction from RatioThickenedPlanarTutte(q, γ 2 ) to Factor-K-NormPlanarTutte(q, γ 1 , γ 2 ), which completes the proof for the first reduction of the statement. The second reduction is analogous, but this time we apply Lemma 47 instead of Lemma 46. Finally, note that our reductions also hold for the analogous non-planar problems since the algorithms given in Lemma 46 and Lemma 47 work for arbitrary graphs (non-necessarily planar) as long as the oracle does.

The connection between approximate shifts and reductions
In this section we show how a polynomial-time approximate shift from (q, γ 1 ) to (q, γ 2 ) may allow us to reduce the problems of approximating the norm of the Tutte polynomial at (q, γ 2 ) to the same problem at (q, γ 1 ) (see Lemma 8). We also derive a similar result for the problem Distance-ρ-ArgTutte(q, γ) in Lemma 56.
Lemma 55. Let q, γ 1 and γ 2 be algebraic numbers with q = 0 such that there is a polynomialtime series-parallel approximate shift from (q, γ 1 ) to (q, γ 2 ). Then there is an algorithm that has as input a graph G and a positive integer k and computes, in polynomial time in k and the size of G, a graph H and a representation of an algebraic number D with D = 0 such that Z Tutte (G; q, γ 2 ) − Z Tutte (H; q, γ 1 ) D ≤ 2 −k .
Moreover, if the graph G is planar, then the graph H is also planar, and if q and γ 1 are real, then D is also real.
Proof. Let G = (V, E) and k be the inputs of the algorithm. Let n = |V | and m = |E|. By the definition of series-parallel polynomial-time approximate shifts, for any positive integer j, one can compute, in polynomial time in j, a series-parallel graph J j that γ 1 -implementŝ γ with |γ 2 −γ| ≤ 2 −j for terminals s and t. By definition of implementations, we havê γ = qZ st (J j ; q, γ 1 )/Z s|t (J j ; q, γ 1 ) and Z s|t (J j ; q, γ 1 ) = 0. We construct a graph G j that is a copy of G where every edge f in G has been replaced by a copy of J j as in Lemma 9, identifying the endpoints of f with s and t. In light of Lemma 9, we have Z Tutte (G j ; q, γ 1 ) = Z s|t (J j ; q, γ 1 ) q 2 m Z Tutte (G; q,γ) .
The algorithm returns H = G j and D = D m j = 0. Note that if G is planar, then H = G j is also planar by construction. If q and γ 1 are real, then the number D = (Z s|t (J j ; q, γ 1 )/q 2 ) m is clearly real too.
In the rest of this section we use Lemma 55 to translate information about the function Z Tutte (−; q, γ 1 ) for certain graphs to information about Z Tutte (G; q, γ 2 ). This leads to the reductions given in Lemmas 8 and 56. These results are stated for polynomial series-parallel approximate shifts, but they would also hold even if the shifts are not series-parallel as long as, in the proof of Lemma 55, the graphs J j are planar and we can compute D j = Z s|t (J j ; q, γ 1 ) /q 2 in polynomial time in the size of J j .
We are now ready to prove Lemma 8, which was stated in the Proof Outline, and which we restate here for convenience. Lemma 8. Let q = 0, γ 1 and γ 2 = 0 be algebraic numbers, and K > 1. For j ∈ {1, 2}, let y j = γ j + 1 and x j = 1 + q/γ j . If there is a polynomial-time series-parallel approximate shift from (x 1 , y 1 ) to (x 2 , y 2 ), then we have a reduction from Factor-K-NormTutte(q, γ 2 ) to Factor-K-NormTutte(q, γ 1 ). This reduction also holds for the planar version of the problem.
We next give the analogue of Lemma 8 for the argument.
This reduction analogously applies to the planar case since the graph H is planar when G is planar (see Lemma 55).

Hardness for the Tutte polynomial
In this section we use the reductions of Section 6.5 to obtain intermediate hardness results that will be used to obtain our main theorems in the upcoming sections. We start with the following corollary which strengthens previous results of [16] (that applied to general graphs rather than planar).
Proof. We consider first the case when γ 2 > 0. For q, γ 1 , γ 2 as in the first item, the conclusion follows from Theorem 40 and the reductions given in Lemma 50. For the second item: when q ∈ (0, 1), the result follows from the reductions given in Lemma 51 and Theorem 40, while for q < 0, the result follows from Lemmas 52 and 54.

Proofs of our main theorems
In this section we show how our main Theorems 1, 2, 3 and 4 follow from the #P-hardness results of Section 6.7. We start with Theorem 4.