Seifert fibering operators in 3d $\mathcal{N}=2$ theories

We study 3d $\mathcal{N}=2$ supersymmetric gauge theories on closed oriented Seifert manifold---circle bundles over an orbifold Riemann surface---, with a gauge group G given by a product of simply-connected and/or unitary Lie groups. Our main result is an exact formula for the supersymmetric partition function on any Seifert manifold, generalizing previous results on lens spaces. We explain how the result for an arbitrary Seifert geometry can be obtained by combining simple building blocks, the"fibering operators."These operators are half-BPS line defects, whose insertion along the $S^1$ fiber has the effect of changing the topology of the Seifert fibration. We also point out that most supersymmetric partition functions on Seifert manifolds admit a discrete refinement, corresponding to the freedom in choosing a three-dimensional spin structure. As a strong consistency check on our result, we show that the Seifert partition functions match exactly across infrared dualities. The duality relations are given by intricate (and seemingly new) mathematical identities, which we tested numerically. Finally, we discuss in detail the supersymmetric partition function on the lens space $L(p,q)_b$ with rational squashing parameter $b^2 \in \mathbb{Q}$, comparing our formalism to previous results, and explaining the relationship between the fibering operators and the three-dimensional holomorphic blocks.


Introduction
Any local quantum field theory (QFT) can be studied on a non-trivial space-time geometry. This is done by coupling the stress-energy tensor to a background metric. 1 In this paper, we study three-dimensional Euclidean QFTs with N = 2 supersymmetrythat is, four Poincaré supercharges-on Seifert three-manifolds. In any supersymmetric QFT, the stress-energy tensor sits together with the supersymmetry current in a supercurrent multiplet, which can be canonically coupled to a supergravity multiplet. Given a choice of supercurrent [1,2] and of the corresponding off-shell supergravity, one can classify the supersymmetry-preserving geometries systematically [3]. In the case of 3d N = 2 supersymmetric theories with an exact U (1) R symmetry [4,5,6], one finds a large class of compact half-BPS geometries, M 3 , which preserve two supercharges, Q andQ, satisfying the curved-space supersymmetry algebra: Here, Z is the real central charge of the 3d N = 2 supersymmetry algebra on R 3 , and L K generates an isometry of the Riemannian manifold M 3 along a real Killing vector K. A necessary and sufficient condition for such a half-BPS background to exist is that M 3 be a Seifert manifold [5]. Given any half-BPS geometric background, one can, in principle, compute the supersymmetric partition function: of any UV-free N = 2 supersymmetric field theory, using supersymmetric localization techniques. (See e.g. [7] for a recent review.) On general grounds, the quantity (1.2) is renormalization-group (RG) invariant, therefore it gives access to non-perturbative information about the strongly-coupled infrared (IR) of the theory. It is also a function of background vector multiplets for the flavor symmetries of the theory, in particular through some complex parameters ν, as indicated in (1.2). Moreover, Z M 3 (ν) is locally holomorphic in those parameters, ν [8,9]. Explicit localization formulas are known for (1.2) when M 3 is a lens space-see e.g. [10,11,12,13,14,15,16,17,18]. However, localization computations become increasingly complicated to carry out as the topology of M 3 becomes less trivial, in part because the sum over topological sectors becomes more involved. In this work, we will bypass such difficulties by thinking of Z M 3 as an observable in an auxilliary two-dimensional topological field theory, the so-called "3d A-model" [19]. 2 The basic idea is the following. Let us first consider the product space: with Σ a Riemann surface. One can preserve the supersymmetry algebra (1.1) on this product three-manifold by performing a topological A-twist along the Riemann surface [24,25]. The two supercharges Q andQ are the A-twisted version of the flat-space supercharges Q − andQ + in the 3d N = 2 algebra-equivalently, if we consider the theory on R 2 × S 1 , Q − andQ + are part of the 2d N = (2, 2) supersymmetry algebra along R 2 . We then consider the operators, L , that commute with them: These are the twisted chiral operators, in the 2d nomenclature. Note that the twistedchiral condition is not Lorentz covariant in dimension larger than two, so that L cannot be a local operator in 3d. In the three-dimensional N = 2 theory on R 2 ×S 1 , the twisted chiral operators are half-BPS line operators, wrapping the S 1 and localized at a point on Σ. Typical examples are the half-BPS Wilson loops in 3d N = 2 gauge theories. We define the 3d A-model as the two-dimensional topological quantum field theory (TQFT) on Σ obtained by viewing the 3d theory as a 2d theory with an infinite number of fields (the S 1 Fourier modes), and by performing the topological A-twist. The TQFT is obtained by passing to the (simultaneous) cohomology of the scalar supercharges Q,Q.
The 3d A-model observables are of the form: where the insertion points of the lines can be omitted, since the theory is topological along Σ. These observables encode the algebra of half-BPS line operators-see e.g. [26,27] for detailed discussions of the Wilson loop algebras. In this work, we will view the supersymmetric partition functions as 3d A-model observables: where the line L = G M 3 is a particular line defect, or geometry-changing line operator, whose insertion is equivalent to introducing a non-trivial fibration of the S 1 over Σ, giving rise to the Seifert manifold M 3 . In a previous work [19], we carried out this program for a restricted class of Seifert geometries. In the present paper, we define the geometry-changing line operator for any Seifert manifold, in the case of 3d N = 2 gauge theories. This gives us a compact formula for the supersymmetric partition functions, (1.2), for supersymmetric gauge theories on any half-BPS Seifert geometry. Even in the previously-understood cases when M 3 is a lens space, our results offers a new perspective on some well-known matrix integrals obtained by supersymmetric localization. We also clarify a number of more subtle points along the way.
In the remainder of this introduction, we review some necessary background material and spell out our main results in some detail.

Seifert geometry and surgery
By a Seifert manifold M 3 , we mean a closed, oriented three-manifold, equipped with a Seifert fibration: π : M 3 →Σ g,n . (1.7) For our purposes, a Seifert fibration is simply an S 1 bundle over a two-dimensional orbifold [28,29]. Here the orbifold base of the fibration,Σ =Σ g,n , is a genus-g Riemann surface with n marked points, the "orbifold points," x i , which have conical local neighborhoods U i ∼ = C/Z q i , with q i > 0. In the absence of orbifold points, the Seifert fibration is a principal circle bundle over a smooth Riemann surface Σ g , which is fully determined by its degree (or first Chern number) d ∈ Z. More generally, we must also specify what happens at the fibers above the orbifold points, the so-called "exceptional fibers." The tubular neighborhood of each exceptional fiber in M 3 is a solid fibered torus, which is characterized by a pair of co-prime integers (q i , p i ). 3 Note that, while a generic S 1 fiber has a fixed radius β, the radius jumps to β/q i over the orbifold point x i . In this way, the Seifert manifold M 3 is fully characterized by a finite numbers of integers, known as the "Seifert symbols:" M 3 ∼ = d ; g ; (q 1 , p 1 ) , · · · , (q n , p n ) . (1.8) Here d is the degree of the Seifert fibration, g is the genus of the base, and (q i , p i ) are the so-called Seifert invariants of the exceptional fibers. 4 Any such M 3 can be constructed by surgery on the product manifold: seen as a trivial Seifert fibration. Indeed, given any Seifert manifold M (n) 3 with n exceptional fibers, one can add an exceptional (q, p) fiber by Dehn surgery along a generic Seifert fiber at x n+1 ∈Σ, by removing a tubular neighborhood of the fiber, resulting in a manifold M Shifting the degree d to d + 1 in (1.8) can be done similarly, with g ∈ SL(2, Z) corresponding to (q, p) = (1, 1). In fact, any Seifert manifold can be constructed by elementary surgery operations on the genus-zero trivial fibration S 2 × S 1 . One may consider the following operations (in whatever order; all these operations are reversible): 3 A solid fibered torus T (q, t) is obtained by gluing together the two disk boundaries of a solid cylinder, with a relative rotation of 2πt q , for q and t some co-prime integers. One can equivalently describe T (q, t) in terms of the coprime integers (q, p) such that pt = 1 mod q, as we are doing here. 4 More precisely, d is the degree if the invariants (q i , p i ) are normalized such that q i > 0 and 0 ≤ p i < q i . We will give a detailed introduction to Seifert geometry in Section 2.
• Add handles to the baseΣ g,n , for instance going from S 2 × S 1 to Σ g × S 1 . This operation only affects the base of the fibration.
• Change the degree d of the fibration. This operation leaves the base invariant.
• Add an exceptional (q, p) fiber. This operation modifies both the base and the fibration.
These three topological operations can be implemented in N = 2 supersymmetric field theories on M 3 , by the insertion of geometry-changing line operators along the Seifert fiber [19], as anticipated in (1.6). In the case of a smooth baseΣ = Σ g , the line operators for the first and second operations were discussed in [25,30,27] and [19], respectively. The main goal of this paper is to explain how to carry out the third operation-the insertion of an exceptional Seifert fiber-, thus allowing us to study 3d N = 2 theories on any Seifert manifold.

Gauge theories on Seifert manifolds
Let us choose a Riemannian metric on M 3 compatible with the Seifert fibration (1.8).
In particular, a compatible metric admits a Killing vector K whose orbits are the Seifert fibers. In this paper, we will assume that K is the Killing vector entering the curvedspace supersymmetry algebra (1.1). As we will see, this assumption is less restrictive than it might appear. We consider any 3d N = 2 gauge theory with gauge group G, and with g = Lie(G) its Lie algebra. Here, G can be a compact, simply-connected, simple Lie group, G γ , a unitary group, or a product thereof: (1.12) The inclusion of non-simply-connected gauge groups (other than U (N )) requires additional care, and we leave it for future work. We may decompose any 3d field in Kaluza-Klein (KK) modes along the Seifert fiber. In particular, the zero-mode of the 3d gauge field gives us a two-dimensional gauge field onΣ, which sits in a 2d N = (2, 2) vector multiplet V (2d) . It will be natural to write down an effective field theory for the complex scalar u in V (2d) on the classical Coulomb branch: u = diag(u a ) , a = 1, · · · , rk(G) , (1.13) by integrating out all the other massive fields at generic values of u a , and with various mass parameters, ν, for the flavor symmetries turned on. The topological twist of this effective two-dimensional field theory will be our "3d A-model" [19].
Then, any half-BPS line operators L in the A-model will be expressed as functions of the gauge parameters, u, and of the flavor parameters, ν: (1.14) As an example, consider L = W R , a supersymmetric Wilson loop in a representation R of G, wrapped along the S 1 fiber. It takes the form: with σ the real scalar in the 3d vector multiplet, and ψ the circle coordinate. In the 3d A-model, this is simply the character of the representation: (1. 16) Here, we are interested in defect line operators that change the topology of M 3 . The geometry-changing line operators: were discussed in previous papers [25,30,27,19]. The handle-gluing operator H [31,25] has the effect of adding one handle to the baseΣ of the Seifert fibration M 3 . The "ordinary" fibering operator F [19] has the effect of shifting the degree of the Seifert fibration by one, d → d + 1. In this paper, we define and compute the (q, p)-fibering operator: G q,p = G q,p (u, ν) , (1.18) which introduces an exceptional fiber of type (q, p). Given these building blocks, we can write the supersymmetric partition function (1.6) as: schematically, for any Seifert fibration. Here, the S 2 × S 1 background on which we insert L M 3 corresponds to the topologically twisted index [32]. The main object of this work is to understand and compute the Seifert fibering operator: 20) associated to an arbitrary Seifert manifold M 3 , with Seifert symbols (1.8).

R-charge and spin-structure dependence of Z M 3
As part of our choice of supersymmetric background on M 3 , we must specify the U (1) R line bundle, L R , associated to the background R-symmetry gauge field. This line bundle is defined by the condition: where K M 3 is the "canonical line bundle" of the Seifert manifold M 3 seen as a transversely holomorphic foliation (THF) [5,9]. For our purposes, K M 3 can simply be defined as the pull-back of the canonical line bundle on the orbifoldΣ along the Seifert fibration (1.7): Note this group also determines the allowed set of spin structures on M 3 . In fact, these two choices, of a line bundle L R and of a spin structure on M 3 , are correlated. The supersymmetric background on M 3 includes a pair of Killing spinors, ζ andζ, of R-charge ±1, respectively, which solve the generalized Killing spinor equations: where∇ µ is a particular connection adapted to the Seifert geometry, and A (R) µ is the connection on L R . Whenever we change the R-symmetry line bundle on M 3 , the old and new U (1) R gauge fields are distinguished by Z 2 -valued holonomies along certain 1-cycles, determined by an element of H 1 (M 3 , Z 2 ). In order to retain the two solutions to the Killing spinor equations (1.24), we must simultaneously shift the spin structure in such a way as to cancel the holonomy incurred by the Killing spinors. In this sense, different elements in (1.23) correspond to different choices of a spin structure on the Seifert manifold.
The partition function of a 3d N = 2 gauge theory depends in a subtle way on the choice of spin structure, as we will see in later sections. In particular, in the special case of (N = 2 supersymmetric) Chern-Simons (CS) theories, this reproduces the spinstructure dependence expected in certain cases, whenever the CS theory is known to be a spin-TQFT [33].
An additional feature of the choice of R-symmetry line bundle is that it determines the allowed R-charges for matter fields. Namely, the R-charges, r, must be such that the bundle L ⊗r R is well-defined. This typically forces the R-charges to be integer-quantized, r ∈ Z. In some special cases, we may relax this condition. In particular, in the special case of a topologically trivial R-symmetry line bundle: 25) we may allow arbitrary real R-charges, r ∈ R. Such backgrounds are particularly important if we want to study the N = 2 superconformal field theories (SCFT) that may appear in the IR of UV-free gauge theories. Indeed, the superconformal R-charges are often irrational, due to mixing of the UV R-charge with abelian flavor symmetries. 5 A topologically trivial U (1) R line bundle is allowed only on certain choices of M 3 . Important examples are the so-called squashed sphere S 3 b , and more generally the squashed lens spaces L(p, −1) b . These examples belong to more general family of Seifert manifolds with topologically trivial L R , the "spherical manifolds," which are described in Section 3.6. (Other interesting examples are the torus bundles described in Section 3.5.)

Parity anomaly, Chern-Simons contact terms and supersymmetry
In this work, we are careful to treat fermions in a manner consistent with gauge invariance and the parity anomaly [34,35,36]-see [37,38,39,40] for detailed recent discussions. Since our treatment differs from most of the supersymmetric localization literature, let us elaborate on this point here. For completeness, we provide more background material on 3d fermions, the parity anomaly, and supersymmetric CS terms, in Appendix A.
Parity anomaly and CS contact terms. Consider a massless Dirac fermion ψ coupled to a background gauge field A µ . The parity anomaly is the statement that we cannot quantize ψ while preserving both three-dimensional parity 6 and gauge invariance. In this work, we always wish to preserve gauge invariance, and therefore the effective action S eff [A] obtained after integrating over the (possibly massless) fermions generally violates parity.
The relevant parity-violating terms contribute to the imaginary part of S eff [A]. They are conveniently captured by parity-odd contributions to the two-point functions of conserved currents [37], with coefficients denoted by κ ∈ R. Consider various abelian symmetries U (1) a coupled to our fermions. (The generalization to non-abelian symmetries is straightforward.) In a general theory, we have the contributions: κ ab , κ g , (1.26) 5 The SCFT charges can often be determined by F-maximization [12,8]. 6 On R 3 with Euclidean signature, parity acts by inverting the sign of a single coordinate.
where κ ab is the contribution from the two-point functions of U (1) a conserved currents, and κ g is the gravitational contributions (from the two-point function of the stress-energy tensor). The κ coefficients in (1.26) are called the "Chern-Simons contact terms," by a slight abuse of notation. They are physical modulo integers. This is because we always have the freedom of adding Chern-Simons terms to the effective action: where S CS and S grav are the U (1) and gravitational CS actions, respectively (with g a background metric). The CS levels k and k g are integer-quantized, as required by gauge invariance. The shift (1.27) induces a shift of the CS contact terms: κ → κ + k , κ g → κ g + k .
(1. 28) In the UV, the gauge theory is free, and the only contribution to κ is from free fermions coupled to gauge fields, whether dynamical gauge fields or background gauge fields for global symmetries, and from the CS terms themselves. 7 Consider then a single free fermion ψ coupled to A µ with U (1) charge 1. One can consider the so-called "U (1) − 1 2 quantization" for ψ, which corresponds to having the UV contact terms: 8 Any other choice of quantization is related to this one by a shift of the UV CS levels, as in (1.28), and is a matter of convention. For instance, the "U (1)1 2 quantization" would correspond to κ = 1 2 and κ g = 1. Importantly, for a single Dirac fermion, there exists no gauge-invariant scheme in which κ = 0 in the UV. 9 We refer to Appendix A for a more detailed discussion.
Finally, we may also consider adding a "real mass" m for ψ, which breaks parity explicitly. In that case, we can integrate out the fermion in the IR, which has the effect of shifting the CS contact terms according to: δκ = 1 2 sign(m) , δκ g = sign(m) .
Quantizing the N = 2 chiral and vector multiplets. Given the above discussion, let us state our conventions for quantizing fermions in N = 2 supersymmetric theories with a U (1) R symmetry. In the supersymmetric theory, we distinguish between the gauge (dynamical or flavor) Chern-Simons terms, the mixed gauge-R CS terms, the R-R CS term, and the gravitational CS term. The supersymmetrization of these terms is reviewed in Appendix A. Given some U (1) a gauge (or flavor) symmetries, we denote the corresponding CS contact terms by: respectively. Consider first a chiral multiplet Φ of U (1) a charges Q a and R-charge r. Unless otherwise stated, we always use the "U (1) − 1 2 quantization" described above for the Dirac fermion ψ in Φ, which then contributes to the CS contact terms as: Consider next the vector multiplet V. It is convenient to decompose the gauge fields into abelian gauge fields in vector multiplets V a along a maximal torus H ∼ = a U (1) a , and into the components along the non-trivial roots. Then, we choose a so-called "symmetric quantization" for the gauginos, such that they contribute trivially to the contact terms involving the gauge symmetry: V : δκ ab = 0 , δκ aR = 0 .
(1. 33) We must also specify the U (1) R and gravitational CS contact terms. In our conventions, each gaugino component contributes κ RR = 1 2 and κ g = 1. Therefore, the adjoint gaugino in the full vector multiplet contributes: δκ RR = 1 2 dim(G) , δκ g = dim(G) , (1.34) in the UV. We explain our motivation for this particular choice in Appendix A. Concretely, the quantization requirements (1.32) and (1.33)-(1.34) constrain the regularization of the various one-loop determinants that appear in supersymmetric localization formulas, as we will see in later sections. Implicitly, a lot of the supersymmetric localization literature used regularizations that set every CS contact term to zero, in the UV, κ (UV) = 0, thus preserving parity but violating gauge invariance. In this paper, as in [19], we are careful to regulate the one-loop determinants consistently with gauge-invariance. This leads to subtle corrections with respect to previous results. Those corrections turn out to be important when performing finer checks of the supersymmetric partition functions, for instance when testing supersymmetric dualities.

Supersymmetric partition functions and sum over Bethe vacua
As described above (1.19), we expect that the supersymmetric partition function on a general Seifert manifold, M 3 , can be computed as the expectation value of a suitable "geometry changing line operator" L M 3 inserted along the circle on the A-twisted S 2 × S 1 geometry. Consequently, the explicit expression for the partition function Z M 3 has a similar form to that of the expectation value of line operators in S 2 × S 1 .
The partition function of an N = 2 supersymmetric gauge theory on S 2 × S 1 , with the topological A-twist on S 2 , was computed in [32] using supersymmetric localization in the UV, and in [25] using topological field theory methods. The S 2 ×S 1 computation has been generalized to the product space Σ g × S 1 in [25,30,27]. More recently, we considered the case of the three-manifold M g,d , a principal S 1 bundle of degree d over the smooth Riemann surface Σ g [19]. 10 In all cases, the partition function can be computed using two complementary methods. Let us discuss them in turn.

TQFT computation
The first method exhibits the partition function as an observable in the 3d A-model [25,19]. As for any two-dimensional TQFT, A-model observables can be written as a trace over a suitable basis of field theory vacua. In the case of the 3d A-model, these two-dimensional vacua are called the "Bethe vacua," because the equations determining them coincide with the Bethe equations for a certain class of integrable spin chains [42,25].
The 3d A-model on Σ g is fully characterized by the two-dimensional twisted superpotential, W(u, ν), on the one hand, and by the effective dilaton, Ω(u, ν), on the other hand. These two functions are determined by the UV Lagrangian, and control the low-energy effective action on the Coulomb branch of any effective 2d N = (2, 2) gauge theory. They depend (locally) holomorphically on the gauge parameters u and on the global-symmetry parameters ν. 11 The "Bethe equations" determining the supersymmetric vacua are written in terms of the twisted superpotential alone, according to: Π a (u, ν) = exp 2πi ∂W(u, ν) ∂u a = 1 , a = 1, · · · , rk(G) .
(1. 35) We denote by S BE the set of Bethe vacua: S BE = û a Π a (û, ν) = 1 , w ·û =û, ∀w ∈ W G /W G . (1.36) Here, we exclude solutionsû which are fixed by some Weyl group elements, and count the remaining solutions up to the Weyl group action. Then, the partition function on Σ g × S 1 -also known as the genus-g twisted index-can be computed as [25,30,27]: with H is the handle-gluing operator introduced in (1.17). Its explicit expression in the 3d A-model is [25]: (1. 38) Note that, in this approach, we assume that there are a finite number of isolated Bethe vacua. This is the case in many interesting theories. In particular, in the presence of enough flavor symmetries, one can turn on generic real mass parameters and the vacua are then isolated.
A-model observables and geometry-changing line defects. A general A-model observable can be computed as: L i L j · · · Σg×S 1 = û∈S BE L i (û, ν)L j (û, ν) · · · H(û, ν) g−1 , (1. 39) with the insertion of any half-BPS line (1.14) in the 3d A-model. In [19], we considered the principal S 1 bundle M g,d , which is realized by inserting the so-called "ordinary" fibering operator, L = F. It can be written explicitly in terms of the twisted superpotential W: where the sum over repeated indices is implicit. Therefore, we have [19]: (1. 41) In this paper, we want to generalize those results to any half-BPS background (M 3 , L R ), with M 3 a Seifert manifold (1.8), and L R the R-symmetry line bundle discussed above, which determines a choice of spin structure over M 3 . We do this by introducing the "(q, p) fibering operator" (1.18). More precisely, we should consider the object: G q,p (u, ν) n,m , (1. 42) with q and p some mutually prime integers. Without loss of generality, we take q > 0. The integers n and m in (1.42) refer to "fractional fluxes" localized at the exceptional fiber, for the gauge and global symmetries, respectively, described in more detail below. Unlike the handle-gluing operator (1.38) or the "ordinary" fibering operator (1.40), the fibering operator (1.42) cannot be expressed in a simple way in terms of the twisted superpotential and effective dilaton alone. We can nevertheless write down explicit expressions for this operator in terms of the UV Lagrangian of the theory. For instance, the contribution of a U (1) Chern-Simons term at level k is given by: Here, t and s are integers such that qs + pt = 1, while the parameters l R and ν R are related to the choice of U (1) R bundle L R , as we will explain in detail later on. As another example, a chiral multiplet Φ of unit U (1) charge contributes: 12 with the integer t defined as before. In a general theory, there can be contributions from various U (1) R and gravitational Chern-Simons terms, and there is also an important contribution from the vector multiplet. These are described in full detail in Section 4. The Seifert fibering operator for a general gauge theory is built by assembling these building blocks, for fixed gauge and flavor fluxes n and m. Then, the "physical" (q, p) fibering operator of the gauge theory is obtained by summing over the fractional gauge fluxes n, according to: The M 3 partition function. Given the above discussion, the geometry-changing line operator (1.19) can be written as: with G M 3 the Seifert-fibering operator, which is determined by the Seifert fibration (1.8): Here, the (q, p) fibering operators is given as in (1.45). Note that the ordinary fibering operator is a special case of the (q, p) fibering operator, with (q, p) = (1, 1). We should also anticipate that the individual fibering operators appearing in (1.48) are generally not completely well-defined for every choice of L R in (1.23). Nonetheless, their product in (1.48) is always well-defined (assuming the half-BPS geometry itself is welldefined globally). Thus, we have obtained an explicit expression for the supersymmetric partition on any Seifert manifold, as a sum over the Bethe vacua of the 3d N = 2 gauge theory: This is the main result of this paper.

Supersymmetric localization computation
An alternative approach to the TQFT computation, which can be shown to be completely equivalent, is to follow the standard localization procedure and to deform the UV action by a suitable Q-exact term. This concentrates the path-integral to the neighborhood of a finite dimensional space, M BP S , which consist of field configuration that satisfies the BPS equations: Here, H is a supergravity background scalar proportional to the rational number: The quantity (1.51) is a topological invariant of the Seifert fibration. The case c 1 (L 0 ) = 0 and c 1 (L 0 ) = 0 are qualitatively different. Let us first assume that c 1 (L 0 ) = 0. By a standard abelianization procedure [43,44], the path integral reduces to a finite dimensional integral over the complex variable u ∈ h C , valued in the complexified Cartan subalgebra of G. The BPS equations also allow non-trivial gauge line bundles on the baseΣ of the Seifert fibration, and we should sum over all the lines bundles L on M 3 that can be obtained as pull-backs of the orbifold line bundles L onΣ-that is, L = π * (L). These line bundles form a group, which we denote by: with Pic(Σ) the orbifold Picard group onΣ. After integrating out the gaugino zero modes and the auxiliary field D in the vector multiplet, which can be done in the same way as in [30,27,19], we can write the partition function as: The various factors in the integrand will be defined in Section 6. As in [19], the choice of the contour C(η) in (1.53) can be rigorously derived in the rank-one case, while it remains as a conjecture for the higher rank case, due to a number of subtleties that we will review in Section 6. One can check that the integrand of (1.53) is invariant under large gauge transformation along the Seifert fiber, which acts on the gauge parameters as: 13 This is a trivial operation in Pic(M 3 ), which ensures that the summation in (1.53) is well-defined. On the other hand, there exists an alternative way of fixing the gauge under this large gauge transformation [45,46]. Namely, one can take a quotient on the "classical Coulomb branch" spanned by the variables u ∈ h C , by restricting them to: In this way, one arrives at the formula: where the contour C 0 (η) can be obtained by restricting C(η) in (1.53) to the "strip" (1.55) in the Coulomb branch variables. Here, Γ G ∨ is the ordinary lattice of magnetic fluxes. Now, the formula (1.56) is also valid for Seifert manifolds with c 1 (L 0 ) = 0. For instance, in the case of the twisted index on M 3 ∼ = Σ g × S 1 , the sum over the n i with 13 For non-abelian G, it is understood that the shifts are by elements of Λ cochar . i > 0 trivializes, while the sum over n 0 is a sum over the magnetic fluxes on Σ g , thus reproducing the localization formula derived in [32,30,27].
In the case of a gauge group G = U (1), one can explicitly perform the summation over n 0 in (1.56), as explained in [19]. We will show that the resulting expression is equivalent to the Bethe-sum formula (1.49) which we obtained from the two-dimensional TQFT point of view.
We will also show that the contour C(η) used in (1.53) can be continuously deformed to a non-compact integral C σ , the "σ-contour," which connects the region Im(u) → −∞ with the region Im(u) → +∞. This reproduces the well-known expressions for the partition functions on lens spaces in earlier literature [10,13,47,18], which were given as an integral over the constant mode of the real scalar σ in the vector multiplet.
When G is non-abelian and 2g − 2 + n ≥ 0, the abelianized path integral becomes singular at the loci where the non-abelian symmetry enhances. The simple "σ-contour" integral formula must be modified in generic cases due to these additional singularities in the integrand. We will briefly discuss this subtlety in Section 6. On the other hand, the Bethe-sum formula (1.49) is always valid, for any gauge group of the form (1.12), with the Bethe vacua defined as in (1.36). This claim is supported by a number of highly non-trivial consistency checks.

Testing supersymmetric dualities
A common application of exact results for supersymmetric partition functions is to test field theory dualities-see e.g. [48,49,50]. In particular, since the supersymmetric partition functions are RG-invariant, we can test infrared dualities-that is, the claim that two different gauge theories flow to the same infrared fixed point. A prime example of that are the 3d infrared dualities [51,52,50,53] similar to 4d Seiberg duality [54].
Given two infrared-dual theories T and T D , their supersymmetric partition functions must agree: for any half-BPS geometry M 3 . By now, many three-dimensional dualities are firmly established, and therefore we can also consider verifying (1.57) as a strong consistency check on our results for Z M 3 . This is what we will do. Given the 3d A-model formula (1.49) for the partition function, the duality relation (1.57) is equivalent to the statement that the various (q, p)-fibering operators agree on dual Bethe vacua, namely: Here,û denotes a solution to the Bethe equation in theory T , andû D denotes a solution to the dual Bethe equation in the dual theory T D , withû andû D paired by the duality map. In previous work, similar duality relations were checked for the handle-gluing operator [27] and for the ordinary fibering operator [19]. 14 The duality relations (1.58) are hard to prove in general, but we were able to checked them numerically, for a very large number of pairs of mutually-prime integers (q, p), and for a large number of infrared dualities. For instance, consider Aharony duality [51], which is an infared duality between a U (N c ) gauge theory with N f chiral multiplets in the fundamental and anti-fundamental representations (that is, N f "flavors"), on the one hand, and a U (N f −N c ) gauge theory on the other hand, schematically: The Bethe equation of both theories are determined by a certain polynomial: 60) of degree N f in a single variable x. Here, ν denotes collectively various flavor parameters for the SU (N f ) 2 × U (1) 2 global symmetry. A Bethe vacuum in the U (N c ) theory corresponds to a choice of N c distinct roots,x a = e 2πiûa , amongst the N f roots of P (x, y), the "Bethe roots." The dual vacuum in the U (N f − N c ) theory corresponds to choosingx D a = e 2πiû D a the complement of N f − N c roots. Then, the duality relations (1.58) depends on seemingly "miraculous" properties of the fibering operators G q,p (u, ν) m in (1.45) when evaluated on the Bethe roots.
It would be interesting to prove those relations analytically, presumably using some "number theoretic" reasoning. In any case, the exact match that we found, numerically and in many examples of 3d dualities, already provides a very strong test of our main results.

Lens spaces and holomorphic blocks
Lens spaces are an important class of thee-manifolds that admit supersymmetric backgrounds. Topologically, we define the lens space L(p, q), for any pair of mutually prime integers p and q (with p = 0), as the quotient: where the three-sphere S 3 is viewed as the unit sphere, {|z 1 | 2 + |z 2 | 2 = 1}, inside C 2 . Important special cases are: namely the three-sphere itself, and certain "simpler" lens spaces S 3 /Z p . Every lens space supersymmetric background is part of a continuous one-parameter family, generally indexed by a complex "squashing parameter" b ∈ C. The supersymmetric partition function on the (squashed) three-sphere S 3 b was studied in [10,12,13,14,47,55,5,56,57,9]. The generalization to the (squashed) lens space L(p, −1) b was considered in [11,15,58,59,60]. The three-sphere S 3 b and the lens space L(p, −1) b are examples of supersymmetric backgrounds with a trivial R-symmetry line bundle, as in (1.25); they are the only lens spaces with that property. The third example in (1.62) consists of the degree-p principal circle bundle over S 2 as studied in [41,19,61]. 15 The general L(p, q) b lens space partition functon was studied in [18].
Lens space are rather special amongst half-BPS geometries, due to the continuous parameter b-most half-BPS Seifert geometries are rigid and admit no such "squashing" deformation. Moreover, for generic b ∈ C, the half-BPS background is actually not of the form studied in the present work, because the Killing vector K in the supersymmetric algebra (1.1) does not generate the Seifert fibers. This is because, on L(p, q) b with any b, the Killing vector appearing in the curved-space supersymmetry algebra takes the form: (1.63) For a generic b, this Killing vector is complex. Even for b ∈ R, its orbits are noncompact unless we impose the rationality condition: Precisely in this case, the orbits of the U (1) action generated by K (b) span the S 1 fibers of a Seifert fibration structure on L(p, q). More precisely, for: the lens space L(p, q) b admits a presentation as a Seifert fibration over S 2 (q 1 , q 2 ), a genus-zero Riemann surface, with two exceptional fibers: and with the identifications p = p 1 q 2 + p 2 q 1 and q = q 1 s 2 − p 1 t 2 between the lens space and Seifert fibration parameters. 16 The lens spaces are the only Seifert manifolds that 15 To avoid any possible confusion, let us note that, in [19], we chose a different naming convention for L(p, q) (which is the convention more often used in the physics literature), so that L(p, p − 1) here was named L(p, 1) there, and vice-versa. 16 As above, the integers s i , t i are defined by the condition q i s i + p i t i = 1.
admit an infinite number of inequivalent Seifert fibrations, which are all accounted for by the rational squashing parameters, b 2 ∈ Q. The above discussion assumed p = 0, but it will be very natural to also define the spaces: Topologically, L(0, 1) and L(0, −1) have the same topology, S 2 × S 1 , but they differ very much as supersymmetric backgrounds. In our notation, L(0, 1) corresponds to the (refined) topologically-twisted supersymmetric index [32]. For rational values of the "refinement parameters" , L(0, 1) is again a Seifert fibration and it fits into our formalism (in particular, for = 0, this gives the twisted index discussed above). On the other hand, the supersymmetric background L(0, −1) admits no Seifert description. It corresponds to the "ordinary" supersymmetric (or superconformal) index, without topological twist [62,63].
Holomorphic blocks and fibering operators. We will demonstrate that our formalism for general Seifert manifolds reproduces, in the special case above, the known results for partition functions on rationally-squashed lens spaces. In particular, we clarify many subtle features of these partition functions, including a detailed discussion of the possible R-symmetry backgrounds. 17 We also relate our results to the "holomorphic blocks" of Beem, Dimofte and Pasquetti [17]. The holomorphic blocks can be defined as an uplift of the two-dimensional vortex partition function, or, equivalently, as the twisted partition function on a solid torus, D 2 × τ S 1 . In [17,18,65] it was shown that the supersymmetric partition function on lens spaces can be constructed by "fusion" of two holomorphic blocks: schematically. Here, ν are flavor parameters, τ is a geometric parameter related to the squashing b, and g is an SL(2, Z) element used to glue the two solid tori into a closed three-manifold-corresponding to the genus-one Heegaard splitting of L(p, q) into solid tori. The sum in (1.68) is over the Bethe vacua, and therefore (1.68) is very reminiscent of our general result (1.49) for Seifert manifolds. Indeed, we will show that, in the limit of b 2 rational, (1.68) becomes equivalent to (1.49). The holomorphic blocks are actually singular in the limit where b 2 becomes rational, but that singular behavior encodes interesting physics. In particular, that limit is governed by the twisted superpotential and by the effective dilaton [17]. We will show that, in the limit of rational squashing, the holomorphic blocks essentially reduce to the (q, p) fibering operators. This serves as an independent derivation of the fibering operators, and gives a new perspective on the holomorphic blocks themselves. We will also clarify some technical features of the blocks, such as their dependence on the choice of spin structure.

Discussion and outlook
The present work can be connected to many other lines of inquiries. First of all, as a special case of our formalism, we can study 3d N = 2 supersymmetric Chern-Simons theory on Seifert manifolds. Supersymmetric CS theory is essentially equivalent to pure (non-supersymmetric) CS theory, therefore we can directly compare our results to many exact results in Chern-Simons theory [66,67,68,69,70,45,46]. This will be discussed in a separate work [71]. See also [72] for some interesting recent work in that direction.
Another interesting research direction concerns the existence of many supersymmetric backgrounds that admit a topologically-trivial canonical line bundle (in addition to S 3 b and the lens space L(p, −1) b ), which can be used to study N = 2 superconformal field theories. For instance, using our results, the partition function of N = 2 SCFTs can be computed explicitly on the Poincaré homology sphere, and the obvious challenge is to understand exactly what kind of CFT observables that quantity may encode. We hope to return to this investigation in future work.
Let us also mention that the relation between the integral formula (1.53) and the Bethe-sum formula (1.49) had been found previously, in some special cases, in studies of state integrals in complex Chern-simons theory [73,74]. It would be interesting to understand if our evaluation formula (1.49), in the case of a lens space, can provide additional insight into multi-dimensional state-integrals. More generally, it would be very interesting to better understand our results in the context of the 3d/3d correspondence [75], wherein the supersymmetric partition functions on a given Seifert three-manifold should be related to observables in some (possibly new) 3d TQFT.
The results of this paper can also be uplifted to four-dimensional N = 1 gauge theories, by considering complex four-manifolds that are also T 2 fibrations over a Riemann surface, T 2 → M 4 →Σ [76]. In this way, one could study the most general half-BPS 4d N = 1 geometries, generalizing the approach of [77].
Finally, it would be very interesting to study boundaries and boundary conditions in the 3d A-model, making contact with the work of, e.g., [78,79]. Such a study would likely lead to a deeper understanding of the fibering operators as 3d defects defined in the UV by suitable boundary conditions (instead of the simpler two-dimensional definitions we adopted here), and it would likely allow us to explore more interesting coupled bulk-boundary systems exactly, using TQFT and localization techniques.
Due to its length, this paper is divided in three parts, plus appendices.
Part I gives a detailed discussion of half-BPS supersymmetric backgrounds. In Section 2, we provide an introduction to Seifert three-manifolds. On any Seifert threemanifold, we construct a half-BPS "A-twisted" supergravity background. The formalism of that section will be used extensively throughout the paper. In Section 3, we use that formalism to spell out a number of interesting examples of half-BPS Seifert geometries. We pay particular attention to lens spaces, for which we enumerate all the possible Seifert structures and choices of spin structure.
In Part II, we compute supersymmetric partition functions of 3d N = 2 gauge theories on a general Seifert manifold. In Section 4, we derive the result (1.49) from the point of view of the three-dimensional A-model, by introducing various geometrychanging line operators. In Section 5, as a non-trivial test of our result, we study infrared dualities of three-dimensional gauge theories on Seifert manifolds. In Section 6, we provide an alternative derivation of the partition function formula via Coulomb branch localization in the UV, which leads to the expressions (1.53) and (1.56).
In Part III, we revisit the computation of supersymmetric partition functions on the lens spaces, L(p, q). We compare our results with the previous literature and we clarify various subtleties. In Section 7 and 8, we study the squashed three-sphere partition function (M 3 = S 3 b ) and the refined twisted index (M 3 = S 2 × S 1 ), respectively. In Section 9, we discuss the general squashed lens space L(p, q) b in terms of holomorphic blocks, and we exhibit the precise relation between the holomorphic blocks and the Seifert fibering operators.

Part I
Half-BPS Seifert geometry

Supersymmetric backgrounds on Seifert three-manifolds
In this section, we give an introduction to the topology and geometry of Seifert threemanifolds, following [28,29] and [80,70,46]. Each Seifert fibration M 3 , together with a choice of spin structure on M 3 , provides us with a distinct half-BPS supersymmetric background, which we will spell out in detail.

Two-dimensional orbifolds and holomorphic line bundles
Since a Seifert manifold 18 M 3 can be viewed as circle bundle M 3 →Σ g,n over a twodimensional orbifoldΣ g,n , we first discuss the latter in some detail. A two-dimensional orbifoldΣ g,n is topologically a genus-g closed orientable Riemann surface Σ g with n marked points x i ∈ Σ g , i = 1, · · · , n, called the orbifold (or ramification) points. In an open neighborhood U i of an orbifold point x i , the coordinate system is modeled on C/Z q i instead of C, where q i ∈ Z >0 a positive integer. That is, in terms of a complex coordinate z (i) centered at x i , we have a cyclic identification: (2.1) An orbifold point x i has an "anisotropy parameter" q i > 1. If q i = 1 instead, the point x i is simply a smooth marked point. We often denote the orbifoldΣ g,n byΣ g (q 1 , · · · , q n ). Many of the familiar geometrical and topological tools can be extended to the orbifold case, in particular, one can define vector bundles, various cohomology theories, etc., similarly to the smooth case [81,82,83]. In particular, one can define a Q-valued orbifold Euler characteristic. It takes the numerical value: with χ(Σ g ) = 2−2g, the Euler characteristic of the underlying smooth surface. One can also choose a Riemannian metric compatible with the orbifold structure. A metric g(Σ) is a Riemannian metric with conical singularities 19 at x i , with deficit angles 2π q i −1 q i . The orbifold version of the Gauss-Bonnet theorem [82] reads: Physicists may be more familar with the notion of an orbifoldΣ as the quotient, Σ ∼ = Σ/Γ, of a smooth surface Σ by a discrete group Γ. An orbifold that can be written in this way is called "good", otherwise it is called "bad" [29]. Almost all twodimensional compact orbifoldsΣ g,n are good. The only bad orbifolds are S 2 (q 1 , q 2 ), with q 1 = q 2 , a two-sphere with two orbifold points of anisotropy parameters q 1 and q 2 . (This includes the cases q 1 = 1 or q 2 = 1. If q 1 = q 2 = q, we have S 2 (q, q) ∼ = S 2 /Z q , which is a good orbifold.) 18 Here and in the rest of this paper, every two-and three-manifold is orientable. In particular, by "Seifert manifold" we mean "orientable Seifert manifold." M 3 is also taken to be a closed manifold. 19 Near the point x i , we have: in terms of the polar coodinates z = re iφ , so that there is a deficit angle 2π qi−1 qi .

Holomorphic line bundles overΣ
One may define an orbifold holomorphic line bundle L overΣ g,n , similarly to the smooth case. Topologically, the line bundle L is fully determined by the data: The integer deg(L) is the degree of L. On the open set U i centered at the orbifold point x i , the local trivialization is modeled on (C × C * )/Z q i , with the quotient: with s (i) the fiber coordinate. Note that L is an ordinary line bundle over the underlying smooth Rieman surface Σ g if and only if b i (L) = 0 mod q i , ∀i. We may also introduce a connection A on L. The (integrated) first Chern class of L may be defined as: In terms of the invariants (2.6), it reads: Unlike the degree, the first Chern class transforms simply under tensor product: On the other hand, the invariants b i satisfy: It follows that the degree of the tensor product line bundle is: Here, x is the floor function: Let us denote by: the line bundle L overΣ g,n . In the following, it will sometimes be useful to relax the constraints 0 ≤ b i < q i on the fiber invariants b i . That is, we may take with the understanding that a shift of b i → b i + q i , at any given orbifold point, is equivalent to shifting the degree by one unit. We then have the equivalences: for any (m i ) ∈ Z n . The first Chern class (2.9) is invariant under such shifts. We should note that, as in the case of an ordinary line bundle, the holomorphic line bundle L is also characterized by some continuous holomorphic data, corresponding to flat connections valued in H 0,1 (Σ g,n ).
Canonical line bundle and spin structures. The canonical line bundle K over Σ g,n has the topological invariants: Its first Chern class is equal to minus the Euler characteristic (2.2), c 1 (K) = −χ(Σ). A spin structure onΣ g,n is a line bundle √ K such that √ K ⊗ √ K ∼ = K. Such a square root: exists if and only q i ∈ 2Z + 1, ∀i. More generally, we will need to consider a spin c structure onΣ, which always exists-that is, on a givenΣ, we may always introduce another line bundle L such that K ⊗ L possesses a well-defined square root. We will come back to this point later in the discussion.
Riemann-Roch-Kawasaki theorem. Let h 0 (L) = dim H 0 (Σ, L) denote the number of holomorphic sections of the line bundle L overΣ g,n . The Riemann-Roch-Kawasaki theorem [83] states that: generalizing the smooth case.
The orbifold Picard group. Let us denote by Pic(Σ) the group of linearly inequivalent line bundles, with the group multiplication given by the tensor product. Let us denote by L 0 and L j the elementary line bundles: That is, L 0 is an ordinary line bundle of degree 1, while the line bundle L j is an elementary orbifold line bundle with b j = 1 at the orbifold point x j , and b i = 0 for i = j. The Picard group takes the form: Let us emphasize that, in general, Pic(Σ) is not freely generated. To summarize, any L ∈ Pic(Σ) can be written as: for some integers n 0 , n i , giving d = n 0 , b i = n i up to the equivalences (2.15). It follows from the above discussion that: In the following, when thinking of the connection A on L as an abelian gauge field, we will often refer to n 0 and n i as the "ordinary flux" and the "fractional fluxes" of the U (1) gauge field A, respectively. They can be thought of as gauge fluxes localized at a smooth point x 0 ∈Σ or at the orbifold points x i : The statement L q i i = L 0 is the statement that q i units of fractional flux at x i are equivalent to a single unit of ordinary flux, which can then be moved away from the orbifold point.

Seifert three-manifolds: definition and properties
Given any line bundle L over the two-dimensional orbifoldΣ, we may consider the associated circle bundle S[L]. The total space of S[L] is a smooth three-manifold if and only if, at each each orbifold point x i , the integers q i and b i (L) are mutually prime. This follows simply from (2.7). A Seifert manifold is a closed three-manifold M 3 endowed with a Seifert fibration: as we explain momentarily. Any Seifert manifold M 3 can be viewed as the circle bundle associated to a certain defining line bundle L 0 over the orbifoldΣ g,n (q 1 , · · · , q n ), with topological invariants: We summarize this construction by the standard short-hand notation: The integers d and (q i , p i ) appearing in (2.26) are the so-called normalized Seifert invariants if 1 ≤ p i < q i . We will often consider the unnormalized invariants with p i ∈ Z, taking into account the equivalences (2.15). Moreover, it is possible to relax the condition that q i > 0, taking into account the equivalence (q i , p i ) ∼ = (−q i , −p i ) for each exceptional fiber. In the following, we will always choose q i > 0 unless otherwise stated. For future reference, let us write down the first Chern class: This quantity is independent of the specific normalization of the Seifert invariants, since it remains invariant under the shift d → d − 1, p i → p i + q i , as well as under the inversion (q i , p i ) → (−q i , −p i ), for any i. A Seifert fibration (2.24) is a smooth map π : M 3 →Σ such that any point x ∈Σ has a neighborhood D 2 ⊂Σ (with x at r = 0 ∈ D 2 , the center of the disk) whose pre-image is isomorphic to a solid fibered torus, π −1 (D 2 ) ∼ = T (q, t). Here we define to be obtained by gluing the two disk boundaries of the cylinder D 2 × I with an angular twist 2πt/q, with t ∈ Z and gcd(q, t) = 1. In the local coordinates (r, ϕ, ψ), with r ∈ [0, 1), ϕ ∈ [0, 2π) the polar coordinates on the disk D 2 , and ψ ∈ [0, 2π) the angular coordinate on S 1 , we identify: (2.29)  For q > 1, the fiber S 1 at r = 0 is an exceptional Seifert fiber. There can only be a finite number of exceptional fibers, at a finite number of points x i ∈Σ (i = 1, · · · , n).
The neighborhood of an exceptional fiber is illustrated in Figure 1. At any smooth point x 0 ∈Σ, we simply have π −1 (D 2 ) ∼ = T (1, 0). This description of M 3 is related to the S 1 bundle description (2.26) as follows. For T (1, 0) ∼ = D 2 × S 1 , we clearly have a (trivial) circle fibration structure over the disk, corresponding to the neighborhood of a smooth point onΣ. For T (q, t), the neighborhood of an exceptional fiber, on the other hand, we can obtain a Z q orbifold trivialization D 2 × S 1 of the form (2.7), by considering the q-covering T (1, 0) → T (t, q). Note that the generic fiber (at r = r 0 > 0) in T (q, t) winds q times around the torus. Let us define the coordinate ψ =ψ/q, so that the generic fiber has length 2π, and the singular fiber (at r = 0) has length 2π/q. Then, the identification (2.29) becomes (ψ, ϕ) ∼ (ψ + 2π/q, ϕ + 2πt/q), which is equivalent to: reproducing the local trivialization (2.7) at an orbifold point. 20 Surgery construction. Any Seifert manifold can be constructed by some simple surgery operations, as summarized in Section 1.1. Consider a Seifert manifold M 3 presented as in (2.26). One may add a new exceptional fiber of type (q, p), as follows. Consider cutting out T (1, 0) ∼ = D 2 × S 1 around a generic fiber, with D 2 a small disk around the smooth point on the base. We thus obtain a three-manifold M 3 with boundary ∂ M 3 ∼ = T 2 ∼ = −∂D 2 × S 1 . One can then glue back D 2 × S 1 along the boundary with an SL(2, Z) twist, to obtain a new closed three-manifold. If (ϕ, ψ) and (ϕ , ψ ) denote the angular coordinates on the T 2 boundary of M 3 and D 2 × S 1 , respectively, we glue the boundaries according to: This introduces a new (q, p) fiber, for q, p two mutually prime integers; by convention, we choose q > 0. In particular, this introduces a new Z q orbifold point on the base of the Seifert fibration. The special case: leaves the base invariant. The introduction of such a "(1, 1) fiber" is equivalent to shifting the degree, d → d + 1. In this way, we may obtain the Seifert manifold (2.26) starting from the trivial fibration: and performing surgery to introduce the exceptional fibers (1, d) and (q i , p i ), i = 1, · · · , n. One may also consider the reverse process, by performing surgery at exceptional fibers. Note that s, t ∈ Z in (2.31) are not fully determined by: Given a solution (s, t), we have an infinite number of solutions (s + np, t − nq), n ∈ Z. This shift of (s, t) corresponds to: which does not affect the topology of the resulting thee-manifold.

Fundamental group, (co)homology and line bundles
Consider the Seifert manifold M 3 ∼ = [d; g; (q i , p i )]. Its fundamental group π 1 (M 3 ) has the following explicit presentation: with l = 1, · · · g, i = 1, · · · , n, and [a, b] = aba −1 b −1 the group commutator. The generators a l , b l correspond to the A-and B-cycles of the underlying Riemann surface Σ g , g i corresponds to a loop inΣ around the orbifold points x i , and h corresponds to a generic Seifert fiber. The first homology of M 3 is the abelianization of (2.36). It can be written as: Here, the free factor Z 2g in H 1 (M 3 , Z) corresponds to the one-cycles a l , b l of Σ g . The group Pic(M 3 ) which appears in (2.37) can be viewed as the pull-back of the orbifold Picard group Pic(Σ) through the map: where we identified lines bundles overΣ or M 3 with their first Chern classes in H 2 (Σ, Z) or H 2 (M 3 , Z), respectively. One finds: 21 That is, the group Pic(M 3 ) is isomorphic to the two-dimensional orbifold Picard group modulo tensor products with the defining line bundle L 0 . One can also show that Pic(M 3 ) is finite if and only if c 1 (L 0 ) = 0, with: We also have: Line bundles over M 3 . The group Pic(M 3 ) is the group of complex line bundles over M 3 which are the pull-backs of orbifold line bundles overΣ. For later purposes, it is useful to spell this out explicitly. Let us introduce the generators: such that h = e γ and g i = e ω i in the abelianization of (2.36). Here, γ and ω i are viewed as representatives of first homology classes in H 1 (M 3 , Z) (which are all torsion if c 1 (L 0 ) = 0). They are in one-to-one correspondence with the elementary line bundles (2.19) in Pic(Σ), according to: (2.43) 21 Assuming that we can simply generalize the smooth case to the orbifold case, this follows from the Gysin sequence, · · · −→ H 0 (Σ) More precisely, the pull-back of L 0 to M 3 is a line bundle π * (L 0 ) represented by −[γ], and the pull-back of L p i i is represented by [ω i ]. Therefore, the abelian group Pic(M 3 ) has the explicit presentation: (2.44) For each pair (q i , p i ), let us introduce the integers s i and t i such that: The elementary line bundles L 0 , L i pull-back to the following ordinary line bundles over This directly gives us the pull-back of an arbitrary orbifold line bundle (2.21) to M 3 .

The classification of Seifert manifolds
Most three-manifolds that admit a Seifert fibration π : M 3 →Σ do so in a unique way. The only-and very important-exceptions are the lens spaces (including S 2 × S 1 ), which are realized as genus-zero Seifert manifolds with n ≤ 2 exceptional fibers. Each lens space L(p, q) admits an infinite number of inequivalent Seifert fibrations. This will be discussed in greater detail below. For the purpose of classification, it is useful to define a small Seifert manifold as one amongst the following short list [28]: 23 (i) The lens spaces M 3 ∼ = [0; 0; (q 1 , p 1 ), (q 2 , p 2 )].
(ii) The manifolds M 3 ∼ = [0; 0; (q 1 , p 1 ), (q 2 , p 2 ), (q 3 , p 3 )] such that 1 q 1 + 1 q 2 + 1 q 3 > 1. Here we have set d = 0 by using unnormalized Seifert symbols; these four cases will be discussed in detail in Section 3. Any other Seifert manifold is called large. It turns out that any two large Seifert manifolds M 3 and M 3 have equivalent Seifert fibrations if and only they are homeomorphic [28]. Moreover, they are homeomorphic if and only if they have the same fundamental group. Note that this topological classification of Seifert manifolds is valid up to orientation reversal, which acts on Interestingly, the only Seifert manifolds with a finite fundamental group (2.36) are the small Seifert manifolds of type (i) or (ii). Otherwise, the order of π 1 (M 3 ) is infinite. Seifert manifolds span six out of the eight Thurston geometries [29]. 24 It is convenient to distinguish three cases according to the Euler characteristic of the base. If χ(Σ) > 0, the Seifert manifold is modeled on S 3 if π 1 (M 3 ) is finite, or on S 2 × R otherwise. If χ(Σ) = 0, M 3 is Euclidean if c 1 (L 0 ) = 0, and has Nil geometry otherwise. If χ(Σ) < 0, the general case, then M 3 has SL(2, R) or H 2 × R geometry.

Adapted metric and transversely holomorphic foliation
Given a Seifert manifold M 3 , we choose an adapted metric: which admits a real Killing vector K along the Seifert fiber. The one-form η is dual to K-that is, η µ = K µ in local coordinates. We introduce the local coordinates ψ, z,z, with ψ ∈ [0, 2π) the angular coordinate along the fiber, and z,z the complex coordinates along the orbifoldΣ, so that: and: with β > 0 the radius of a generic fiber. Let us normalize the volume ofΣ to vol(Σ) = π. The connection C is a real two-dimensional connection on the defining line bundle L 0 . Its curvature reads ∂ z Cz − ∂zC z = c 1 (L 0 ) 2ig zz , with c 1 (L 0 ) given in (2.27). Therefore: Note also the useful identities: THF and the canonical line bundle of M 3 . A Seifert fibration is a special case of a transversely holomorphic foliation (THF), viewed as the foliation generated by the nowhere-vanishing vector field K-see [5,9] and references therein. A metriccompatible THF can be characterized by the tensors η µ and Φ µ ν = − µ νρ η ρ , which gives a three-dimensional analogue to a complex structure. Under a change of adapted coordinates, we have: with λ real and f (z) a holomorphic function of z. Given a THF, there exists a notion of Dolbeault-like decomposition of differential forms [9]. In particular, one can define the notion of a holomorphic one-form, ω ∈ Λ 1,0 M 3 , such that: Thus ω has a single component, ω z , which transforms as ω z = (∂ z f (z)) −1 ω z under (2.52). This makes ω z a section of a holomorphic line bundle over M 3 , by definition. We call this particular holomorphic line bundle the canonical line bundle of the Seifert manifold M 3 , denoted by K M 3 . It is also the pull-back of the canonical line bundle of Σ through the Seifert fibration: . Therefore, (2.46) implies: THFs on three-manifolds were classified in [84,85]. It turns out that "most" threemanifolds that admit a THF are Seifert manifolds (in the sense that they admit at least one Seifert fibration), and can thus preserve two supercharges. 25 We also expect that most half-BPS Seifert backgrounds do not admit any continuous "squashing" deformations, in the following sense. In order to affect supersymmetric observables, any half-BPS "squashing" should modify the supersymmetry algebra (1.1), deforming K to K + K , with K a distinct Killing vector on M 3 . This K must be the pull-back of a Killing vector along the baseΣ g,n , which can only exist at genus 0 with n ≤ 2 (giving us the lens space case) or at genus 1. It would be interesting to verify this by a direct analysis of the THF moduli of half-BPS Seifert manifolds.

Spin structures on M 3
Recall that any orientable three-manifold is spin, and that the distinct spin structures are in one-to-one (non-canonical) correspondence with elements of H 1 (M 3 , Z 2 ). Using the universal coefficient theorem and Poincaré duality, one finds: (2.56) Here Tor(A, Z 2 ) ∼ = {a ∈ A | 2a = 0} for any abelian group A-the group of elements that square to zero. From Subsection 2.2.1, we find: The factor Z 2g 2 corresponds to the familiar choice of spin structure on the underlying genus-g Riemann surface. The supersymmetric observables will be independent of that choice. The factor Pic(M 3 ) ⊗ Z 2 reflects the further possibility of choosing the periodic or anti-periodic boundary conditions for fermions along all the other non-trivial onecycles in M 3 . Note that: 26 Now, let us sketch a more explicit description of the spin structure.
Spin structures onΣ. On a smooth Riemann surface Σ g , choosing a spin structure is equivalent to choosing a square root of the canonical line bundle: This square root always exists in that case, with c 1 (K) = g−1.
There is a Z 2g 2 ambiguity corresponding to the boundary conditions for the fermions along the A-and B-cycles. Equivalently, we can introduce a Z 2 -valued flat connection on Σ g , which couples nontrivially to fields of half-integer spin, as follows. The two-dimensional connection A K µ on the canonical line bundle overΣ is given by the spin connection: (2.60) Then, choosing a spin structure with periodic boundary conditions for fermions around a one-cycle C l is equivalent to choosing a connection 1 2 ω (2d) µ on √ K with a non-trivial Z 2 holonomy around C l . For a two-dimensional orbifoldΣ(q i ), on the other hand, we saw in (2.17) that the square root √ K only exists if all the q i 's are odd integers. When it exists, √ K has a Z 2g 2 ambiguity as in smooth case-see e.g. [86]. While √ K generally does not exist, we may be able to define a spin c structure for some spinors, in the sense that there might exist a line bundle L ∈ Pic(Σ) such that √ K ⊗ L exists. As we will show, this is precisely what happens in the 3d A-model.
Since K M 3 = π * (K) by definition, we may view the "holomorphic" cotangent bundle of M 3 as: with fibers R ⊕ C adapted to the THF. The 3d spin bundle, denoted by S, is a C 2 vector bundle over M 3 with structure group Spin(3) = SU (2), such that: (2.63) In other words, for any two Dirac spinors ψ α and ψ α valued in S, we have the obvious decomposition ψ α ⊗ ψ α ∼ = ψ ⊕ ψ µ into a scalar and a vector. 27 The spin bundle over M 3 can then be written as: with S defined in (2.61). The decomposition (2.64) also naturally corresponds to the decomposition of a 3d Dirac spinor ψ α into the two-dimensional Weyl spinors ψ ± . (We refer to Appendix D of [64] and to [61] for related discussions of S some special cases.) Therefore, choosing a spin structure on M 3 is equivalent to choosing a square root S of K M 3 . 28 Let us assume that we have found a solution to (2.61), denoted by S 0 . If c 1 (L 0 ) = 0 for the defining line bundle L 0 overΣ, Pic(M 3 ) is a finite group and any S can be written as a product of S 0 with a nilpotent element: If c 1 (L 0 ) = 0, there is an additional twofold freedom associated with the free generator of Pic(M 3 ). We will show this more explicitly in the next subsection. In this way, the set of spin structures on M 3 are indeed in one-to-one correspondence with elements of the group (2.58). 27 Our conventions for spinors are summarized in Appendix B. We will always choose an adapted frame (e 0 , e 1 , e1) = (η, √ 2g zz dz, √ 2g zz dz). In the second equation in (2.63), we view K M3 as the associated U (1) line bundle, so that O ⊕ K M3 ⊕ K −1 M3 corresponds to the decomposition of a vector into components v 0 , v 1 , v1 in the adapted frame. 28 Here and in the following, we ignore the additional choice of spin structure on the underlying smooth Riemann surface Σ g . As we mentioned, the supersymmetric observables are independent of that choice. Heuristically, this is because, after the topological A-twist, all the A-twisted fields have integer spins on Σ g and therefore do not depend on the spin structure on the Riemann surface.

A-twist and supersymmetric backgrounds on Seifert manifolds
On M 3 with the adapted metric (2.49), we may preserve two supercharges Q andQ, corresponding to the generalized Killing spinors ζ andζ of R-charge 1 and −1, respectively [5,4]. A rigid supersymmetric background on M 3 consists of supersymmetrypreserving background values for the bosonic fields in the 3d N = 2 new-minimal supergravity multiplet [3,5,6]: is a background gauge field for the U (1) R symmetry. The metric g µν is given by (2.49), and the other background fields are: with the U (1) R gauge field A (R) given by the expression: in the adapted coordinates ψ, z,z. Using a modified (torsionfull) connection∇ such that∇η = 0, as defined in Appendix B, the Killing spinor equations take the simple form: The THF-adapted connection∇ has U (1) holonomy, which can be compensated by the holonomy of the U (1) R connection (2.68), generalizing the familiar topological A-twist from two to three dimensions [5,22,19]. The Killing spinors read: in the adapted frame. The function s appearing in (2.68) and (2.70) encodes the freedom in choosing the spin structure associated to our supersymmetric background, as we will now explain.

Three-dimensional A-twist and spin structure
Let L R be the U (1) R line bundle on M 3 . Given the Killing spinorζ, we may define a spinor bilinear valued in L −2 R : P µ =ζσ µζ . (2.71) One can show that P µ is in fact a holomorphic one-form [5]-it satisfies (2.53). It follows that: is a nowhere-vanishing section of K M 3 ⊗ L −2 R . We thus have: Therefore, the more precise statement of the three-dimensional A-twist [19] is that we choose the R-symmetry line bundle L R to be any well-defined square root of the canonical line bundle, as in (2.61): The connection (2.68) on L R can be written as: in terms of the spin connection (2.60) onΣ and of a flat connection A flat µ with Z 2 holonomies: Since we have A (R),flat µ = ∂ µ s, the "function" e is in (2.70) should really be seen as a non-trivial map: Once we have fixed some s 0 so that (2.75) is well-defined, we can also find any other maps e is related to e is 0 by a non-trivial Z 2 -valued homotopy [22]. The A-twist (2.74) correlates this choice of A (R),flat µ with the choice of spin structure on M 3 , precisely so that the Killing spinors (2.70) are always invariant. In other words, for every one-cycle on M 3 , we might choose either the periodic or the anti-periodic boundary condition for the fermions, as long as we also choose the R-symmetry background gauge field with Z 2 -valued holonomies in such a way that the Killing spinors ζ andζ, of R-charges ±1, remain periodic and therefore globally defined.
In this way, we obviously preserve supersymmetry. Even though a particular fermionic dynamical field might be either periodic or anti-periodic in some spin structure, the U (1) R background ensures that all the scalars in the same supersymmetry multiplet have the same boundary conditions, thus preserving supersymmetry. Note that, for a vector multiplet, both the gauge field and the gauginos are periodic in any spin structure, since the gauge field has zero R-charge while the gauginos have R-charge ±1 just like the Killing spinors.
We should also note that the two-dimensional connection 1 2 ω (2d) µ in (2.75) is not welldefined by itself if √ K does not exist onΣ. When that happens, the flat connection A (R),flat µ will be similarly ill-defined such that the full three-dimensional A (R) µ is welldefined. This construction can be made very explicit from the two-dimensional point of view, as we now explain.

Constructing L R on Σ g
We can view the Seifert supersymmetric background (M 3 , L R ) as the pull-back of the topological A-twist background onΣ [76,5,19]. In particular, there exists a twodimensional R-symmetry line bundle L R ∈ Pic(Σ) such that: with S defined in (2.61). In the rest of this paper, it will be most useful to consider any three-dimensional N = 2 supersymmetric field theory as a two-dimensional theory with N = (2, 2) supersymmetry, topologically twisted alongΣ [19]. The two-dimensional field theory has an infinite number of fields, corresponding to the Kaluza-Klein (KK) modes of the 3d fields along the Seifert fiber: For any field ϕ a section of a vector bundle E over M 3 , the two-dimensional modes are sections: The Killing spinors (2.70) need not be constant along the Seifert fiber. We generally have: in local coordinates, where the ellipsis denotes ψ-independent term. The parameter ν R encodes the Z 2 holonomy of the flat connection A (R),flat µ along the generic Seifert fiber: Somewhat formally, the 3d spinorsζ is the pull-back of the following nowhere-vanishing section onΣ:ζ and similarly for ζ. Here, √ K is the naive square root defined in (2.17), N is some formally nilpotent 2d line bundle in Pic(Σ), while L 0 pulls back to the trivial line bundle in Pic(M 3 ). In general, both √ K and N ⊗ (L 0 ) ν R are ill-defined, in such a way that L R is well-defined. This gives a slight generalization of the usual A-twist on a Riemann surface, with the identification: We can now characterize this L R explicitly, as an element of Pic(Σ). We have: with n R 0 ∈ Z the "ordinary flux" and n R i ∈ Z the "fractional fluxes" for U (1) R . For future reference, let us define another integer n R 0 by: We then introduce the parameterization: Here, we introduced the integer-valued parameters: They correspond to the formal line bundle N , with: Note that the (generally ill-defined) line bundle N ⊗ L ν R 0 in (2.84) cannot be trivial unless √ K exist. If q i is odd for every exceptional fiber, we can choose l R i = 0 and ν R = 0, as in the ordinary A-twist (and as was considered in [19], for instance). On a generic Seifert background M 3 , however, the parameters l R i and ν R are non-trivial. There are chosen precisely such that the fluxes n R 0 , n R i are integers.

L R and the M 3 spin structure
By definition, we have: From (2.87), we immediately see that: Any other solution L R is obtained by a shift of the parameters ν R modulo 1 and l R i modulo 2. Let us denote these shifts by: respectively. We have: with the first Chern class of the line bundle δL R given by: The shifting parameters (2.92) are constrained by: By comparing this constraint to the presentation (2.44) of three-dimensional Picard group, we see that the shifts (2.92) are in one-to-one correspondence with elements of Pic(M 3 ) ⊗ Z 2 , by identifying the generators as: Since the choice of L R is equivalent to a choice of spin structure, this completes our discussion of the relation between the choice of spin structure on M 3 and the group (2.58). In Section 3, we will illustrate the above procedure in many examples.

Holomorphic line bundle moduli
Holomorphic lines bundles onΣ and M 3 are determined by additional data, beyond the topological data encoded in Pic(Σ) or Pic(M 3 ). In two-dimensions, it is well-known that holomorphic line bundles can come in continuous families, indexed by complex moduli, corresponding to the Dolbeault cohomology H 0,1 (Σ); the moduli correspond to (anti-holomorphic) flat connections A flat z . In three-dimensions, the THF structure allows for similar holomorphic moduli for a holomorphic line bundle L, with complex moduli valued in H 0,1 (M 3 ) [9]. Given A F µ a 3d background gauge field and σ F its scalar superpartner in a vector multiplet, it is convenient to define the complexified gauge field: The complex moduli of the associated bundle L F correspond to the holonomies of (2.97) along one-cycles. In particular, we denote by: its holonomy along the Seifert fiber [γ]. The continuous parameters ν F play a crucial role in this paper, because the various half-BPS observables we compute are holomorphic-more precisely, meromorphic-in them. 29 Note that we have the identifications: corresponding to large U (1) gauge transformations along the fiber.
In summary, at least for our present purposes, any holomorphic line bundle L F over M 3 is fully characterized by a particular element L F ∈ Pic(M 3 ) together with a complex parameter ν F ∈ C. From the two-dimensional point of view, the parameters ν F are simply twisted masses in background N = (2, 2) vector multiplets onΣ.
µ is part of the supergravity multiplet, it is also part of a smaller vector multiplet, which includes the gauge field A (R) µ + V µ and the scalar σ R = H [6,22]. Thus, we see that the U (1) R analogue of (2.97) is precisely the gauge field A (R) µ in (2.68): It follows that the U (1) R complex structure modulus is given by the parameter ν R introduced in (2.81). In addition to ν R , we have seen above that it is important to keep track of the parameters l R i , corresponding to Z 2 holonomies of A (R),flat µ along the one-cycles ω i , or equivalently along the exceptional fibers.

Quantization condition on the R-charge
By definition, any 3d field ϕ of R-charge r ∈ Z is valued in (L R ) r , and the corresponding two-dimensional KK modes ϕ n take value in L r R ⊗ L n 0 . For the three-dimensional Amodel to be well-defined, those bundles should be well-defined. This condition can be written as: with L R the two-dimensional U (1) R line bundle defined in Subsection 2.3.2. If we assume that L R exists, we generally have the integrality condition: for the R-charges of the matter fields. We may also consider the case for which only L 2 R exists-in such a case, we must impose the quantization condition r ∈ 2Z for all 3d chiral multiplets. In such a case, the partition function becomes independent of a choice of spin structure. More general R-charges might also be allowed on a given background. For instance, if the U (1) R fluxes n R 0 and n R i have a common divisor m, the Dirac quantization condition will simply be mr ∈ Z.

Topologically trivial K M 3 and real R-charges
A very special but very important case occurs when L R is topologically trivial: This is equivalent to the conditions: This system of n + 1 equations for the n + 1 variables 2ν R , l R i , generally does not have any solution over the integers. By construction, there exists a solution if and only if the three-dimensional line bundle K M 3 in (2.55) is trivial in Pic(M 3 ). When c 1 (L 0 ) = 0, this fixes ν R to be: When c 1 (L 0 ) = 0, there exists a linear relation between the equations (2.104), and we then have an additional freedom in choosing a topologically trivial L R . When (2.104) holds, there is no Dirac quantization condition and we may consider arbitrary real R-charges r ∈ R for the matter fields. Such supersymmetric backgrounds are particularly interesting in order to study 3d N = 2 superconformal field theories, which generally have irrational R-charges. When K M 3 ∼ = O and c 1 (L 0 ) = 0, there exists a unique spin structure on M 3 compatible with real R-charges.

Examples of supersymmetric Seifert backgrounds
In this section, we discuss some important examples of Seifert manifolds and their associated supersymmetric backgrounds, to illustrate the formalism of Section 2. After reviewing the principal-bundle case of [19], we discuss in detail all the possible Seifertfibration backgrounds on lens spaces. We then present a few other interesting example of manifolds with more general topology.

The principal bundle M g,p
As a first example, consider the family of manifolds M g,p studied in [19]. In the Seifert notation, we have: This is a principal circle bundle of first Chern class p ∈ Z over the smooth Riemann surface Σ g : The 2d Picard group Pic(Σ g ) ∼ = {L 0 } ∼ = Z is freely generated. The defining line bundle is: and therefore: To fully specify the supersymmetric background, we need to choose a U (1) R line bundle over Σ g : For p odd, we must take ν R integer. The case ν R = 0 was called the "A-twist gauge" in [19]. When p is even, we can choose ν R to be either integer or half-integer. In particular, taking 2ν R even or odd corresponds to the choice between the two distinct spin structures on M g,p [64,61]. Indeed, we have: In that case, L 0 ∼ = O, and we can still turn on the U (1) R fugacity ν R ∈ 1 2 Z. Thus, even the "ordinary" twisted index Z Σg×S 1 admits a Z 2 refinement keeping track of the choice of spin structure. 30

The twisted S 2 × S 1
Consider the three-manifold S 2 × S 1 . There exists a one-parameter family of half-BPS backgrounds, denoted by S 2 × S 1 , with non-trivial U (1) R flux through the S 2 . The corresponding supersymmetric partition function is the refined twisted index of [30]. The case = 0 corresponds to the standard A-twist on S 2 .
The THF associated to this family of supersymmetric backgrounds is best understood as the quotient of S 2 × R by: with τ , z,z the adapted coordinates, and the THF modulus [9]. Let us introduce the real coordinates θ, ϕ, τ , with θ ∈ [0, π], ϕ ∈ [0, 2π) the standard angular coordinates on S 2 . We have: In these angular coordinates, the quotient (3.7) simply corresponds to the identification τ ∼ τ + 2π. For definiteness, we consider the same adapted metric as in [30]: The Killing vector entering in the curved-space supersymmetry algebra reads: We have η = βdτ with η µ = K µ . Note that the orbits of K only close if is a rational number: Let us restrict ourselves to this case. We claim that, with the identification (3.11), K generates a Seifert fibration: with S 2 (q, q) ∼ = S 2 /Z q . In the standard notation, we have: In particular, we have the defining line bundle: over the spindle S 2 (q, q), with L 1 and L 2 the elementary line bundles associated to the two orbifold points at the north and south poles, respectively. Note that c 1 (L 0 ) = 0. One can show that (3.13) gives the complete list of Seifert fibrations of S 2 × S 1 [87]. The fibration (3.13) is given explicitly by: This map is obviously invariant under (3.7) if = t/q. We can also understand the fibration structure directly from the metric (3.9) and Killing vector (3.10). Consider the change of coordinates: For q, s, p, t ∈ Z such that qs + pt = 1, this is an SL(2, Z) transformation and the new angles ψ, φ have periodicities 2π. Let us also define β = q β. In the new coordinates, we have: and We may choose the radius R 0 = √ q so that vol(S 2 (q, q)) = π. This brings this geometric background to the general form (2.49), with the flat L 0 connection C = p q dϕ. The spindle metric in (3.18) is a special case of (2.4). We have the holonomies: with ω 1 , ω 2 the generators of the orbifold fundamental groups-the loops around the poles. This reproduces (3.13).
Line bundles and choice of L R . Finally, let us discuss the orbifold bundles on Σ ∼ = S 2 (q, q). We have: which is not freely generated. These orbifold line bundles pull-back to the threedimensional line bundles in: [ Of course, [Ω] is the single generator of H 2 (S 2 × S 1 , Z) ∼ = Z. Note that we have: and We have the 2d and 3d canonical line bundles: with integer U (1) R fluxes: Note that l R 1 and l R 2 must have the same parity. There are three different cases, depending on the parity of p and q. One easily finds: for q and p odd , These two distinct solutions, for any given (q, p), are in one-to-one correspondence with the two spin structures on S 2 × S 1 .

The three-sphere
Consider the three-sphere S 3 . There exists a one-parameter family of supersymmetric backgrounds preserving two supercharges, indexed by the so-called squashing parameter b ∈ C [14,47,56,9]. Viewing S 3 as a T 2 fibered over an interval, with ϕ, χ the angular coordinates on the T 2 , let us consider the background of [14] with b 2 ∈ R, for definiteness. The supersymmetry algebra involves the Killing vector: There is a natural symmetry under b → b −1 , which corresponds to exchanging the two cycles, ϕ and χ, of the torus. For generic b 2 ∈ R, the orbits of K do not close and this K does not define a Seifert structure (it only defines a THF). However, in the special case: the orbits close and the S 3 b geometry can be viewed as a Seifert fibration over a sphere with two orbifold points: The integers q 1 and q 2 should be mutually prime, and exchanging their roles corresponds to the equivalence b → b −1 . We then have: for b 2 = q 1 q 2 a rational squashing parameter. 31 We will demonstrate (3.31) momentarily, in the more general case of the lens space. This can also be understood by bringing any metric on the three-sphere, with the Killing vector K, to the form (2.49)-we give an example of that approach in Appendix C.1. Moreover, the Seifert fibrations (3.31), modulo trivial equivalences, coincide with the set of all Seifert fibrations of the three-sphere [28].
Consider the spindle S 2 (q 1 , q 2 ) with gcd(q 1 , q 2 ) = 1. We have the defining line bundle: The orbifold Picard group of S 2 (q 1 , q 2 ) is freely generated, with L 0 the single generator: with L 1 ∼ = L q 2 0 and L 2 ∼ = L q 1 0 . It directly follows that the three-dimensional Picard group is trivial: On the other hand, we have the two-dimensional canonical line bundle: We may choose: We can choose any ν R such that 2ν R − q 1 − q 2 is even. Note that the parity 2ν R is fixed by the parity of q 1 + q 2 , which here corresponds to the fact that there is a unique spin strucure on S 3 . A particularly interesting choice is: such that L R is trivial in Pic(Σ) as well. This is the background that can be directly compared to the squashed-sphere backgrounds considered in the literature [14,47], as we will further discuss in Section 7. For this choice of L R ∼ = O, we have n R 0 = n R 1 = n R 2 = 0 and the Dirac quantization on the R-charge is trivial. This allows us to consider real R-charges for the matter fields.

The lens space L(p, q) b
We define the lens space L(p, q) as the quotient of S 3 : 32 The associated supersymmetric backgrounds come in one-parameter families L(p, q) b , indexed by the so-called "squashing parameter" b [14,15,9]. We already discussed the special case L(1, 1) b ∼ = S 3 b in the previous subsection. Another very special case is L(0, 1) ∼ = S 2 × S 1 , which we analysed separately; here we consider p = 0.
As mentioned above, lens spaces are the only compact three-manifolds which admit more than one Seifert fibration (with the baseΣ g orientable); in fact, they admit an infinite number of distinct Seifert fibrations, which are fully classified [28,87]. Any Seifert fibration of genus 0 with n ≤ 2 exceptional fibers is a lens space, and every Seifert fibration over a lens space can be constructed in that way. We have: with the identifications: Here, as usual, the integers s i , t i are such that q i s i + p i t i = 1. The pair of integers (s 2 , t 2 ) entering in (3.40) is only defined up to shifts by (p 2 , −q 2 ). This has the effect of shifting q to q + p, which gives the same lens space. More generally, two lens spaces L(p, q) and L(p, q ) are related by an orientation-preserving diffeomorphism if and only if q = q mod p, or qq = 1 mod p. This second equivalence is realized in (3.39)-(3.40) by exchanging the roles of the two exceptional fibers, which also takes b → b −1 . 33 Note also the following special cases: For q 1 = q 2 = 1, there are no orbifold points on S 2 and we have the principal bundle L(p, 1) 1 ∼ = M 0,p as defined in (3.1), where p = p 1 + p 2 . The other special case is when there is only one orbifold point, with q 1 = q and q 2 = 1 or q 1 = 1 and q 2 = q, then: respectively.
Seifert fibration from Hopf surface. To understand the identification of the Seifert structures (3.39) with the known supersymmetric backgrounds, it is useful to consider the four-dimensional uplift to the secondary Hopf surface, which is diffeomorphic to L(p, q) × S 1 . The primary Hopf surface M p,q (3.42) 32 In this paper, we are using the "mathematicians' definition" for L(p, q). The lens space L(p, q) as defined in many physics papers, for instance in [15,58,19], corresponds to L(p, −q) here. 33 Taking q = q 2 s 1 − p 2 t 1 and q as in (3.40), one can check that qq = 1 − p(t 1 s 2 + s 1 t 2 ).
The parameters p, q are complex structure moduli of the Hopf surface-they give rise to the one-parameter family of THFs in 3d, which we can parameterize by p = e −2πbβ , q = e −2πb −1 β , with β the radius of the S 1 [53,9]. The secondary Hopf surface M 4 ∼ = L(q, p) × S 1 is obtained by a further Z p quotient of M p,q 4 as in (3.38). As in the three-sphere case, the THF is also a Seifert fibration if and only if b 2 ∈ Q: The lens space Seifert fibration is given explicitly by: with z the local coordinate on the S 2 base. The map (3.44) is obviously compatible with the quotient (3.42) when (3.43) holds. It is also compatible with (3.38) provided that qq 2 − q 1 = 0 mod p; one can check that this automatically follows from (3.40). The map (3.44) also makes manifest the presence of ramification points at the poles, so that the base of the fibration is a spindle S 2 (q 1 , q 2 ). The defining line bundle of the Seifert fibration (3.39) has a first Chern class: Unlike the case of S 3 b , the integers q 1 and q 2 may not be coprime; in Appendix C.2, we review an algorithm to constructs all the Seifert fibrations of any given L(p, q) [87].
Line bundles and R-symmetry backgrounds. The base space for the Seifert fibration (3.39) of L(p, q) is the spindle S 2 (q 1 , q 2 ). Since q 1 and q 2 need not be relatively prime, the two-dimensional orbifold Picard group Pic(S 2 (q 1 , q 2 )) is not necessarily freely generated. In the three-dimensional notation, it has the presentation: (3.46) Following (2.46), we denote the pull-backs of the elementary orbifold line bundles L i by: One may check that: as relations inside the 2d Picard group, thus Pic S 2 (q 1 , q 2 ) is also generated by [δ 1 ] and [δ 2 ]. The three-dimensional Picard group Pic L(p, q) is the quotient of Pic S 2 (q 1 , q 2 ) by the relation: One can check that: as relations in Pic S 2 (q 1 , q 2 ) , with p and q given by (3.40). The first relation implies that [δ 2 ] lies in the group generated by [δ 1 ] in Pic L(p, q) , and therefore Pic(L(p, q)) can be generated by the single generator [δ 1 ]. The second relation in (3.50) then implies that: Now, consider the R-symmetry line bundle. The canonical line bundle of the spindle is given by K ∼ = L −1 1 L −1 2 , which can be written as: in Pic S 2 (q 1 , q 2 ) . Using the relations (3.50), we may rewrite this as: In particular, this is trivial in (3.51) if and only if: In the general case, the 2d R-symmetry line bundle takes the form: (3.55) In the special case (3.54), it is natural to choose L R ∼ = O topologically trivial, so that we may consider any real R-charges. Writing q + 1 = np for some integer n, we see that: It follows that L R is topologically trivial if we choose: where we used (3.40). Equivalently, this follows from (2.105). From (3.54), we also see that a lens space admits a trivial R-symmetry line bundle if and only if has the form L(p, p − 1). This obviously generalizes the case of the S 3 b background with ν R given by (3.37). This L(p, p − 1) supersymmetric background was the one studied by supersymmetric localization in [15,58,19]. 34 Choice of L R and spin structure. On a general lens space L(p, q), we have: (3.58) and the R-symmetry line bundle cannot be topologically trivial unless (3.54) holds [9]. Nonetheless, we can always choose ν R and l R i such that arbitrary integer R-charges satisfy the Dirac quantization condition (2.101). Consider the general parameterization of L R as in (2.86)-(2.87), with the 2d integer fluxes: That implies: The special case (3.57) with L R ∼ = O corresponds to this integer being zero. We should carefully distinguish between the cases with p odd or even. If p is odd, (3.60) implies that ν R mod 1 is fixed by the parity of q 1 + q 2 -that is, ν R ∈ 1 2 + Z if q 1 + q 2 is odd, and ν R ∈ Z if q 1 + q 2 is even. If p is even, on the other hand, we see that q 1 + q 2 must be even 35 and the constraint (3.60) can be solved with ν R either integer or half-integer. Therefore: While any such choice of ν R mod 1 satisfy (3.60), we must also solve the stronger constraints (3.59). From the constraint n R 0 ∈ Z, we see that l R 1 and l R 2 have the same parity. Then, one can check that, if p is odd, that parity is determined by the fibration: while if p is even, we have the following three cases: The important point is that there are two and only two distinct possibilities, for any Seifert fibration of L(p, q). This nicely agrees with the geometric result: For p even, the two distinct spin structures of L(p, q) correspond to the two choices in (3.63), generalizing the M 0,p ∼ = L(p, 1) example discussed in Section 3.1.

Torus bundles over the circle
Another interesting class of examples consists of Seifert manifolds which are also surface bundles over the circle. It turns out that a Seifert manifold, M 3 , fibers over the circle if and only if c 1 (L 0 ) = 0 [28]. 36 Here we consider two simple examples of torus bundles. (Interestingly, there are only five torus bundles which are also oriented Seifert manifolds, including the trivial case T 3 ∼ = [0; 0; ]. In addition to the S-and C-twisted torus bundles to be discussed below, the two last examples can be found in [88].)

S-twisted torus bundle
A torus bundle M A 3 is a three manifold which is obtained from the product T 2 × I, with I ∈ [0, 1] an interval, by gluing the end-points of the interval into a circle while identifying the tori with a non-trivial automorphism A: Let us choose the automorphism to be: Consider T 2 to be the square torus have a Z 2 stabilizer (generated by C ≡ S 2 ) and are identified by S. The fundamental domain for Z 4 is the square with corners z = 0, 1 2 , 1 2 + i 2 , i 2 . The corresponding Seifert three-manifold takes the form: where the three orbifold points on the genus-zero base correspond to z = 1 2 ∼ i 2 , z = 0 and z = 1 2 + i 2 , respectively. More precisely, it is possible to show that: Note that the base has vanishing orbifold Euler character, and the first Chern class of the defining line bundle vanishes as well: 36 We already studied a trivial example of this, the manifold S 2 × S 1 .
as anticipated. The 2d Picard group takes the form and we have: The 2d U (1) R line bundle therefore takes the form: so that ν R must be half-integer. We will consider this square-root a little bit more carefully below.
The 3d Picard group. The three-dimensional Picard group takes the form: By changing the basis of generators to: we find that: Note that the free generator [λ 1 ] corresponds to L 2 1 L 4 2 in Pic S 2 (2,4,4) . It follows that: which comes entirely from (3.75). In other words, there are four distinct spin structures compatible with supersymmetry on M S 3 .
It is also very natural to choose a line bundle L R ∼ = O, with vanishing fluxes. This is possible for: Interestingly, we can have a topologically-trivial L R (and therefore choose any real Rcharge for the matter fields) for two out of the four choices of spin structures, namely for the two spin structures corresponding to (l i ) mod 2 equal (0, 0, 0) and (0, 1, 1).

C-twisted torus bundle
Another interesting torus bundle is obtained by taking the order-two automorphism C = −1 in (3.65). It corresponds to a genus-zero Seifert fibrations with four exceptional fibers: This is also the "small" Seifert manifold (iii) in Section 2.2.2. It has c 1 (K) = 0 and c 1 (L 0 ) = 0 as in the last example. We easily find the three-dimensional Picard group: It follows that: so that there are eight distinct spin structures on M C 3 . They can all be probed by our supersymmetric backgrounds. Indeed, the conditions on the U (1) R flux are equivalent to: and there are eight distinct possibilities for the parameters l R i mod 2. There are also "conformal" backgrounds for which L R is topologically trivial, with ν R = − 1 2 + k and (l R i ) = (−k, −k, −1 + k, −1 + k), spanning two out of the eight spin structures.

Spherical manifolds S 3 /Γ ADE
Another interesting family of genus-zero Seifert manifolds are the so-called spherical three-manifolds, which are quotients of the three-sphere, Here we consider the simple case in which Γ is a subgroup of SU (2) L . These background are particularly interesting from the point of view of 3d N = 2 superconformal theories. Recall that one can preserve the superalgebra: on the round S 3 , where the SU (2) L factor can be taken to act by left multiplication. This is a subgroup of the full flat-space superconformal algebra OSp(2|2, 2) which contains four supercharges and is compatible with N = 2 massive deformations of the theory on S 3 [12]. It is immediately clear that, if we quotient S 3 by Γ ⊂ SU (2) L , we do not break any further supersymmetry. Therefore, such spherical three-manifolds can also be used to construct 3d N = 2 backgrounds preserving four superchages [5].
It is well-known that the finite subgroups Γ ⊂ SU (2) are in one-to-one correspondence with the finite Dynkin diagrams of type ADE, according to: Here,D 4n is the binary dihedral group, and T , O and I are the binary tetrahedral, binary octahedral and binary icosahedral groups, respectively. Their orders are given in Table 1. Let us also introduce the notation: By construction, spherical three-manifolds have a finite fundamental group: The corresponding Seifert manifolds can be written as [28,89]: (3.88) Extrapolating the E-series to m = 1, 2, we have the equivalences E 4 = A 4 and E 5 = D 5 , which are clearly realized by the Seifert geometries (3.88). (We also have D 3 = A 3 .) In all cases, we find the relation: with c 1 (L 0 ) = 0, and therefore there exists a "superconformal" background with the U (1) R fugacity: The A-series consists of the lens spaces L(p, p − 1) with squashing b 2 = q 1 /q 2 , which we discussed in Section 3.4. Let us briefly discuss the other cases.

The D-series
Consider the Seifert fibrations S 3 [D n+2 ] as defined in (3.88). One easily finds that: When n is even, the two generators of Z 2 × Z 2 can be taken to be [ When n is odd, the generator of Z 4 can be taken to [ω 1 ]. Correspondingly, there are four distinct spin structures if n is even, and two distinct spin structures if n is odd. The U (1) R fluxes are: If n is even, we have ν R = 1 2 mod 1 and there are four distinct choices of l R i mod 2. If n is odd, we also have ν R = 1 2 mod 1 but we also need l R 3 = 1 mod 2 and there then only two distinct choices of the U (1) R fractional fluxes, matching the number of spin structures.

The E-series
For the Seifert fibrations S 3 [E m+3 ] defined in (3.88), we find: 37 where the single generator can be take to be [ω 1 ] + [ω 2 ]. In other words, we have the homologies: It also follows that the E 6 and E 8 spherical three-manifolds have admit unique spin structure, while there are two distinct spin structures in the E 7 case. The Seifert manifold: is the celebrated Poincaré homology sphere-it has the same homology as the threesphere, but its fundamental group (the binary icosahedralÎ) is non-trivial. Beyond this complete list of spherical three-manifolds preserving four supercharges, it is natural to extend the E-series in (3.88) to m > 5. The bound m ≤ 5 is equivalent to: The "E m+3 manifolds" with m > 5 are examples of rational homology spheres (discussed in the next subsection), which generally do not have spherical geometry. For instance, the Seifert manifold S 3 [E 9 ] has χ(Σ) = 0 and c 1 (L 0 ) = 0 and Euclidean geometry (according to the classification reviewed in Section 2.2.2). The manifold S 3 [E 10 ] provides an example of an integral homology sphere with SL(2, R) Thurston geometry.

Homology spheres
A three-dimensional "integral homology sphere" (ZHS) is a three-manifold M 3 with the same integral homology as the three-sphere: More generally, a "rational homology sphere" (QHS) has Seifert rational homology spheres can be constructed as the genus-zero fibration: such that: This implies that the anisotropies q i should be mutually prime: For instance, that is the case for both the examples S 3 [E 8 ] (the Poincaré homology sphere) and S 3 [E 10 ] mentioned above, with (q i ) = (2, 3, 5) and (2, 3, 7), respectively. Then, Pic(Σ) ∼ = Z is freely generated by: and Pic(M 3 ) is trivial. In particular, there is a unique choice of L R and of spin structure. In their studies of CS theories, [70,46] also considered certain simple QHS's obtained by a Z d quotient of a ZHS. They can be obtained by replacing p i by dp i , ∀i, in (3.98).
To conclude this survey of Seifert backgrounds, let us note that, while all the examples of Seifert fibration in this section had an a underlying genus-zero baseΣ 0,n , the generalization toΣ g,n is automatic. Indeed, changing the genus of the base does not affect the discussion of Pic(M 3 ) nor the determination of the R-symmetry line bundle. In the field theory discussion of the next sections, this will be reflected in the fact that the handle-gluing operator and the Seifert fibering operator are independent from each other.

Part II
Seifert fibering operators

Fibering operators and partition functions
Supersymmetric partition functions of 3d N = 2 gauge theories on Seifert manifolds M 3 can be computed in the language of the "3d A-model," a topologically twisted 2d N = (2, 2) effective field theory for abelianized vector multiplets on the baseΣ of the Seifert fibration [19].
In this section, we first review this construction in the case of a principal bundle M 3 = M g,d , while also discussing the spin-structure dependence of 3d A-model. We then introduce the (q, p)-fibering operator, whose insertion at a smooth point onΣ corresponds to adding a (q, p) exceptional fiber to M 3 . This allows us to elegantly write down the exact supersymmetric partition on any Seifert manifold.

Twisted superpotential and Bethe vacua
Consider a 3d N = 2 gauge theory with gauge group G, a product of semi-simple simply-connected and unitary groups, coupled to chiral multiplets Φ in representations R of G. We consider the theory on R 2 × S 1 , with a finite circle S 1 of radius β, and we focus on the effective field theory on the two-dimensional Coulomb branch. The lowenergy modes consist of 2d N = (2, 2) twisted chiral multiplets U a , a = 1, · · · , rk(G)which are the field strength multiplets of 2d gauge fields-with complex scalar u a . We have u = iβσ − a 0 in terms of the 3d real scalar σ and the Polyakov loop a 0 = 1 2π S 1 A, which gives the equivalences: under large gauge transformations along the maximal torus of G.
The theory might also have a flavor group G F , with maximal torus α U (1) α ⊂ G F , and we may turn on chemical potentials ν α (α = 1, · · · , rk(G F ))-i.e. background gauge fields-for these flavor symmetries. We have the periodicities ν α ∼ ν α + 1 under large gauge transformations of the background gauge fields. Let us introduce the convenient notation: with the index a = (a, α) running over both the gauge and flavor groups. We also consider the U (1) R fugacity: as discussed in previous sections. Choosing either ν R = 0 or ν R = 1 2 (mod 1), is correlated with choosing the periodic or anti-periodic spin structure, respectively, for 3d fermions along the S 1 fiber.

Twisted superpotential of the 3d gauge theory on
Up to Q-exact terms, the 2d low energy action on R 2 is fully determined by the twisted superpotential [25,19]: On general grounds, the twisted superpotential is only defined up to linear shifts [19]: Classical contribution. The first term in (4.4) is the contribution from the Chern-Simons terms (for the gauge and flavor groups) in the UV action. It is given by: (4.6) Here, k ab are the CS levels for the gauge and flavor groups, including possible, mixed gauge-flavor CS levels in the abelian sector; k aR are the mixed U (1) a -U (1) R CS levels.
All the Chern-Simons levels are integer-quantized. The ellipsis in (4.6) corresponds to u-independent terms, which will not concern us in the following. Note that ν R enters in (4.6) in two conceptually different ways: In the second line, it enters as a chemical potential for ν R in the mixed gauge-R CS term. In the first line, it enters as a shift of the linear term in u, corresponding to a choice of spin structure on R 2 × S 1 . In fact, the classical action for a U (1) k N = 2 Chern-Simons theory on Σ g × S 1 , with n units of flux through Σ g , gives: for u constant, where the sign depends on whether we choose the periodic (ν R = 0) or anti-periodic (ν R = 1 2 ) spin structure. 38 Note that the sign dependence disappears if k is even, in agreement with the fact that U (1) k CS theory only depends on the spin structure if k is odd, while it is a fully topological theory for k even [33].
Matter contribution. The second term in the twisted superpotential (4.4) is a oneloop-exact contribution from the chiral multiplets. For a single chiral multiplet of U (1) gauge charge 1 and R-charge r ∈ Z, we have the formal contribution: where the infinite sum is over the KK modes on the circle. This gives: This is the result in the "U (1) − 1 2 quantization," consistent with the parity anomaly [36]. In the large-σ limit, we have: (4.10) The limit σ → +∞ corresponds to an empty theory at vanishing CS levels. The limit σ → −∞ reproduces the integer CS levels: as expected. We refer to [19] for further discussion of the parity anomaly in this context. 39 The matter contribution W matter in (4.4) is the sum over all the chiral multiplets, weighted by their charges: with r ω the R-charge of the fields Φ ω in some representation R of the gauge group.
Vector multiplet contribution. The last term in (4.4) is the contribution from the vector multiplet. Consider first the W-bosons W α , with α ∈ ∆ the roots of g = Lie(G).
In the abelianized theory on the Coulomb branch, W α contributes exactly like a chiral multiplet of gauge charges α a and R-charge r = 2 [90]. For each pair of roots α and −α, we choose the "symmetric quantization," such that there is a vanishing net contribution to the contact terms κ GG , κ GR , κ RR and κ g . Each positive root then contributes: to the twisted superpotential. Up to u-independent terms, the expression (4.13) is equivalent to ν R α(u). Therefore, we find the very simple result: with ∆ + the set of positive roots, and ρ W = 1 2 α∈∆ + α the Weyl vector. For G a simply-connected simple gauge groups, the Weyl vector is a weight, so that ρ a W ∈ Z and W vector can be set to zero by a linear shift (4.5). For G = U (N ), on the other hand, W vector will contribute some non-trivial signs to physical observables if and only if N is an even integer (and ν R = 1 2 mod 1). As already anticipated in the introduction, with our choice of quantization the vector multiplet also contributes non-trivially to the κ RR and κ g CS contact terms, as in (1.34). These contribute to the constant piece in the twisted superpotential, which we ignored in the above. 40 They do affect the more general geometry-changing operators to be introduced below, as we will see.

Bethe equations and Bethe vacua
Consider the so-called "gauge flux operators:" The Bethe vacua are the two-dimensional vacua of the effective field theory for the abelianized 2d vector multiplets. These Bethe vacua are obtained from the Bethe equations: with the identification u a ∼ u a +1. Here W G denotes the Weyl group of G, and w·u the Weyl group action on {u a }-that is, we should discard any solution to the equations {Π a = 1} that is not acted on freely by the Weyl group [91,92]. Note that the Bethe equations generally depend on ν R . In the special case when all U (1) CS levels and all chiral-multiplet R-charges are even, the dependence on ν R drops out and the Bethe equations are the same as in the "A-twist background" studied in [19]. When the R-charges are all integer-quantized (as is the case, for instance, on Σ g × S 1 ), the dependence on ν R only appears through subtle signs.

Handle-gluing operator and twisted index
Consider the supersymmetric partition function of the 3d N = 2 theory on Σ g × S 1 , also known as the twisted index [25,32,30,27]. It is given by a sum over Bethe vacua, as: This is a sum over the solutions u =û of the Bethe equations (4.16), with the handlegluing operator H evaluated on the vacua. The handle-gluing operator of a 3d gauge theory reads: Here, the "effective dilaton" Ω is given by: with: the contribution from the gauge or flavor-R and RR CS levels. The matter contribution reads: 21) and the vector multiplet contribution reads: This last term is ν-and ν R -independent, and gives rise to a factor: At genus g = 0, this is an ordinary Weyl determinant. The last factor in (4.18) is the Hessian determinant of the twisted superpotential (4.4) as a function of the gauge parameters u a . It can be written as: in terms of the gauge flux operators (4.15). One can also insert background flux n α ∈ Z for some U (1) α flavor symmetry through Σ g . That background flux can be localized at a point, in which case it can be viewed as another local operator in 2d, the flavor flux operator [19], given by: In three dimensions, this is a line operator wrapping the S 1 , at a point on Σ g [93,94]. One can also insert a supersymmetric Wilson loops W R in representations R of the gauge group, wrapping the S 1 , which corresponds to the characters: The operators Π α and W R are the simplest examples of half-BPS lines operators, also known as twisted-chiral operators, which can be inserted at any point on Σ g while preserving the same supercharges Q − andQ + as the geometric background. The correlations functions of twisted-chiral operators are topological-i.e. independent of the insertion points on Σ g . Therefore, the most general correlation function in the 3d Amodel is the expectation value of a general line operator L wrapped over S 1 , which is given explicitly by the formula: The twisted index (4.17) is the very special case L = 1.

Fibering operators for Seifert manifolds
In this work, we study a more general class of half-BPS line operators in the 3d Amodel, the geometry-changing line operators, whose insertion on Σ g is equivalent (in Q-cohomology) to considering the field theory on a different three-manifold with S 1 non-trivially fibered over Σ g [19]. For any supersymmetric background (M 3 , L R ) on a Seifert manifold M 3 , we expect that the supersymmetric partition function can be written (at least formally) as an expectation value: with L M 3 the line operator associated to the Seifert geometry M 3 , from the point of view of S 2 × S 1 . In [19], we studied the case of M 3 ∼ = M g,d a principal circle bundle, in which case: with F the so-called fibering operator. In the present work, we will write down the geometry-changing line operator associated to any Seifert geometry (2.26) as: schematically. Each (q, p)-fibering operator G g,p corresponds to adding an exceptional fiber with the Seifert invariants (q, p). Using unnormalized Seifert invariants and the fact that the degree d can be viewed as a (1, d) exceptional fiber, we write a general Seifert fibration as: and we will use the notation: for the "ordinary" fibering operator, F(u). We then write: Note that the (q i , p i )-fibering operators (with q i > 1) should be inserted at distinct points x i ∈ Σ g , corresponding to the n ramification points of the two-dimensional orbifoldΣ g (q 1 , · · · , q n ) at the base of the Seifert fibration M 3 . The position of the ramification points is otherwise arbitrary. Since the correlation function does not depend on the position of these points, we may take them arbitrarily close to one another, and so may effectively treat the operator L M 3 as a single line operator.
Fractional fluxes and large gauge transformations. From the point of view of the 2d orbifoldΣ, we may consider any holomorphic line bundle as in (2.21). We refer to the corresponding integers n i as the "fractional fluxes" at the orbifold points x i , while a flux n 0 localized at a smooth point is an "ordinary flux." Then, considering a single (q, p) exceptional fiber, we denote by: with n ∈ Z the fractional flux. (From here onwards, the dependence on ν R is left implicit.) Strictly speaking, the fractional flux is valued in Z q , and we must have: with Π(u) the ordinary flux operator defined above. (Treating gauge and flavor fluxes democratically.) In particular, we have: for the (1, d) "exceptional fiber" encoding the degree of L 0 . We will use the notation G q,p (u) for (4.34) with n = 0. The fractional fluxes encode all the relevant (supersymmetry-preserving) non-trivial lines bundles over M 3 in a redundant manner, according to (2.39). Tensoring by L 0 corresponds to a large gauge transformation in the A-model. Considering a configuration with fractional fluxes (n 0 , n i ) and holomorphic modulus u ∈ C, we have: By gauge invariance of the quantum field theory, the shift (4.37) should be an invariance of the various fibering operators, viewed as functions of u ∈ C and n ∈ Z: G q,p (u + 1) n+p = G q,p (u) n . (4.38) We will verify this in the explicit results below. 41 In the special case (4.36), the difference equation (4.38) is equivalent to: which was a crucial ingredient in the analysis of [19]. In the following subsections, we present explicit expressions for the building blocks of the fibering operators for general 3d N = 2 gauge theories. 41 There is an important subtlety for general L R , which we will address below.

Contribution from Chern-Simons terms
Let us first consider the contribution from the classical action to the fibering operators. It comes entirely from Chern-Simons terms. (The relevant supersymmetric Lagrangians can be found in [19], following [5].) U (1) k CS term. Consider first the supersymmetric Chern-Simons action for a single U (1) vector multiplet, at level k. We claim that each (q, p)-fibering operator contributes: with the function: Here, n ∈ Z denotes the fractional flux, l R ∈ Z corresponds to the parameterization (2.86) for the R-symmetry line bundle L R , and the integers s and t are such that qs+pt = 1, as usual. It follows from (2.86) that, for a given (q, p), (4.41) is independent of the choice of (s, t). 42 The function (4.41) is invariant under the large gauge transformation (u, n) → (u + 1, n + p) up to a sign: as one can easily check. When taking the product of all the fibering operators to obtain a geometry-changing operator, as in (4.33), the signs (−1) l R from (4.42) cancel out due to (2.88). Therefore the operator G M 3 (u) for the U (1) k theory is gauge invariant, as expected. We can also check that: with: the ordinary flux operator for the U (1) k=1 term.
Mixed abelian CS term. Consider a mixed abelian CS term at level k 12 ∈ Z for some U (1) 1 × U (1) 2 vector multiplets. At level k 12 = 1, we have: 42 Under a shift (s, t) → (s − p, t + q), the expression (4.41) gets multiplied by a trivial sign (−1) n(q−1+2pν R +l R q) = 1, where we have used the fact that q − 1 + 2pν R + l R q = 2n R is even.
with n (1) , n (2) the fractional fluxes for the two U (1) factors. This expression is fully gauge-invariant and satisfies: (1) , n (2) , (4.46) in agreement with the form of the corresponding flux operators [19]. Note that (4.45) is independent of ν R , in agreement with the fact that the mixed CS action is spin-structure independent.
Non-abelian CS terms. The Chern-Simons contribution for a non-abelian gauge group G can be obtained similarly. For G = U (N ) at level k, we simply have: For G a simply-connected simple Lie group, the signs in front of (4.41) cancel out, in agreement with the expected spin-structure-independence of the answer, and one obtains: with h ab the Killing form of g = Lie(G).
Mixed gauge-R CS term. We may also have a mixed CS term between an abelian gauge field and the R-symmetry background gauge field on M 3 , at level k GR ∈ Z. This is given in terms of: to the power k GR . Here the R-symmetry "fractional flux" n R at the exceptional fiber (q, p) is given as in (2.86), namely: The expression (4.49) can be understood as a special case of (4.45), essentially because the R-symmetry gauge field also sits in a vector multiplet, which is a submultiplet of the 3d N = 2 "new minimal" supergravity multiplet [22]. Using (4.50), the expression (4.49) can also be written as: The RR CS term. We can also have a U (1) R CS term at level k RR ∈ Z. It contributes to the fibering operator through: to the power k RR , with n R given by (4.50). Since ν R is real, G RR q,p is a pure phase. Obviously, this can also be understood as a special case of (4.41).
The gravitational CS term. The last supersymmetric Chern-Simons term is the supersymmetrization of the gravitational CS term, with level k g ∈ Z [37]. For future reference, let us first introduce the phase: with s(p, q) the Dedekind sum: (4.54) We will denote by: the contribution of the gravitational CS term at level k g . We find: with the phase G RR q,p given by (4.52). Note that we could only determine the precise phase (4.55) for k g even. (In other words, we determined G grav up to a sign. In any case, in this paper at least, we will only ever need to consider k g even.)

Contribution from chiral multiplets
Next, we consider the contribution of chiral multiplets to the fibering operator. This can be extracted from the one-loop determinant of a free chiral multiplet on the supersymmetric background (M 3 , L R ). Let Φ be a chiral multiplet coupled to a U (1) background vector multiplet with charge 1, of R-charge r ∈ Z. We can compute the one-loop determinant by considering the KK expansion (2.79) of the fields along the Seifert fiber. By supersymmetry, the only modes that give a net contribution to the one-loop determinant are holomorphic sections onΣ [19]. Let L = L n 0 0 ⊗ i L n i i denote the gauge bundle. The KK modes φ k for the scalar field φ in Φ are then valued in the holomorphic line bundles: Using the Riemann-Roch-Kawasaki theorem (2.18), we obtain the simple result: (4.58) with: The formal infinite product (4.58) needs to be regularized.
Vanishing R-charge. Consider first the case of a chiral multiplet of R-charge r = 0. As in [19], we define the ordinary flux and fibering operators for a free chiral by: (4.60) Similarly, we find the (q, p)-fibering operator for a free chiral multiplet: With these definitions, we find: In the U (1) − 1 2 quantization for the Dirac fermions, we obtain: upon regularizing (4.60). Note that F Φ (u) is a meromorphic function of u which satisfies , as in (4.39) [19]. We can similarly regularize the infinite product (4.61)-this is elaborated upon in Appendix D. In the absence of fractional flux (n = 0), we find: with t the modular inverse of p mod q. Note that G Φ q,p (u) is a meromorphic function of u with poles or zeros at u = −k ∈ Z, as expected from (4.61). (One can show that the various branch cut ambiguities in the definition (4.64) cancel out entirely, so that G Φ q,p (u) is single-valued.) This generalizes the ordinary flux operator, which corresponds to: The function (4.64) can be also written as: The contribution from the fractional fluxes can be conveniently written in term of Pochhammer symbols: (4.67) Let us note the identity: The full (q, p) fibering operator for Φ is then given by: One can check that: as expected on general grounds.
General R-charge. For a general R-charge r ∈ Z, we simply have: with the R-symmetry line bundle overΣ parameterized as in (2.86) and (2.87). In particular, the chiral multiplet simply contributes: to the (q, p)-fibering operator.
Large σ limits: In the limit σ → ∞, we find: 73) in agreement with having an empty theory in the IR. In the opposite limit σ → −∞, one can show that: with the right-hand-side given in terms of the CS fibering operators defined in Subsection 4.3.1. 43 This is exactly as expected from (4.11). The l R -dependent term in front of the CS terms in (4.74) cancels out in the full fibering operator G M 3 due to the constraint n i=0 l R i = 0.
Complex mass term. Similarly, we can consider two chiral multiplets Φ 1 , Φ 2 with gauge charges ±1 and R-charges r and 2 − r, such that we can write down a superpotential mass term W = Φ 1 Φ 2 . One finds: with: a (q, p)-independent function, which therefore cancels out from G M 3 . In the limit u → −i∞, we have g(u) ∼ e −πiu and (4.75) obviously reduces to (4.74). The relation (4.75) nicely matches our expectations-the two chiral multiplets are given in the "U (1) − 1 2 quantization" and, upon integrating them out with a superpotential mass term, we remain with the integer-quantized CS contact terms (4.11), including the U (1) −1 CS term.

Contribution from the vector multiplet
Let us now consider the vector multiplet V for the gauge group G with Lie algebra g. The (q, p) fibering operator has contributions both from the 3d H = U (1) rk(G) vector multiplets V a in the maximal torus of G, and from the massive "W-bosons" on the Coulomb branch. 43 See Appendix D for details on the derivation of (4.74).
W-boson contribution. Consider first the W-bosons, which contribute like chiral multiplets of gauge charges α a and R-charge 2. For each pair of roots α, −α, we choose the symmetric quantization as discussed around equation (4.13). This gives: Here we have used the fact that, in the symmetric quantization, we have to turn on some bare CS levels k = α 2 -as in (4.13)-as well as k RR = 1 and k g = 2. Then, using the relation (4.75) leads us to (4.77). 44 This expression can be massaged to: with the function g(u) defined in (4.76). Here we defined: a function of a single set of parameters u ∈ C, n ∈ Z. The factors (− g) l R in (4.78) can be dropped, since they cancels out in G M 3 . We are then left with a rather simple expression for the W-boson contribution to the fibering operator: 1 − e 2πiα(u) . (4.80) Note that, while G W q,p is gauge-invariant by construction, G W q,p shifts by a sign under large gauge transformations, due to the relation: This follows either from the definition (4.79), or from the factorization (4.78) together with the fact that g(u + 1) = − g(u). As a small consistency check on (4.80), one can also check that: where n + δ a q corresponds to the shift n a → n a + q. This shift is due to the twisted superpotential term (4.14), which contributes to the gauge-flux operator a sign: Therefore, (4.82) is in perfect agreement with (4.35). 44 Up to some l R -dependent factor which cancels from G M3 .
U (1) contribution. Consider next a U (1) vector multiplet, and more generally the maximal torus H of G. On general grounds, the one-loop fluctuations of V a could contribute to the fibering operator. We claim that each U (1) vector multiplet does contribute a pure number: to the fibering operator, with G (0) q,p defined by (4.53). We interpret the phase G q,p as the result of quantizing the gaugino λ such that it shifts the RR and gravitational contact terms by δκ RR = 1 2 and δκ g = 1, as we explained in Section 1.4. Indeed, we see from (4.56) that: therefore it is natural to assign the contact terms: to (4.84). The factor of 1/ √ q in (4.84) is more ad-hoc, but it can be argued for by requiring consistency with many well-established results. In particular, we can argue for (4.84) by comparing our results to well-known results for pure CS theory [69]. This will be discussed elsewhere [71]. Following our discussion in Section 1.4 (and in Appendix A), it is also convenient to introduce a factor of (G (0) q,p ) 2 for each pair of W-bosons W α , W −α -in that case, this is simply a different choice of quantization of the vector multiplet, since it corresponds to adding the integer-quantized RR and gravitational CS terms (with level k RR = 1 and k g = 2) to the UV action, for each α ∈ ∆ + . We then have an overall contribution: from the vector multiplet, in addition to the W-boson contribution (4.80).

Supersymmetric partition on M 3 as a sum over Bethe vacua
Combining all the ingredients above, we can now write down the full formula for the geometry-changing operator, for any Seifert manifolds, in the general class of gauge theories considered here. Consider a 3d N = 2 supersymmetric gauge theory with gauge group G and matter fields Φ in chiral multiplets, with generic background gauge fields turned on for the global symmetry group G F . Let n a and m α denote the gauge and flavor fluxes, respectively. The gauge and flavor chemical potentials are denoted by u a and ν α , respectively. At fixed gauge flux n a = (n a,0 , n a,i ) on M 3 , the fibering operator reads: The first factor G CS q,p is the classical contribution from Chern-Simons terms, including CS contact terms for global symmetries, which can be constructed from the results in Section 4.3.1. The second factor is the contribution from matter fields, which reads: with the gauge and flavor weights ρ a and ω α , respectively, r ω the R-charges, and the function G Φ q,p defined in (4.64). The third factor in (4.88) is the contribution from the vector multiplet, which reads: with G W q,p given by (4.80). Note that (4.90) is independent of the flavor parameters. The expression (4.88) depends both on the gauge theory chemical potentials u a and on the gauge fluxes n a . In the full theory, we need to "integrate over" the vector multiplet. In the present formalism, "integration over u" is realized by the sum over Bethe vacua in (4.28). However, we also need to sum over the fractional fluxes, for each exceptional fiber (q, p). For a gauge group G, the fractional fluxes are valued in a Z q reduction of the magnetic flux lattice: with Λ char and Λ cochar the character and co-character lattices of G, respectively-in other words, Γ G ∨ (q) ∼ = Λ cochar ⊗ Z q . The full fibering operator is obtained by summing over all the fractional fluxes: We will argue below that this is the correct sum over topological sectors, when we consider supersymmetric localization in Section 6. Heuristically, the idea is that, from the two-dimensional point of view, we should sum over all orbifold H-bundles on the orbifold baseΣ, in order to have a consistent sum over topological sectors. The sum (4.92) is well-defined when evalued on a Bethe vacuum. Indeed, if we shift any n a by q in the summand, we obtain: where the new prefactor trivializes on any Bethe vacuum, Π a (û, ν) = 1. Moreover, while we saw before that the individual fibering operators G q i ,p i are not well-defined in the presence of a general R-symmetry line bundle L R (when l R i = 0), these ambiguities factor out of the sum (4.92), and safely cancel in the full Seifert fibering operator: Recall that, in this notation, (q 0 , p 0 ) = (1, d), and so m = (m i ) includes both the "ordinary fluxes" m 0 and the "fractional fluxes" m i , i > 0.

The M 3 partition function as a sum over Bethe vacua
This completes the definition of the general fibering operator of a 3d N = 2 gauge theory. We have found the geometry-changing line operator, given by the product of g handle-gluing operators (4.18) with the Seifert fibering operator (4.94), namely: This operator can be inserted along S 1 in the topologically-twisted S 2 ×S 1 geometry, as in (4.28). We therefore found a closed exact formula for the supersymmetric partition function on any Seifert manifold: Note that this expression is properly gauge invariant, including under large gauge transformations for the flavor symmetry. 45 In Section 6, we will provide further evidence for (4.96) from a localization argument in the UV.

Infrared dualities on Seifert manifolds
The above results can be used to check infrared dualities between 3d N = 2 gauge theories, by matching their supersymmetric partitions on any Seifert manifold. Given two dual theories T and T D , we must have: for any supersymmetric background M 3 . More generally, any infrared duality implies the existence of a "duality map" mapping the Bethe vacua in the dual theories: where the Bethe vacua are defined by (4.16). Given the formula (4.96) for Z M 3 as a sum over Bethe vacua, the equality of partition functions is equivalent to the relations: between the handle-gluing and fibering operators of the dual theories, for every pair of dual Bethe vacuaû andû D . These duality relations were previously proven for H [27] and for the "ordinary" fibering operator F = G 1,1 [19], for many three-dimensional Seiberg-like dualities [51,95,96,52,50]. 46 In the following, we verify the duality relations (5.3) in a few simple examples. This also serves to illustrate the formalism of the previous section, by spelling out the fibering operators of some well-known theories. In each case, we performed detailed numerical checks of the duality relations (5.3). Even in the case of the simplest abelian dualities, these are very non-trivial checks, which work for any (q, p)-fibering operator and depend crucially on the fine structure of the theories and of the duality relations, including the relative background Chern-Simons contact terms between dual theories [37,50]. We thus view the successful matching across dualities as very stringent consistency checks of our results, including more subtle features such as the spin-structure dependence of the supersymmetric background (M 3 , L R ).

Duality between the U (1) 1 CS theory and an almost trivial theory
As our first example, consider a 3d N = 2 supersymmetric U (1) gauge theory at Chern-Simons level k = 1, without matter. It is dual to an empty theory. More precisely, the dual theory consist only of a CS contact term for the topological symmetry U (1) T , at level k T T = −1, and of a pure gravitational CS term at level k g = −2: As we discussed in Section 4.3.3, we quantize the gaugino in the vector multiplet in such a way that it contributes the contact terms: 46 In our previous work [19], we only discussed the case ν R ∈ Z for the U (1) R background, corresponding to the "periodic" spin structure. Here we consider the general case ν R = 1 2 Z as well.
for the U (1) R and gravitational background fields, respectively. Recall that most N = 2 CS theories are equivalent to pure CS theories in the infrared-a CS term at level k gives a real mass m = − kg 2 2π to the gaugino, 47 which can be integrated out, and we are left with the gauge field only. In the present case, integrating out the single gaugino in the U (1) vector multiplet shifts the CS contact terms by − 1 2 and −1, respectively, so that we have: κ in the deep infrared. We then have a U (1) 1 pure CS theory, which was recently studied in detail in [40]. As argued there, the theory is "almost trivial," being equivalent to a purely gravitational CS term at level k g = −2. If we couple the topological symmetry of the U (1) 1 theory to a background U (1) T gauge field, we also have the U (1) T CS term at level k T T = −1 in the dual description [97], as indicated in (5.4).
The Bethe vacuum. The U (1) 1 supersymmetric theory has the gauge flux operator: Here ζ = ν T is the fugacity for U (1) T , which is equivalent to a complexified FI parameter. We then have a single Bethe vacuum (up to large gauge transformations, u → u + 1): A very simple observable in this theory is the U (1) T flavor flux operator, which reads: Plugging in the Bethe solution, we obtain: with is precisely the U (1) T flux operator generated by a U (1) T CS level k T T = −1, in agreement with the right-hand-side of (5.4). It is interesting to note that the U (1) T flux operator (5.9) is equivalent to a Wilson line of charge 1 wrapping a generic Seifert fiber. Even as we turn off the U (1) T fugacity, setting ζ = 0, we remain with a non-trivial sign in (5.10), which depends on the spin structure of M 3 restricted to the Seifert fiber. 48 This is in agreement with the known properties of this line operator [40]. 47 With g 2 the YM coupling, or any other UV regulator. 48 That is, assuming the Seifert fiber corresponds to a non-trivial element of H 1 (M 3 , Z 2 ). Otherwise there is a unique choice of ν R mod 1 consistent with supersymmetry.
Matching the fibering operators. In the present theory, we have H = 1 for the handle-gluing operator, so it trivially matches across the duality. To match the supersymmetric partition functions, we then only need to match the (q, p)-fibering operators. In the U (1) 1 theory, we have: Here n is the gauge flux and m T is the U (1) T background flux. The fibering operator is obtained by summing over the gauge fluxes: In the "dual theory," we have: Plugging in the Bethe vacuum (5.8), we find: 14) The prefactor on the right-hand-side cancels out when we consider the full fibering operator G M 3 . The relation (5.14) therefore implies (5.3). We should emphasize that the factor G (0) q,p in (5.11), which originates from the gaugino, is crucial in obtaining a precise match across the duality, even in this overly simple example. This and other related consistency checks give us confidence that we have identified the correct fibering operators. The above analysis can be generalized to the N = 2 version of level/rank duality, U (N ) k ↔ U (|k| − N ) −k , and one again finds a perfect agreement [71]. (Supersymmetric level/rank duality can be also obtained as a limit of Aharony duality, which we study below.)

Elementary mirror symmetry
Consider the elementary N = 2 mirror symmetry [96] between a U (1) gauge theory with one chiral multiplet and a free chiral multiplet: The gauge theory consists of a U (1) vector multiplet coupled to a single chiral multiplet of unit charge, with effective CS level κ = 1 2 . The dual theory is a single free chiral, denoted by T + , which is identified with the gauge-invariant monopole operator of the U (1) gauge theory. If the chiral multiplet of the original theory has an R-charge r ∈ Z, the dual chiral multiplet T + has R-charge R[T + ] = 1 − r. Moreover, we also have the relative Chern-Simons contact terms: 16) in the dual description. These relative CS levels can be derived, for instance, by integrating out Φ with a large positive real mass, thus flowing to the duality (5.4). 49 Bethe equation, handle-gluing operator and fibering operators. Consider first the gauge theory T . We have the twisted superpotential: Note the presence of a U (1) CS level k = 1, corresponding to the choice of U (1) − 1 2 quantization for the chiral multiplet. 50 The Bethe equation reads: Letû denote the unique solution . We also have the non-trivial effective dilaton: and the handle-gluing operator: which is easily derived from (5.17) and (5.19). Last but not least, the (q, p)-fibering operator reads: The second and third factors in the summand corresponds to the chiral multiplet in the U (1)1 2 quantization, and the last factor is the mixed U (1)-U (1) T CS term, which includes the contribution from the FI coupling. 49 In this limit, the gauge theory T flows exactly to the U (1) 1 theory in (5.4). In the dual description, integrating out the chiral multiplet T shifts the CS levels (5.16) back to zero, while it also generates the levels k T T = −1 and k g = −2. See e.g. [37,27,19] for detailed discussions of such decoupling limits. 50 That is, we must add a "bare" CS term at level 1 to go from our default "U (1) − 1 2 quantization" to the "U (1) 1 2 quantization" that appears in (5.15), in the theory T .
Matching across the duality. It is straightforward to check the matching of the handle-gluing operators across the duality. Plugging the solution to (5.18) into (5.20), we obtain: The dual handle-gluing operator is derived from the effective dilaton: Note the contribution from the contact terms (5.16). Similarly, the dual (q, p)-fibering operator takes the form: We verified numerically the duality relations: with f D (ζ, r) a function independent of (q, p), which therefore cancels out from the physical fibering operator G M 3 . 51 This establishes the equality of the dual supersymmetric partition functions on any M 3 .

General abelian mirror symmetry and gauging flavor symmetries
The elementary mirror symmetry described above is the basic building block in a more general class of dualities due to [96]. These can be obtained by starting with several decoupled copies of the above duality and gauging certain combinations of the flavor symmetries on each side of the duality [98]. Then, since the original theories were equivalent, the theories we obtain after this gauging procedure must also be equivalent. At the level of the partition function on a Seifert manifold, M 3 , suppose we have shown that two theories, A and B, have equal M 3 partition functions. Equivalently, this implies that all the basic building blocks match between the two theories, i.e.: Here, we denote by v the flavor symmetry parameters, and by m the corresponding (fractional) fluxes. We have implicitly included any relative background CS terms 51 By checking the duality for (q, p) = (1, 0), one can derive f D (ζ, r) 2 = 1 − e 2πi(ζ+ν R (1−r)) , which determines f D up to a sign. We can also easily perform numerical checks of the matching of G M3 across the duality for various numbers of exceptional fibers. We find perfect agreement. necessary for the duality. Then, we expect that any pair of theories we obtain by gauging some flavor symmetry, on both sides of the duality, will also have matching partition functions.
It is clear that this last statment will follow immediately if we can construct the building blocks for any daughter theory, T , obtained by gauging some flavor symmetry of a parent theory, T , entirely in terms of the building blocks of the parent theory. In the case of the handle-gluing and ordinary fibering operators (i.e., G 1,p ), this was shown in [19]. In fact, these ingredients were shown to be obtained from two more basic objects, the "on-shell twisted superpotential" and the "on-shell effective dilaton" of the parent theory. For the more general (q, p) fibering operators, the latter statement no longer holds, however it is still straightforward to obtain the building blocks of the daughter theory from those of the parent. Consider gauging a U (1) F symmetry for concreteness, as the general case is a straightforward extension, and let v and m be the corresponding U (1) F flavor parameter and fractional flux. Then we first obtain the Bethe vacua of the daughter theory as the set: where Π v is the ordinary U (1) F flux operator in the parent theory, and Π α v denotes that flux operator evaluated on the Bethe vacuum α in the parent theory. Then, we simply have: for the "on-shell" fibering operators of the daughter theory.
Example of N = 2 abelian mirror symmetry. To illustrate the above discussion, let us consider a simple example. According to [96], we have the duality: A: A single U (1) gauge group U (1) −N f /2 coupled to N f chiral multiplets of charge 1.
B: A circular quiver with gauge group U (1) , with bifundamental chiral multiplets connecting adjacent nodes.
"Theory A" can clearly be obtained by starting with N f copies of theory T D in (5.15), and gauging the diagonal U (1) flavor symmetry. Similarly, we claim that "Theory B" can be obtained by starting with N f copies of the theory T in (5.15), and then gauging a diagonal U (1) J flavor symmetry. Implementing this gauging at the level of the fibering operator, starting from N f copies of (5.11), we obtain: where we have written the FI terms for the U (1) gauge groups asζ + ζ i , with the constraint i ζ i = 0, and similarly for the corresponding fluxes. We have also introduced a new FI parameter, ζ , for new gauge symmetry corresponding toζ. It is useful to solve the Bethe equation corresponding to the dynamical FI parameter,ζ, which is simply: We may absorb the dependence on n into a redefinition of ζ . If we isolate theζ and m T dependence in (5.29), we find: Recall we must also sum over the fractional fluxes,m T ∈ Z q . This imposes: Then theζ dependence in (5.31) also drops out. We may solve (5.30) and (5.32) by writing (setting n = 0): Note the second relation implies a non-trivial quantization of the fluxes n i when m T is not a multiple of N f , so that n i ∈ Z. Plugging this in to (5.29), we find: which is the expected fibering operator for Theory B. Since we demonstrated in Section 5.2 that the original two theories have equal fibering operators, this proves the equality of the fibering operators across this more general abelian mirror symmetry.

Aharony duality
Next, consider N = 2 SQCD with gauge group U (N c ) and N f flavors-N f chiral multiplets Q i in the fundamental representation of U (N c ), and N f chiral multiplets Q j in the anti-fundamental, of R-charges r ∈ Z, with vanishing effective CS level for the gauge group. The gauge and flavor charges of the fields are summarized in Table 2. When N f ≥ N c , the theory has a infrared-dual description discovered by Aharony [51], similar to Seiberg duality:  The dual theory is a U (N f − N c ) gauge theory with N f dual flavors q j , q i together with N 2 f + 2 gauge singlets M j i and T ± , which are dual to the gauge-invariants mesons M = QQ and to the monopole operators T ± (of topological charge ±1) in the U (N c ) theory, respectively. The gauge-singlet fields couple to the dual gauge sector through the superpotential: with t ± the elementary monopole operators of the U (N f − N c ) theory. The charges of the dual matter fields are sumarized in Table 2 as well.
To fully define the duality, we need to specify the relative Chern-Simons contact terms for the global symmetries [50,37]. In our present conventions, the dual theory contains the CS levels: for the SU (N f ) × SU (N f ) flavor symmetry, the integer-quantized CS levels: for the abelian global symmetries, and: for the gravitational CS level. These levels can be derived in a variety of ways. One interesting derivation consist in integrating out the matter fields so that Aharony duality reduces to 3d N = 2 supersymmetric level/rank duality U (N ) K ↔ U (K − N ) −K in the IR, with K = N f -after integrating out the gaugini, one can compare the IR relative CS levels to known results for level/rank duality in pure CS theory [97], which then implies the above contact terms in the Aharony-dual theory. In previous literature, it was found that the relative CS levels vanish for the Aharony duality, 52 contrary to what we are claiming here. The more precise claim is that, in a scheme in which all the fermions (including the gaugini) would be quantized in such a way that gives a trivial contribution to the flavor contact terms, κ F = 0, then we would indeed have no relative CS levels. However, that (implicit) quantization scheme is not consistent with background gauge invariance for U (1) R [19], as we already explained. Here instead, we are following the conventions in which each chiral multiplet is taken in the "U (1) − 1 2 quantization," while the gaugini are quantized with the contact terms (4.86). For instance, in the U (N c ) gauge theory T , the fermions in Q, Q contribute: to the gauge and U (1) A UV contact terms. Since those shifts are by integers, we can always cancel them by adding the bare CS levels k U (Nc) = N f and k T AA = N f N c . For the gauge group, this is part of the definition of the theory, and we need to introduce the bare level so that we have the effective CS level k U (Nc) = 0. For the flavor symmetry U (1) A , however, this is a non-physical contact term, which we can choose at will-only the relative level k AA ≡ k T D AA − k T AA across the duality is physically meaningful. Here we chose k T AA = 0. For the U (1) R symmetry, on the other hand, the gauge-invariant quantization (in the conventions of this paper) gives a contribution: to the U (1) R CS contact term in the UV, coming from the chiral multiplets and the gaugino, respectively. We see that, for N c odd, δκ RR is half-integer and cannot be fully cancelled by a gauge-invariant counter-term. Nonetheless, consider for a moment setting k T F = −δκ T F formally, for the full flavor symmetry G F , and similarly in the dual theory T D . Then, the assumption that there are no additional relative contact terms between the dual theories, in that particular "scheme," allows us to derive: which must be integer quantized. We choose k T F = 0 throughout, so that the flavor CS levels in the dual description are given by the right-hand-side of (5.42). This reproduces (5.37)-(5.39).

Bethe equations and dual Bethe vacua. Consider turning on generic chemical potentials for the flavor group
respectively, and similarly for the background fluxes m i , m j , m A , m T ∈ Z. The gaugeflux operators of the U (N c ) theory are given by: with ν denoting collectively all the flavor parameters (5.43), and: , (5.45) a function of a single variable u. Let us call "Bethe roots" the N f solutions {û α } N f α=1 to Π 0 (û, ν) = 1. They correspond to the N f rootsx α of the polynomial: consists of a choice of N c distinct Bethe roots. In particular, there are: distinct Bethe vacua. This number is the flavored Witten of U (N c ) SQCD [99,27], and it is obviously invariant under N c → N f − N c . Consider now the dual U (N f − N c ) gauge theory. Using the identification ζ D = −ζ for the dual FI term, and the charge assignments in Table 2, it is easy to show that the dual Bethe equations are isomorphic to the ones in the original theory. More precisely, we find: for the dual gauge-flux operators. Here the indexā = 1, · · · , N f − N c runs over the Cartan of the dual gauge group. It follows that the duality map (5.2) is given by: α=1 . (5.50) Namely, the Bethe vacuumû D dual toû is obtained by taking the complement u =û c ofû in the set of Bethe roots, and shifting each uā by ν R .
Matching the handle-gluing operators. The handle-gluing operator of the U (N c ) gauge theory is given by: with the function: of a single variable u, corresponding to the Hessian det ab ∂ a ∂ b W = a H(u a , ν). Similarly, the handle-gluing operator of the dual gauge theory takes the form: a product of three contributions. The gauge theory contribution reads: with the function: Note that H D (u, ν) = −H(u − ν R , ν), with H(u, ν) defined in (5.52). The contribution from the gauge-singlet fields M and T ± reads: We also have a contribution from the Chern-Simons contact terms: with the levels k RR and k AR given in (5.38). Note that the handle-gluing operator H T and H T D are rational functions of x a = e 2πiua and xā = e 2πiuā , respectively. By using elementary identities involving the rootsx α of the polynomial (5.46), one can prove the matching of the handle-gluing operators across the duality [27]. That is, given any Bethe vacuumû in T and its dual Bethe vacuumû D in T D , we find: This was first proven in [27] in the special case ν R = 0, and the generalization to ν R ∈ 1 2 Z is straightforward. 53 The identity (5.58) proves the matching of the twisted indices (4.17) across Aharony duality, for both the periodic and anti-periodic spin structures.
Matching the fibering operators. We can similarly compare the (q, p)-fibering operators of the dual theories. Let us set r = 0 to avoid clutter. The R-charge dependence can easily be restored by shifting ν A → ν A + ν R r and m A → m A + n R r. For a U (N c ) gauge theory with N f flavors, we have: with: and with the various building blocks introduced in Section 4, including the W-boson contribution (4.79). Note the presence of the bare U (N c ) CS term at level N f on the second line, as discussed above. In our conventions, we then have: for 3d N = 2 SQCD. For the dual theory, on the other hand, we have: a product of three contributions, similarly to (5.53). The gauge-theory contribution is given by: in terms of the function (5.59). The gauge-singlet contribution reads: with r T the monopole R-charge (with r = 0, here). The CS contact term contribution reads: with the SU (N f ) CS contribution: and the flavor CS levels (5.37)-(5.39). The infrared duality between the two theories implies the equality: for any pair of dual Bethe vacuaû andû D , with f D (ν) some function independent of (q, p), which cancels from the physical fibering operator G M 3 . We checked (5.66) numerically, for a large number of examples. Together with (5.58), this identity implies the equality of the supersymmetric partition function across Aharony duality on any Seifert manifold. Note that (5.66) was previously proven in the special case q = 1 [19]. For q > 1, given the sum over fractional fluxes in (5.59), the duality relation (5.66) is rather more complicated. It would be worthwhile to find an analytic proof. Finally, let us note that, through various decoupling limits, we can go from 3d N = 2 SQCD to more general U (N c ) k theories with N f fundamental chiral multiplets, N a ≤ N f anti-fundamental chiral multiplets, and an effective CS level k ∈ 1 2 Z such that k + 1 2 (N f − N a ) ∈ Z. These theories also enjoy interesting dualities [52,50]. (The elementary mirror symmetry (5.15) is a special case.) The corresponding duality relations for the geometry-changing operators directly follow from (5.58) and (5.66) by taking appropriate limits on the chemical potentials [19].
It would be interesting to extend this discussion to various other three-dimensional IR dualities, such as dualities involving adjoint fields [100,101] or monopole-operator superpotentials [102,103,104].

The "duality appetizer"
As our final example, we consider the duality of [105], relating the following theories: A: An SU (2) 1 CS theory coupled to an adjoint chiral multiplet, Φ.
The chiral operators in the two theories are identified by: In particular, theory A has a U (1) F global symmetry acting on Φ with charge 1, which maps to a symmetry acting on Z with charge 2. In addition, theory A has a Z 2 1-form electric symmetry [106], which maps to that of the decoupled U (1) 2 CS theory.
Bethe equations The twisted superpotential and the Bethe equation for the SU (2) theory were described in [19]. The Bethe equation reads: 54 where we have defined: with ν the U (1) F parameter. Here we have used the U (1) −1/2 quantization for the chiral multiplets, so that the adjoint chiral multiplet itself contributes a gauge CS contact term κ = −2 in the UV, therefore we have included a bare CS term at level k = 3, to recover the appropriate effective level k = 1 of the SU (2) 1 theory. Then, factoring out trivial solutions, (5.68) can be rearranged to: Up to Weyl equivalence, taking x → x −1 , there are two solutions, x ± = e 2πiû ± , given by the two choices of sign in taking the square root of (5.70).
On the dual side, we must consider the Bethe equation for the U (1) 2 supersymmetric CS theory, which is: 55x and so there are two vacua, matching the counting in Theory A. Note that, since a free chiral by itself has only one vacuum, this extra decoupled CS sector in Theory B is crucial for the duality to make sense. 54 In [19], we worked with the A-twist background, namely ν R = 0. More generally, the dependence on ν R here is trivial, and we have absorbed it into the definition of µ below. 55 In principle one can include a background gauge field coupled to the U (1) J topological symmetry, as was suggested in [105]. However, this explicitly breaks the Z 2 1-form symmetry, and so we do not include this here.
Handle-gluing and flux operators. Let us first consider the flux operator for the U (1) F flavor symmetry. The adjoint chiral multiplet contributes: . (5.72) Plugging in the solutions (5.70), we find: which precisely agrees with the contribution of the charge 2 chiral Z in the dual theory. Next consider the handle-gluing operator. Without loss of generality, we may assign the chiral multiplet Φ an R-charge of r = 1, and then Z has R-charge 2. Then in the SU (2) theory, the handle-gluing operator is given by: where the first factor is the W-boson conrtribution, and H is the Hessian of the twisted superpotential: Plugging in the solutions (5.70), one finds that, in both vacua, we have: On the dual side, the U (1) 2 CS theory contributes a factor H U (1) 2 = 2 to the handlegluing operator, while the free chiral Z contributes a factor (1 − µ 2 ) −1 , therefore we recover (5.76).
Fibering operators. Let us now consider the matching of the fibering operators, G q,p . For the SU (2) theory, we have: with n and m the gauge and flavor fractional fluxes, as usual. Then the full fibering operator, evaluated at the Bethe vacua (5.70), reads: For the dual theory, we find: The two Bethe vacua (from the U (1) 2 sector) correspond toû + = 0 andû − = 1 2 . Thus, we find the full "on-shell" fibering operators: We note that the contribution of the decoupled CS theory is quite non-trivial; in particular, unlike the flux and handle-gluing operators, the two vacua give different contributions, which must be separately matched. We have checked numerically in several examples that the following relation holds: 56 giving a new strong test of this peculiar duality. In particular, this is a strong test that the conjectured decoupled topological sector described above indeed appears. It also gives a precise handle on the relative CS contact terms between the two dual theories. Interestingly, with the choice of quantization for the fermions used in this paper, there are no additional relative global Chern-Simons term necessary for the duality to hold.

Localization on Seifert manifolds
The exact result for the Seifert manifold partition function can also be arrived at by a direct three-dimensional path-integral computation, as in [32,30,27]. In this section, we derive the result (4.96) via supersymmetric localization onto the classical Coulomb branch, starting from the three-dimensional UV action. The relevant curved-space supersymmetric actions and supersymmetry multiplets [5] can be found in Section 3 of [19]. The supersymmetric localization argument is a straightforward generalization of Section 4 of [19], which we we will briefly summarize for completeness. The gauge group G is chosen as in (1.12).

Supersymmetric localization and integral formula
Consider M 3 with the supergravity background as in Section 2.3. In particular, we have first Chern class: with H = iβc 1 (L 0 ) the supegravity background field given in (2.67). In addition to the BPS equations, we impose the gauge fixing condition along the Seifert fiber: which implies ∂ 0 a 0 = 0, with a 0 ∈ R, in the adapted frame. We can diagonalize a 0 using the residual gauge symmetry. The equation D µ σ = 0, together with the reality condition on σ, implies [a 0 , σ] = 0, and therefore we can diagonalize a 0 and σ simultaneously: with constant σ a 's. This breaks the gauge group down to its maximal torus times the residual Weyl symmetry: The fields a 0 and σ are combined into the η-component of the complexified 3d gauge field: A µ = a µ − iη µ σ , (6.6) similarly to (2.97). Then, the two-dimensional scalar fields u a are defined as: We localize onto the constant modes: which naturally span the "classical Coulomb branch" for the 3d theory on R 2 × S 1 .
It is important to note that the BPS equations allow for non-trivial H-bundles on the two-dimensional orbifold. We must sum over all such independent line bundles, which are indexed by the 3d Picard group: 9) 57 Here we impose a reality condition on σ and a µ , not on the auxiliary field D.
as discussed in Section 2.2.1. We will denote the gauge line bundles in Pic(Σ) by: where n i = (n i,a ) label the GNO-quantized magnetic fluxes: Any line bundle (6.10) has the orbifold first Chern class: Recall that these orbifold line bundles are not all independent. They are subject to the equivalence relations in Pic(Σ): From now on, let us assume that c 1 (L 0 ) = 0. Then the line bundles in (6.9) are all torsion line bundles, and they can be characterized by their flat connections. In each topological sector {n 0 , n 1 , · · · , n n }, the localized gauge field can be written as:  (6.16) so that the one-form η is well-defined. We can also write: where wΣ is the volume form on the two-dimensional base. It is convenient to define the forms w  Σ by descent with respect to the coordinate transformation δ x , as: Then, we can write C and the gauge field a as: 19) where b and c are globally-defined functions on the base. It follows that the change of coordinates acts as: Comparing this expression with (6.16), we find: This gives the holonomy: along the Seifert fiber γ (at generic point on the base). Therefore, the complex variable u in (6.8) can be written as: which is valued in u ∈ h C . One can check that this expression is compatible with the large gauge transformation: ∈ R is a free parameter which can be reabsorbed intoâ 0 , corresponding to the free generator in Pic(M 3 ). In that case,â 0 is also subject to the large gauge transformationâ 0 ∼â 0 + 1. It is then more natural to gauge-fix that invariance by imposing thatâ 0 is valued in the intervalâ 0 ∈ [0, 1). Then, the Coulomb branch variable u can be defined as: Finally, the flat connection α on the Riemann surface corresponds to the factor Z 2g ⊂ H 1 (M 3 ), which we can expand as: In addition to these bosonic zero modes, this background admits 2g + 2 gaugino zeromodes, which can be written as: Localization formula for the path integral. The bosonic and fermionic zeromodes can be organized into short supermultiplets: V 0 = (a 0 , σ, Λ 0 , Λ 0 ,D) , V I = (α I , α I .Λ I , Λ I ) , I = 1, · · · , g . (6.28) Here, we also introduced a constant modeD for the auxiliary field D, as a regulator for the localization computation, as studied e.g. in [107,108]. Then, using a standard localization argument, we can reduce the supersymmetric path integral to supersymmetric ordinary integral over the zero-modes (6.28), namely [19]: 58 where Z 1-loop (V 0 , V I ) is the contribution from the one-loop fluctuation around the solution to the BPS equations. Here we again assumed that c 1 (L 0 ) = 0. The integration over the fermionic zero modes and theD integral can be done as in [19]. We then obtain: as a holomorphic contour integral in the variables u a . The factor e −S CS in the integrand is the classical contribution from the Chern-Simons terms in the UV Lagrangian. The factor Z 1-loop (u, ν) is the one-loop contribution, 59 given in terms of the one-loop determinants for the chiral and vector multiplets, which we discussed in Section 4 (see also Appendix D). The function H(u, ν) in the integrand is the Hessian of the twisted superpotential: as in (4.24). The factor H(u, ν) g in (6.30) arises from integrating out the zero-mode multiplets V I . 58 Here and in the following, in addition to the gauge magnetic fluxes n (that must be summed over), we can turn on background fluxes m for the flavor symmetries. We leave them implicit to avoid clutter. We similarly leave the dependence on the L R parameters implicit. 59 Z 1-loop (u, ν) is specialization toD = 0 of the one-loop determinant Z 1-loop (V 0 , V I ) appearing in (6.29). The latter is not holomorphic in u, but a careful integration over the gaugino zero-modes Λ 0 ,Λ 0 , and over the bosonic modeD, leads to the holomorphic contour integral (6.30)-see the discussion in Appendix D of [19], and references therein.
The contour C(η) in (6.30) is a "JK-like" middle-dimensional contour on the udomain, closely related to the Jeffrey-Kirwan (JK) residue [109,110], which depends on an auxiliary real vector η ∈ h * . The contour can be derived in the rank-one case, while in the higher-rank case we can propose some natural conjecture [19]. We will review these contour prescriptions momentarily. We will also discuss how they can be related to a non-compact "σ-contour" which appeared in well-known localization formulas for the supersymmetric partition function on the three-sphere and other lens spaces [10,13,47,15,18].
Another integral formula. There exists an alternative way to present the summation over the line bundles and the u-integral in (6.30). The integrand in (6.30) is invariant under the large gauge transformation (6.24), as required by gauge invariance. Recall from Section 4 that this large gauge transformations corresponds to tensoring the line bundle (6.10) by the defining line bundle of the Seifert manifold: This ensures that the summation over Pic(M 3 ) in (6.30) is well-defined. On the other hand, we could also fix the gauge freedom (6.34) in a different way, so that we sum over all independent line bundles in Pic(Σ). In this scheme, we should quotient the space u ∈ h C by the action of the large gauge transformations (6.24). This can be done by restricting the range of the Coulomb branch variables, according to: Given this gauge-fixing of the large gauge transformations (6.34), we still have to sum over all the fluxes (n 0 , n i ) in Pic(Σ), instead of the smaller group Pic(M 3 ). Given the 2d Picard group relations (6.13), this is equivalent to: with n 0 an ordinary magnetic flux overΣ, and n i the fractional fluxes at the exceptional fibers, as explained in detail around (4.91). For instance, for G = U (1), we should restrict the integration variables to the strip Re(u) ∈ [0, 1), while we sum over the ordinary fluxes n 0 ∈ Z and over the fractional fluxes n i ∈ Z q i . We then arrive at the localization formula: Here, C 0 (η) is defined as the contour C(η) restricted to the quotient space (6.35). Thus, for c 1 (L 0 ) = 0, we have replaced the finite sum over the torsion H-bundles in (6.30) by an infinite sum over n 0 , together with a sum over the fractional fluxes. The infinite sum is essentially a sum over the images of the restricted domain (6.35) under the large gauge transformations (6.34). Interestingly, in the gauge (6.35)-(6.36), we can naturally include the case with c 1 (L 0 ) = 0, as should be clear from (6.25). Thus, the integral formula (6.37) should be valid for any M 3 . In this formulation, we have an infinite sum over the magnetic fluxes n 0 , and one should worry about whether that sum converges. The convergence ultimately follows from the properties of the contour C 0 (η). In the following, we will study this contour more in detail, focussing on the rank-one case where everything can be done very explicitly.
For future reference, let us note that the sum over the fractional fluxes in (6.37) is exactly the same sum that we considered in (4.92) when computing the full fibering operators. Therefore, we may also define: the product of the "full" (q, p)-fibering operators, so that the integral formula (6.37) reads: Here, H(u, ν) = e 2πiΩ(u,ν) H(u, ν) is the handle-gluing operator (4.18). In this form the partition function is exhibited as the expectation value of the geometry changing line operator, L M 3 , in the S 2 × S 1 partition function [32], as anticipated in (1.19).

Contour prescriptions and the Bethe-sum formula
In the rest of this section, we explain the relation between the above contour-integral formulas and the Bethe-sum formula (4.96). For a rank-one gauge theory, we will explicitly show that the two types of expressions agree, when certain additional conditions are satisfied. We also study the relation to the "σ-contour" formula, which has been considered in previous works on lens spaces [10,13,47,18].

Singularities of the integrand
Let us denote the integrand in (6.30) by: The function J (n 0 ,n i ) (u, ν) has various singularities on the domain u ∈ h C , which define four different types of hyperplanes [19], including "hyperplanes at infinity." Chiral multiplet singularities. For each chiral multiplet with gauge charge ρ and R-charge r, we have singular hyperplanes where the chiral multiplet becomes massless, defined by The order of pole at H ρ,r,k is N ρ,r,k = deg(L r,k )+1−g = ρ(n 0 )+ n R 0 r +dn+ n i=1 ρ(n i ) + n R i r + p i n q i +1−g , (6.42) with the orbifold line bundle L r,k as in (4.57).
Large Im(u) regions (monopole) singularities. The integrand may diverge in the large Im(u) region. The hyperplanes defined by these singularities are The behaviour of the integrand in this limit depends on the charges of the monopole operators [27,19]. Equivalently, the behaviour of the integrand in this limit depends on the value of the effective Chern-Simons levels as σ → ±∞-the limit is given explicitly in (4.74) for the chiral-multiplet contribution to the fibering operator, and similarly for the effective dilaton.
Large Re(u) regions. When c 1 (L 0 ) = 0, the integrand is not periodic in the Re(u a ) directions, and can be divergent as we take the limit Re(u a ) → ±∞. Let us define the integer Q = n i=1 q i > 0. We then have: 61 W-boson singularities. For a non-abelian gauge group, when 2 − 2g − n > 0, we also have potential singularities at each root α ∈ g: This is the locus where the non-abelian gauge symmetry enhances. As in [19], our prescription for the contours C and C 0 is to define them such that we do not pick any contributions from poles which intersects with H α .

Contour integral for U (1) theories.
Let us make this contour more precise in the case G = U (1). For a U (1) gauge theory, we can explicitly derive the contour C and prove the equivalences among different expressions for the partition functions.
JK contour and the Bethe-sum formula. In the U (1) case, the formula (6.39) simplifies to: with: Here and in the following, we suppress the dependence on the flavor parameters ν, for simplicity of notation. The contour C 0 (η) is given by: 62 Here we consider shifting a single u a at the time. 62 The derivation of the contour is essentially the same as that for the M g,p partition function. This is discussed in Appendix D of [19].
Here,M 0 is defined to be the complex u-plane restricted to the strip Re(u) ∈ [0, 1), with the -neighbourhoods of the singularities listed in Section 6.2.1 removed. We also remove the region outside of the large box with the boundaries Im(σ) = ±R, Re(u) = 0, 1, with R arbitrarily large. Then, the boundary ∂M 0 consists of small circles along the "bulk" singularities, plus the boundary of the strip. The prescription (6.48) is to take the subset of ∂M 0 such that |Π(u)| > 1 if η > 0, or such that |Π(u)| < 1 if η < 0. In this way, C 0 (η) defines a contour integral which is equivalent to the JKresidue prescription for singularities at finite u, with additional contributions from the boundary integral. Here, the parameter η ∈ R can be chosen arbitrarily, but the final answer is independent of that choice.
Note that the two geometric series in (6.49) converge, since |Π(u)| < 1 for η < 0 and |Π(u)| > 1 for η > 0. In the last expression, C BE denotes the contour enclosing the poles of the new integrand, which are located at Π(u) = 1 [19]. Thus, we pick up the residues: , (6.50) at the Bethe rootsû such that Π(û) = 1. Using the fact that H(u) = 1 2πi ∂ u log Π(u), we directly obtain: thus reproducing the Bethe-sum formula (4.96). This can be considered a derivation of the TQFT formula from a UV localization computation, in this special case.
The σ-contour integral formula. For c 1 (L 0 ) = 0, we have seen that there exists an alternative way of fixing the gauge under the large gauge transformation (6.24), which leads to the expression (6.30). Let us define: 52) which depends on the fractional fluxes n i but not on the "ordinary flux" n 0 . For a U (1) gauge group, the formula (6.30) can then be written as: with the contour: Here,M is defined in the same way as inM 0 of (6.48), but now u is valued in the entire complex plane, u ∈ C. Let us choose: for definiteness, and without loss of generality. 63 One can then show that the contour C(η) can be deformed to a non-compact σ-contour integral connecting Im(u) → −∞ to Im(u) → +∞ [19]. To see this, let us first write: by closing the contour on the boundary of each stripM m in the obvious way. We then have: with C 0 (η) as above. Now, let us choose η as: (6.59) 63 Changing the sign of c 1 (L 0 ) corresponds to flipping the orientation of M 3 , which can be achieved by the replacement (d, Then, under some convenient assumptions about the flavor parameters, one can show 64 that most of the contributions along the contour cancel out between adjacent terms, and that the only non-vanishing contribution comes from the contour along the imaginary axis at Re(u) = 0: Note that this simple contour along the imaginary axis is valid under certain assumptions on the charges of the chiral multiplets and monopole operators, as studied in [19]. In general, the resulting contour C σ is deformed with respect to the Re(u) = 0 contour, in such a way that the non-compact integral (6.60) converges. We will see explicit examples of this σ-contour in later sections.
From the σ-contour to the Bethe-sum formula. We can also derive the Bethesum formula (4.96) directly from the σ-contour formula (6.60). More precisely, let us start from the equivalent expression (6.58), namely: Using the gauge-invariance of the fibering operator, as in (4.38) and (4.39), this equals: Now, reparameterizing of the fluxes: the sum over (n 0 , n i ) ∈ Pic(M 3 ) and the sum over m ∈ Z can be replaced by a summation over all the element (n 0 , n i ) in Pic(Σ). Taking into account the relations (6.13), we find: du Π(u) n 0 I(u) , (6.64) 64 We refer to Section 4.6.1 in [19], whose argument can be repeated verbatim.
The last expression is obtained by performing the sum over the fractional fluxes to obtain the "full" fibering operator. Thus we obtain the same expression as in (6.46), which was shown to be equivalent to (6.51).
Non-abelian generalization For a non-abelian gauge theory, we lack of a complete derivation of the contour C(η). We expect that the Bethe-sum formula: provides the correct answer for any gauge group G of the type considered in this paper. This claim, while not rigorously proven, has been corroborated by numerous highly non-trivial consistency checks.
Recall that, when looking for the solutions u =û to the Bethe equations Π a (u, ν) = 1, we need to exclude the would-be solutions that are located on a Weyl chamber boundary. Correspondingly, in the integral formula (6.39), the contour C 0 (η) must be such that we do not pick any higher-dimensional residues from the W-boson singularities.

Higher-dimensional C 0 -contour
Somewhat formally, the contour C 0 can be defined in terms of a rk(G)-dimensional residue at the "poles" defined by an intersection of r independent singular hyperplanes (including "poles" at infinity), with r ≥ rk(G). This can always be decomposed into bulk and boundary contributions: where the contour C bulk 0 captures the contribution from the residues at finite u, while the C boundary 0 captures the singularities that intersect the hyperplanes "at infinity." We will not derive the precise contribution from the boundary contour C boundary 0 for a higherrank gauge group in this paper.
The bulk contribution is given by the JK residue, which can be derived as in [32,27,19]. However, when the singularity has an intersection with the hyperplane H α , the JK residue is not well-defined. At these loci, where α(u) = 0 for some root α, the non-abelian gauge symmetry enhances and the path integral becomes potentially singular. This happens when 2g − 2 + n ≥ 0, in the C 0 -contour integral formula. We claim that we should always exclude such poles, which are fixed by the Weyl group W G . This is true already in the case of the trivial fiber bundle, M 3 = Σ g × S 1 , and the principal S 1 bundle, M 3 = M g,p , as discussed in [32,30,19].
Non-abelian σ-contour. For non-abelian gauge groups, the existence of additional singularities due to the W-bosons also modifies the σ-contour formula. Namely, the integrand in (6.64) may contain a potential singularity when α(u) = ∈ Z, in addition to the acceptable solutions to the Bethe equations. In the rank-one case, the general relation between the σ-contour and the Bethe-sum formula is: , (6.67) with I (n i ) (u) and I(u) defined in (6.52) and (6.47) respectively, including the W-boson contribution, which we may write as (extracting the contribution from the handle-gluing and fibering operators): For 2g − 2 + n < 0, the exponent of the first factor is positive, and vanishes at points with α(u) ∈ Z, and so the contribution to the second term in (6.67) vanishes. In the marginal case, 2g − 2 + n = 0, we note that if α(u) = n ∈ Z, then the set {α(û −t i n i q i )}, as we vary n i , is invariant under reflections, x → −x. Thus when we sum over fractional fluxes, n i , the terms come in pairs related by a sign, due to the second factor in (6.68), and so their contribution cancels out. Then we again find that the second term in (6.67) vanishes.
The two cases above correspond precisely to the Seifert fibrations over S 2 with at most two exceptional fibers, which are precisely the lens spaces. We see that, in these cases, the Bethe sum agrees with the standard σ-contour formula found in the supersymmetric localization literature [10,11,12,13,14,15,16,17,18]. We will discuss the lens-space partition functions in more detail in the next sections.
Finally, in the general case, 2g − 2 + n > 0, the second term in (6.67) is generically non-trivial, and so the Bethe-sum formula is different from the naive σ-contour formula. The discrepancy is given by the residue at α(u) = n ∈ Z in the strip. Interestingly, the formula (6.67) agrees with a formula derived by Lawrence and Rozansky [68] for a pure CS theory with gauge group G = SU (2) on a Seifert homology sphere. It will be interesting to explore this point further [71].

Part III
Lens space partition functions 7. The S 3 b partition function In this final part of the paper, we compare our results above to the well-known localization results for supersymmetric partition functions on lens spaces. We prove that our results agree with the known results, in the cases where they overlap, and clarify various subtleties related to the choice of spin structure and to the contributions from CS contact terms. We start in this section with the squashed three-sphere, S 3 b . For a 3d N = 2 gauge theory, the S 3 b partition function can be written as the integral formula [14,47]: where |W G | is the order of the Weyl group of G, andm stands for the real masses associated to the flavor symmetry. The classical piece Z CS (σ,m) comes from CS terms, and takes the general form: The various supersymmetric CS actions evaluated on the S 3 b background give the contributions [14,47,37]: Here we defined the parameter:σ which is the effective "real mass" for the R-symmetry [22]. The generalization to any non-abelian CS term is straightforward. One can similarly write down CS contact terms for the flavor symmetries, by replacing the gauge parametersσ a by the flavor parametersm α appropriately.
The remaining contributions to the integrand in (7.1) are one-loop determinants around the supersymmetric background with constantσ. The vector multiplet contributes a term: α∈∆ + 4 sinh (πbα(σ)) sinh πb −1 α(σ) . (7.5) Here the product is over the positive roots of g. Note that, in addition to the standard result from [14,47], we introduced a phase: which is the contribution 2δκ RR = δκ g = 1 to the contact terms from each gaugino, consistently with our conventions. The matter contribution to (7.1) is given by a product over all the chiral multiplets of gauge and flavor charges ρ, ω, respectively, and R-charges r ω : the partition function for a single chiral multiplet of unit gauge charge, and withσ R defined in (7.4). The partition for a free chiral multiplet of R-charge r can be written as: The field-theory computation actually gives us the formal infinite product [14]: 11) 65 To be exact, we defined the new function: with Φ b (x) is the standard quantum dilogarithm, as discussed for instance in [74]. This is partly a matter of convention: Φ b (σ) would be precisely the contribution from a chiral multiplet in the "U (1) 1 2 quantization," while we are considering the "U (1) − 1 2 quantization." The definition (7.10) (with the (a, q) ∞ ≡ ∞ k=0 (1−aq k ) the q-Pochhammer symbol) only holds for Im(b 2 ) > 0, but admits an analytic continuation to more general b, and in particular to b ∈ R >0 . The one-loop determinant (7.8) has appeared under various names in the physics literature-it can be conveniently written in terms of the quantum dilogarithm Φ b [112,111], the double-sine function s b [113], or the hyperbolic gamma function Γ h [114,115], among other names. which must be regularized. We claim that (7.8) is the correct gauge-invariant regularization, corresponding to the "U (1) − 1 2 quantization" scheme and consistent with the parity anomaly [36,19]. To confirm this, we consider the limits: which correspond to integrating out the chiral multiplet of R-charge r = 1 with a large real massσ. By comparing with (7.3), we see that we generate the gauge and gravitational CS terms at levels k = −1 and k g = −2 in the limitσ → −∞, while the theory is trivial in the limitσ → ∞. This is exactly as expected. Finally, the contour Cσ is defined by a non-compact real rk(G)-dimensional contour that connectsσ → ∞ and σ → −∞ region, which is properly deformed in such a way that the integral converges.

Comparison with the Seifert-manifold formalism
Setting b 2 = q 1 /q 2 , with q 1 , q 2 ∈ Z some positive integers (for definiteness), we can compare the standard result (7.1) to our new formalism. Let us consider S 3 b as discussed in Section 3.3, a Seifert fibration of genus zero with two exceptional fibers (q 1 , p 1 ) and (q 2 , p 2 ), with d = 0 (for convenience). We must have: We choose the two-dimensional R-symmetry line bundle to be trivial, L R ∼ = O. Setting n R 0 = −1 + n R 0 = 0 and n R 1 = n R 2 = 0, this gives: This allows us to consider any real R-charge for the chiral multiplets, r ∈ R. In our formalism, we have the gauge and flavor parameters u = iβσ and ν = iβm, and the R-symmetry chemical potential ν R , which are identified with the parametersσ,m and σ R appearing in (7.1) according to [13]: One can then write the integrand of (7.1) as: with the identification (7.15). The S 3 b fibering operator takes the simple form: Note that all these fibering operators are evaluated at zero flux, n = m = 0, except for G 1,0 which has a contribution from the effective R-symmetry flux n R 0 = l R 0 2 = 1 (so that n R 0 = g − 1 + n R 0 = 0), as indicated schematically in (7.17). For instance, for the U (1) CS term we have G GG 1,0 (u) = 1 and G GG q,p (u) = e −πi p q u 2 , so that: This CS term does not contribute to the effective dilaton. For the U (1) R CS term, we find: Note here that G RR 1,0 = −1 is non-trivial, due to the non-zero parameter l R 0 = 2. That sign cancels the sign from e −2πiΩ RR . The other CS terms can be checked similarly. Therefore we find: for the classical contribution (7.2). For the vector-multiplet contribution, we have: with: so that: Note the factor of −i √ q 1 q 2 for each element of the Cartan, which will be important below. Finally, for the chiral-multiplet contribution, we find the nice factorization formula: if b 2 = q 1 /q 2 and q 1 p 2 + q 2 p 1 = 1. Here the first factor is the product of a contribution from the effective dilaton and from G 1,0 : We give an explicit proof of the factorization formula (7.24) in Appendix D.4. The identity (7.24) is equivalent to some previously-known factorization formula for the quantum dilogarithm at rational values of b 2 [74].

Integral formula and its evaluation
Using the above relations in the case b 2 = q 1 q 2 , we can write the integral formula (7.1) for the S 3 b partition function in the canonical form: with the G S 3 b the zero-flux three-sphere fibering operator defined in (7.17), and C σ the σ-contour defined in Section 6. On the other hand, our Bethe-sum formula for the partition function reads: with G S 3 b the full fibering operator for the squashed three-sphere, including the sum over fractional fluxes: This gives an explicit evaluation formula for the squashed-sphere partition function (7.26) of any N = 2 supersymmetric gauge theory. 66 Direct computation. One can check that (7.26) equals (7.27) by an explicit computation. Here we consider the case G = U (1), for simplicity. Let us write (7.26) as: where we suppressed the dependence on ν to avoid clutter, and we introduce a trivial factor 1 = x x in the integrand. The contour is taken along the imaginary axis (for appropriate choices of the flavor parameters). Now, using the difference equation: we obtain: One can argue that the contour C BE encloses all the poles at Π(u) = 1 located in the strip Re(u) ∈ [0, q 1 q 2 ). We then find: In the last equation, we used the fact that the handle-gluing operator is periodic under u ∼ u + 1. Finally, one can check that the contribution from the fibering operator factorizes as: Here we used the transformation property of G q,p (u) under the large gauge transformation and the Bethe equation Π(û) = 1. Written in this way, (7.32) becomes equivalent to the formula (7.27).
Further comments. It is interesting to note that, in some very special cases, this evaluation formula (7.27) has appeared before in a different context. Namely, in complex Chern-Simons theory, the integral (7.1) for an abelian gauge group (in the supersymmetric language) is known as a "state integral" [116,73], and it has been studied in the literature in parallel to the development of 3d N = 2 localization methods. (This apparent coincidence between the two subjects is explained by the 3d/3d correspondence [75] in string theory.) The state integral corresponding to an U (1) k supersymmetric CS theory coupled to N f chiral multiplets of unit charge was given an evaluation formula for b 2 rational equivalent to (7.27) in [74]. 67 The evaluation formula (7.27) renders manifest a number of properties of Z S 3 b which are less than obvious from the integral expression. One property is that, for any theory without any supersymmetric vacuum, Z S 3 b = 0. This follows from (7.27) and the fact that the number of Bethe vacua-that is, the mass-regulated Witten index [99]-is zero in that case. For instance, for U (N c ) SQCD with N f < N c flavors, the Witten index (5.48) vanishes and so does Z S 3 b . Another property which is obvious from (7.27) is 67 More precisely, Theorem 1.1 of [74] is equivalent to (7.27) in that case. Their state integral I A,B corresponds to a U (1) k theories with N f = B flavors and effective CS level k = 1 2 B − A.
that supersymmetric Wilson loops wrapping generic Seifert fibers 68 satisfy the correct twisted chiral ring relations [26,27].

The refined twisted index
Next we consider the refined topologically twisted index of [32], computed as a supersymmetric partition function on the supersymmetric background S 2 × S 1 discussed in Section 3.2. In particular we have the metric (3.9), where the "refinement" parameter: plays the role of a chemical potential for the azimuthal momentum on S 2 . Importantly, there is a non-trivial U (1) R flux across the S 2 : This implies that the R-charges must be integer-quantized, r ∈ Z. We also introduce a U (1) R flat connection along the S 1 : which is correlated with a choice of spin structure on S 2 × S 1 . If v R = 0 mod 1, we choose the periodic boundary condition for fermions along S 1 , while if v R = 1 2 mod 1, we choose the anti-periodic boundary condition. Thus, the fugacity v R introduces a further Z 2 refinement of the twisted index by the choice of spin structure. Following [32,90], we can compute the supersymmetric partition function on this background by supersymmetric localization: 69,70 with the integrand: In this case, these correspond to (q 1 , q 2 )-torus knots on S 3 b , for b 2 = q1 q2 as above. 69 This is the result derived in [32], after taking into account our conventions for quantizing fermions, and keeping track of the spin structure dependence. The parameters v and here correspond to u 2π and ς 2π , respectively, in Section 4 of [32]. 70 In this section, the parameters m and m F denote gauge and flavor fluxes, respectively, unlike in previous sections. We hope this will cause no confusion.
Here and in the following, v denotes the gauge parameters to be integrated over, v F denotes the flavor chemical potentials, m F denotes the flavor background fluxes, and we leave the dependence on the U (1) R parameter v R implicit to avoid clutter. In (8.4), the sum is over the gauge fluxes m a , and the v-integral is a particular middle-dimensional contour integral in the strip-like region: that implements a modified JK residue prescription-see [32,30,27]. The integrand is periodic under v a ∼ v a + 1, corresponding to large gauge transformations along the S 1 in S 2 × S 1 .
The classical contribution to the integrand is given by the CS contributions, of the schematic form: with: The gravitational CS term is trivial on this background. Note the spin-structure dependence of the gauge CS term, corresponding to v R = 0 or v R = 1 2 . 71 The vector multiplet contribution to the integrand (8.5) is given by: (8.9) The matter contribution to (8.5), as usual, is a product over the chiral multiplets of the theory: Here we defined the function: The RR CS term is similar, but in that case v R enters both as the choice of spin structure and as the U (1) R fugacity, and the effect cancels out-we have in terms of the q-Pochhammer symbol (x; q) n , defined in (4.67). which is the contribution of a chiral multiplet of U (1) gauge charge 1 and R-charge r = 0. For a single chiral multiplet of R-charge r ∈ Z, in particular, we have the contribution: including a subtle spin-structure dependence through v R when r is odd. As a consistency check on this result, we should consider the decoupling limits v → ±i∞. For a chiral multiplet of R-charge r = 1, we find: In the limit v → −i∞, we thus generate a gauge CS term k = −1, as expected in the U (1) − 1 2 quantization. Note that, for = 0, the chiral multiplet contribution simplifies to: , (8.14) and the supersymmetric partition function (8.4) becomes the ordinary genus-zero twisted index Z S 2 ×S 1 , given by (4.17) with g = 0. (In that = 0 limit, we can identify the parameters v, v F , v R here with u, ν F , ν R .)

Comparison to the Seifert fibration result for rational
As we explained in Section 3.2, the S 2 × S 1 geometry is a Seifert fibration over the orbifold S 2 (q, q) ∼ = S 2 /Z q if and only if the deformation parameter is rational, with: The Seifert fibration is then: In the Seifert description, we have the JK-residue formula (6.37), which gives: d rk(G) u e −2πiΩ(u,ν) G (u, ν) n 0 ,n 1 ,n 2 ,n F .
(8.17) Here, n 0 ≡ n 0,a and n 1 ≡ n 1,a , n 2 ≡ n 2,a denote the ordinary fluxes and the fractional fluxes at the two Z q orbifold points, respectively, and similarly for the flavor background fluxes n F . The contribution G to the integrand of (8.17) is the fibering operator for the Seifert fibration (8.16) before performing the sum over fractional gauge fluxes: G (u, ν) n 0 ,n 1 ,n 2 ,n F ≡ G 1,0 (u, ν) n 0 ,n F 0 G q,p (u, ν) n 1 ,n F 1 G q,−p (u, ν) n 2 ,n F 2 .
The complete fibering operator is: and (8.17) can then be written as: We note the important property that the integrand in (8.17) is periodic under u ∼ u+q.
Back to the Bethe sum. By summing over n 0 in (8.20) like in (6.49), and picking the poles at the solutions to the Bethe equations, we recover the Bethe-sum formula: where G (u, ν) n F is the full Seifert fibration (8.19) at n 0 = 0.
Comparison to the integral formula (8.4) for rational. One can compare (8.17) to (8.4) and find perfect agreement at = t q , given the following identification of the parameters: The matching of the fluxes between the two descriptions is clear from: π * (L n 0 0 L n 1 1 L n 2 2 ) = (qn 0 + n 1 + n 2 )[Ω] . (8.24) The matching between the continuous parameters v and u is obtained by comparing the supersymmetric Wilson loops in the two descriptions [32]. Note that the parameters v, v F , v R are defined modulo 1. Using the parameterization (3.26) for the U (1) R fluxes, with n R 0 = −1 + n R 0 , we find: Here l R ≡ l R 1 = l R 2 mod 2, where we used the fact that the parities of l R 1 and l R 2 must be equal for the line bundle L R to be well-defined. As a consistency check, it is interesting to note that: where, for any fixed (q, p), the two signs correspond to the two distinct choices of L R given by (3.27). By a direct computation with the identifications (8.23), we can check that: where the left-hand-side is the integrand (8.5) evaluated at rational values of . For instance, for a chiral multiplet, we have a "factorization" formula for (8.12), according to: Here, the first integral is over the strip Re(u) ∈ [0, q), which is rewritten as a sum of integrals over the strip Re(u) ∈ [0, 1). Then, using (4.38), we may write: and we then find: This shows the equality of (8.4) with (8.17), whenever is rational. This proof is easily generalized to any gauge group G. 72 72 Up to the unresolved difficulties in defining the correct JK-like contour.

Lens spaces and holomorphic blocks
In this final section, we revisit the general lens spaces, L(p, q). We will recover some of the above results on S 3 b and S 2 × S 1 as special cases, and connect our results to general lens space partition functions.
As we already mentioned, three-dimensional lens spaces are rather special amongst Seifert manifolds, since they are the only three-manifolds that admit an infinite number of Seifert fibrations. The lens space L(p, q) is defined as a Z p quotients of the threesphere: where we view S 3 as the set: For gcd(p, q) = 1, this identification defines a free Z p action and L(p, q) is a smooth manifold, which depends only on q modulo p. For later convenience, we formally define: We described the L(p, q) supersymmetric backgrounds in Section 3.4-see also Appendix C. The partition function of 3d N = 2 gauge theories on spheres and lens spaces has been extensively studied in the literature-e.g. in [10,12,14,15,58,17,32,65]; see the reviews [117,118] and references therein. Lens spaces admit a family of supersymmetric backgrounds preserving two supercharges, which can be characterized by a complex "squashing parameter," b [14,9]. To see how b appears, let us introduce some angular coordinates on L(p, q), with: In this description, the covering space S 3 is viewed as a torus, with angles (χ, ϕ), fibered over the interval θ ∈ [0, π]. The lens space admits a metric where ∂ χ and ∂ ϕ are generators of a U (1) × U (1) isometry. Then, in the supersymmetric background L(p, q) b with squashing b, the anti-commutator of the two supercharges is an isometry along a Killing vector K (b) : where L K (b) is the Lie derivative along K (b) . For generic b, the orbits of the U (1) isometry generated by K (b) do not close, except at θ = 0 and θ = π, where ∂ ϕ and ∂ χ , respectively, vanish. However, in the special case where: then all of the orbits close. In this case, the orbits of the real Killing vector K (b) define a Seifert fibration with base S 2 (q 1 , q 2 ), which generically has two exceptional fibers at the "poles" θ = 0 and θ = π.
In the following, we start by reviewing earlier computations of supersymmetric partition functions on squashed spheres and lens spaces. Interestingly, these partition functions are known to factorize into pairs of "holomorphic blocks," or D 2 × S 1 partition functions, reflecting the genus-one Heegaard splitting of the lens space into two solid tori [119,17,18,65]. We then explain how the holomorphic blocks can be directly related to the fibration operators, by considering a singular limit on the blocks. Using this correspondence, we demonstrate that, in the case of rational squashing (9.6), the partition functions computed in the Seifert formalism reproduce the earlier computations on squashed spheres and lens spaces. Along the way, we will also clarify a number of points, and obtain some new explicit results for the L(p, q) partition functions.

Holomorphic blocks and lens space partition functions
Let us start by reviewing the definition of the holomorphic blocks [17], and their role as building blocks of lens space partition functions. This subsection is mostly a review, but we also clarify some details of the construction, in particular concerning the role of the R-symmetry background, which leads to some new observations.

Definition and properties
The holomorphic block of a 3d N = 2 gauge theory is the partition function of the theory on a disk, D 2 , fibered over a circle. Specifically, we consider a space D 2 × τ S 1 with metric: where (r, ϕ) are the disk coordinates, ζ ∈ [0, 2π) the S 1 coordinate, and β the radius of the S 1 . (We also choose an arbitrary positive function f (r) which goes to 1 at the boundary.) Here, we perform a topological twist along D 2 , so that the R-symmetry gauge field has flux − 1 2 through the disk. We will discuss the R-symmetry gauge field in more detail below. As a consequence of the twist, the partition function is independent of the metric on D 2 . On the other hand, the space S 1 × τ D 2 has a torus boundary, T 2 , and we must specify some data at this boundary. The partition function on the solid torus S 1 × τ D 2 will depend on this data, which consists of: • A choice of two-dimensional vacuum (i.e. a Bethe vacuum) on the disk, α ∈ S BE , which fixes the asymptotic behavior of the fields at the boundary.
• The complex structure parameter, τ , of the boundary torus.
• The holonomy of background gauge fields, A F , coupled to global symmetries. Specifically, we define: Here ν lives in the complexified Cartan subalgebra of the flavor symmetry group. For simplicity of notation, we will focus on the case of a rank-one flavor symmetry group, U (1) F , so that ν ∈ C, but the general case is a straightforward extension.
• The holonomy of the U (1) R background gauge field: and a corresponding choice of spin structure on D 2 × τ S 1 . We will discuss this point momentarily.
Given this data, the holomorphic block is a locally-holomorphic function: The ν R dependence is kept implicit. Note that (9.10) is neither a modular nor an elliptic function, since those symmetries of the boundary torus are broken by the fact that only one of its cycles is filled. However, there is a residual symmetry under the independent shifts: τ → τ + 1 , ν → ν + 1 , (9.11) with the latter corresponding to large gauge transformations of A F along the S 1 . Thus, it is sometimes convenient to use the single-valued parameters: q ≡ e 2πiτ , y ≡ e 2πiν . (9.12) Note that shifting ν → ν + nτ , or y → q n y, for any n ∈ Z, corresponds to a large gauge transformation on the boundary torus, but is not a symmetry of the block. From (9.8) and Stoke's theorem, this is equivalent to a shift of the flux of A F through the disk by n units. Thus we define: to be the block with n units of flux. Here we have made an arbitrary choice of the zero of ν, which can always be redefined by ν → ν + α + βτ , with α, β ∈ Z. This freedom will be useful below.
The R-charge dependence of the holomorphic blocks can be discussed similarly. In the following discussion, we assume that the R-charges are integer-quantized. (Later on, we will be able to relax this restriction on some compact three-manifolds.) We have the background U (1) R gauge field A R , and the corresponding parameter ν R defined by (9.9), similarly to the flavor parameter ν. Naively, we have ν R = − τ 2 because the topological twist on D 2 introduces − 1 2 unit of U (1) R flux. More generally, we should consider: Here, the parameter ν R ∈ 1 2 Z mod 1 gives a Z 2 valued holonomy of A R through the S 1 : Similarly to the discussion in previous sections, in order to preserve supersymmetry, ν R must be correlated with a choice of spin structure on D 2 × τ S 1 . If ν R is an integer, we choose the periodic spin structure for fermions around the S 1 ; if ν R is half-integer, we choose the anti-periodic spin structure. 73 If we mix the R-symmetry current with the flavor symmetry current according to: (9.16) this has the effect of shifting the U (1) F gauge field according to A F → A F + rA R . The R-charge dependence of the blocks then appears through the shift: For r ∈ 2Z, this depends only on q, or equivalently, on the choice of τ mod 1, but for more general r the symmetry under τ → τ + 1 is partially broken. Namely, for general r ∈ Z, we only have τ ∼ τ + 2. If we allow for general r ∈ R, all shifts of τ are inequivalent. We will discuss the R-charge dependence of the blocks more carefully below.

Explicit construction of the blocks for a gauge theory
To construct the blocks for a given 3d N = 2 supersymmetric gauge theory, we first specify the contributions of the chiral multiplets and the Chern-Simons terms. Since we are not yet gauging any symmetry, we are considering a theory with a single vacuum and we can omit α ∈ S BE from the notation. 73 The parameters ν R and ν R here are closely related but distinct from the parameter ν R on Seifert backgrounds. We will discuss the relation later in this section.

Chiral multiplets. Let us introduce the function:
B Φ (ν, τ ) n ≡ q 1+n y; q ∞ , (9.18) defined in terms of the (extended) q-Pochhammer symbol: The expression (9.18) is the contribution from a chiral multiplet in the U (1) − 1 2 quantization, with unit charge under U (1) F and R-charge r = 0, including also n units of flux through the disk. A chiral multiplet of R-charge r ∈ Z contributes: 74 Note that the function (9.19) is analytic for |q| < 1 or |q| > 1, with: but it diverges at |q| = 1. The holomorphic blocks are therefore divergent in the limit τ → R, a limit we will discuss in detail below.
Chern-Simons contributions. The classical Lagrangian contributes to the blocks through the supersymmetric Chern-Simons terms. These contributions are somewhat subtle, but can be inferred by consistency from the chiral multiplet contribution [17]. The U (1) Chern-Simons term at level k = 1 contributes: (9.22) in terms of the Jacobi theta function: For a mixed CS term, we have: This is useful, for instance, to insert the contribution of an FI term (which is a mixed U (1) T -gauge CS term at level 1) in an abelian theory. 74 For general r, we define q r 2 = e πiτ r and (−1) 2 ν R r = e 2πi ν R r .
We also find an interesting formula for the supersymmetric gravitational CS term, which contributes: 75 B grav (τ ) = (−1) 2 ν R q We have the obvious identity: This is simply the statement that a pair of chiral multiplets of U (1) charge ±1 and R-charge r = 1 can be given a superpotential mass, which generates the CS levels k = −1 and k g = −2.
To fully specify the classical contribution to the blocks, we should also discuss the R-gauge and RR CS contributions. To our knowledge, this has not been discussed precisely in the literature, and we leave it for future work. We should also note that the holomorphic blocks are only defined up multiplications by certain elliptic functions E(ν, τ ), which cancel out from partition functions on closed three-manifolds upon gluing [17].
Vector multiplets. Next we have the contribution of the vector multiplets. The contribution from the W-bosons, corresponding to the non-trivial roots of G, contribute in the same way as chiral multiplets of R-charge 2 and U (1) a gauge charges α. For the Cartan components H = a U (1) a , we propose the following contribution: We will argue below this has the appropriate limit as we take τ → Q, reproducing the Seifert manifold formalism above. We denote the total contribution from the Cartan and from the W-bosons by B vec (u, τ ).
Gauging the blocks. Given a 3d N = 2 Lagrangian gauge theory, we may assemble the "ungauged block:" schematically, by combining the above contributions for the chiral and vector multiplets and CS terms, as a function of both the gauge and the flavor symmetry parameters u and ν, respectively. 75 As far as we know, this precise identification of B grav (τ ) is new in the literature. We will provide some strong consistency checks of this claim-see equation (9.56) below.
Then the "gauged block" is determined by integrating this over certain middledimensional contours, Γ α , in the complex "u-plane," which are naturally associated to the Bethe vacua, α ∈ S BE [17]: The Γ α -contours are described in more detail in Appendix F. We will see in a moment that we can also define the partition function of the gauge theory on a closed manifold directly in terms of the ungauged block, (9.28).

Lens space partition function from holomorphic blocks
The holomorphic blocks can be used to construct supersymmetric partition functions on closed manifolds. By gluing two solid tori along their boundary tori, we may obtain a general "squashed" lens space: Here, the gluing of the tori is through a large diffeomorphism: Note that one should flip the orientation of one of the solid tori before gluing, to obtain a compact three-manifold. Correspondingly, the lens space partition function of 3d N = 2 gauge theories can be written as the "fusion" of two holomorphic blocks [17]. To see how this works, consider two holomorphic blocks with parameters ν 1 , τ 1 , n 1 and ν 2 , τ 2 , n 2 , respectively. To glue these along their boundaries, we must ensure that the boundary data is compatible.

Identity gluing and S 2 × S 1
Let us first consider the "trivial gluing," with g in (9.31) the identity matrix. Here, we simply identify the two boundary tori with a change of orientation of D 2 × τ 1 S 1 . Thus we impose (ignoring the magnetic flux for the moment): Topologically, this gives us the space S 2 × S 1 . Since each block includes a flux − 1 2 for the R-symmetry, there is a net U (1) R flux −1 through S 2 . Thus we recover the background corresponding to the refined topological index, which we discussed in Section 8.
Explicitly, the fusion of blocks is achieved by taking an inner product in the basis of Bethe vacua. One finds [65]: (9.33) Here, we have set ν = ν 1 = ν 2 and τ = −τ 1 = τ 2 . By direct computation, one can check that the fusion (9.32) indeed reproduces the refined index (8.4). The parameters used here and the ones in Section 8 are related by: (9.34) and similarly for the R-symmetry parameters. (In particular, v R = ν R .) For instance, for a chiral multiplet of R-charge r = 0, we have: where we defined z = q − 1 2 (n 1 −n 2 ) y = e 2πiv . This is indeed equal to (8.11).
The supersymmetric index. Another "trivial gluing," which was studied in [17], corresponds to: This also gives S 2 × S 1 topologically, but it is distinct from (9.32). When considering this gluing, the sign flip in ν 1 must also be applied to the U (1) R flux through the disk, and the resulting background has a vanishing R-symmetry flux through the S 2 . The corresponding supersymmetric background computes the "ordinary" supersymmetric index, also known as the 3d superconformal index [62,63]. In terms of the gluing (9.30), it corresponds to: instead of the identity for the twisted index. We may denote this background by L(0, −1), which is distinct from L(0, 1). The supersymmetric background L(0, −1) is the exceptional case amongst the L(p, q) backgrounds; it does not admit any Seifert limit, and therefore does not fit directly into the formalism of this paper.

Non-trivial gluing and the lens space L(p, q)
Consider the more general gluing (9.30)-(9.31). We should identify the parameters according to: More precisely, the background gauge field parameters ν i could be shifted by elements of Z + Zτ i , for each block. As before, we may introduce in this way the fluxes n i on each block: Then, for the fluxes n i , we find the following consistency conditions upon gluing: 76 with α 1 , α 2 ∈ Z and otherwise arbitrary. We then identify: as the torsion U (1) flux on L(p, q), since a shift of m by p is equivalent to a shift of α 2 . We may fix α 1 = −tn 2 and α 2 = 0, for definiteness.
Fusing the blocks. Given the identifications (9.38) and (9.41), we directly find the partition function on a squashed lens space: In order to directly compare to the more common notation on squashed spheres and lens spaces, we can solve the gluing constraints (9.38) by: (9.43) Here, b 2 ∈ C is the squashing parameter. Consider for instance the L(p, q) b partition function of a free chiral of R-charge r = 0: We directly find [18]: Here, we used (9.21) to write the chiral-multiplet partition function in terms of the "ordinary" q-Pochhammer symbol, for |q| < 1, which corresponds to Im(b 2 ) > 0. For p = 1, this reduces to the S 3 b one-loop determinant: with Φ b defined in (7.10). 76 Here we used the identities τ2 −pτ2+q = −qτ 1 − t and 1 −pτ2+q = −pτ 1 + s.
R-symmetry dependence and spin structures. The R-symmetry background gauge fields: satisfy a consistency condition upon gluing, analogous to the one for flavor background gauge fields. Namely, we must have: This is equivalent to: This fixes the parameters ν R i ∈ 1 2 Z (mod 1). More precisely, there are three cases: if q is odd, p is even, (9.50) We see that there is a unique consistent choice for the Z 2 holonomies ν R i when p is odd, while there are two distinct choices when p is even. This is exactly as expected from our discussion of Seifert backgrounds. On L(p, q) with p even, there are two distinct choices of spin structures, which are probed by the two distinct supersymmetric backgrounds.
The R-symmetry Z p torsion flux can be read off from (9.49), similarly to (9.41): This is in agreement with the discussion in Section 3.4. For p even (and therefore q odd), there are two distinct choices in Z p , namely m R = − 1 2 (q+1) or m R = − 1 2 (q−p+1). We also recover the fact that the canonical line bundle K L(p,q) ∼ = L 2 R is trivial if and only if q = −1 (mod p). The U (1) R line bundle itself is trivial, L R ∼ = O, if the two integers in (9.49) vanish. This requires: which is only possible for q = −1 mod p. On such a background, we can consider any real R-charges, r ∈ R. In this case, combining (9.52) with (9.43), we see that: and therefore the shift (9.17) induced by a change of R-charge corresponds to: This reproduces the well-known R-charge dependence on S 3 b , as in (7.4). In fact that result directly generalizes to L(p, p − 1) ∼ = S 3 b /Z p [22], as we see here. Note that, for p even, the "superconformal" background with m R = 0 exists for a particular choice of spin structure. The other choice of spin structure gives rise to a distinct L(p, p − 1) b background, with non-trivial U (1) R flux m R = p 2 and Dirac-quantized R-charges.
Gravitational CS term. As another consistency check of the above discussion, it is interesting to consider the gravitational Chern-Simons term. Consider the compact lens space L(p, −1) b with the the R-symmetry background such that L R ∼ = O, as described above. Then, we find [18]: For p = 1, we recover the S 3 b contribution as given on the last line of (7.3). One can check that this term indeed factorizes as expected: for p = 0. Here we used the gluing matrix g with (p, q) = (p, −1) and (t, s) = (0, −1), which implies ν R 1,2 = 0 due to (9.52). The identity (9.56) can be checked numerically. For the identity gluing, we obtain B grav (−τ )B grav (τ ) = 1 instead, as expected for the twisted index.
Integral formula. An alternative expression for the lens space partition function starts from the ungauged blocks,B(u, ν, τ ), introduced above. We may fuse two ungauged blocks, thus obtaining the lens space partition function of the ungauged theory: 77 Z Here, we denoted by n i and n F i the gauge and flavor fluxes, respectively, and we identify the torsion fluxes: The proportionality factor is a τ -dependent factor, which can be thought of as contributing to the measure in the integral formula below. We will be somewhat imprecise about such measure factors in the following. as in (9.41). Then, for p = 0, the partition function of the gauge theory can be obtained by integrating (9.57) over the realσ u contour, 78 and summing over fluxes m ∈ Z p . Schematically, this gives: where we have included the contribution from the vector multiplets in the maximal torus, as above. Indeed, one can show that this agrees with the expressions for the squashed sphere and lens space obtained directly by localization in [10,12,14,15,58]. When p = 0, the sum in (9.59) is over the integers, m ∈ Z-more generally, for a gauge group G, the sum is over the GNO-quantized magnetic fluxes on S 2 -, and the integration is over the JK contour, as described in Section 6.
Geometric equivalences amongst lens spaces L(p, q). Before concluding this discussion of the L(p, q) partition function, let us make a few more comments about the geometry. In the above, we constructed the lens space L(p, q) using the arbitrary SL(2, Z) element g in (9.31). In particular, the integer p could be positive or negative.
In general, it is chosen positive. There is an obvious equivalence: where the minus on the right-hand-side stands for orientation reversal. This is clear, for instance, from the definition (9.1)-(9.2), since sending p to −p is equivalent to sending z 1 , z 2 toz 1 ,z 2 . In terms of the Heegaard splitting (9.30), the lens space L(−p, q) is realized by the gluing: Interestingly, we have: and therefore: The last relation precisely realizes −L(p, q). That is, C acting on the boundary tori changes the sign of a single direction, and the gluing is with the same g that realizes L(p, q), therefore we indeed obtain L(p, q) with the opposite orientation. 78 More precisely, this is true for b 2 > 0. For b 2 < 0 we should instead integrate over the imaginary σ ν contour.
Let us mention two other operations we can perform. First, we may replace: This is equivalent to exchanging the roles of the two blocks, i.e., τ 1 ↔ τ 2 and ν 1 ↔ ν 2 , and so does not affect the partition function obtained by fusing the two blocks. More precisely, we find the relation: This exhibits the equivalence L(p, q) ∼ = L(p, q −1 (mod p)), where we use q −1 = s (mod p). Next, we may replace g → −g. We see this has the effect of replacing L(p, q) → L(−p, −q). From (9.38), this has no effect on the identification of the τ i , but now the relation between ν i incurs an additional sign. Inspecting (9.43), we see that, for p = 0, we may equivalently replace: In other words, we have the relation, for p = 0: For p = 0, where g = Id, this operation takes us between the topological index, L(0, 1), and the ordinary index, L(0, −1), but the partition functions on these two spaces do not obey a simple relation, as in (9.67). These two choices are the three dimensional analogue of the topological-topological (tt) and topological-anti-topological (tt * ) fusion of the holomorphic blocks, respectively [120,21]. The statement of (9.67) is then that, once we non-trivially fiber the S 1 over S 2 , the distinction between these two choices goes away. This gives another perspective on why the partition function on the squashed sphere and lens spaces, which can be thought of as a 3d uplift of the tt * partition functions [21], can also be computed in the 3d A-model, which is an uplift of the topological A-model.

Rational squashing and the Seifert fibering operators
Given this discussion of the holomorphic block, we can now come back to the half-BPS Seifert manifold formalism. Recall that, although the orbits of the Killing vector K (b) in (9.5) do not close for generic b ∈ C, they do close when In this case, the orbits of K (b) are the fibers of one of the infinitely many inequivalent Seifert fibrations of the lens space, L(p, q). Thus we expect that, by taking a limit of the lens space partition function as b 2 approaches a rational number, we may express it in terms of the formalism introduced in earlier sections. In fact, more directly, we expect there to be a simple relation between the holomorphic blocks and the Seifert fibering operators, which insert an exceptional (q, p) fiber in a general Seifert manifold. Namely, the holomorphic block is the partition function on a disk fibered over an circle, and in the limit where this fibration approaches a rotation by a rational angle, τ → t q , (9.69) this is precisely the solid fibered torus T (q, t) introduced in Section 2-see equation (2.28)-, which is the local model of an exceptional fiber. That is, schematically, we expect a relation of the form: The precise relation is given in (9.79) below. In the following, by establishing this correspondence more precisely, we demonstrate that the Seifert formalism of this paper indeed reproduces the known partition functions on squashed lens spaces in the rationalsquashing limit, (9.68).

Trivial gluing and the topological index
Let us start with the "trivial gluing" of two blocks, as in (9.33) above, which gives us the topological index [32]. First of all, in the limit τ → 0, we should recover the ordinary (i.e. non-refined) S 2 × S 1 twisted index. The precise claim is that, for each Bethe vacuum α ∈ S BE : Here m F = n 1 + n 2 is a flavor symmetry background flux, and Π the ordinary flavor flux operator. It then directly follows from (9.33) that: which is the expected result from the A-model computation of the twisted index. We demonstrate (9.71) in Appendix F. Here, let us briefly illustrate the argument in the case of a free chiral multiplet with R-charge r ∈ Z, and setting the fluxes to zero.
The corresponding holomorphic block (9.20) is given in terms of the q-Pochhammer symbol: B Φ (ν, τ ) = ((−1) 2 ν R r q 1− r 2 y; q) ∞ , q = e 2πiτ , y = e 2πiν . (9.73) For τ → 0, we may use the following expansion of the q-Pochhammer symbol [17]: The leading behavior of the chiral multiplet block as τ → 0 is then: (9.75) When we multiply this with another block with τ → −τ , as in the LHS of (9.71), the leading divergence cancels and we obtain a finite limit: which agrees with the handle-gluing operator of a chiral multiplet of R-charge r, as claimed. Comparing (9.76) to (4.21), we also see that ν R can be identified with ν R in the Seifert formalism. This is expected in this case: given the identity gluing, we have ν R 1 = ν R 2 and the choice of spin structure on the solid tori becomes a choice of spin structure on S 2 × S 1 .

General lens spaces
To consider similar limits for general lens spaces, it will be useful to first introduce some notation. For g ∈ SL(2, Z) given as in (9.31), we define: as in (9.62). We also define: This is simply a reparameterization of the variables ν and τ defining the blocks. Specifically, these are the values measured after applying the SL(2, Z) transformation g to the boundary torus.
Fibering operators from the holomorphic blocks. Let us choose q > 0 for definiteness. Then, the precise form of the relation (9.70) between the holomorphic block and the Seifert fibering operator reads: We can understand this geometrically, as follows. To glue an exceptional Seifert fiber of type (q, p), we first cut out a tubular neighborhood of "trivial fiber," D 2 × S 1 , and then glue the local model of an exceptional fiber, T (q, t), to the boundary torus. This is reflected in the equation above, where the denominator corresponds to the "trivial block" we are removing, and the numerator corresponds to the non-trivial block, with rational rotation angle g · τ → − t q . More precisely, we must first regularize by taking non-zero τ ∈ C\R, as the blocks are divergent at real τ , and we recover the above procedure in the limit τ → 0, reflected in (9.79).
We prove the relation (9.79) in Appendix F. Let us again illustrate the argument in the case of a free chiral multiplet. For simplicity of notation, we take both the R-charge and flux to be zero. Then, we are interested in the limit of: as τ → 0. Using the identity: (qy; q) = n−1

(9.83)
In these new variables, the L(p, q) partition function (9.42) takes the suggestive form: (9.91) At this point this is simply a reparameterization. However, if we now take the limit τ → 0 of (9.91), we find: Then using the limits (9.79) and (9.71),this becomes: This is precisely the partition function of a Seifert manifold with two exceptional fibers, (q i , p i ), i = 1, 2, over a genus zero Riemann surface-namely, a lens space. Recall from Section 3.4 that the lens space L(p, q) b with b 2 = q 1 q 2 has the Seifert fibration: The identification of the lens space parameters p, q with the Seifert invariants (q i , p i ) is precisely as in (9.88). Comparing (9.90) to (9.43), we also find: as expected. Thus, we have proven that: which is our main result for Seifert manifolds, specialized to the lens space Seifert fibration (9.94). We should emphasize the condition q > 0 stated before (9.79) is important for the argument above to go through. Thus we must impose q i > 0 for both SL(2, Z) matrices g i . From (9.95), we see q i = 0 is a singular limit of the squashing parameter, and this limit is not expressible in terms of the Seifert fibering operators. When q i < 0, we may replace g i → −g i , which (at most) takes g → −g. Then for p = 0, we have seen above, in (9.67), that this is simply a reparameterization in terms of the equivalent space L(−p, −q), and so there is no loss in restricting to q i > 0 in these cases.
However, for p = 0, taking g → −g is not a reparameterization, and takes us between the inequivalent backgrounds L(0, 1) and L(0, −1), corresponding to the twisted index and the ordinary supersymmetric index, respectively. Then, one can check that for (p, q) = (0, −1), it is not possible to find matrices g i satisfying (9.88) with both q i > 0. Therefore, although the supersymmetric index can be constructed in terms of holomorphic blocks, it cannot be written in terms of the Seifert fibering operators.
Contour integral expression. Finally, let us return to the integral formula (9.59). Applying the results above to the ungauged theory, we find: for b 2 rational. Here we used the fact that H = e 2πiΩ for the ungauged theory. Then, plugging this into (9.59), we find: schematically, in agreement with the "σ-contour" expression derived in (6.60).

A.1 Three-dimensional fermions and the parity anomaly
It is well-known that three-dimensional fermions suffer from parity anomalies [34,35,36]. Consider a 3d Dirac fermion ψ coupled to a U (1) background gauge field A µ with charge 1. On {x µ } ∼ = R 3 with Euclidean signature, the parity operation is given by changing the sign of a single coordinate, say x 3 → −x 3 . (It is thus indistinguishable from time-reversal symmetry.) The classical Lagrangian of a massless fermion, preserves parity. The parity anomaly is the statement that there exists a mixed parity-U (1) anomaly-in other words, one cannot preserve both parity and (background) gauge invariance. As usual in this type of situation, we have to give up some symmetry of the classical theory in the quantum theory. If we couple the theory to a metric, we have a similar parity anomaly with background diffeomorphism. In this paper, we always choose to preserve gauge invariance (and diffeomorphism invariance). Then, the "parity anomaly" is the statement that the quantum effective action: is a gauge-invariant (non-local) functional of A µ which violates parity. The parityviolating term is an imaginary contribution to S eff , which arises because one needs to regulate carefully the infinite product over the eigenvalues of the Dirac operator. This can be made rigorous on a closed three-manifold. A standard regularization of the phase of the Dirac determinant gives [36,38]: Here, the absolute value is unambiguous, while the phase is given by the APS ηinvariant. Crucially, η(g, A) is a gauge-and diff-invariant functional of the gauge field A and of the metric g, 79 which is generally non-local. The η term is closely related to the U (1) and gravitational CS terms: Tr with ω the spin connection. While these CS terms are not gauge (or diff) invariant unless their coefficient is a quantized level, k ∈ Z and k g ∈ Z, respectively, their infinitesimal variations are well-defined and coincide with the variations of the η-invariant: It is defined by a ζ-regulated sum over the signs of the eigenvalues, λ, of the Dirac operator: By the Atiyah-Patodi-Singer (APS) index theorem, we also have: for any quantized integer k ∈ Z. Thus, for many purposes, the gauge-invariant phase e (plus a gravitational CS term at level −1). 80 In any 3d field theory coupled to background gauge fields and metric, the parityviolating terms are conveniently captured by the two-point functions of the conserved currents, whose parity-odd coefficients are denoted by κ. As explained in [37], the quantity: is a physical observable. This is because κ can always be shifted by some integer k ∈ Z, by adding a background Chern-Simons term with integer level k to the effective action. For instance, we may add the U (1) CS term in (A.4) to the UV action, which would shift the observable κ: Since the CS level k must be quantized by gauge invariance, κ mod 1 is physical. By abuse of notation, we call κ the "CS contact term," but we should not loose sight of the fact that (A.7) is physical (unlike an ordinary contact term, which can be entirely canceled by a local term). For the free fermion ψ regularized as in (A.3), we have: Here, κ is the parity-odd contact term in the two-point functions of the U (1) current, and κ g is a similar contact term involving the stress-energy tensor [37]. The only ambiguity is in shifting κ and κ g by integers, by adding the CS terms (A.4) to the action. We must therefore make a choice in the UV. We call the choice (A.3)-(A.9) the "U (1) − 1 2 quantization," in agreement with standard notation. 81 More generally, for a fermion with charges Q a ∈ Z under some U (1) a symmetries, the "U (1) − 1 2 quantization" (A.3) corresponds to the CS contact terms: (A.10) 80 Nonetheless, we emphasize that it is not possible to "cancel the parity anomaly" (as it is sometimes stated in the supersymmetric localization literature) by adding a CS term with level k = 1 2 to (A.3), since such a term violates gauge invariance. The point is that one cannot take the "square-root" of equation (A.6). 81 The term κ = − 1 2 is sometimes call the "effective CS level." The corresponding CS terms are the mixed U (1) a -U (1) b CS interactions, with levels k ab ∈ Z. (The generalization to non-abelian symmetries is straightforward.) Incidentally, let us note that, while the choice of background CS terms for global symmetries is unphysical, once we start gauging symmetries (making some A µ 's dynamical), their CS terms, of course, become an important part of the definition of the theory in the UV. For instance, a U (1) gauge theory coupled to a single fermion ψ of unit charge, with bare CS term k ∈ Z in the UV, together with our choice of quantization (A.3), is generally denoted by U (1) − 1 2 +k + ψ, and its dynamics, of course, depends crucially on the level k [40].
To conclude this overly detailed discussion of 3d fermions, we recall that the 'real mass" term: breaks parity explicitly. Integrating out the fermion ψ with a large real mass, m → ±∞, shifts the CS contact terms according to: in our conventions. In particular, for a single fermion ψ of U (1) charge 1 and with a mass term m, we have the CS contact terms (A.9) in the UV, while in the IR we can integrate out the fermion and obtain an empty (trivial, gapped) theory. If m > 0, that empty theory has vanishing CS contact terms, κ = 0 and κ g = 0, while if m < 0, we obtain the IR contact terms κ = −1 and κ g = −2.

A.2 Chern-Simons actions, contact terms and supersymmetry
Now, let us specialize the above discussion to the case of N = 2 supersymmetric theories with a U (1) R symmetry. We have to consider the various contact terms: which correspond to the gauge, mixed gauge-R, RR, and gravitational contact terms, respectively. The supersymmetrization of those terms was studied in [37] Supergravity CS terms. Let us briefly discuss the supersymmetric CS term A (R) dA (R) for the U (1) R gauge field A (R) µ , and supersymmetric gravitational CS term [37,6]. Setting the fermions to zero, the N = 2 supersymmetric version of the gravitational CS term reads: with A (R) µ the U (1) R gauge field. The level k g is integer-quantized. This action is conformally invariant. There also exists another, non-conformal CS-like term one can write down using the supergravity multiplet alone: Here, V µ and H and auxiliary supergravity fields (as we briefly review in Section 2.3) and R is the 3d Ricci scalar. The actual U (1) R Chern-Simons level is given by: which is the net coefficient of the A (R) dA (R) term. The RR level k RR is integer-quantized if U (1) R is compact-that is, whenever all the R-charges are integer-quantized.
Quantizing 3d N = 2 supersymmetric multiplets. Let Φ be a chiral multiplet of U (1) a charges Q a and R-charge r. In this paper, we use the "U (1) − 1 2 quantization" for the Dirac fermion ψ in Φ. Then, each chiral multiplet Φ contributes to the CS contact terms: If we give a large positive real mass, m → ∞, to a free chiral multiplet in the U (1) − 1 2 quantization, thus integrating it out, we get vanishing CS contact terms in the IR: Operationally, and especially for the purpose of supersymmetric localization, this is as good a definition as any of what we mean by the "U (1) − 1 2 quantization" of an N = 2 chiral multiplet-it is the regularization of the one-loop determinant Z Φ for Φ such that Z Φ → 1 in the limit m → ∞.
The vector multiplet V also contains an adjoint fermion, the gaugino. To discuss its UV quantization, we decompose V into abelian vector multiplets V a along a maximal torus H ∼ = a U (1) a , and into the components V α along the non-trivial roots. Each V a and V α contains a gaugino λ or R-charge 1 (and its charge conjugateλ or R-charge −1), which we denote by λ a and λ α , respectively. The λ α 's come in pairs λ α , λ −α , which carry opposite gauge charges (Q a = α a and Q a = −α a , respectively) under the Cartan subgroup H. We therefore choose the "symmetric quantization" with respect to the U (1) a gauge charges, which results in a vanishing net shift of the gauge contact terms: V : κ ab = 0 , κ aR = 0 , (A. 19) for the full vector multiplet. (The elements V a are of course neutral.) We also have to specify the U (1) R and gravitational CS contact terms in the UV. We will quantize the gauginos λ = (λ a , λ α ) such that they each induce the RR and gravitational CS levels κ RR = 1 2 and κ g = 1-that corresponds to a phase e − πi 2 η(A (R) ,g) in their one-loop determinant, instead of (A.3). Then, for the full vector multiplet, we obtain the UV CS contact terms: Of course, we could always choose a different quantization in which κ g = 0, by adding the supersymmetric gravitational CS term (A.14), with level k g = −dim(G), to the effective action. On the other hand, the UV contribution of the vector multiplet to κ RR is generally half-integer, and thus cannot be shifted to zero in any gauge-invariant scheme. The quantization (A.20) for the vector multiplet is particularly natural from the point of view of pure Chern-Simons theory, as we now explain.
Flowing to pure CS theory. Consider an N = 2 supersymmetric Chern-Simons theory G k , consisting of a vector multiplet V with a CS term at level k ∈ Z: 82 In such a theory, the gaugino has a real mass (A.11) given by the CS level: 83 It is useful to introduce a supersymmetric Yang-Mills (YM) term as a UV regulator, with gauge coupling g 2 (of mass dimension 1). Then, the gauge field (and the gaugino) acquire a so-called topological mass, m T = g 2 m λ . In the infrared, at scales well below m T (and for k large enough so that we do not break supersymmetry dynamically [121]), we can integrate out the gauginos and recover pure Chern-Simons theory for a gauge group G and shifted levels:k as follows from (A.12). For a simple gauge group G = G γ , this is: More generally, we have distinct levels k γ and k I for each factor in (1.12). We could also consider distinct CS levels for the SU (N ) and U (1) factors in U (N ). 83 This is dimensionless, since the canonical dimension of the gaugino is 3 2 . with h the dual Coxeter number. With the choice of quantization (A.20) for the vector multiplet, we then obtain the infrared contact terms: 25) In particular, if k > 0 we have κ (IR) RR = 0 and κ (IR) g = 0. Since the U (1) R symmetry completely decouples in the pure CS theory, this is a very natural choice. It also simplifies the presentation of various supersymmetric dualities.

B. Geometry conventions
In this appendix, we briefly discuss some useful facts about the half-BPS Seifert geometries, and we set our conventions for spinors. Our geometric conventions closely follow [5,19], to which we refer for further discussion.

B.1 Seifert geometry and THF
Consider the oriented Seifert three-manifold: with Riemannian metric and Killing vector: as discussed in the main text. There is a natural metric-compatible transversely holomorphic foliation (THF) on M 3 generated by the one-form: with η µ = K µ . The THF can be defined in terms of η µ and: with µνρ the Levi-Civita tensor. We have: together with an integrability condition which is automatically satisfied in this case [5]. As one can see from (B.5), the tensor Φ defines a complex structure J on the space of leaves of the foliation-here, the space of leaves is the baseΣ of the Seifert fibration: The local coordinates z,z that appear in (B.2) are the complex coordinates onΣ adapted to JΣ, while ψ ∈ [0, 2π) is the local coordinate along the Seifert fiber.

B.3 Decomposition and adapted connection
Given the Seifert structure above, it is useful to introduce the projectors: They allow a decomposition of any tensor into vertical, holomorphic and anti-holomorphic components, corresponding to the canonical frame (B.7). For instance, for any one-form ω, we have: In particular, a holomorphic one-form on M 3 is such that: By definition, its single component ω z is a section of the canonical line bundle of M 3 : (B.14) Importantly, the Levi-Civita connection ∇ µ does not commute with η µ , and therefore does not preserve the decomposition (B.12). We define a Seifert-compatible adapted connection∇, such that∇ It is given by: with Γ ν µρ the Christoffel symbols. Here, c 1 (L 0 ) is the first Chern class of the defining line bundle onΣ, as defined in Section 2. The compatible spin connection is: The adapted connection∇ commutes with the projectors (B.11), thus it is compatible with the decomposition into vertical, holomorphic and anti-holomorphic components. The price to pay is that∇ has torsion [5]: Using this geometric decomposition and the Killing spinors ζ,ζ, it is easy to rewrite all fields in terms of two-dimensional forms onΣ, thus providing a very explicit description of the topological A-twist pulled-back to M 3 [22,19].
C. Comments on S 3 b and L(p, q) b as Seifert fibrations In this appendix, we discuss some properties of the three-sphere and lens space backgrounds seen as Seifert fibrations, complementing the discussion in the main text.

C.1 The squashed three-sphere as a Seifert fibration
In Section 3.3, we saw that the squashed three-sphere S 3 b with b 2 ∈ Q is given in terms of a Seifert fibration with two exceptional fibers: Any "squashed-sphere" background preserving the supersymmetry algebra: with K (b) a real Killing vector, 84 can be written in the general Seifert form of Section 2.3. For definiteness, let us consider the U (1) × U (1)-isometric background of [14], with 84 More general backgrounds with b and K (b) complex exist. We can focus on b real for our purposes.
a real squashing parameter b. Let us describe the three-sphere as a torus fibered over an interval, with θ ∈ [0, π] the interval and χ ∈ [0, 2π) and ϕ ∈ [0, 2π) the angular coordinates on the torus. The squashed-sphere metric reads: The function h(θ) is some smooth positive function which behaves as: near the "poles" θ = 0, π, and is otherwise arbitrary. For b = 1 and h(θ) = 1, (C.3) is the round metric on S 3 with radius R 0 . The Killing vector K (b) appearing in (C.2) is given by: One can check that: defines a THF, and one finds the auxiliary fields: 85 Now, consider the case: To bring the supersymmetric background (C.3)-(C.7) to the general form of Section 2.3, we need to perform a change of coordinates from the angles χ, ϕ to some new angles φ, ψ such that: with β the radius of the generic Seifert fiber. One can check that, in the new variables: the metric (C.3) takes the standard form: 86 with the Seifert connection: and the orbifold metric: Comparing to (2.4), this is clearly a metric on the spindle S 2 (q 1 , q 2 ). The connection (C.12) satisfies: with ω 1 , ω 2 the generators of the orbifold fundamental group on S 2 (q 1 , q 2 ). This shows that the S 3 b background with b 2 = q 1 q 2 corresponds to the Seifert fibration (C.1).

C.2 All the Seifert fibrations of L(p, q)
As we mentioned in Section 3.4, any genus-zero Seifert fibration with n ≤ 2 exceptional fibers is a lens space. Conversely, for any lens space L(p, q), we would like to find all of its possible Seifert fibrations. Here we review the algorithm of [87]-Theorem 4.10 therein-, which constructs all the Seifert fibrations of a given L(p, q). (We assume that p = 0. The case L(0, 1) ∼ = S 2 × S 1 was treated separately in the main text.) Consider p and q two mutually-prime integers. Given the mutually-prime non-zero integers q 0 1 and q 0 2 , we can construct the Seifert fibration: on L(p, q), as in (3.39)-(3.40), in the following way: • Choose some integers s, t such that qs + pt = 1.
One can check that this reproduces (3.40), for q mod p. Due to (C.16), we also see that: so that a choice of (q 0 1 , q 0 2 ) is equivalent to a choice of b 2 ∈ Q.

D. Supersymmetric one-loop determinants on Seifert manifolds
In this appendix, we further explain the computation of one-loop determinant of a chiral multiplet on M 3 , generalizing the discussion on M 3 = M g,p in [19]. We then study some of its properties, providing additional details about computations that we alluded to in the main text. with the adapted connection∇ introduced in Appendix B, acting on some field ϕ of R-charge r ϕ . On the supersymmetric locus for the vector multiplet, with holomorphic parameters: and flux n, most modes cancel out between the bosons and fermions. By a standard argument-see in particular [122,14,90]-we then find: Here, (D 0 , D 1 , D1) denote the covariant derivative (D.1) in the canonical frame basis. We then expand any field along the Seifert fiber: with the modes ϕ k the two-dimensional fields onΣ. In particular, the modes A k in the kernel of D1 are the holomorphic sections of the orbifold line bundle: Note that: dim kerD1 = h 0 (L (r,k) ) , dim cokerD1 = h 0 (L −1 (r,k) ⊗ K) . (D.6) Using the Riemann-Roch-Kawasaki formula (2.18), we directly find the formal product: which is the result (4.58) quoted in the main text.

D.2 Regularizing
As a formal infinite product, the (q, p) fibering operator for Φ with R-charge r = 0 reads: (D.8) By rewriting the product over k ∈ Z as: k = qn + tl , n ∈ Z , l = 0, · · · , q − 1 , qs + pt = 1 , (D.9) we obtain: with the ordinary fibering and flux operators F Φ and Π Φ , respectively, as in (4.60): (D. 11) which are regularized to: Li 2 (e 2πiu ) + u log 1 − e 2πiu , (D. 12) in the U (1) − 1 2 quantization for the Dirac fermions, as discussed in [19]. The regularized expression (D.10) can then be written as: q,p (u) n = Π Φ q,p (u) n G Φ q,p (u) (D. 13) with: Li 2 (e 2πi u+tl q ) + pu + l q log 1 − e 2πi u+tl q , (D.14) which is the expression discussed in the main text. Using the identities: Li 2 (e 2πi u+tl q ) = 1 q Li 2 (e 2πiu ) ,  This expression only depends on the coprime integers (q, p), not on the choice of s, t such that qs + pt = 1. We claim that, for q > 0 and p coprime to q, (D.21) can be written as: q,p defined as in (4.53). This is equivalent to: exp 2πi s(p, q) = exp πi(q − 1) 6q 3sq 2 − p(q + 1) + t(qs + 1)(2q − 1) , (D. 23) which is an evaluation formula for the Dedekind sum s(p, q) modulo integers, when q > 0 and gcd(q, p) = 1. It would be interesting to prove (D.23) directly. 87 As a sanity check, we note that the following known evaluation formulas for the Dedekind sum at p = 1 and p = 2: s(1, q) = (q − 1)(q − 2) 12q , s(2, q) = (q − 1)(q − 5) 24q , (D. 24) are consistent with (D.23). Now, re-introducing the fractional flux n ∈ Z, we also have the limit: lim u→−i∞ Π Φ q,p (u) n ∼ (−1) n e − 2πi q nu e πi t q n(n+1) . For a general R-charge r ∈ Z, we simply replace: u → u + ν R r , n → n + n R r , (D. 27) in (D.26). The resulting expression must be equal to the correct CS terms, as indicated in (4.74). This is indeed the case, as one can check by direct computation. In fact, that is the method we first used to derive the expression of Section 4.3.1 for the Chern-Simons contributions to the fibering operator. In Appendix E, we give an independent consistency check of those results. The supersymmetric one-loop determinant on S 3 b is given by the formal product [14]:

D.4 Comments on Z Φ
(D. 28) withσ R as defined in (D.29). This corresponds to the elementary N = 2 mirror symmetry (5.15) between the U (1)1 2 gauge theory with one chiral multiplet (with Rcharge r = 1) and the free chiral T + (with R-charge 0). Indeed, since Φ b (σ) corresponds to the "U (1)1 2 quantization," we have κ = 1 2 (for the gauge symmetry) and κ g = 1 on the left-hand-side of (D.36) (with the phase in front of the integral corresponding to the gaugino), while in the right-hand-side we have the contributions δκ T T = 1 2 , δκ T R = −1, δκ RR = 1 and κ g = 1 from Φ b (ξ −σ R ), and a contribution δκ T T = −1 from the bare CS term e −πiξ 2 . This is therefore equivalent to the duality (5.15).
Another interesting relation for Φ b (σ) is the pentagon identity [112]. Let us use the function Φ b (σ), for convenience. Then, the pentagon identity can be written as: This identity corresponds to the well-known mirror symmetry between SQED, a U (1) theory with two chiral multiplets of charge ±1, and the XY Z model, consisting of three chiral multiplets (X, Y, Z) ≡ (M, T + , T − ) coupled by cubic superpotential W = M T + T − . This is also a special case of Aharony duality discussed in Section 5. Finally, let us further comment on the factorization of the one-loop determinant (D.29) into fibering operators, when b 2 is rational. It is convenient to start with the unregularized product (D.28) at r = 0. (The general r case can be obtained by shiftingσ.) Given: b 2 = q 1 q 2 , q 1 , q 2 ∈ Z >0 , u = i √ q 1 q 2σ , (D. 38) the expression (D.28) becomes: (n 2 + 1)q 1 + (n 1 + 1)q 2 − u n 2 q 1 + q 2 n 1 + u . (D.39) By reordering the infinite product, this can brought to the form: 1 u + kq 1 q 2 + l 1 q 2 + l 2 q 1 k+1 . (D.40) The product over k ∈ Z can be interpreted as a product over the momentum modes ϕ k along the Seifert fiber. Using (D.11)-(D.12), that product can then be immediately regularized to: By using the identities (D.15) repeatedly, it is easy to show that: and: This gives a physicist's proof of the factorization formula (7.24), which can be written as a property of the quantum dilogarithm: with q 1 p 2 + q 2 p 1 = 1. To the best of our knowledge, this property was first discussed in [74] from a mathematical perspective. Here, we give it a new physical interpretation, by viewing S 3 b , with b 2 rational, as a Seifert fibration.

E. Chern-Simons actions on Seifert manifolds
In this appendix, we collect some comments about the classical Chern-Simons functional on Seifert manifolds. In Appendix D.3, we explained how we derived the classical Chern-Simons contribution Z CS M 3 to the supersymmetric partition function Z M 3 , for any supersymmetric Seifert background M 3 , by taking appropriate limits of the oneloop determinant for free chiral multiplets coupled to background vector multiplets. This is a convenient but oddly roundabout way to compute Z CS M 3 . Indeed, the straightforward computation would be to evaluate the known supersymmetric actions on the Seifert background: with L CS the sum of the various supersymmetric CS Lagrangians. However, in the presence of non-trivial flat connections on M 3 , the direct evaluation of (E.1) is not entirely straightforward. In the following, we make some further comments on the evaluation of (E.1), and we compare our results from Section 4.3.1 to previously-known results.

E.1 The U (1) k Chern-Simons functional
The N = 2 supersymmetric Chern-Simons functional for a gauge group U (1) at CS level k ∈ Z takes the form: On the supersymmetric locus, λ =λ = 0, σ is constant and: Let us assume that c 1 (L 0 ) = 0, so that we can expand the gauge field A µ as: withâ 0 constant. Then, defining the quantity: it is easy to check that: including the contribution from the flat connection: In principle, this latter quantity (modulo 2πi) can be computed for any a (flat) valued in the torsion group H 1 (M 3 , Z), for instance by extending to a four-manifold with compatible spin structure [33]: In practice, this is rather non-trivial to compute.
Extracting the CS functional from the fibering operator. Here we defined the sign: (E.14) Note that (E.13) is determined by both the choice of A flat and of the spin structure on M 3 . As a small consistency check, one can verify that (E.13) is invariant upon L → L ⊗ L 0 -this follows directly from (4.42). 89 The formula (E.13) therefore gives us a completely explicit formula for the U (1) k CS action (E.7), for any non-trivial torsion line bundle L over M 3 .

E.2 Non-abelian Chern-Simons functional
The above considerations can be generalized to the case of a non-abelian, simply connected (or unitary) gauge group G at level k ∈ Z, by "abelianization" as in equation (4.48). Let us define: the non-abelian generalization of (E.7). Here A flat is the connection of a given flat principal G-bundle E. On the "2d Coulomb branch", G is broken to its maximal torus H = a U (1) a , and the bundle E can be described in terms of U (1) a line bundles L (a) , 88 Here n 0 is an "ordinary flux". We find it convenient to let the index i run from 0 to n. 89 Under a shift n i → n i + p i , for every i at once, the sign (E.14) transforms as (−1) s → (−1) i pisi (−1) s , while the full answer (E.13) is invariant.
which can be treated as in (E.10). Let L (a) denote some line bundles in Pic(Σ) such that π * (L (a) ) = L (a) , and let n i,(a) denote the corresponding fractional fluxes. Here, the non-trivial step is to identify the correct fractional fluxes for a given G-bundle E. We will not discuss that step here.
Let us focus on the case G semi-simple and simply-connected. Upon abelianization, the signs (−1) s in front of (E.13) cancel out in that case, consistent with the fact that (E.15) is independent of the spin structure. We then find the explicit formula: exp −S flat G k = exp πikh ab c 1 (L (a) )c 1 (L (b) ) c 1 (L 0 ) − n i=0 t i n i,(a) n i,(b) q i , (E. 16) with h ab the Killing form. In the next subsection, we compare (E.16) to known results for lens spaces. This already provides a non-trivial consistency check.

F. Seifert operators from holomorphic blocks
In this appendix, we complete the proof of (9.71) and (9.79). This gives the relation between the holomorphic blocks and the Seifert fibering operators, as discussed in detail in Section 9.

F.1 Proof for the trivial gluing
We start by considering (9.71), which reads: This corresponds to the case of trivial gluing.
Trivial gluing for the ungauged blocks. We start by proving the relation (F.1) on the building blocks of the ungauged theory. The proof for the chiral multiplet was given in the main text in the case of zero flux. To incorporate flux, we simply note that: with q = e 2πiτ , y = e 2πi(ν+ ν R r) , and (y; q) n defined as in (4.67), namely: reproducing the ordinary flux operator. Thus, the extra contribution from the fractional fluxes n 1 and n 2 of the two blocks is simply Π Φ (ν) n 1 +n 2 = Π Φ (ν) m F , as in (F.1). Consider next the Chern-Simons contributions (9.22) and (9.25), which read: The gravitational CS term does not contribute directly to the handle-gluing operator, therefore it should drop out in the limit above. As we already mentioned, we have: B grav (−τ )B grav (τ ) = 1 (F. 6) for any τ , and in particular in the limit (F.1). For the U (1) CS term, we similarly have: B GG (ν, −τ ) n 1 B GG (ν, τ ) n 2 = (− y) m F , (F.7) as expected. This simply follows from the relation (9.26) for a pair of massive chiral multiplets. We should also note that fusing the Cartan contribution (9.27) gives: This factor should be compensated by the measure factor in the integral formula (9.59).
Thus, up to this last subtlelty, we find that (F.1) indeed holds true for the ungauged blocks. More generaly, for any "ungauged" theory, we have the following expansion at small τ : Here, W(ν) is the twisted superpotential and Ω(ν) is the effective dilaton. When we glue two blocks with opposite orientations, as in (F.1), the divergences cancel out, and we indeed recover (F.1), with Π = e 2πi∂ν W the flux operator and H = e 2πiΩ the handle-gluing operator for the ungauged theory.
Trivial gluing for the gauged blocks. Let us now consider the blocks of the gauged theory. Let us first note the following limit, for real x and Im(τ ) > 0 [125]: (q x ; q) ∞ → τ →0 exp − πi 12τ +( 1 2 −x) log(−iτ )+(1−x) log(2π)−log Γ(x)+O(τ ) . (F.10) In particular, we have: which gives the limit for B Cart (τ ). The divergence in τ − 1 2 will be important below. As shown in [17], the holomorphic blocks of the gauge theories are obtained by integrating the holomorphic block B of the ungauged theory over certain contours, Γ α , in the u-plane, which are in one-to-one correspondence with the Bethe vacua,û α of the theory: B α (ν, τ ) = Γ α duB(u, ν, τ ) . (F.12) Here and below we work in the rank-one case, for simplicity. The contour Γ α is determined by the following conditions:  Figure 2: On the left, the contour Γ α is shown for finite τ , with towers of poles separated by τ . As τ becomes small, the contributions fromû and its images are dominant, shown in red. On the right, we take the τ → 0 limit, where we may approximate the answer by the contribution from u =û. Here the towers of poles have collapsed to form the branch cuts of W(u).
• It passes through the pointû α , which is a critical point of the twisted superpotential, W(u), and near this point the contour follows the path of steepest descent of W(u).
• It is invariant under the shifts u → u + τ .
• It does not cross lines of poles.
A cartoon of the contour Γ α is shown in Figure 2(a), and we consider the contribution near a single Bethe vacua,û. In the limit τ → 0, the dominant contribution comes from the neighborhood of the critical point,û α , as in Figure 2(b), and we may write: 90 whereû α is the αth solution to the Bethe equation in the region 0 < Re(u) < 1. Here we have used the observation (F.9), and included the extra divergence due to B Cart (τ ), 90 Here and in the following, we omit the background fluxes for flavor symmetries, to avoid clutter. It is straightforward to include them, using (F.9). as in (F.11). The saddle-point approximation at the saddle u =û α becomes exact in this limit. The τ −1/2 prefactor in (F.13) cancels, leaving us with: τ W(u α , ν) − πiΩ(u α , ν) . (F.14) A similar argument holds for the block with τ → −τ . Then, when we fuse these blocks as in (F.1), we see that the divergences in τ cancel out, and we find the finite result: as claimed. The case of a higher-rank gauge group is a staightforward generalization, by the same saddle-point argument, with the handle-gluing operator given by: 16) in the general case. This concludes the proof of (F.1).

F.2 Fibering-operator limit of the holomorphic block
We now turn to the proof of the limit (9.79), namely: Recall that B g (ν, τ ) n is defined in (9.78).
The proof for the Chern-Simons contribution can be shown using the behavior of the Jacobi theta function under modular transformations, or more simply from their relation to two chiral multiplets of opposite charges, as noted above. The contribution from the vector multiplets and gravitational CS term can also be worked out straightforwardly. It is interesting to consider the Cartan component contribution in detail. Consider the modular transformation properties of the Dedekind eta function: 92 η sτ − t pτ + q = e −πi( p q −s(p,q)) e πi 12 ( s p − 1 pq ) √ pτ + q η(τ ) . (F.21) Using the fact that η(τ ) = q −1/24 (q; q) ∞ , we find: q,p defined as in (4.53).
(F. 28) This expression for the "on-shell" gauged (q, p) fibering operator, including the sum over fractional fluxes, agrees nicely with the discussion in Section 4. This completes the proof of (F.17).