't Hooft anomalies and the holomorphy of supersymmetric partition functions

We study the dependence of supersymmetric partition functions on continuous parameters for the flavor symmetry group, $G_F$, for 2d $\mathcal{N} = (0,2)$ and 4d $\mathcal{N}=1$ supersymmetric quantum field theories. In any diffeomorphism-invariant scheme and in the presence of $G_F$ 't Hooft anomalies, the supersymmetric Ward identities imply that the partition function has a non-holomorphic dependence on the flavor parameters. We show this explicitly for the 2d torus partition function, $Z_{T^2}$, and for a large class of 4d partition functions on half-BPS four-manifolds, $Z_{\mathcal{M}_4}$---in particular, for $\mathcal{M}_4=S^3 \times S^1$ and $\mathcal{M}_4=\Sigma_g \times T^2$. We propose a new expression for $Z_{\mathcal{M}_{d-1} \times S^1}$, which differs from earlier holomorphic results by the introduction of a non-holomorphic ``Casimir'' pre-factor. The latter is fixed by studying the ``high temperature'' limit of the partition function. Our proposal agrees with the supersymmetric Ward identities, and with explicit calculations of the absolute value of the partition function using a gauge-invariant zeta-function regularization.


Introduction
In this paper, we explore intriguing properties of supersymmetric partition functions in even space-time dimensions. 1 In two dimensions, we consider the T 2 partition function of 2d N = (0, 2) supersymmetric theories, or elliptic genus [2]. In four dimensions, we consider the S 3 × S 1 supersymmetric partition function, which computes the N = 1 supersymmetric index [3,4]. 2 In both cases, the partition functions depend non-trivially on some continuous parameters: Here, there is one "flavor parameter," ν, for each U(1) current, with α U(1) α the maximal torus of the flavor (non-R) symmetry group, G F , of the field theory. The parameter τ , on the other hand, denotes a "geometric parameter," corresponding to the complex structure modulus of the torus in 2d, or to a complex structure modulus on S 3 × S 1 seen as a Hopf surface [6]. This setup preserves two supercharges of opposite R-charges, Q and Q. Through a number of explicit computations-see in particular [7,8,9,10,11]-, it was found that these supersymmetric partition functions are locally holomorphic in the complex parameters ν and τ . Moreover, there is a simple a-priori argument for the holomorphy of (1.1), which is that the anti-holomorphic parameters,ν and τ , couple to Q-exact operators in conserved-current supermultiplets [6].
The holomorphy of (1.1) in the flavor parameters ν, however, clashes with gauge invariance whenever the flavor symmetry, G F , has non-vanishing 't Hooft anomalies. To see why, consider the effective action for the quantum field theory coupled to a background gauge field for the flavor symmetry: where the ellipsis denotes additional couplings designed to make the full classical action gauge-invariant. A 't Hooft anomaly is a violation of the gauge invariance of the effective action (1.2) which cannot be removed by a local counterterm. 3 Under a gauge transformation δ α a µ = D µ α, with α = α(x) a gauge parameter, it takes the form: on any d-manifold M d (with d even), where the real d-form ω d (a) is local in the background gauge field. The form ω d is universal and well-known, in any dimension and for any compact Lie group G F . The coefficient A F ∈ Z in (1.3) depends on the particular theory; in UV-free theories, it is determined by the flavor charges of the chiral fermions. The crucial aspect of (1.3), for our purpose, is that it is purely imaginary, given a real background gauge field a µ . Therefore, the absolute value of the partition function, |Z|, is gauge invariant, as in the well-known case of free fermions. In fact, we expect |Z| to be invariant under both small and large gauge transformations, provided we work in a scheme that respects the consistent anomaly equation (1.3).
(This expectation will also be borne out by explicit computations.) On the other hand, the absolute value of a supersymmetric partition function that would be truly holomorphic in the flavor parameters cannot be fully gauge invariant and consistent with (1.3). Consider, for instance, the supersymmetric partition function on S 3 × S 1 . It depends on the background U(1) gauge field through two real parameters, which we denote by a t and a ψ . They correspond to holonomies of the gauge field through the S 1 factor and through an S 1 Hopf fiber γ inside S 3 , respectively: (1.4) The complex flavor parameter ν is defined in terms of these real parameters as: The parameter a t is only defined modulo the identification a t ∼ a t − 1 (equivalently, ν ∼ ν + 1), which corresponds to a large gauge transformation along the S 1 . Under it, the S 3 × S 1 partition function computed in [10] transforms as: 4 where A qqq and A q are U(1) 't Hooft anomalies (cubic and mixed U(1)-gravitational, respectively). Since the whole object I S 3 ×S 1 (ν, τ ) is holomorphic in ν, its absolute value is clearly not-and could not be-gauge invariant under the large gauge transformation ν ∼ ν + 1.
A completely analogous puzzle arises in the simpler case of the torus partition function, Z T 2 (ν, τ ), of a 2d N = (0, 2) gauge theory. The explicit localization result of [7,8] transforms non-trivially under the large gauge transformations ν ∼ ν + 1 and ν ∼ ν + τ , and its absolute value is not gauge invariant. It is also interesting to study modular transformations of the torus; we expect the absolute value of the partition function to be modular invariant, which is not the case of the explicitly holomorphic answer for the elliptic genus.
The holomorphy of supersymmetric partition functions in the flavor parameters follow from a supersymmetric Ward identity [6,13], as already mentioned. We have: schematically. Here, the operator J , which happens to be the supersymmetry variation of a fermionic operator j, is the component of the conserved current j µ that couples to the anti-holomorphic parameterν. In that last equality, we then use the fact that the expectation value of any Q-exact operator vanishes. Thus, we seem to have a tension between: (i) Gauge invariance of the absolute value of the supersymmetric partition function Z M d , whenever the flavor symmetry has 't Hooft anomalies; then, Z M d should be compatible with the anomalous G F gauge variation (1.3).
(ii) Holomorphy of the supersymmetric partition function in the flavor parameters, which follows from supersymmetry according to (1.7).
In this paper, we resolve this apparent contradiction. The resolution is based on the fact that, whenever we insist on working in a diffeormorphism-invariant scheme, 5 the G F 't Hooft anomalies induce specific quantum corrections to the supersymmetric Ward identities, which are determined by the Wess-Zumino consistency conditions. As a consequence, the relation (1.7) is modified, and the partition function acquires a non-holomorphic dependence on the flavor parameters, that is precisely as required to make its absolute value gauge-invariant. These quantum corrections to supersymmetric Ward identities were studied long ago in [14,15], and more recently in [16,17,18,19,20,21,22]. In all these references, they were called "supersymmetry anomalies," because the modified supersymmetric Ward identities can be written in the form: where δ ζ denotes a supersymmetry variation in the Wess-Zumino (WZ) gauge [23] for the background vector multiplet. The expression (1.8) requires some explaining, however. First of all, there is no genuine "supersymmetry anomaly" with a new anomaly coefficient-the non-vanishing value of δ ζ W is entirely determined by the bosonic 't Hooft anomalies for the flavor currents. Secondly, the anomalous supersymmetry variation (1.8) is entirely a consequence of working in the Wess-Zumino gauge. Recall that, in the WZ gauge, the supersymmetry transformations themselves depend on the background gauge field, because they are defined as the "bare" supersymmetry transformation, δ ζ , plus a compensating gauge transformation, δ Ω(ζ) , namely: (1.9) Here, δ Ω(ζ) is a specific supersymmetric gauge transformation whose chiral-multipletvalued gauge parameter, Ω(ζ), depends explicitly on a µ . In this language, the supersymmetry variation (1.8) follows from: as we will explain in detail-this makes it completely obvious that (1.8) is a straightforward consequence of the ordinary 't Hooft anomaly in the presence of supersymmetry. For these reasons, we simply refer to the relation (1.8) as the supersymmetry variation of the effective action, with the understanding that this formulation is specific to the WZ gauge, in which we are working throughout. Of course, our physical conclusions below must be the same in any gauge; it is merely convenient to fix the WZ gauge from the start, as usually done in the discussion of supersymmetric partition functions. In general, the supersymmetric Ward identity (1.8) receives contributions from both the "flavor sector" and the "geometric sector" (in particular, from the U(1) R symmetry 't Hooft anomalies). The background gauge fields for the former sector sit in vector multiplets, while the background fields for the latter (including the U(1) R gauge field) are part of a supergravity multiplet. 6 In this work, for simplicity, we focus on the flavor sector and on the consequences of the flavor 't Hooft anomalies.

't Hooft anomalies and supersymmetry
Let us then study supersymmetric partition functions with backgrounds vector multiplets in the Wess-Zumino (WZ) gauge [23]. Any background vector multiplet, V F , has components: V F = (a µ , λ , λ , D) , (1.11) in WZ gauge (in 2d or 4d), with λ, λ the gauginos. Then, the supersymmetry variation (1.8) of the effective action takes the schematic form: √ g ζΨ(λ, λ, a) , (1.12) where ζ is a supersymmetry parameter of R-charge ±1 and dimension − 1 2 , and the coefficient, A F , is the same 't Hooft anomaly coefficient that appears in (1.3). The local function Ψ(λ, λ, a) in (1.12) must be fermionic and of engineering dimension d + 1 2 ; in particular, it is at least linear in the gauginos (it is quadratic in the vector multiplet in 2d, and cubic in 4d). This term was first computed long ago [14,15], while a systematic analysis in 4d N = 1 theories was recently carried out in [22].
In the WZ gauge for V F , the existence of the anomalous supersymmetry variation (1.12) is implied by the Wess-Zumino consistency conditions for the anomalies [14]: (1.13) Since the supersymmetry variation of the gauge anomaly (1.3) is non-trivial: 14) it follows that δ α (δ ζ W ) = 0, therefore δ ζ W itself must be non-zero. Alternatively, one can simply compute (1.12) by fixing the WZ gauge, as in (1.10). We then study δ ζ W on a fixed geometric background-more precisely, a fixed supergravity backgroundà la Festuccia-Seiberg [24]. We will consider the torus in 2d, and half-BPS four-manifolds M 4 in 4d [25,26]. For instance, for 4d N = 1 theories, the cubic 't Hooft anomaly: for a U(1) flavor symmetry, with f = da the field strength of the background gauge field a µ and A qqq ∈ Z the cubic anomaly coefficient, implies: 16) which happens to take the same form as in flat space [14].
The "gauge-invariant," non-holomorphic partition function In this work, we distinguish between two distinct expressions for the supersymmetric partition function on M d : (i) The "gauge-invariant partition function," which we will generally simply call "the partition function," and denote by Z(ν, τ ). Here, by "gauge-invariant," we mean that |Z(ν, τ )| 2 is completely gauge invariant. This partition function is computed in a diff-invariant scheme compatible with the 't Hooft anomaly (1.3).
(ii) The "holomorphic partition function," which is the one studied so far in the literature. We denote it by I(ν, τ ), to distinguish it from Z(ν, τ ). It is implicitly computed in a scheme that violates gauge and diffeomorphism invariance.
In all the examples we will consider, the supersymmetric background is of the form M d ∼ = M d−1 × S 1 , and the supersymmetric partition function can then be computed as an index, by canonical quantization on M d−1 . In 4d, the holomorphic partition function I M 3 ×S 1 can be understood as a generalized 4d N = 1 index, as discussed e.g. in [27,11,28,5] for a large class of geometries. For the S 3 × S 1 partition function, we have the holomorphic result: Here, I S 3 (ν, τ ) is the ordinary N = 1 supersymmetric index [3,4], and the function E(ν, τ ) in (1.17) is the supersymmetric Casimir energy [10,29,30]: The non-trivial large-gauge transformation in (1.6) comes entirely from the latter. 7 We should compare this result to the expected properties of the "gauge invariant" partition function. Working in a diff-invariant scheme, we have an anomalous supersymmetry variation (1.12), which leads to an anomaly in the decoupling of some Q-exact operators [16]. Indeed, consider the naive Ward identity (1.7). The fermionic operator j is precisely the operator that couples to the gaugino λ in the background vector multiplet. Then, in the presence of any non-trivial contribution to δ ζ W , we have: 19) schematically. This "holomorphy anomaly" equation determines the non-holomorphic dependence of the partition function on the flavor parameters ν,ν. For instance, for the S 3 × S 1 partition function, the contribution (1.16) from the cubic U(1) anomaly to δ ζ W implies: We should then revisit the supersymmetric localization computation of the S 3 × S 1 partition function for N = 1 gauge theories [10] in light of the supersymmetric Ward identity (1.20).
Importantly, the above discussion does not invalidate the localization argument in any way-it is still true that one can localize supersymmetric gauge theories and compute at the weakly-coupled UV fixed point. 8 The only subtle point is that various one-loop determinants have to be computed carefully, with appropriate regulators, depending on which scheme we decide to work in. To compute the partition function Z(ν, τ ), we must work in a scheme consistent with the anomalous variations (1.15) and (1.16), and with diff-invariance. We then obtain results for the one-loop determinants that differ from the fully holomorphic results obtained in [9,10]. The non-holomorphic dependence is determined by (1.20).
We show that the absolute value squared of the supersymmetric partition function Z S 3 ×S 1 takes the explicit form: with I S 3 the ordinary letter-counting index, and a ψ related to ν as in (1.5). This is to be compared with the expression (1.17) for the holomorphic partition function I S 3 ×S 1 (ν, τ ). Note that the result (1.21) does not admit an "holomorphic square root," therefore the supersymmetric partition function Z S 3 ×S 1 (ν, τ ) cannot be holomorphic. The expression (1.21) is completely gauge-invariant, by construction. Similar formulae hold for other supersymmetric partition functions. While the result (1.21) determines the absolute value of the "gauge-invariant" partition function, we will further argue that the phase is also fully determined, thanks to supersymmetry, essentially because the anomalous Ward identity (1.20) relates the real and imaginary parts of the supersymmetric effective action.

The small-β limit of supersymmetric partition functions
We also obtain new general constraints on supersymmetric partition functions in the case of any half-BPS manifold M d = M d−1 × S 1 (for d = 2, this is the elliptic genus; for d = 4 we have a generalized index on M 3 ). 9 In that context, we consider the "high-temperature limit," sending the circle radius β to zero, up to order β in the small-β expansion: Crucially, the effective action is expected to be local in the background gauge fields, at each order in β, essentially because the d-dimensional theory compactified on the S 1 (and with appropriate chemical potentials) is generically gapped [31,32]. The term of order 1/β gives the Cardy-like contribution discussed in [32], 10 while the finite term essentially gives the partition function of the dimensionally-reduced (d − 1)dimensional theory on M d−1 -see e.g. [38,39]. We will study in detail the order-β term, W d−1 . That term must reproduce all the consistent flavor anomalies (1.3) of the d-dimensional theory, as well as their consequences (1.12), because the anomalies themselves are local d-dimensional functionals, and therefore only contribute at order β [31].
There indeed exists (d − 1)-dimensional local terms that reproduce the dimensional reduction of the flavor 't Hooft anomalies, and are consistent with supersymmetry. For instance, in 4d N = 1 theories on M 3 × S 1 , the cubic 't Hooft anomaly (1.15), together with the supersymmetry variation (1.16), uniquely determine the 3d local term: Here, the fields (σ, A µ , λ, λ, D) are part of a 3d N = 2 vector multiplet (which descends from the 4d N = 1 vector multiplet), and V µ and H are background supergravity fields necessary to preserve supersymmetry [40]. Analogous 3d local terms are necessary to match any other 't Hooft anomalies. Plugging the supersymmetric values for the background supergravity and vector multiplet fields into (1.23)-and its analogues for other 't Hooft anomalies-, we determine a priori the form of the supersymmetric partition function Z M 3 ×S 1 at order β. The result agrees with our explicit computation of the absolute value of the supersymmetric partition function, and also agrees-as it should, by constructionwith the anomalous Ward identity (1.20).
These considerations lead us to propose a general formula for the supersymmetric partition function Z M d−1 ×S 1 (ν, τ ), which is fully consistent with gauge invariance and supersymmetry. This is based on the observation, true in a number of examples, that the holomorphic partition function I M d−1 ×S 1 (ν, τ ), does not have any order-β term in its small-β expansion-for the S 3 index, this was proven in [41]. Then, we propose that the "gauge-invariant" supersymmetric partition function, compatible with all anomalous Ward identities, takes the form: Here, W Note also that, if we interpret the 3d local term βW (1) d−1 (ν,ν, τ ) as a 4d local term, by a trivial uplift which breaks 4d diff invariance explicitly, one can view the relation (1.24) as a change of scheme from the holomorphic to the "gauge invariant" form of the supersymmetric partition function. As expected, the holomorphic partition function corresponds to a scheme that breaks diff-invariance explicitly. We shall leave a more systematic understanding of the allowed counterterms for future work.

Outlook and summary
In this paper, we focussed our attention on general constraints on supersymmetric partition functions in the presence of 't Hooft anomalies for the flavor symmetry, for 2d N = (0, 2) and 4d N = 1 supersymmetric theories with an R-symmetry, U(1) R . This clarifies important aspects of the dependence of these partition functions on the flavor parameters.
Supersymmetric partition functions can also depend non-trivially on geometric parameters-in particular, on the modular parameter τ discussed in this paper, but also on more subtle geometric data. It was first pointed out in [16] that the 't Hooft anomalies for the U(1) R symmetry-and, more generally, 't Hooft anomalies in the "gravity sector"-can introduce an anomalous dependence of the partition function on the geometry. This interesting problem, which goes back to [42], can be addressed systematically by combining the approach of this paper with the general solution to the WZ consistency conditions for the R-multiplet given recently in [22]. We hope to address it in the near future. It would also be interesting to generalize this work to include 6d N = (1, 0) theories, and to discuss theories in 2d and 4d with higher supersymmetry.
Finally, let us mention that the non-holomorphy of partition functions in the flavor parameters, as discussed here, is distinct from (and much simpler than) several other examples of holomorphic anomalies in the literature, such as the holomorphic anomaly of the topological string partition function [43], or of the elliptic genus of theories with continuous spectra [44,45], or else in Donaldson-Witten theory [46]. In our case, the non-holomorphic term appears entirely as a "supersymmetric Casimirenergy term," and not as part of the "spectrum;" the interpretation being that it essentially corresponds to a choice of scheme. In all cases, however, it is expected that the non-decoupling of the relevant Q-exact operators can be understood as a boundary term in the path integral; it would be interesting to understand our results in that language. This paper is organized as follows. In section 2, we discuss the flavor 't Hooft anomaly in 2d N = (0, 2) supersymmetric theories, and its consequences for the T 2 partition function. In section 3, after reviewing some necessary formalism, we discuss the analogous problem for 4d N = 1 supersymmetric theories on a fixed half-BPS new-minimal supergravity background, and we consider the small-β expansion for theories on M 3 × S 1 . In section 4, we use those results to revisit the computation of supersymmetric partition functions on a large class of four-dimensional backgrounds called M g,p × S 1 , which include S 3 × S 1 as a special case. Additional computations and hopefully useful discussions are contained in several appendices.
2. 't Hooft anomalies and the 2d N = (0, 2) elliptic genus As an interesting warm-up to the four-dimensional case, let us study the partition function of a 2d N = (0, 2) supersymmetric theory on the torus, in the presence of flat connections for background gauge fields coupling to the flavor symmetry-this is also known as the flavored N = (0, 2) elliptic genus.

The free fermion and the Quillen anomaly
The simplest example of a two-dimensional N = (0, 2) supersymmetric theory is a free massless Fermi multiplet, which contains a single chiral fermion, λ − , of positive chirality. Consider the partition function on this free theory on a Riemann surface Σ, with a background gauge field a µ coupled to the U(1) global symmetry: The Dirac operator can be written as: with w some local complex coordinate. The naive formula for the partition function: seems to define a locally holomorphic function of the connection, i.e. it only depends on aw and not on a w . On the other hand, since the operator Dw flips the chirality, its determinant is ill-defined. The standard procedure is to consider det(D w Dw) instead. If the latter determinant factorized holomorphically-that is, if it were a product of a holomorphic times an anti-holomorphic factor-, one would naturally obtain a holomorphic definition of the original partition function, simply by taking the "holomorphic square-root" of det(D w Dw). However, an explicit calculation by means of a gauge-invariant regularization, such as Pauli-Villars or zeta-function regularization, reveals that [47]: where F is a holomorphic function, and q is the "Quillen counterterm:" schematically. Due to the prefactor e −q , the holomorphic factorization fails, and in particular the original partition function cannot be defined as a holomorphic function of the connection. This is known as Quillen's holomorphic anomaly. As we will see, it is also the simplest example of the non-trivial interplay between 't Hooft anomalies and supersymmetry. 11 A nice geometric interpretation of (2.4) was provided in [48]. The freedom in choosing the connection a µ can be parametrized by the space of flat connection on the Riemann surface, i.e. the Jacobian J(Σ). The latter is a 2g-dimensional torus for Σ a Riemann surface of genus g, and it inherits a complex structure from that of Σ. In the presence of a U(1) 't Hooft anomaly, the partition function of the chiral fermion is not a holomorphic function on J(Σ) but rather a section of a holomorphic line bundle over it: usually called the determinant line bundle [47]. The expression (2.4) is then interpreted as defining a Hermitian norm on L (known as the Quillen metric), and its failure to factorize is due to its curvature. The first Chern class c 1 (L ) is fixed precisely by the 't Hooft anomaly coefficient.
The case Σ = T 2 . In anticipation to the discussion of the elliptic genus, let us consider more explicitly the case of a chiral fermion on a torus. We choose coordinates x ∼ x + 2π and y ∼ y + 2π, with the complex coordinate: for some fixed complex structure modulus τ . The metric on the torus reads: In this case, the Jacobian is itself a torus, parametrized by the complex variable: ν ≡ a x τ − a y = 2iτ 2 aw , (2.9) subject to the identifications: under large gauge transformations. In Appendix C.1, for review the calculation of the determinant det(D w Dw) via zeta-function regularization. From that calculation, we obtain the following result for the partition function of a chiral fermion: where the coefficient of proportionality is a phase factor (possibly a function of the real parameters a x , a y , τ 1 , τ 2 ). Here, θ 0 (ν; τ ) is the "reduced" theta-function; its definition and properties can be found in Appendix B. The theta-function is an holomorphic section of the determinant line bundle on J(T 2 ), in agreement with the discussion above; in particular, it transforms non-trivially under large gauge transformations. The non-holomorphic prefactor in Z λ takes the form of a Casimir energy, being the dominant contribution in the limit τ 2 → ∞. By construction, the absolute value of the partition function, |Z λ |, is invariant under the large gauge transformations ν → ν + 1 and ν → ν + τ , in agreement with the requirement of gauge-invariance described in the introduction.

The elliptic genus and the torus partition function
Let us now consider a two-dimensional field theory with N = (0, 2) supersymmetry. We are interested in its elliptic genus, which may be defined as the supersymmetric index: Here, Q F denotes the generator of a U(1) global symmetry, and y is the associated fugacity-more generally, one introduces one fugacity y α for each U(1) α in the maximal torus of the global symmetry group G F . The elliptic genus can also be understood as the supersymmetric partition function on T 2 with complex structure modulus τ , as in (2.7). The chemical potential ν corresponds to a flat background gauge field for the U(1) global symmetry, a µ dx µ = a w dw + awdw, with: with γ x and γ y the one-cycles along x and y, respectively. As we will review below, a simple argument shows that the derivatives with respect toν andτ are Q-exact and therefore the partition function Z T 2 (ν, τ ) is expected to be holomorphic in ν; a similar argument shows that it should be holomorphic in the geometric parameter τ , as well.
Explicit expression for 'Lagrangian' theories. The elliptic genus can easily be computed for free theories. For a free chiral multiplet Φ or for a free Fermi multiplet Λ, of charge q = 1 under the U(1) background gauge field, we have: , respectively. Here, θ(ν, τ ) is the ordinary Jacobi theta function-see Appendix B.
Thanks to supersymmetric localization, we also an have explicit expression for supersymmetric gauged linear σ-models (GLSM) [7,8,49]. Consider an N = (0, 2) vector multiplet for the gauge group G, coupled to chiral multiplets Φ i and Fermi multiplets Λ I in representations R i and R I of G, respectively. The localization formula for the elliptic genus takes the form: where the contour integral denotes the Jeffrey-Kirwan residue [50]. The integrand reads: The products over the indices i and I, on the first line, run over the chiral and Fermi multiplets, respectively. The fugacities associated to the gauge group are denoted by u a , and are integrated over; the flavor fugacities are denoted by ν. Here, ρ = (ρ a ) denote the weights of the representations R under the gauge symmetry. We will also uses indices α, β, . . . for the Cartan subalgebra h F of the flavor symmetry, so that e.g. ω(ν) = ω α ν α , with ω = (ω α ) a flavor weight and ν = (ν α ) ∈ (h F ) C . The second line in (2.16) is the contribution from the vector multiplet, with the product over the non-zero roots α of the gauge algebra g.
Behavior under large gauge transformations. It is instructive to consider the behavior of the elliptic genus under large gauge transformations for the flavor fugacities: (a x , a y ) ∼ (a x − m, a y + n) ⇔ ν ∼ ν + n + mτ , (2.17) for any n, m ∈ Z. For instance, for a free Fermi multiplet of charge q ∈ Z under the U(1) flavor symmetry, we have: The behavior under large gauge transformations is governed by A qq = q 2 , the 't Hooft anomaly coefficient for a free Fermi multiplet. More generally, for any GLSM, we have the quadratic U(1) α 't Hooft anomaly coefficients: where the integers ω α i and ω α I denotes the U(1) α flavor charges of the chiral and Fermi multiplets, respectively. In a well-defined GLSM, all the gauge and gaugeflavor anomalies should vanish: This implies that the integrand (2.16) is single-valued under u ∼ u + 1 ∼ u + τ . Under an arbitrary large gauge transformation: for the flavor parameters, the elliptic genus transforms as: 12 where we sum over repeated indices. The fact that the behavior under large gauge transformations is governed by the 't Hooft anomalies can be understood on general ground; we discuss some aspects of this in Appendix D.1.
Holomorphy versus gauge invariance. As emphasized in the introduction, the transformation property (2.22) is somewhat puzzling when I(ν, τ ) is viewed as a partition function on T 2 , because the real part of log I transforms non-trivially under large gauge transformations. On the other hand, we expect that there exists a scheme in which the absolute value of the partition function, Z T 2 (ν, τ ), is fully gauge invariant: Consider again a free Fermi multiplet of unit charge. According to (2.11), we have: More generally, we will argue that: 25) for any N = (0, 2) supersymmetric theory, with W 1d a function to be determined below. Note that W 1d cannot be holomorphic in ν if (2.23) holds true. In the case 12 Here we also introduced the "linear anomaly" coefficient: which governs the sign on the right-hand-side of (2.22). This sign is a more subtle effect, related to the parity anomaly in 1d, which we will not discuss in this paper.
of a GLSM, it is easy to check that imposing (2.23) a priori completely determines the real part of W 1d to be: 13 Re W 1d (ν,ν, τ,τ ) = πτ 2 A αβ a x,α a x,β , (2.26) up to a pure constant. The explicit result (2.24) is a special case of the relation (2.26). We see that gauge invariance imposes that the T 2 partition function is not fully holomorphic in the flavor parameter ν (and possibly in τ , as well). Naively, this is in contradiction with supersymmetry. As we will review below, the anti-holomorphic parameterν couples to a Q-exact operator, and therefore we would expect to have: as a supersymmetric Ward identity. The presence of a non-trivial quantum correction to the supersymmetric Ward identity [15] resolves this puzzle, as we explain in the next subsection.
Behavior under modular transformations. Let us also briefly discuss the behavior of the elliptic genus under large diffeomorphisms of the torus, which span the modular group SL(2, Z). Let k g denote the gravitational anomaly coefficient, defined as: for a GLSM. Using the properties of the θ-function summarized in Appendix B, one can check that: under the S and T generators of SL(2, Z), respectively. This behavior presents physical puzzles similar to the case of the behavior under large gauge transformations, and their resolutions will be similar.

Non-holomorphy of the supersymmetric partition function Z T 2
We will now derive the correction to (2.27) in the "gauge-invariant" scheme. To this end, we first review the structure of the conserved current (0, 2) multiplet, its coupling to a background vector multiplet, and the supersymmetry algebra in WZ gauge. Consider a 2d N = (0, 2) supersymmetric theory with G F = U(1), for simplicity. We can preserve the two supercharges, Q + and Q + , on the flat torus. Let us denote the supersymmetry variations by: where ζ − and ζ − are constant Weyl spinors, 14 which we take to be bosonic, so that the supersymmetry variations are fermionic.
Coupling to a background vector multiplet. The U(1) flavor symmetry current, j µ , sits in a 2d N = (0, 2) current multiplet, J , with component operators: where j + and j + are fermionic operators. Let us denote by (j w , jw) the components of j µ in complex coordinates; in particular, we have ∂ w jw + ∂wj w = 0. The N = (0, 2) supersymmetry variations of the current multiplet read: 15 (2.32) We couple the current multiplet to an abelian background vector multiplet in the Wess-Zumino (WZ) gauge, which consists of a gauge field a µ = (a w , aw) and its superpartners: Its supersymmetry variations read: where f µν = ∂ µ a ν − ∂ ν a µ is the field strength. The supersymmetry algebra in the WZ gauge takes the form: on any field Φ (q) of charge q under the U(1) flavor symmetry; note that it is gaugecovariant. We can also write the last anti-commutator as: The second term on the right-hand-side can be understood as an a µ -dependent gauge transformation, δ α . Then, (2.36) gives the supersymmetry algebra acting on any fields, including the gauge field itself (with δ α a µ = ∂ µ α).
The supersymmetric minimal coupling between the current and the background gauge field takes the form: (2.37) In particular, we can consider supersymmetric background values for V F , which are such that the gauginos λ − , λ − and their variations vanish-that is: 38) and the gauge field a µ must be flat. For future purpose, we will consider small variations (a µ , λ − , λ + , ∆D) around that locus, while keeping the gauge field flat. Then, using (2.38), one can write (2.37) as: Looking at (2.32), we see that a w couples to a δ ζ -exact operator, 16 which should not affect supersymmetric observables. This is why we expect the T 2 partition function to be holomorphic in the flat connection aw, which is related to the flavor parameter ν as in (2.9).
Supersymmetry variation of the effective action. Let W denote the effective action on the torus, in the presence of an arbitrary background vector multiplet: The U(1) symmetry generally suffers from a quadratic 't Hooft anomaly, with coefficient A qq = tr(γ 3 Q 2 F ), as in (2.19). Under a gauge transformation δ α a µ = ∂ µ α, the effective action must then transform as: where we used the form notation, with f ≡ da = 1 2 f µν dx µ ∧ dx ν . Since the gauge transformations commute with supersymmetry (in the WZ gauge), we should have: The supersymmetry variations of (2.41) give: (2.43) 16 One can write it as a δ ζ -exact term as well, by integration by part.
where we used (2.42) in the last equality, and similarly: This implies the presence of a non-zero supersymmetry variation, δ ζ W = 0 [15]. The equations (2.43)-(2.44) determine δ ζ W up to the addition of a gauge-invariant term.
To fix this ambiguity, we use the WZ condition coming from the anti-commutators (2.36) of two supersymmetry transformations, namely: 17 Taking into account this additional constraint, the supersymmetry variation of W is uniquely fixed to be: Let us now discuss how these supersymmetric Ward identities allow us to constrain the form of the partition function, Z T 2 (ν, τ ).
Holomorphy anomaly of Z T 2 (ν, τ ) in ν. On a flat torus, we can take the supersymmetric gauge field components (a w , aw) to be constant, in which case the flavor parameters are given by: An infinitesimal variation ofν then simply corresponds to an insertion of the component jw of the conserved current, which is itself Q-exact: Due to the non-trivial supersymmetry variations (2.46), the last expression in (2.48) does not vanish. Instead, since the operator j + couples to the gaugino λ − as in (2.39), we obtain: This gives us a simple anomalous Ward identity for the supersymmetric T 2 partition function: which entirely fixes its dependence on the anti-holomorphic parameterν-we must have: with Z holo (ν) a locally holomorphic function of ν. To relate Z holo (ν) to the holomorphic partition function I(ν) defined above, we will need additional information. We can already note, however, that if we had: then the expectation (2.25)-(2.26) would hold true, and the absolute value of the T 2 partition function Z T 2 would be properly gauge invariant. In the rest of this section, we will argue that (2.52) precisely holds.

The small-β
We can attain a complementary understanding of the non-holomorphy of the partition function by considering the reduction of the 2d N = (0, 2) theory to a onedimensional N = 2 supersymmetric theory (as studied e.g. in [51]) in the limit when we take one of the circle of T 2 to be very small. Using the metric (2.8), we consider β 1 → 0. This correspond to the limit: on the T 2 partition function. The basic idea is that, in this limit, all the anomalies should be reproduced by local terms in the sources of the dimensionally-reduced theory, because generically the effective one-dimensional theory will be gapped [31,32]. Upon evaluating these local terms, we find that they depend onν exactly as expected from (2.50). This procedure will also allow us to fix the entire ratio between Z T 2 and the holomorphic partition function, I T 2 , including the holomorphic term.
In the small-β 1 limit (2.53), we study the expansion of the effective action: as a functional of background vector multiplets. The divergent term, of order 1 β 1 , is proportional to the gravitational anomaly coefficient, k g ; the functional W (−1) 1d is supersymmetric and gauge-invariant. 18 The finite term, W 1d , is essentially the 1d index of the dimensionally reduced theory [51]. Here, we are interested in the term linear in β 1 . Let us define: (2.55) It is a local functional of a one-dimensional background vector multiplet, which is strongly constrained by the two-dimensional anomalies. This is because each of the two-dimensinal anomalies, being local, reduces to a term of order β 1 [31], which must then be exactly reproduced by the variation of the local functional W 1d .
Dimensional reduction and 1d N = 2 background vector multiplet. Let X µ = (x, y) denote the 2d coordinate, with y the 1d coordinate in the β 1 → 0 limit. The torus metric: is already in the "Kaluza-Klein" form, with ds 2 (S 1 ) = β 2 2 dy 2 the 1d metric and τ 1 dy a flat graviphoton. The two-dimensional gauge field, a µ , reduces to a one-dimensional gauge field A y and a real scalar σ, which are related to a µ by: (2.57) Here, for convenience, we introduced the one-dimensional coordinate y ≡ β 2 y, with y ∼ y + 2πβ 2 . The 1d vector multiplet consists of the fields: with the supersymmetry variations: This directly follows from (2.34).
One-dimensional local functional. The functional W 1d is constrained by the requirement that its gauge variation (under δ α A y = ∂ y α) should reproduces the dimensional reduction of the U(1) anomaly: It should also reproduce the 1d reduction of the supersymmetry variations (2.46), namely: This fixes W 1d to be: up to terms of dimension two that are gauge-invariant and supersymmetric. Such terms vanish on the supersymmetric locus (D = ∂ y σ = 0). We can therefore conclude that, in the limit (2.53), the order-β 1 term in the expansion of the T 2 supersymmetric partition function is fully determined by (2.62).

The supersymmetric T 2 partition function, revisited
Consider the elliptic genus of a GLSM, as given explicitly in (2.15)-(2.16). We can consider its small-β 1 limit explicitly. One finds: In other words, there is no order-β 1 contribution appearing in the small-β 1 expansion of the "holomorphic partition function." By contrast, the order-β 1 term in the expansion of the partition function Z T 2 is fully captured by (2.62), which evaluates to: 19 Of course, this satisfies the quantum Ward identity (2.50). Incidentally, we note that W 1d is holomorphic in τ when expressed in terms of the 2d variables a x and a y : Based on these considerations, we make a conjecture for the exact form of the "gauge invariant" supersymmetric T 2 partition function, for any 2d N = (0, 2) theory. It is simply given by: with I the elliptic genus, which is holomorphic in ν = τ a x − a y and τ = τ 1 + iτ 2 , and with the prefactor W 1d given by: By construction, this is fully consistent with gauge-invariance and supersymmetry, with the 't Hooft anomalies properly taken into account. Note that its real part is given by (2.26), as expected.
Large gauge transformations. Under large gauge transformations of the background gauge fields on T 2 : (a x,α , a y,α ) ∼ (a x,α + m α , a y,α − n α ) , n α , m α ∈ Z , (2.68) we obtain: to be compared with (2.22). In particular, the absolute value of Z T 2 is gauge invariant. This behavior agrees with general expectations for gauge anomalies on the torus. As explained in Appendix D.1, general considerations determine the behavior of any flavored T 2 partition function under large gauge transformations in terms of the 't Hooft anomaly coefficients, modulo various ambiguities that depend on the renormalization scheme. These general considerations are consistent with the explicit result (2.69).

Modular transformations.
One can also check that the partition function (2.66) transforms naturally under SL(2, Z). Using (2.29), one finds the simple result: for the T transformation, and: for the S transformation. We therefore see that the anomalous behavior of Z T 2 under large diffeomorphisms is determined by the gravitational anomaly only, as one would have naively expected on physical ground; when k g = 0, the supersymmetric partition function is modular invariant. This has to be contrasted with the behavior of the holomorphic elliptic genus under SL(2, Z), which is given by (2.29). In fact, we again find perfect agreement with general constraints on Z T 2 imposed by the anomalies, as explained in Appendix D.1.
Local counterterm and holomorphy. We have seen that the non-holomorphic dependence of the T 2 supersymmetric partition function is dictated by the 't Hooft anomalies, as in (2.50). Namely, we have: for an arbitrary abelian flavor symmetry, G F = α U(1) α , with 't Hooft anomaly coefficients A αβ qq . Given the explicit form of the superymmetric Ward identity (2.46), it is clear that one could cancel this anomaly-and, therefore, restore the holomorphy of the supersymmetric partition function in ν-by adding the following local term to the effective action: Thus, there certainly exists a scheme where the holomorphy in ν is manifest, corresponding to the partition function (2.52). 20 The counterterm (2.73) is not gauge invariant, however. Note also that, since: it follows from (2.45) that δ α(a) (W + W ct ) = 0. This does not mean that we have cancelled the gauge anomaly, however, only that this counterterm also cancelled the U(1) anomaly under a particular gauge transformation with parameter α = α(a).
In conclusion, the holomorphy of the T 2 supersymmetric partition function in ν can only be maintained, by adding the counterterm (2.73), at the cost of violating gauge invariance for background gauge fields. (Note that (2.73) violates explicitly the gauge-invariance of the real part of W .)

Anomalous supersymmetry variation from WZ gauge-fixing
As explained in the introduction, we can understand the anomalous supersymmetry variation, δ ζ W = 0, as a simple consequence of fixing the WZ gauge. Let us show this in more detail. Here, we will use a superspace notation, for convenience.
WZ gauge-fixing. The N = (0, 2) abelian background vector multiplet can be written in terms of two superfields: (2.75) The U(1) gauge symmetry, δ α a µ = ∂ µ α, can then be supersymmetrized by: where the gauge parameters sit in the chiral and anti-chiral superfields: (2.77) Using this larger gauge freedom, one can fix the WZ gauge: The WZ gauge (2.78) is not invariant under supersymmetry, because: Nonetheless, one can define consistent supersymmetry transformations, which we denote by δ ζ , δ ζ , by performing a compensating gauge transformation that restores the WZ gauge: Here, δ ζ, ζ is the "bare" supersymmetry transformation before gauge fixing, and δ Ω( ζ) , δ Ω(ζ) are compensating gauge transformations with field-dependent gauge parameters: respectively.
In other words, the U(1) 't Hooft anomaly is compatible with supersymmetry and there is no genuine "supersymmetry anomaly." Then, by its definition (2.80), the supersymmetry in the Wess-Zumino gauge does have an anomalous variation, namely: Plugging the values (2.81) inside (2.84), one finds: This indeed reproduces the anomalous supersymmetry variations (2.46).

't Hooft anomalies and 4d N = 1 partition functions
Let us now consider 4d N = 1 supersymmetric theories. In this section, after reviewing the curved-space rigid supersymmetry formalism [24,25] and the main result of [6] on the holomorphic dependence of supersymmetric partition functions on continuous parameters, we derive the supersymmetric Ward identities on a general half-BPS background. This determines the non-holomorphic dependence of the supersymmetric partition function, in our "gauge invariant" scheme for background gauge fields.
In the case of half-BPS four-manifolds of topology M 3 × S 1 , with S 1 a circle of radius β S 1 , we also discuss how the 't Hooft anomaly together with supersymmetry determine the order-β S 1 term in the small-β S 1 expansion of the partition function. Our four-dimensional conventions are summarized in Appendix A.1.

Curved-space supersymmetry for 4d N = 1 theories
Consider a four-dimensional N = 1 supersymmetric theory with a U(1) R symmetry. By assumption, there exists an R-multiplet, which contains the R-symmetry current j µ R together with the energy-momentum tensor T µν , and which can be consistently coupled to four-dimensional new-minimal supergravity [52]-see e.g. [53,54]. At the linearized level: We consider a curved-space rigid supersymmetric background on a compact fourmanifold M 4 , which can be obtained as a rigid limit of new-minimal supergravity, with the background fields: such that the gravitino and its supersymmetry variations vanish [24]: This means that there exists spinors ζ α and/or ζα on the Riemannian manifold (M 4 , g µν ) that satisfy the generalized Killing equations: The Killing spinors are globally defined and nowhere-vanishing. Their existence allows us to define curved-space rigid supersymmetries, with the supersymmetry variations on fields written as: where Q α and Qα denote the "curved-space supercharges" (one for each Killing spinor). Note that the Killing spinors are bosonic and of R-charge ±1 while the supercharges have R-charge ∓1, so that δ is a fermionic operation of vanishing Rcharge.

Complex structure and background supergravity fields
Given a Killing spinor ζ, the real bilinear tensor: defines an integrable complex structure on M 4 [26,25]. One can preserve a single supercharge on any Hermitian four-manifold. Given an Hermitian manifold, one can explicitly solve for ζ and for the remaining supergravity background fields: Here, for later reference, we defined: The expression for A c µ is only valid in complex coordinates adapted to the complex structure; the function s in (3.9) is a U(1) R gauge transformation parameter. We will use the notation X µ (µ = 1, · · · , 4) for the four-dimensional real coordinates, and: for the complex coordinates w, z on M 4 .

Half-BPS Hermitian geometry
In the following, our main interest will be in half-BPS supersymmetric backgrounds which preserve two Killing spinors of opposite chiralities, ζ and ζ. The second Killing spinor, ζ, defines a second complex structure: and a complex Killing vector: We will assume that K commutes with its complex conjugate, [K,K] = 0. Then, the background geometry admits two commuting complex structures, [J, J] = 0, and K is anti-holomorphic with respect to both: We choose the holomorphic coordinates (3.10) such that: with β 1 > 0 a real positive constant introduced for later convenience. The holomorphic coordinates adapted to the complex structure J are (w,z). The background geometry is locally a T 2 fibration, 22 and the Hermitian metric (with respect to J) can be written in the canonical form [25]: The factor Ω(z,z) is related to the norm of the Killing vector, and of the Killing spinors, as: For simplicity (and without much loss of generality), we will restrict ourselves to the case Ω = β 1 , so that |K| 2 = 2. The supergravity background fields V µ and A (R) µ are still given by (3.8), with the additional constraint: The parameter κ is part of the definition of the supersymmetric background, and it can be chosen arbitrarily. In the following, we will mostly be interested in the case of a product four-manifold M 4 ∼ = M 3 × S 1 , and we will require that the 4d N = 1 supersymmetric background admits a consistent reduction to a 3d N = 2 supersymmetric background on M 3 [40]. This will fix κ uniquely.
Topological-holomorphic twist. In the following adapted complex frame: 23 the Killing spinors take the particularly simple form: Let us define the projectors onto holomorphic vectors in either complex structure: 20) and similarly for the anti-holomorphic projectors: Since the two complex structure commute, we can project any vector X µ into its four components X w , Xw, X z , Xz, respectively, and similarly for any tensor. One can also define an adapted connection,∇, that preserves both complex structures: with Γ µ νρ the Levi-Civita connection, and: the contorsion tensor, with (dJ) µνρ ≡ ∇ µ J νρ + ∇ ν J ρµ + ∇ ρ J µν . 24 This connection has non-trivial torsion: In terms of the adapted connection, the Killing spinor equations take the simple form: . The connection∇ has a U(1) holonomy which can be "twisted" by the U(1) R gauge field. Whenever the orbits of K µ close, we have a proper elliptic fibration over a two-dimensional complex space Σ and the 4d N = 1 supersymmetric background is precisely the four-dimensional uplift of the topological A-twist on Σ [56,25]. The half-BPS supersymmetric background (3.8)-(3.15) can then be understood as a topological-holomorphic twist-that is, holomorphic along the fiber direction [13] (with coordinate w) and topological along the base (with coordinate z).

Background vector multiplet and minimal coupling
Consider an N = 1 theory with a flavor symmetry group G F , and let us introduce a background vector multiplet V F for that symmetry. Its component fields are: with λ, λ a "background" gaugino. Note again that we fixed the Wess-Zumino gauge for V F , and work only in terms of the remaining "physical" components (3.27). The supersymmetry variations in WZ gauge [23] are famously modified by including a compensating gauge transformation into the supersymmetry transformation, to preserve the WZ gauge. This implies that the supersymmetry algebra itself become gauge-covariant under G F . Let us then consider the background vector multiplet (3.27) in addition to the supersymmetric curved-space background on M 4 . Note that, while we require the supergravity background fields to be fixed to definite values so that (3.3) holds, as described above, we do not impose any requirement on V F at this point-we will need to consider arbitrary background values of the fields (3.27), including for the gaugino.
Given two Killing spinors ζ and ζ, we have two independent supersymmetries on M 4 , denoted by δ ζ and δ ζ , respectively, satisfying the following curved-space supersymmetry algebra [13]: on any field Φ (s,r) of spin s, R-charge r and arbitrary flavor charges. Here, L K denotes the Lie derivative along the Killing vector K µ , and the background gauge field a µ acts in the appropriate G F representation. The curved-space rigid supersymmetry transformations for the vector multiplet (3.27) are given by: in the WZ gauge. Here, we defined the field strength 30) and the covariant derivatives D µ are understood to be appropriately gauge covariant, including under U(1) R -for instance, Coupling to an abelian conserved current. Let us focus on the case of an abelian G F , for simplicity. In a supersymmetric theory, any U(1) conserved current operator j µ (with the conservation equation ∇ µ j µ = 0 on M 4 ), sits in a linear multiplet: The supersymmetry variations are: (3.32) We then have the supersymmetric minimal coupling: In the following, we will consider small variations of the background vector multiplet around a fixed value, V F , denoted by ∆V F : On any supersymmetric background M 4 , the first-order correction to the effective action upon a small change of the sources is captured by the expectation value of the minimal coupling (3.33).
Supersymmetric background. A supersymmetric background for the vector multiplet is a bosonic configuration (a µ , D) such that the gaugino and its variations vanish: On our half-BPS geometry, this corresponds to: We will consider real background gauge fields a µ on M g,p × S 1 , in which case the only non-vanishing gauge-field curvature component is f zz . The background gauge field is the connection of a holomorphic line bundle over M 4 [6], which we denote by L F .

M 3 × S 1 supersymmetric partition functions and holomorphy
Consider any 4d N = 1 supersymmetric theory with a U(1) R symmetry. Its supersymmetric partition function on M 4 , denoted by Z M 4 , is the path integral on a fixed supersymmetric background for the geometry and for the vector multiplet V F : Naively, the partition function may depend on all the background fields shown in (3.37). However, it was argued in [6] that, given an Hermitian four-manifold M 4 and a choice of flavor line bundle L F , the partition function Z M 4 only depends on two types of continuous complex parameters: Here, we have: 25 (i) the "geometric" parameters τ , which are complex structure moduli of the complex manifold M 4 ; (ii) the flavor parameters ν, which are holomorphic line bundle moduli of the line bundles L F . (That is, for abelian symmetries; they are holomorphic vector bundle moduli in general.) In particular, for any fixed complex structure on M 4 , the supersymmetric partition function is independent of the choice of Hermitian metric. Moreover, the partition function was found to be holomorphic in all of its continuous parameters: These results seemingly holds for any supersymmetric background (3.37) preserving at least one supercharge. For half-BPS geometries, we have further restrictions, and the theory becomes fully topological along the z,z directions [6]. These results were derived by a standard argument. Consider the effective action W [b], defined as minus the logarithm of the partition function in the presence of the supersymmetric background fields b n : and consider an infinitesimal variation: of the background fields b n around some particular supersymmetric value, b n , while keeping b n supersymmetric. Each independent variation ∆b n couples to a particular bosonic operator O n contained in the R-multiplet or in the linear multiplet J of the quantum field theory coupled to M 4 , so that: at first order in ∆b n . Whenever the insertion is Q-exact: for ψ n some fermionic operator, the expression (3.42) vanishes and the partition function is independent of that particular parameter b n . This result relies on the fact that the expectation value of any Q-exact operator vanishes: As in 2d, the existence of flavor 't Hooft anomalies will amend this simple picture, and imply an anomalous dependence of the partition function on some Q-exact couplings [14,22] .

Supersymmetry variation of the effective action
Let W = W [V F ] denote the effective action in the presence of arbitrary flavorsymmetry sources (3.27), including the background gauginos: on a fixed background M 4 ; we now consider G F = U(1), for simplicity. Since the theory is supersymmetric, we would expect that: under the supersymmetry transformations (3.29) of the background fields. This is inconsistent with U(1) gauge invariance and diff-invariance whenever the U(1) symmetry suffers from 't Hooft anomalies [14], in the following sense. Let δ α denote a gauge transformation with gauge parameter α, with: The consistent anomalous variation of the effective action takes the form: with: the U(1) field strength and the Pontryagin density, respectively, with R µνρλ the Riemann tensor of the metric g µν . The ellipsis in (3.48) denotes additional contributions from mixed U(1) R -U(1) anomalies, to be discussed in subsection 3.8 below. The cubic and mixed U(1)-gravitational 't Hooft anomalies coefficients are normalized such that A qqq = q 3 and A q = q for a single chiral fermion ψ α of charge q. In a Lagrangian theory, we have: where the trace is a sum over all the chiral fermions charged under U(1). The supersymmetry variations of the U(1) anomaly (3.48) are non-trivial. We have: and similarly for δ ζ (δ α W ). Since the supersymmetry and gauge transformations commute, we necessarily have δ α (δ ζ W ) = 0, and therefore there must be a non-trivial supersymmetry variation of the quantum effective action, δ ζ W = 0. More generally, the supersymmetry variations must satisfy the following Wess-Zumino consistency conditions [14,22]: Note the a µ -dependent gauge transformation on the second line, which is a consequence of working in the WZ gauge for the vector multiplet. The consistency conditions (3.52) determines the anomalous supersymmetry variations, δ ζ W and δ ζ W , on a fixed curved-space supersymmetric background. At this point, an important comment is in order. The curved-space supersymmetry algebra (3.28) takes the form: with δ ξ(K) a diffeomorphism along the Killing vector K. In four dimensions, we can always choose a scheme which preserves diffeomorphism invariance, and therefore δ ξ W = 0 for any ξ. This leads to the WZ conditions (3.52). The results of this paper are then only valid in such a diff-invariant scheme. The condition (3.52) has the important implication that, in any diff-invariant scheme, the variations δ ζ W and δζW cannot vanish, because their commutator gives a gauge-transformation, and the latter is non-zero in any scheme by the assumption that a flavor 't Hooft anomaly exists [16]. 26 26 Note, however, that this argument holds only when the background supergravity fields are allowed to vary arbitrarily. On a fixed half-BPS geometry-that is, for fixed Killing spinors-, there might well exist a diff-invariant local term that cancels δ ζ W , and therefore cancels the gauge anomaly for the particular gauge parameter a(α) in (3.52), as we discussed at the end of section 2.5. In any case, this appears not to be the case in 4d [14].
Let us decompose the supersymmetry variations into contributions from the cubic and linear flavor 't Hooft anomalies: where the ellipsis denotes the contribution from other potential anomalies, to be discussed later on. One finds: for the cubic-anomaly contribution. The term linear in the gaugino obviously follows from (3.51); the second term, which is gauge-invariant and cubic in the gaugino, is fixed by the second line of (3.52). This result was first obtained in flat space in [14], and much more recently on curved space but at first order in the gauginos in [22]; here we give the full expression valid on any curved-space N = 1 new-minimal rigid-supersymmetric background.
The mixed U(1)-gravitational anomaly contribution to δ ζ W is harder to study on a fixed supergravity background. On any half-BPS four-manifold, the Pontraygin density turns out to be a total derivative: with the vector P µ a local expression of dimension 3 in the supergravity fields [57]. Then, one can easily check that the following terms solve the Wess-Zumino consistency conditions: This solves (3.52), as one can see using (3.56) and the fact that P µ is invariant under the isometry K of the background. Note that the vector P µ is only defined up to a divergenceless quantities; to completely fix it, one should consider the full background new-minimal supergravity away from the rigid-supersymmetry limit. One actually finds [22]: on any half-BPS supersymmetric background. We will give another argument to that effect in section 3.9.

Non-holomorphy of the supersymmetric partition function Z M 4
Even though the supersymmetry variation (3.54) vanishes when we set the background gauginos to zero, it has some important consequence for supersymmetric partition functions, as we now explain.
On curved space with two Killing spinors ζ and ζ, it will be convenient to introduce the following twisted notations for the gauginos in the background vector multiplet: The minimal coupling (3.33) to the linear multiplet then reads: where we introduced the twisted fermionic operators: It follows from their definition that Λ and j are holomorphic one-forms and vectors, respectively, with respect to the complex structure J µ ν ; similarly, Λ and j are holomorphic with respect to J µ ν .
The case of a single Killing spinor ζ. Let us first look at the case of a single curved-space supercharge, with Killing spinor ζ. We consider small variations of the background gauge field near the supersymmetric locus: In particular, we allow a small variation ∆D of the background field D around its supersymmetric value. We also turn on background gauginos: 27 Then, the effective action W = W [a µ , λ α , Λ µ , ∆D] has a nilpotent supersymmetry: with δ ζ W determined by the 't Hooft anomalies as discussed above. Let us define the operator: in terms of the linear multiplet operators (3.31). It follows from (3.32) that: where Π µ ν is the projector on the holomorphic indices, as defined in (3.20). Using the complex coordinate indices X µ = (z i ,zī), we can write the minimal coupling as: (3.66) 27 When considering the effect of a single supercharge, we cannot use ζ to "twist" λ α into a oneform as in (3.58); instead, we could write it in terms of two scalars γ = ζλ and η = ζ † λ |ζ| 2 , but this will not be necessary for our discussion.
We see that the holomorphic gauge field components, a i , couple to a Q-exact operator. We have:

(3.67)
Assuming that Q-exact operators decouple, we would conclude that the partition function is independent of a i , and only depends on the background gauge field a µ through aī; in fact, one can then easily show that the dependence is only through the holomorphic moduli of the line bundle L F ; they are in one-to-one correspondence with the Dolbeault cohomology classes: Due to the quantum correction to the supersymmetric Ward identity, however, the right-hand-side of (3.67) does not vanish. Instead, since j i couples to Λ i as shown in (3.67), we have: .

(3.69)
This anomalous Ward identity gives rise to a holomorphy anomaly in the flavorparameter dependence of supersymmetric partition functions. Since the supersymmetry variation (3.55) has a term linear in Λ, the holomorphy anomaly (3.69) will generally be non-vanishing.
The case of a two Killing spinors, ζ and ζ. Consider now the case of a half-BPS background. We define the linear-multiplet operators: in addition to (3.64). We now have the relations: in terms of the projectors (3.20). This is equivalent to: Expanding around the supersymmetry locus (3.36), the linear coupling (3.59) reads: L VJ = a w J w + aw( Jw − κKw) + a z J z + azJz + J∆D + Λ w j w + Λ z j z + Λ w j w + Λz jz . In this case, only aw does not couple to a Q-exact operator, and therefore the partition function is expected to depend only on the corresponding line bundle modulus, which we denote by ν. Note also that the coupling a w J w in (3.73) is equivalent to a w J w by integration by part. We then find the anomalous Ward identities: . (3.74) In section 4, we will evaluate these identities explicitly, for a large class of half-BPS supersymmetric partition funtions.
3.6 The small-β S 1 limit of Z M 3 ×S 1 (ν, τ ) Whenever the four-dimensional background is of the form: it is interesting to consider the small-circle limit, β S 1 → 0, where β S 1 is the radius of the S 1 . Formally, this is a "high-temperature" limit of the supersymmetric partition function. At finite temperature-and also with supersymmetry-preserving boundary conditions on the Euclidean time circle, provided that generic fugacities are turned on-, it is expected that the effective action is local in the background gauge field and metric, order by order in β S 1 [31,32]. For any set of background fields b, we have: (3.76) The 1/β S 1 term was studied in [32]; it is fully gauge invariant and supersymmetric. The finite term W 3d roughly corresponds to the supersymmetric partition function of the 3d N = 2 theory on M 3 obtained from the 4d N = 1 theory by dimensional reduction, up to important subtleties that will not affect our discussion-see [58,59,60,39]. Here, we are interested in the order-β S 1 functional in (3.76). Let us introduce the notation: This term should capture all the anomalies of the four-dimensional theory, including the anomalous variation δ ζ W , which allows us to fix it entirely-modulo fully gaugeinvariant and supersymmetric terms, which do not contribute on the supersymmetric locus.

Dimensional reduction and 3d N = 2 supersymmetry
Before discussing the anomalies, we need to recall some formalism to deal with supersymmetry on M 3 . Here, we assume that the background is half-BPS, with two Killing spinors ζ and ζ.
3d N = 2 supergravity background fields. We couple the 4d N = 1 theory to a fixed N = 1 new-minimal supergravity background on M 3 × S 1 , and similarly the three-dimensional reduced theory couples to a 3d N = 2 supersymmetric background on M 3 , of the type studied in [40]. The three-dimensional bosonic supergravity fields are denoted by: The three-dimensional Killing spinor equations read: (3.79) Our conventions for the 3d γ-matrices are given in Appendix A.12. We choose the following Kaluza-Klein reduction ansatz for the metric: We will focus on the case of a topologically-trivial circle bundle over M 3 , in which case the graviphoton c µ is actually a well-defined one-form on M 3 . The threedimensional background field V µ should be given in terms of the 3d graviphoton, as: Let us also define the unit-norm one-form: Then, the 3d and 4d supergravity fields are related as [40]: where X µ and x µ denote the coordinates on M 4 and M 3 , respectively.
Transversely holomorphic structure (THF) on M 3 . The 4d Killing spinors descend to 3d Killing spinors. In terms of the latter, one can define the following real one-form on M 3 : with the last equality being a property of the half-BPS backgrounds under consideration [40]. We also define the three-dimensional tensor: These objects define a metric-compatible THF, which is obtained from the complex structure on M 4 by dimensional reduction. In the conventions of Appendix A.2, we have: The one-form η = η µ dx µ has unit norm and defines the foliation. The THF-adapted metric on M 3 takes the canonical form: with z,z the transverse holomorphic coordinates [40].
Dimensional reduction of the background gauge field. The 4d N = 1 vector multiplet reduces to a 3d N = 2 vector multiplet: 28 The three-dimensional gauge field A µ and scalar σ are related to the four-dimensional gauge field a µ by: The three-dimensional supersymmetry transformations on M 3 are given by: and: with F µν the field strength of A µ . Here, we again focus on the case of an abelian vector multiplet, for simplicity. On the supersymmetric locus, we have: Note also that the combination η µ A µ + iσ is invariant under supersymmetry. 28 The scalar D is defined with a shift with respect to its 4d counterpart, D 3d = D 4d − σH [40].

't Hooft anomalies and three-dimensional local functional
Let us now consider the reduction of the 4d anomalies to three dimensions. Since the 3d effective action should be local, in the small-β S 1 expansion, the 3d reduction of the anomalies should be the variation of a 3d local term of order β S 1 , which we denoted by W 3d in (3.77).
Reduction of the U(1) anomaly. Consider first the U(1) 't Hooft anomaly (3.48). Its three-dimensional reduction is given by: for the cubic anomaly, and: for the mixed U(1)-gravitational anomaly, formally. 29 On any four-manifold of the form M 3 ×S 1 , the Pontryagin density vanishes, and therefore so does (3.94), namely: Reduction of the supersymmetry variations. Similarly, the three-dimensional reduction of δ ζ W and δ ζ W is given by: for the cubic anomaly contribution (3.55), and by: for the mixed U(1)-gravitational anomaly contribution, according to (3.57). 29 Here, we defined the vector: with G µν the Einstein tensor of the three-dimensional metric, for M 4 a circle bundle over M 3 , with V µ defined as in (3.81). Then, the Pontryagin density of the 4d metric (3.80) can always be written as P = −∇ µ N µ . Whenever the S 1 is trivially fibered, P = 0.
Explicit formula for W 3d . As we explained, there should exist a three-dimensional local functional, W 3d , of the vector multiplet, in the fixed 3d N = 2 supergravity background on M 3 , such that: Up to any three-dimensional action that is gauge-invariant and supersymmetric under (3.90)-(3.91), the functional W 3d must take the form: 30 The mixed U(1)-gravitational anomaly contribution must vanish, W 3d | q = 0. By a straightforward computation, one can check that there is a unique possibility for the cubic-anomaly contribution, given by: (3.100) The first line in (3.100) is the flat-space answer, while the second line adds additional couplings to the curved-space supersymmetric background.

Generalization to any abelian flavor symmetry
The above discussion can be generalized straightfowardly to any abelian flavor group: (For a non-abelian G F , we focus on the maximal torus, which is what is generally done when discussing supersymmetric partition functions.) The G F anomaly can be obtained from the anomaly polynomial: by the descent relations, P 6 = dQ 5 and δ α Q 5 = d(αω 4 ). Then, the cubic 't Hooft anomaly reads: with α denoting an arbitrary abelian gauge parameter along (3.101), and with f α = da α for the background gauge fields a α,µ . The sum over repeated flavor indices will 30 Here we take only into account the contribution from the U (1) flavor anomaly. There can be additional contributions from mixed U (1)-U (1) R anomalies, which we will consider in section 3.8 below.
be left implicit, in the following. Note that the 't Hooft anomaly coefficient A αβγ qqq is fully symmetric in the three flavor indices α, β, γ.
The expression (3.103) is valid up to ambiguities that correspond to the gaugevariations of local terms-those, in turn, correspond to ambiguities in the descent relations. For instance, given two abelian symmetries U(1) α and U(1) β with α = β, we could always add the local term: 31 with s, t ∈ R some arbitrary coefficients. The addition of such counterterms to the effective action can "move around" the mixed anomalies; for instance, setting s = −2 and t = 1 would ensure that the variation δ αα W only depends on the gauge field a α , at the price of pushing all the mixed anomalies into δ α β W . Here and in the following, we always work in the "symmetric" scheme which treats all the U(1) α factors equally, in which case (3.103) holds. The supersymmetry variations (3.55) are then generalized similarly, in the fully symmetric scheme: 32 The 3d local term that reproduces the 3d reduction of the anomalies (3.103) and (3.105) takes the form: generalizing (3.100).

R-symmetry contributions to δ ζ W
Finally, we should discuss the effect of the R-symmetry background gauge field. Consider again the case G F = U(1), to avoid clutter. The anomalous U(1) variation of the effective action has contributions from mixed 't Hooft anomalies U(1) 2 -U(1) R and U(1)-U(1) 2 R , which read: 31 In this equation, there is no sum over repeated flavor indices. 32 Here, the indices α, β, · · · are flavor indices, while the spinor indices are left implicit. This is the contribution that was denoted by an ellipsis in (3.48). Here, f (R) = da (R) is the field strength of the U(1) R gauge field: The second term in (3.107) vanishes on the half-BPS background, because: in that case. The mixed 't Hooft anomalies (3.107) then contribute to right-hand-side of the supersymmetry variation of W as: and similarly for δ ζ W . Note again that, in this paper, we focus on the flavor anomaly on a fixed half-BPS background. The more general form of the mixed anomalies on arbitrary supergravity backgrounds, including the contributions from the gravitino, were recently discussed in [22].
4d U(1) R vector multiplet. An important property of the 4d N = 1 supergravity multiplet is that it contains an ordinary vector multiplet for the R-symmetry, V R , as a sub-multiplet of supersymmetry [61]. The gaugino λ (R) inside V R is a contraction of the gravitino Ψ µ . On the half-BPS background M 4 , with Ψ µ = δ ζ Ψ µ = δζΨ µ = 0, we are left with the bosonic fields: given in terms of the supergravity fields by (3.108), and: with R the four-dimensional Ricci scalar. One can verify that these combinations of background fields satisfy the conditions (3.36) for an half-BPS vector multiplet, namely: Note that the background gauge field a (R) µ is not real, unlike the background flavor gauge fields that we consider in this paper; supersymmetry generally imposes that a (R) µ be complex.
The U(1) R vector multiplet controls the R-charge dependence of supersymmetric partition functions [13]. Consider any mixing of the R-charge with abelian flavor symmetries U(1) α : with t α ∈ R some mixing parameters. The effect of this shift on the supersymmetric partition function, computed with background vector multiplets V F,α , is simply to shift the latter by the U(1) R vector multiplet itself: This allows us to treat the R-charge dependence systematically once we understand the "flavor sector." For instance, as a typical example of this approach, let us consider a free chiral multiplet. The mixed flavor-R 't Hooft anomaly coefficients for a chiral multiplet of U(1) charge q and R-charge r are: and therefore we can ignore the effect of those anomalies if we choose r = 1. Then, the general case can be obtained by starting from the "reference" R-charge R 0 with r = 1 and shifting the partition function of the free chiral to R = R 0 + (r − 1)Q using (3.115). Similarly, the anomalous variations (3.107)-(3.110) can be obtained from (3.103) and (3.105), simply by replacing one flavor index "α" by "R." This again corresponds to a fully symmetric scheme, treating a (R) µ and a α,µ on the same footing.
Dimensional reduction and 3d U(1) R vector multiplet. Finally, let us briefly discuss the 3d reduction of the U(1) R vector multiplet: Using (3.83) and (3.89), one can check that [13]: where R is the 3d Ricci scalar, which is related to the 4d Ricci by R = R + 1 2 V µ V µ . On any half-BPS background M 3 , we have the analogue of the condition (3.92) for a vector multiplet on its supersymmetric locus, namely: One can then find 3d local terms that reproduce the mixed U(1)-U(1) R 't Hooft anomalies and are consistent with supersymmetry, by an appropriate generalization of (3.100).

Anomalous supersymmetry variation from WZ gauge-fixing
As in 2d, we can understand the 4d "anomalous supersymmetry variation," δ ζ W = 0, as a direct consequence of the Wess-Zumino gauge-fixing procedure. This provides a conceptually and technically simpler derivation of those anomalous variations, and demonstrates that they are simple consequences of the ordinary 't Hooft anomalies, when working in the WZ gauge. For simplicity of presentation, in this subsection, let us work in flat-space, R 4 , so that we can use the 4d N = 1 superfield notation. (The generalization to rigid supersymmetry on M 4 is completely straigthforward.) This corresponds to the real superfield: (3.121) The gauge freedom of the gauge field, δ α a µ = ∂ µ α, is supersymmetrized to: with the gauge parameters valued in a pair of chiral and anti-chiral multiplets, Ω and Ω-in terms of superfields, we have: Let us define the gauge parameters α and γ by: In components, (3.122) is equivalent to: while λ, λ and D are gauge-invariant. Using this gauge-freedom, we can fix the so-called WZ gauge [23]: This leaves δ α V F as a residual U(1) gauge transformation. Obviously, the WZ gauge does not commute with supersymmetry. Nonetheless, one can define a consistent set of supersymmetry transformations by accompanying any "bare" supersymmetry transformation, denoted by δ (0) ζ or δ (0) ζ , with a gauge transformation to restore the WZ gauge: The compensating gauge transformations are given by specializing (3.125) to the field-dependent gauge parameters: (3.128) or: respectively. 33 't Hooft anomaly and supersymmetry. Let us first consider the cubic 't Hooft anomaly: Its supersymmetric completion takes the form [62]: possibly up to the δ Ω -variation of a local term. Here, we defined the standard fieldstrength chiral and anti-chiral multiplets: 34 Expanding in components, (3.131) gives: (3.133) 33 In flat space, ζ and ζ are arbitrary constant spinors. They become our non-trivial Killing spinors ζ and ζ on M 4 once we generalize this discussion to curved space. 34 With the usual definitions: D α = ∂ α + i(σ µ θ) α ∂ µ and Dα = − ∂α − i(θσ µ )α∂ µ .
Specializing to the WZ gauge, we see that (3.133) reproduces (3.131) up to the variation of a local term-namely, the cubic 't Hooft anomaly δ α W in (3.130) is given by: with the simple local term: The gauge variation of (3.135) in (3.134) cancels the second term on the first line of (3.133).
Anomalous supersymmetry variation in WZ gauge. Before fixing the Wess-Zumino gauge, the "bare" supersymmetry transformations are non-anomalous [63]: This is the statement that, the one hand, there is no genuine supersymmetry anomaly; and, on the other hand, the 't Hooft anomaly (3.131) does not contribute any quantum correction to (3.136). The latter statement directly follows from the WZ consistency condition: and the fact that (3.131) is supersymmetric, δ (0) ζ δ Ω W = 0. The WZ gauge fixing modifies the supersymmetry algebra, introducing an explicit dependence on the gauge fields due to (3.128)-(3.129). The compensating gauge transformation also introduces non-vanishing WZ-gauge supersymmetry variations, since: (3.138) and δ Ω W = 0 due to the U(1) 't Hooft anomalies. This gives an alternative way to compute the anomalous variations δ ζ W in WZ gauge. To compare to the results from the previous subsections, we should take into account the fact that we are working in a scheme in which the cubic anomaly is given by (3.130) exactly. This corresponds to (3.134), including the contribution from the local term (3.135). We thus have: (3.139) Here, the gauge variation (3.133) is specialized to Ω = Ω(ζ) or Ω = Ω( ζ), and the second term is the (WZ-gauge) supersymmetry variation of (3.135). One finds: δ Ω(ζ) W = A qqq 24π 2 d 4 x ζσ µ σ νρ λa µ f νρ + iζσ µ λa µ D + iζλ λ λ , and: (3.141) It follows that (3.139) exactly reproduces the result (3.55), which was obtained by solving the WZ consistency conditions for supersymmetry and gauge transformations directly in WZ gauge.
Note also that, even if we worked in WZ gauge in the scheme defined by (3.133) with Ω = Ω = α, in which case the anomalous supersymmetry variation takes the more cumbersome form (3.140), we would still obtain the same results for supersymmetric partition functions, because the local term (3.135) vanishes on the supersymmetric locus for the background vector multiplet.
One can similarly discuss the mixed U(1)-gravitational anomaly in this language, generalized to supergravity. The supersymmetrization of the anomaly is similar to (3.131), with W α replaced by a chiral multiplet, T µνα , that contains the Riemann tensor in its θ-component [57]. The bottom and θθ components of T µνα vanish once we set the gravitino to zero and therefore, using (3.138), we find that the mixed U(1)-gravitational anomaly does not contribute to δ ζ W on a rigid-supersymmetric background.

4d N = 1 supersymmetric partition functions, revisited
In this section, as an application of the above formalism, we study how the supersymmetric Ward identities constrain supersymmetric partition functions on some specific half-BPS backgrounds. This leads us to discuss the explicit form of the partition functions Z(ν, τ ) on M 3 × S 1 , which differ from the well-known holomorphic results, I(ν, τ ), in the Casimir-like prefactor.

The M g,p × S 1 background
We will focus on the special case of M 4 a principal elliptic fiber bundle over a closed genus-g Riemann surface: In that case, the four-manifold necessarily takes the form: where the three-manifold M g,p is a degree-p principal circle bundle over Σ g . As a special case, this includes S 3 × S 1 (for p = 1, g = 0) and Σ g × T 2 (for p = 0). The corresponding supersymmetric backgrounds were studied e.g. in [24,25,26,10,11,5]. 35 The metric on M g,p × S 1 is chosen to be: with the angular coordinates t ∈ [0, 2π) and ψ ∈ [0, 2π), with t the coordinate along the circle direction. In (4.3), g zz is the Hermitian metric on Σ g , which we normalize such that vol(Σ g ) = π; the one-form C is the connection of a principal circle bundle over Σ, with first Chern class p, which satisfies: with C Σ a two-dimensional gauge field on Σ g which pulls back to C. The complex coordinates w along the T 2 fiber is given explicitly by: where the complex function f (z,z) is related to the one-form C as shown, and we introduced the complex parameter: This τ is a complex structure modulus of the Hermitian manifold M 4 ∼ = M g,p × S 1of course, it is also the complex structure of the T 2 fiber itself; note that it is kept constant over the base, Σ g . The Killing vector K µ is given by: The metric (4.3) is equivalent to the canonical expression (3.15)-(3.18), with: e 1 ≡ e (1) + ie (2) , e (1) = β 1 dψ + τ 1 dt + C(z,z) , e (2) = β 2 dt .
with A c µ defined in (3.9). The gauge field A c µ is the pull-back of a non-trivial twodimensional R-symmetry gauge field with 1 − g units of flux on Σ g : The free parameter κ in (4.9) can be fixed by requiring the existence of a consistent dimensional reduction of this 4d N = 1 supergravity background to a corresponding three-dimensional N = 2 supergravity background on M g,p [40]. This imposes: This is an important point for the computations that follow, since only with this particular choice, (4.11), do we have a consistent reduction of the 4d N = 1 half-BPS background to a 3d N = 2 half-BPS background on the three-manifold M g,p .
Kaluza-Klein form of the metric. In order to discuss the 3d reduction, it is useful to work with a slightly different frame, obtained from (4.8) by an SO(2) rotation: Let us define the radii: In term of these, (4.12) gives us the one-forms: with c µ , the so-called graviphoton, given by: This brings the metric into the Kaluza-Klein (KK) form: Note that, in our conventions, we have the volumes: Supersymmetric background on M g,p . In the following, we will also need the explicit form of the corresponding 3d N = 2 supersymmetric background on M g,p , as discussed in general terms in section 3.6.1. The three-dimensional metric on M g,p takes the simple form: ds 2 (M g,p ) = η 2 + ds 2 (Σ g ) , (4.18) in the coordinates (ψ, z,z) adapted to the THF. Here, η is defined as in (4.14), and ds 2 (Σ g ) = 2g zz dzdz is the metric on Σ g . This manifold is also a Seifert manifold, 36 with ψ the coordinate on the Seifert fiber of constant radius β 3d . The other threedimensional supergravity fields are given by: with A c µ defined as in (4.10). The three-dimensional background field V µ is the dual field strength of a real graviphoton c µ , with: 37 This is as expected for a 3d background obtained by dimensional reduction from 4d, with the KK metric (4.16). Requiring the existence of this supersymmetric reduction to 3d uniquely fixes the parameter κ in the 4d background to (4.11).

Supersymmetric Ward identity on M g,p × S 1
Let us evaluate δ ζ W on the M g,p × S 1 supergravity background (focussing on the cubic 't Hooft anomaly). We may write the anomaly in terms of the gaugino oneforms defined in (3.58). In the complex frame basis, they are given by: We will choose Λ 1 , Λ 2 constant, for our purposes. Then, the cubic-anomaly contribution (3.55) takes the simple form: at first order in the gaugino. 38 The 4d background U(1) gauge field takes the form: in terms of the complex frame, withâw = (â w ) * ∈ C an arbitrary complex parameter.
The term a (m) in (4.23) denotes a topologically non-trivial gauge field with flux m ∈ Z.
If p = 0, we have M 4 ∼ = Σ g × T 2 and −m units of flux through the Riemann surface Σ g : 24) 37 We have the useful relation: ǫ µνρ ∂ ν η ρ = 2pβ 3d η µ in this geometry. 38 The higher-order terms in λ can be ignored for our purpose, since they do not affect the anomalous Ward identities (3.74). 39 The choice of −m instead of +m here is to conform to the definition of the "flux operator" in [5], where the orientation convention for Σ was the opposite as it is here.
If p = 0, on the other hand, the flux m is a torsion flux, m ∈ Z p , and a (m) is a flat connection with non-trivial holonomy along the Seifert fiber of the three-manifold M g,p : While the two cases, p = 0 or p = 0, must be treated separately, the final result is valid for every M g,p × S 1 background. The gauge field component aw are related to the above parameters as: 26) and similarly for the complex conjugate a w . The flavor parameters ν,ν are then defined as: Here, for future reference, we also gave these expressions in terms of the real gaugefield components a ψ and a t .
The case p = 0, m = 0. Consider first the case without flux. When m = 0, the gauge-field (4.23) is a well-defined one-form, and the integral (4.22) can be evaluated straightforwardly. One finds: The general case. In the general case with m = 0, the integral (4.22) is not well-defined, strictly speaking. Nonetheless, we claim that the general result should be: The term linear in m can be deduced by requiring consistency with explicit results for one-loop determinants and with the 3d reduction, as we will discuss below. A completely rigorous derivation of (4.29) would require an a-priori definition of (4.22) for topologically non-trivial gauge fields, possibly akin to the definition of the 3d Chern-Simons functional in terms of a bounding four-manifold. We leave this as an interesting question for future work.

The holomorphy anomaly on Z Mg,p×S 1
Given the above discussion, the holomorphy anomaly of the supersymmetric partition function (in the flavor sector) follows from (3.74). We have: We also see that, since the supersymmetry variation (4.29) is independent of Λ z (and, similarly, δ ζ W is independent of Λz), there is no dependence of the partition function on background flat connections on the Riemann surface base, Σ g . The supersymmetry variation (4.29) contributes the following holomorphy anomaly in the flavor parameters: The generalization to any abelian symmetry is straightforward.

4.2.2
The small-β S 1 limit and the 3d functional W 3d .
Let us now compute W 3d , as defined in section 3.6.2. It is obtained in the limit τ → 0 with ν/τ kept finite. We again focus on the cubic 't Hooft anomaly contribution. We should then evaluate the local action: on the 3d N = 2 supergravity background (4.18)- (4.19). We also consider the background vector multiplet on its supersymmetric locus, (3.92). Then, the threedimensional gauge field takes the form: withâ 0 ∈ R a constant, and with the non-trivial gauge field A (m) defined exactly as a (m) in (4.24) or (4.25). Let us also introduce the real parameter: The three-dimensional flavor parameters σ and a 0 are related to the 4d flavor parameters (4.27) by: Equivalently, we have: in terms of the 4d gauge-field components a t and a ψ . Similarly to the 4d expression (4.22) for δ ζ W , the action (4.32) is only well-defined for m = 0. We claim that the complete expression for (4.32) on this supersymmetric background is: (4.37) For m = 0, this is obtained by a straightforward computation using the supergravity and flavor background fields. In the general case with m = 0, this is essentially a conjecture-assuming there exists a first-principle definition of the 3d action for non-trivial gauge fields. Using the relation (4.35), one can write (4.37) as: In particular, we see that W 3d reproduces the holomorphy anomaly (4.31)-as it should, by construction. It will also be useful to give (4.38) in terms of the real parameters a ψ and a t ; we have: Incidentally, W 3d | q 3 is holomorphic in τ when viewed as a function of (a ψ , a t ) and τ . Finally, for future reference, let us also give the explicit expression for the real part: (4.40)

The holomorphic supersymmetric partition function
In the rest of this section, we would like to discuss the "gauge invariant" supersymmetric partition functions Z Mg,p×S 1 , in light of our general results for the supersymmetric Ward identities in WZ gauge. Before proceeding, let us first review the standard expressions for the holomorphic partition functions.

The S 3 × S 1 partition function
The most studied 4d N = 1 supersymmetric partition function is certainly the S 3 ×S 1 partition function, which computes the 4d N = 1 supersymmetric index: The parameters p and q are complex structure parameters on S 3 × S 1 seen as a Hopf surface [6], and y α = e 2πiνα are the flavor parameters. In this work, we will only discuss the special case: which corresponds to (g, p) = (0, 1) for the M g,p × S 1 background defined above [5]. The S 3 index is easily computed for a free theory. For a free chiral multiplet, Φ, of unit charge under a background U(1) and of R-charge r ∈ R, we have: 43) in terms of the function [5]: Here, the "restricted elliptic Γ-function," Γ 0 , is the p = q limit of the elliptic-Γ function, defined as: 40 for τ on the upper-half plane. The prefactor in (4.43) is the contribution from the supersymmetric Casimir energy for a free chiral multiplet [10,64]. More generally, there exists an explicit formula for any 4d N = 1 gauge theory, with gauge group G and chiral multiplets Φ i in representations R of the gauge algebra g. It is given by [10,29]: Here, I S 3 denotes the "ordinary" 4d N = 1 index; for SCFTs, it starts at 1 when expanded in powers of q [3,4,65,66]: with x a ≡ e 2πiua . The supersymmetric Casimir energy contribution in (4.46) is given entirely in terms of the 't Hooft anomalies [29,30,67]: where the ellipsis denotes contributions from the 't Hooft anomaly coefficients involving the R-symmetry.
Behavior under large gauge transformations. On S 3 ×S 1 , one has the equivalence ν ∼ ν +1 for the flavor parameter, corresponding to the large gauge transformation a t ∼ a t −1 along the S 1 . While the "pure index" (4.47) is clearly gauge invariant, the holomorphic partition function (4.46) is not. Due to the supersymmetric Casimir energy contribution, we have: 41 under the transformation ν α → ν α +n α for the flavor parameters. Similarly to the case of the elliptic genus discussed in section 2, the puzzling aspect of the transformation (4.49) is that the absolute value of I S 3 ×S 1 is not gauge-invariant. As we discussed, it cannot possibly be gauge invariant whenever the partition function is holomorphic.
The three-dimensional limit. Consider the small-β S 1 limit of the holomorphic partition function, namely: (4.50) In this limit, we claim that: Here, W is given by the Cardy-like formula discussed in [32,59], and W 3d is essentially the partition function of the dimensionally-reduced theory. The important point, for our purpose, is that there is no order-β S 1 term in the expansion (4.51). This is analogous to the expansion (2.63) for the 2d elliptic genus.
Note that the supersymmetric Casimir energy in (4.48) precisely survives in the limit (4.50). Therefore, the property (4.51) is equivalent to the statement that the order-β S 1 term in the expansion of the ordinary index is governed by the supersymmetric Casimir energy: For general gauge theories, using the explicit localisation formula (4.47), this expansion follows from the estimate: for the restricted elliptic Γ-function (4.45), with ν held fixed (and modulo 2πi, corresponding to a choice of branch cut for the log). Here, the finite term is given by: (4.54) corresponding to a free chiral multiplet on the round S 3 [68], with ν ≡ ν/τ the 3d flavor parameter (4.35). The expansion (4.53) was proven in [41].

The M g,p × S 1 partition function
The M g,p × S 1 holomorphic partition functions were computed in [5]. They can be written as generalized indices: with q = e 2πiτ and y = e 2πiν as above. For p = 0, we have the topologically-twisted index on Σ g × S 1 [69,28,70]; for p = 1, g = 0, we recover the S 3 index discussed above. The parameter m in (4.55) denotes a background flux for the flavor symmetry on M g,p , as discussed in subsection 4.2 above. For our purpose, we only need to know that the M g,p ×S 1 holomorphic partition function for a 4d N = 1 gauge theory may be written as: where the sum is over the solutions to the "4d Bethe equations," withû a gauge parameter evaluated onto the so-called Bethe vacua [69]. The objects F 1 , H and Π α are called the fibering operator, the handle-gluing operator, and the flavor flux operators, respectively. For a free chiral multiplet, the (holomorphic) fibering operator is given by (4.44). The flavor flux operator, on the other hand, takes the form: with θ(ν, τ ) defined in Appendix B. The handle-gluing operator of a free chiral multiplet of R-charge r (with r ∈ Z, on a generic M g,p × S 1 ) takes the form H Φ = (Π Φ ) r−1 [5].
Large gauge transformations. On M g,p × S 1 , there are two types of large gauge transformations for the gauge parameters. In addition to ν ∼ ν + 1, corresponding to the large gauge transformation a t ∼ a t − 1 along the circle, we also have ν ∼ ν + τ together with m ∼ m + p, a large gauge transformation along the S 1 fiber of M g,p .
Consider a 4d N = 1 gauge theory whose partition function is computed as in (4.55). For generic values of g, p, the R-charges of the matter fields should be integer-quantized on M g,p × S 1 . Then, the entire R-charge dependence of I Mg,p is through the handle-gluing operator, H, which drops out for g = 1. Here we focus on the contributions from the fibering and flux operator-schematically: Under the large gauge transformation: for the flavor parameters, the fibering and the flux operator transform as: (nγ +2νγ)+ nα 3τ 2 (n β nγ +3n β νγ +3ν β νγ )) , e ϕ Πα n,m ≡ (−1) A αβ qq (n β +m β ) e − πi τ A αβγ qqq (n β nγ +2m β νγ) .
Then, the holomorphic partition function (4.58) transforms as: One can easily generalize this expression to include the effect of the handle-gluing operators [5].
The three-dimensional limit. As in the special case of the S 3 index, we again claim that there is no order-β S 1 term to the supersymmetric index (4.55). More precisely, one can again write the index as a "pure index" contribution times the supersymmetric Casimir energy contribution: Explicit expressions for the Casimir energy were given in [5]. Then, we claim that the analogue of (4.52) holds for any M g,p . In gauge-theories, this can be shown easily for the handle-gluing operator and for the flux operators, which are given in terms of θ-functions. For the fibering operator, that small-β S 1 property again follows from the estimate (4.53).

The "gauge-invariant" supersymmetric partition function
As we have reviewed, there are various exact results for 4d N = 1 supersymmetric indices in the literature, and those formulae are locally holomorphic in all the parameters. While this holomorphy agrees with the known classical supersymmetric Ward identities on curved space [6], it clashes with simpler requirements that stem from gauge invariance for real background gauge fields coupling to the flavor symmetry. For instance, there should exists a scheme in which the absolute value of the supersymmetric partition function is gauge invariant. The presence of a non-zero contribution from the flavor 't Hooft anomaly to the supersymmetric Ward identity, in the "gauge invariant scheme," resolves this apparent puzzle-it is then possible to have a supersymmetric partition function which respects all the quantum Ward identities at the same time. The only price to pay is that the partition function is not fully holomorphic in the flavor parameters.
Given this understanding, it is now straightforward to revisit previous localisation computations to derive the "gauge invariant" partition functions. As explained before, the localisation argument still goes through. The only modification comes from a more careful computation of the various one-loop determinants on the supersymmetric locus. Since the new non-holomorphic terms depend on 't Hooft anomalies, they factor out of various "localization integrals" in gauge theories, and only contribute to a Casimir-like overall pre-factor.
One-loop determinant and holomorphy. Let us focus on the contribution from a free chiral multiplet, Φ. This is a free theory, whose path integral can be computed on any M g,p × S 1 . In fact, we can factorize this one-loop determinant in terms of the fibering and flux operators [5]: 43 Here, the hatted symbols denote the "gauge invariant" objects, by opposition to the holomorphic fibering and flux operators discussed above. In particular, the S 3 × S 1 partition function is given by: As always with perturbative anomalies, the difficulty lies in treating the chiral fermion, ψ α , whose one-loop determinant is not well-defined. On the other hand, we can consider a theory consisting of the chiral multiplet Φ together with a "shadow chiral multiplet"Φ of opposite chirality and gauge charge, whose kinetic operator is the Hermitian conjugate to the one of Φ. 44 Then, the partition function of the pair Φ andΦ unambiguously defines the absolute value of Z Φ . In Appendix C.2, we give an derivation of this absolute value by an explicit heatkernel computation, generalizing the discussion of the Quillen anomaly in section 2.1. One finds: for the fibering operator, and: for the flavor flux operator, with ν = τ a ψ −a t . Moreover, from our general discussion in subsection 4.2.2, we know the explicit form of the chiral-multiplet supersymmetric effective action at order β S 1 in the small-circle limit; it is given by (4.39) with A qqq = 1, namely: We then propose that the supersymmetric partition function of the free chiral multiplet is given by: (4.68) with I Φ Mg,p×S 1 the holomorphic partition function, including the supersymmetric Casimir energy contributions: One can check that (4.68) reproduces (4.65)-(4.66)-that is, minus the real part of W 3d , as given in (4.40), plus the real part of 2πiE Mg,p (the supersymmetric Casimir energy) exactly reproduces the factors in the exponents in (4.65)-(4.66). In particular, the absolute value of (4.68), |Z Φ Mg,p×S 1 |, is fully gauge invariant.
The "gauge-invariant" supersymmetric partition function. Building the partition function of any "Lagrangian" gauge theory from the chiral and vector multiplet building blocks, in the usual manner, one then obtains a simple proposal for the complete answer for the supersymmetric partition function in the gauge-and diff-invariant scheme.
We may state this proposal as a conjecture for any supersymmetric partition function on a product four-manifold M 3 × S 1 , with geometric parameters τ and flavor parameters ν. Let I M 3 ×S 1 denote the holomorphic partition function (or "holomorphic M 3 index"), defined such that there is no order-β S 1 contribution to I M 3 ×S 1 in the 3d limi-as in (4.51) for M 3 = S 3 .

Conjecture:
The "gauge-invariant" supersymmetric partition function Z M 3 ×S 1 is related to the "holomorphic partition function," I M 3 ×S 1 , by the 3d local functional W 3d , evaluated on the supersymmetric background and viewed as a function of the 4d parameters, according to: (4.70) By construction, this supersymmetric partition function is properly gauge-invariant and supersymmetric, in the sense that it is compatible with all the anomalous Ward identities.
In this work, we focussed on the dependence of the partition function on the flavor parameters. The form (4.70) of the supersymmetric partition function should also account for more subtle anomalous Ward identities in the "geometric sector," which should also contribute to W 3d , and whose detailed study we leave for future work.
Behavior of Z Mg,p×S 1 under large gauge transformations. Finally, we can discuss the behavior of the partition function under large gauge transformations. We again focus on the contributions from the fibering and flux operators in the M g,p × S 1 background. Then, under a large gauge transformations across the S 1 : we have: Z Mg,p×S 1 (a ψ , a t − n, τ,τ ) m = e πiA αβ qq mαn β e − πi 6 pA α nα × e πiA αβγ ( p 3 a ψ,α a ψ,β nγ −mαa ψ,β nγ) Z Mg,p×S 1 (a ψ , a t , τ,τ ) m . (4.72) We can also consider the large gauge transformation along the M g,p Seifert fiber: which gives: (4.74) For p = 0, we find the behavior of the supersymmetric Σ g × T 2 partition function under large gauge transformations, which nicely agrees with the general expectations discussed in Appendix D.2.
In the case p = 1, m = 0, we also find a very simple behavior for the S 3 × S 1 supersymmetric partition function under large gauge transformations across the circle, namely: for any n ∈ Z. This is the result up to terms that depend on the R-charge; the full result can be obtained from (4.75) by simply allowing the flavor indices α, β, · · · in the exponent to run over the value "R" as well, at least formally. A more complete account of the R-symmetry dependence of partition functions, which is tied to the "geometric sector," will be given elsewhere.

A. Conventions in various dimensions
In this appendix, we briefly summarize our conventions in various dimensions. In 4d and 3d, our conventions are the same as in [6].
This is obtained by dimensional reduction from 4d along the "e (2) direction," in our conventions. We denote by: the frame covector in that direction. Note that the 4d and 3d ǫ-tensor are the related by ǫ abc = −ǫ 0abc , in the frame basis. (The dimensional reduction is discussed in detail in [40], which we follow.) In terms of local coordinates, we will have: The three-dimensional spinors are two-component Dirac spinors, denoted by either ψ α or ψ α . The reduction of the 4d Weyl spinors give 3d spinors, with the index position given as: The three-dimensional γ-matrices are (note the default index positions): They satisfy γ µ γ ν = g µν + iǫ µνρ γ ρ . The 3d γ µ -matrices are obtained from the 4d σ µ matrices according to: One has to be careful with the signs when reducing from 4d to 3d, due in particular to the fact that the 4d "dotted indices" become "undotted" in 4d; for instance: (A.14) 45 One can directly adapt various identities from [71] by replacing η µν and ǫ µνρσ there with g µν and −iǫ µνρσ , respectively, to account for the change in space-time signature. 46 Note that the we use coordinate and frame indices µ, ν and a, b, · · · , respectively, both for the four-dimensional and three-dimensional quantities. This should not lead to any confusion.

A.3 Two-dimensional and one-dimensional conventions
In two dimensions, we denote the real coordinates by X µ = (x, y) and we pick a complex coordinate w = x + τ y. The γ-matrices can be chosen as: The 2d Dirac spinors decomposes into Weyl spinors of positive and negative chiralities, which we denote by ψ − and ψ + , respectively-namely: They have 2d spin 1 2 and − 1 2 , respectively. We then reduce to one dimension along the coordinate x. The 1d fermions do not carry any space-time index, and are simply denoted by: B. θ-function and elliptic Γ-function In this appendix, we collect some useful definitions and properties for some θ-and Γ-functions used in the main text. We will use the standard notation: The function θ(ν, τ ). Let us define the "reduced" theta-function: with ν ∈ C and τ valued on the upper-half-plane. The function (B.2) has simple zeros at ν = n + mτ , with n, m ∈ Z. Then, the "ordinary" θ-function is defined as: It satisfies: θ(ν + n + mτ, τ ) = (−1) n+m e −2πimν−πim 2 τ θ(ν, τ ) , (B.4) for any n, m ∈ Z, and θ(−ν, τ ) = −θ(ν, τ ). Under modular transformations, we have: for the generator T and S of SL(2, Z), respectively. Let us also define the η-function: We have: It transforms as: under SL(2, Z).
In this paper, we focus on the following "restricted value" of the elliptic gamma function, for p = q = q: It satisfies: for any n, m ∈ Z.

C. One-loop determinants and ζ-function regularization
In this Appendix, we compute explicitly the (gauge-invariant) absolute value of oneloop determinants for chiral fermions and their superpartners. We first review the computation of the determinant of the Dirac operator Dw on T 2 , following the computation of Ray and Singer in [73]. We then generalize that procedure in order to compute the absolute value of the one-loop determinant of a 4d N = 1 chiral multiplet Φ on M g,p × S 1 .

C.1 Free fermions on T 2
Consider a free chiral fermion λ − (of positive chirality) on T 2 , with complex coordinate w = x + τ y, coupled to the background U(1) flat connection parametrised by a constant: We consider the determinant of the Dirac operator Dw, twisted by the background connection: with the periodic boundary condition along two circles. We may then define the absolute value squared of the "determinant" of Dw as: Physically, this corresponds to the partition function for a pair of fermions of opposite chiralities, which admits an obviously gauge-invariant regularization. The determinant of the Hermitian operator D w Dw can be written as an infinite product: Alternatively, one can consider the untwisted Laplacian ∆ ≡ ∂ w ∂w with the twisted boundary condition along the two circles: We would like to compute the effective action, defined as In order to compute this, let us consider the heat kernel for the Laplacian: On the complex plane, C, the solution can be written as: The heat kernel on T 2 can be easily obtained by implementing the twisted boundary condition (C.5). One can check that the following solution has the desired periodicities: We can now write the trace in (C.7) as: tr(e −t∆ ) = n,m∈Z Removing the divergence from the term m = n = 0, we can perform the t integral when Re(s) < 1, to obtain: (C.13) One can show the summation uniformly converges when Re(s) < 1 2 , once we first sum over n ∈ Z. Taking the derivative with respect to s, we have: 1 |m| e 2πimay n∈Z e 2πinax |m|τ 2 π|mτ + n| 2 . (C.14) The first term gives: 47 (C. 15) The second term in (C.14) can be computed using the Poisson summation formula: (C. 16) for any function f (ν) which is periodic under ν → ν + 1. This gives: with θ 0 (ν, τ ) defined as in (B.2). We then arrive at the expression: (C. 18) As discussed in section 2.1, an holomorphic square root of (C.18) does not exist. Instead, we find: a 2 x 2 − ax 2 + 1 12 θ 0 (ν, τ ) , (C. 19) up to a phase factor, which should be compatible with the U(1) anomaly.
C.2 4d N = 1 chiral multiplet on M g,p × S 1 We can run a similar computation for a chiral multiplet (of R-charge r = 1) on M g,p × S 1 . As reviewed in section 4.4, the partition function on that space can be factorized into contributions from "fibering and flux operators." The flux operator computation is essentially identical to the T 2 computation above. We then focus on the fibering operator contribution. The fibering operator for the chiral multiplet,F Φ 1 , is given formally by the infinite product [5]:F (C.20) We will compute the absolute value of this expression, by a careful zeta-function regularization of the quantity: We will write ν = τ a ψ − a t , to match the 4d notation in the main text. Following the 2d computation in the last section, we introduce the zeta function: In order to use the Poisson summation formula, we decompose G(t) into a linear combination of two functions periodic in ν → ν + 1 and ν → ν + τ : Note that G (2) (t) is equivalent to (C.12). On the other hand, G (1) (t) can be computed by applying the Poisson summation formula (C.16) twice. We find: m,n∈Z (n + mτ 1 )e 2πi(na ψ +mat) e −π 2 |n+mτ | 2 /t . (C. 27) We can also decompose the zeta function (C.22) accordingly: ζ F (s) = ζ (C.31) The first line evaluates to: log |1 − yq k | 2k + a ψ log |θ 0 (ν, τ )| 2 = − log |Γ 0 (ν, τ )| 2 + a ψ log |θ 0 (ν, τ )| 2 , (C. 33) with Γ 0 (ν, τ ) defined as in (B.9). Combining all the terms, we have: (C.34) Therefore, we found: This expression does not admit a holomorphic square root. We have:

D. Large-gauge transformations and the anomaly polynomial
In the presence of 't Hooft anomalies, the partition function Z[a], viewed as a functional over the space of background gauge fields a µ , M, is not a "function" over M but rather a non-trivial section of a line bundle: In the case of free fermions, the partition function is the "determinant" of a Dirac operator, and L is then know as the determinant line bundle. The anomalies of the theory are encoded invariantly in terms of the non-trivial topology of L [74].
In this appendix, we compute explicitly the first Chern class of the determinant line bundle is some simple cases, with Z[a] depending only on background flat connections. The first Chern class c 1 (L ) can be obtained by pushing-foward the anomaly polynomial onto space-time [74], and it is thus determined directly by the anomalies. In this approach, it is easy to see that, even as we restrict ourselves to a subspace of flat gauge fields a µ , M 0 ⊂ M, the anomaly still implies that the partition function must transform non-trivially under large gauge transformations.

D.1 Determinant line bundles on J(T 2 ) and torus partition function
Consider a 2d N = (0, 2) supersymmetric theory coupled to a U(1) background gauge multiplet V F . In the presence of a t'Hooft anomaly, the partition function Z(ν, τ ), with a fixed complex structure τ , can be thought of as a section of a holomorphic line bundle L over the Jacobian torus: with ν = τ a x − a y as in section 2. Let N be the product space J × T 2 , with the projection map: 48 J × T 2 π −→ J .

(D.3)
Then, L can be obtained from the Poincaré line bundle L over J × T 2 of degree zero. 49 The first Chern class of the "determinant line bundle," L , is obtained by pushing-forward the 4-form anomaly polynomial on T 2 , according to [74]: where δ p,q is a p-form along T 2 and a q-form along J. Now, we have: This can be computed by explicitly constructing the locally holomorphic section of L [76]. One can show that: where A qq is the quadratic 't Hooft anomaly, and ω is the normalised Kähler form on J. For a theory coupled to a general abelian background gauge multiplet, the parameter space is a product of the Jacobian tori for each U(1) α , and the formula generalises to: c 1 (L ) = 2πA αβ da x,α da y,β , (D.11) where ν α = a x,α τ − a y,α . In particular, the connection on the line bundle L can be locally chosen as: A = 2πA αβ (c · a α,x da β,y − (1 − c) · a β,y da α,x ) , (D. 12) for any c ∈ R. This implies that a section Z(n) of the line bundle L picks up a phase under the large gauge transformation along a 1-cycle γ, as: φ γ : Z(ν) → e iΛγ (ax,ay) Z(ν) , (D. 13) when the connection transforms as δ γ A = dΛ γ . More explicitly, we have Z(ν α + 1, τ ) = e 2πi(1−c)A αβ a β,x Z(ν, τ ) , Z(ν α + τ, τ ) = e 2πicA αβ a β,y Z(ν, τ ) . (D.14) For 2d N = (0, 2) supersymmetric theories, the consistency of the gauge anomaly with supersymmetry fixes the constant c = 1 2 , as explained in the main text.

Modular transformation
The relation between the gravitational anomaly and the behaviour of the partition function under the SL(2, Z) modular transformation: T : (a x , a y , τ ) → (a x , a y + a x , τ + 1) , S : (a x , a y , τ ) → (a y , −a x , −1/τ ) , (D. 15) can be understood in a similar way, as explained in detail in [77]. We view the parameter space Y as a fibration: J → Y → H/SL(2, Z) , (D. 16) where the fiber at each point τ ∈ H/SL(2, Z) is the Jacobian J (with the complex structure induced by τ ). Now let N be the product T 2 × Y . Again, the first chern class of L over Y can be computed from the anomaly polynomial: Now, let us couple the theory to the flat background gauge for the flavour symmetry, ν ∈ J. The first term of (D.17) implies that the connection on the line bundle restricted to the fiber direction can be locally written as (D.12), which transforms under the T operation as: δ T A = πA αβ (2c − 1)d(a α,x a β,x ) , (D. 20) and under S as: δ S A = −2πA αβ (2c − 1)d(a α,x a β,y ) .

D.2 Large gauge transformations for the 4d partition function
Consider now the supersymmetric partition function on M g,p × S 1 . Now, a supersymmetric U(1) background gauge field is characterized by an integer m ∈ Z (if p = 0) or m ∈ Z p (if p = 0), and by a complex parameter ν, with the identifications: Here, we will only discuss the case p = 0, corresponding to Σ g × T 2 . Then, ν is valued in the Jacobian torus J(T 2 ), and the discussion above generalizes easily. The Σ g × T 2 partition function can be built out of the (non-holomorphic) flavor flux operator and handle-gluing operator. As a special case of the discussion in the main text, the flux operator of a free chiral is given by: ψ −a ψ at) θ(ν, τ ) , (D. 24) with ν = τ a ψ − a t , and similarly for the handle-gluing operator. A general partition function can be constructed from those building blocks. By explicit computation, one can check that the non-holomorphic flux operators of a general 4d N = 1 gauge theory transform as:Π α (ν α + 1, τ ) = (−1) A αβ e −πiA αβγ a ψ,γΠ α (ν, τ ) , Π α (ν β + τ, τ ) = (−1) A αβ e −πiA αβγ at,γΠ α (ν, τ ) .