Factorisation and holomorphic blocks in 4d

We study N=1 theories on Hermitian manifolds of the form M^4=S^1xM^3 with M^3 a U(1) fibration over S^2, and their 3d N=2 reductions. These manifolds admit an Heegaard-like decomposition in solid tori D^2xT^2 and D^2xS^1. We prove that when the 4d and 3d anomalies are cancelled the matrix integrands in the Coulomb branch partition functions can be factorised in terms of 1-loop factors on D^2xT^2 and D^2xS^1 respectively. By evaluating the Coulomb branch matrix integrals we show that the 4d and 3d partition functions can be expressed as sums of products of 4d and 3d holomorphic blocks.


Introduction
In recent years thanks to the development of a new method to formulate SUSY gauge theories on curved spaces initiated by [1] and to the application of Witten's localisation technique to the path integral of theories defined on compact spaces, a plethora of new exact results for SUSY gauge theories in various dimensions have been obtained.
The focus of this note is on 4d theories defined on Hermitian manifolds of the form M 4 = S 1 ×M 3 where M 3 is a possibly non-trivial U (1) fibration over the 2-sphere, and their 3d reductions. These 4-manifolds can preserve 2 supercharges with opposite R-charge and a holomorphic Killing vector generating the torus action on M 4 [2], [3], [4]. General results [5], [6] state that partition functions on these spaces do not depend on the Hermitian metric but are holomorphic functions of the complex structure parameters and of the background gauge fields through the corresponding vector bundles. Similar results hold for the 3d N = 2 reductions of these theories.
For these spaces it has also been observed that the partition function can be expressed in terms of simpler building blocks. It turns out that for 3-manifolds M 3 g , which can be realised by gluing two solid tori D 2 × S 1 with an element g ∈ SL(2, Z), and likewise for 4-manifolds M 4 g constructed from the fusion of two solid tori D 2 × T 2 with appropriate elements in SL(3, Z), the geometric block decomposition is very non-trivially realised also at the level of the partition functions.
This phenomenon was first observed for 3d N = 2 theories on M 3 S = S 3 and M 3 id = S 2 id ×S 1 which were shown in [7] and [8] (see also [9], [10], [11]) to admit a block decomposition where the 3d holomorphic blocks B 3d c are solid tori D 2 ×S 1 partition functions. The two blocks are glued by the appropriate SL(2, Z) element S or id acting on the modular parameter of the boundary torus and on the mass parameters. The sum is over the supersymmetric Higgs vacua of the theory which remarkably are the only states contributing to the sums in (1.1), even though these partition functions, although metric independent, are not properly topological objects. In fact, in the case of M 3 S = S 3 , the factorisation was proved to follow from a stretching invariance argument [12]. Indeed in [12] it is shown that it is possible to deform the S 3 geometry into two cigars D 2 × S 1 connected by a long tube, which effectively projects the theory into the SUSY ground states, without changing the value of the partition function.
In [8] it was developed an integral formalism to compute the holomorphic blocks which build on the fact that they are solutions to a set of difference equations. The 3d blocks are obtained by integrating a meromorphic one-form Υ 3d , consisting of the mixed Chern-Simons, vector and chiral multiplet contributions on D 2 × S 1 , on an appropriate basis of middle-dimensional cycles in Later on, in [13], block integrals were derived from localisation on D 2 × S 1 . Curiously the integrand Υ 3d turns out to be the "square" root of the integrand appearing in the Coulomb branch partition function on the compact space, so that by combining (1. where the gluing rule can be g = S, id. The first term of the equality is a smart rewriting of the partition function on the Coulomb branch, where the localising locus may contain a continuous and a discrete part. As observed in [8] this suggestive chain of equalities hints that factorisation commutes with integration. The factorisation of partition functions has been observed also on lens spaces L r [14], on S 2 A × S 1 with R-flux (3d twisted index) [15], in 4d N = 1 theories on S 3 × S 1 (4d index) [16], [17] and in 2d N = (2, 2) theories on S 2 , [18], [19], [20]. In fact for all these cases the block factorisation can be incorporated in the general analysis of 2d, 3d and 4d tt * geometries [21], [22]. An alternative perspective on the factorisation is the localisation scheme known as the Higgs branch localisation considered in [18], [19], [23], [24].
The goal of this note is to elucidate the block decomposition of partition functions for theories defined on L r , L r × S 1 , S 2 A × S 1 and S 2 × T 2 . The Coulomb branch partition functions on these spaces have been computed in [34], [35], [15] and [36], [37], [38].
Our main result in 3d is the extension of the remarkable identity in (1.3) to the lens space M 3 r = L r and to the twisted index M 3 A = S 2 A × S 1 , which are respectively obtained through the r-gluing implementing the appropriate SL(2, Z) transformation on the boundary of one solid torus to obtain the lens space geometry, and through the Agluing which realises the topological A-twist on S 2 .
We then move to 4d, where for M 4 S = S 3 × S 1 , M 4 r = L r × S 1 and M 4 A = S 2 × T 2 we are able to prove an identical relation (1. 4) In the case of the index S 3 × S 1 and lens index L r × S 1 , the factorised form of the integrand emerges after we perform a modular transformation on the complex structure parameters by means of the remarkable property of the elliptic Gamma function discovered in [39]. This transformation generates a term which can be identified with the 4d anomaly polynomial and represents an obstruction to factorisation. However, for anomaly free theories this factor is one and we can express the integrand as Υ 4d 2 r . It is then fairly easy to check that the S 2 ×T 2 integrand can also be expressed in terms of the same meromorphic function Υ 4d 2 A . The second step in (1.4) is the actual evaluation of the Coulomb branch sum and integral on a suitable integration contour yielding the factorisation into 4d holomorphic blocks B 4d c which we compute in some explicit cases. The last step in (1.4) introduces the 4d block integrals. In general determining the integration contours Γ c is harder than the 3d case, here we give a prescription in few examples based on physical considerations such as periodicity/invariance under large gauge transformations.
The paper is organised as follows. We begin section 2 with the study of N = 2 theories on the lens space where, thanks to a new identity for the generalised double Sine function, we can prove the integrand factorisation. We then show the block factorisation for two interacting cases. We take a small detour to discuss the T [SU (2)] theory. In this case, thanks to the transformation properties of the holomorphic blocks, we are able to prove that partition functions on generic 3-manifolds admitting a block decomposition are invariant under mirror symmetry. In section 3 we discuss the 3d twisted index. In section 4 we introduce the lens index partition function and show that the integrand can be expressed in a factorised form after cancelling the anomalies. We then show two examples of block factorisation. We check the analogue factorisation of S 2 ×T 2 partition functions in section 5. Finally in section 6 we introduce the 4d block integrals. The paper is supplemented by several appendices where we discuss many technical details and computations.
2 3d N = 2 partition functions on S 3 Z r We consider the free orbifold S 3 Z r of the squashed 3-sphere The resulting smooth 3-manifold is the squashed lens space L r .
The partition function of N = 2 theories on L r has been first obtained in [34] and revised in [35]. The localising locus is labelled by the continuous variables Z in the Cartan of the gauge group G and discrete holonomies in the maximal torus. The integer variables 0 ≤ 1 ≤ . . . ≤ G , n ∈ [0, r − 1], parameterise the topological sectors. The holonomy is non-trivial since the fundamental group of the background manifold is π 1 (L r ) = Z r and breaks the gauge group to 1 where the subgroup G k has rank given by the number of n = k. We also turn on continuous Ξ and discrete H variables for the non-dynamical symmetries.
The partition function reads where W k is the order of the Weyl group of G k . The classical terms is given by the mixed Chern-Simons action (CS). For example, a pure U (N ) CS term contributes as 2 For U (1) factors we can also turn on an FI term ξ where we have considered a background holonomy θ also for the topological U (1). The 1-loop contribution of matter multiplets is given by where i runs over the chiral multiplets, ρ i , φ i , are respectively the weights of the representation of the gauge and flavour groups and ∆ i the Weyl weight. For convenience we will absorb the Weyl weight into the mass parameter, and we will be denoting the squashing parameter by b = ω 2 = ω −1 1 , with Q = ω 1 + ω 2 . The 1-loop contribution of the vector multiplet is given by where the product is over the positive roots α of G and we set Z α = α(Z), α = α( ).
The functionŝ b,H is the projection of the (shifted) double Sine function improved by a sign factor σ, and it is defined as the ζ-regularised product where the sign factor is given by In appendix A we have derived a new expression forŝ b,H in terms of ordinary double Sine functionŝ This expression allows us to easily evaluate the asymptotic, locate zeros and poles, take the residues and express it in a factorised form

Factorisation
We will now show that by using our expression (2.11) the partition function of theories with integer effective CS couplings (parity anomaly free) can be expressed in terms of a suitable set of holomorphic variables and factorised in 3d holomorphic blocks.
We begin with the simplest parity anomaly free theory, the free chiral with −1 2 CS unit The subscript ∆ is due the fact that, in the context of the 3d-3d correspondence relating 3d N = 2 theories to analytically continued CS on hyperbolic 3-manifolds, this theory is associated to the ideal tetrahedron [40]. In this context the fundamental Abelian mirror duality relating the anomaly free chiral to the U (1) theory with 1 chiral and 1 2 CS unit is interpreted as a change of polarisation. At the level of lens space partition functions this duality reads We prove this equality in appendix B.1. 3 The half CS unit in (2.12) has the effect to cancel the quadratic factor in (2.11) so that the anomaly free result can be written in a block factorised form 4 (2.14) in terms of holomorphic variables The 3d holomorphic block is the partition function on D 2 × τ S 1 of the tetrahedron theory defined in [8]. Notice that when q < 1 we have q > 1 and (2.17) Basically blocks in x, q, andx,q, share the same series expansion but they converge to different functions. This is actually a key feature of holomorphic blocks which has been extensively discussed in [8] and will play an crucial role in the example we discuss in section 2.3.
The two blocks are glued through the r-pairing acting as where τ is to be identified with the modular parameter of the boundary T 2 , while the flavour fugacity and holonomy transform as This gluing rule as expected coincides with ther ∈ SL(2, Z) element (composed with the inversion) realising the L r geometry from a pair of solid tori.
CS terms at integer level and FI terms can be expressed in terms of periodic variables as r-squares of Theta functions defined in (A.47) by means of (A.49) 5 The ∝ means that we are dropping background contact terms depending on ω 1,2 and r only. From now on we will assume equalities up to these constants.
Obviously the factorised expressions are not unique. As pointed out in [8] the ambiguity amounts to the freedom to multiply the blocks by "q-phases" (elliptic ratios of Theta functions with unit S, id, r-squares). For example another possibility is to factorise the vector multiplet contribution as in [8] (2.22) 5 For the improved CS term proposed in [14] we simply have e − iπ The vector multiplet factorised form in [8] differs from ours by a sign factor (−1) . Notice that Θ(−q These observations imply that on parity anomaly free theories, where the total effective CS couplings are integers, we can replace each 1-loop vector multiplet with (2.21), each chiral contribution with B 3d ∆ (x; q) 2 r and then factorise the remaining integer CS units using (2.20). This procedure allows us to rewrite the partition function as with exactly the same integrand Υ 3d appearing in the analogous factorisation observed in [8] for S 3 and S 2 id × S 1 . The three cases differ only for the integration measure which can include also a summation over a discrete set and for the gluing rule. The prefactor e −iπP is the contribution of background mixed CS terms which can have half-integer coupling preventing their factorisation.
The integrand Υ 3d appears also in the definition 3d blocks via block integrals proposed in [8] where Γ c is an appropriate basis of middle-dimensional cycles in (C * ) G . Recently block integrals were rederived via localisation on D 2 × S 1 by [13]. In their analysis the B 3d ∆ (x; q) block corresponds to imposing Dirichlet (D) boundary conditions  [14]. Notice that, while the parity anomaly cancellation condition is a sufficient condition to factorise the integrand in the first step, in the second step it is only a necessary condition. The actual evaluation of the integral might require additional conditions to ensure convergence. However as we already mentioned, there are other ways to prove factorisation besides explicit integral evaluation. For example, Higgs branch localisation, stretching/projection arguments or the existence of a commuting set of difference operators in x, q andx,q acting on the partition functions.

SQED
We now consider the U (1) theory with N f charge +1 and N f charge −1 chirals (SQED), for which we turn on masses X a ,X b , and background holonomies H a ,H b . We also turn on the FI ξ and the associated holonomy θ. The L r partition function reads where in the last step we simply sent Z → −Z and used the reflection property (A.43).
In order to evaluate the integral we can close the contour in the upper-half plane (assuming ξ > 0) and take the sum of the residues at the poles of the numerator The details of the computation and notations are given in appendix B.2, the result is where we introduced the notation and set We can finally express everything in terms of the "holomorphic" variables factorising the classical part as where we used (2.20). Therefore, we finally obtain are the same SQED holomorphic blocks derived for S 3 and S 2 id × S 1 .

T [SU (2)]
As an application of the result obtained in the previous section we consider the mass deformed T [SU (2)] theory. This is a U (1) theory with 2 charge +1 and 2 charge −1 chirals and a neutral chiral. We turn on vector and axial masses m 2 , µ 2 , the FI parameter ξ and their respective holonomies In [42] it was shown that the S 3 partition function of the mass deformed T [SU (2)] theory (the axial mass m coincides with the mass of the 4d adjoint breaking the 4d SYM to N = 2 * ) coincides with the S-duality kernel in Liouville theory acting on the torus conformal blocks. It was also explicitly proved that the S 3 partition function is invariant under the action of mirror symmetry. Actually, as we are about to see, the self mirror property can proved on generic 3-manifolds that can be decomposed in solid tori. This result follows from the highly non-trivial tranformations of holomorphic blocks across mirror frames.
The lens space partition function of T [SU (2)] reads and is the contribution of background CS terms.
Mirror symmetry acts by exchanging Higgs and Coulomb branches, correspondently the vector mass and the FI parameter are swapped while the axial mass is inverted, and similarly for the associated holonomies so that the partition function in the mirror frame reads (2.44) 7 We introduced the index I to distinguish the theory from its mirror as it will be clear later.
where we used that P is invariant under the mirror map and obtained the blocks in phase II from the ones in phase I by applying the mirror map (2.45) At this point proving that the partition function is invariant under mirror symmetry amounts to prove the following equality which ensures (2.46). The transformations of the blocks across mirror frames has the characteristic structure of a jump across a Stokes wall. The interplay between mirror symmetry and Stokes phenomenon for 3d blocks and its relation to analytically continued CS theory has been extensively discussed in [8].
Notice that our proof relies only on the blocks transformation properties and makes no reference to the specific gluing rule, hence it can be extended to all the cases in which the partition function can be block factorised.

SQCD
We now continue our examples with the SU (2) theory with N f fundamentals and N f antifundamentals chirals (SQCD). The partition function reads (2. 49) In this form the matter sector reads formally the same as the previous abelian theory with the replacements a → a ′ , b → b ′ . In fact also the vector multiplet contribution is equivalent to a pair of charge ±2 chirals. Therefore, there is a canonical Abelian theoryẐ SQCD [ξ, θ] associated to the SU (2) theory, for which we also turn on an FI coupling e 2πi r Zξ e 2πi r θ . Since the vector multiplet does not bring any pole, the residue computation proceeds exactly as in the SQED case and the SU (2) partition function can be obtained from the limit (2.52)

3d twisted index
We now consider N = 2 theories with R-symmetry on S 2 A ×S 1 with a topological A-twist on S 2 . This background has been recently reconsidered in [15]. The topological twist is performed by turning on a background for the R-symmetry proportional to the spin connection with a quantised magnetic flux, as a consequence R-charges are integers. Magnetic fluxes are also turned on for all the flavour symmetries.
The path integral on this space localises on BPS configurations labelled by continuous variables Z in the Cartan and discrete variables in the maximal torus of the gauge algebra. The integer variables parameterise the magnetic flux while z = e 2πiZ is the holomorphic combination of the S 1 holonomy and of the real scalar. We also turn on analogous continuous and discrete variables for the non-dynamical symmetries. The partition function reads The contributions to the classical part come from (mixed) CS terms. In particular, a pure CS and FI read z κ , z θ ξ , (3.2) where ξ, θ, are the holonomy and flux associated to the topological U (1) symmetry. The contribution of a chiral multiplet with R-charge R is given by where the shifted R-charge B = − R + 1 is quantised. Finally the vector multiplet contribution is given by where we used the usual shorthand notation . We refer the reader to [15] for a detailed analysis of the integration contour in (3.1).
Geometrically, the twisted index background is realised by gluing two solid tori twisted in the same direction so to realise the A-twist on S 2 . We then expect that also in this case the partition function can be expressed in terms of the universal blocks B 3d c . We begin studying the free chiral with R-charge 0 and −1 2 CS unit (the tetrahedron theory). It is easy to see that by defining the A-gluing acting as we obtain the twisted index of the tetrahedron theory by A-fusing two 3d blocks with the factor z B 2 contributing the +1 2 CS unit.
CS terms at integer level and FI terms can also be expressed as A-squares of the same blocks appearing in (2.20) where u = q θ 2 ξ. Finally also the vector multiplet can be factorised as in (2.21) From eqs. (3.6), (3.7), (3.8) and (3.9) it follows straightforwardly that for parity anomaly free theories the integrand is factorised Clearly one expects the result of the contour integral to take factorised form too. Indeed in [15] it has been observed that this is the case. For example it is an easy exercise to show that the SQED partition function can be written in terms of the 3d holomorphic blocks We will not show the details of the computation because we will perform an almost identical computation for the S 2 × T 2 case in section 5.
In the end we can extend also to the twisted index case the identity suggesting that the factorisation commutes with integration.

4d N = 1 lens index
In this section we consider N = 1 theories formulated on L r × S 1 . The lens index of a chiral multiplet of R-charge R and unit charge under a U (1) symmetry is [43] I (R)
where w is the U (1) fugacity and H the holonomy along the non-contractible circle of L r . I 0 (w, H) is the zero-point energy and, as suggested in [14], we included the sign σ(H) defined in (2.9).
For a chiral multiplet in a given representation of a gauge group G and global flavour group, the lens index reads ρ,φÎ where z, ζ, are respectively the gauge and global fugacities associated to the Cartan, ρ, φ, the weights of the gauge and flavour representations, while , H, are respectively the gauge and background holonomies in the maximal torus, which can be represented by vectors with components in Z r . The gauge theory lens index is then obtained by summing over the dynamical holonomies 0 and integrating the matter contribution with integration measure given by the vector multiplet of the unbroken gauge group where α denote the gauge roots, and we defined with and zero-point energy If the gauge group has an abelian factor we can introduce an FI term which contributes to the partition function as where we turned on also a background holonomy θ for the topological U (1) symmetry. As argued in [44] the 4d FI parameter ξ 4d r needs to be quantised. This allows the index, which is independent on continuous couplings, to actually depend on the FI parameter.
In the following we will show that by performing a modular transformation and cancelling the anomalies it is possible to express the lens index integrand in a very neat factorised form.

Chiral multiplet
Let us consider the index of a single chiral and introduce the following parametrisation where Q = ω 1 + ω 2 , and ω 3 = 2π β measures the (inverse) S 1 radius β. For convergence, we also assume Im > 0. Also, since it is going to appear quite often, we define the combination By using the modular transformation (A.61) and the reflection properties of the elliptic Gamma function (appendix A) we can rewritê The cubic polynomial Φ 3 (X) is defined in (A.11). As we will see in section 4.3, these polynomials contribute to the 4d gauge and global anomalies. In the above expression we introduced the function 9 rω 2 ) , (4.14) satisfying and which can be factorised as where the 4d r-pairing acts according to (4.17) 9 For r = 1, G coincides with the so-called modified elliptic Gamma function, see for example [45].
Notice that in the 3d limit ω 3 → +∞ R (or q σ → 0), we have with the quadratic polynomial Φ 2 (Q − X) in (4.13) contributing the correct half CS unit in 3d. The functionẐ 4d compatible with a superpotential term W ∝ Ψ 1 Ψ 2 for two chiral superfields Ψ 1,2 , which disappear from the IR physics. In the case r = 1,Ẑ 4d χ can be shown to reduce to the result for a chiral multiplet found in [36,46]. 10 We see that there are two natural ways to rewrite the lens index for a chiral where, in analogy with the 3d case, we defined the 4d holomorphic blocks for the anomaly free chiral We interpret the 4d blocks as partition functions on D 2 × τ T 2 σ , where = τ R 1 is the cigar equivariant parameter and σ is the torus modular parameter. From (4.22) and (4. 23) we see that the polynomials Φ 3 , Φ 2 , which we will identify with anomaly contributions, are obstructions to factorization, while the anomaly free chiral indexes have a neat geometric realisation as 4d blocks glued through the 4d r-pairing (4.18), which implements the gluing of two solid tori D 2 × τ T 2 σ to form the L r × S 1 geometry. Similarly to the 3d case, 4d holomorphic blocks are annihilated by a set of difference equations which can be interpreted as Ward identities for surface operators wrapping the torus T 2 σ and acting at the tip of the cigar. For example for B 4d D we find 11 The lens index is annihilated also by another equation for the tilde variables and similarly for B 4d The existence of two commuting sets of difference operators annihilating the lens index indicates that it might be expressed in a block factorised form. Indeed we will shortly see that anomaly free interacting theories can also be factorised in 4d holomorphic blocks. We also expect that our 4d holomorphic blocks will be the building blocks to construct partition functions on more general geometries through suitable pairings. For example, in section 5 we will discuss the S 2 × T 2 case.
We close this section by observing that our definition of the blocks B 4d D and B 4d N via factorisation or as solutions to difference equations suffers from an obvious ambiguity. It is clear that we have the freedom to multiply our blocks by q τ -phases c(x; q τ ) satisfying The first condition ensures that the c(x; q τ ) is a q τ -constant passing through the difference operator while the second condition ensures that these ambiguities disappear once two blocks are glued. 4d blocks for more complicated theories will be also defined up to q τ -phases, which can be expressed as elliptic ratios of theta functions. 11 For the free chiral case, there is an apparent symmetry between q σ and q τ , for example we also have T qσ,x − Θ(x −1 ; q τ ) 1 Γ(qσx −1 ;qτ ,qσ) = 0. However there is a profound difference between q σ and q τ . This clearly visible if we realise these 4d theories as defects in 6d theories engineered on elliptic Calabi-Yau's. In that setup q σ corresponds to a Kähler parameter while q τ is related to the topological string coupling.

Vector multiplet
Repeating the steps we have done for the chiral multiplet, we can also bring the vector multiplet contribution to the following form , Z . Also in this case the prefactor of (4.30) is an exponential of a cubic polynomial contributing to the anomaly, which we will discuss in subsection (4.3). In the 3d limit ω 3 → +∞ R we havê matching the 3d vector contribution (2.7) with the identifications (α(Z), α( )) = (iZ α , α ). It the case r = 1,Ẑ 4d V reduces to the contribution of the vector multiplet in [46]. By using the factorised form of the G function we can expressẐ 4d V aŝ In this form we immediately see that in the 3d limit q σ → 0,Ẑ 4d V matches the 3d vector contribution (2.21) (notice that Θ(x; 0) = 1 − x). We then define which in the 3d limit q σ → 0 reduces to the 3d block (2.22).
Finally, we observe that the FI terms can also be naturally factorised as in 3d (2.20)

Anomalies and factorisation
We now return to the polynomials Φ 3 , Φ 2 appearing in the modular transformations (4.12), (4.30). We will see that their total contributions reconstructs the 4d anomaly polynomial. This interplay between modular transformations and anomalies was first observed in [45] (see also [46], [47]).
Collecting the contribution of the chiral multiplets we find where we introduced the exponentiated flavour fugacities ζ = e In total we find where in the last step we further distinguished between local (gauge (G)) and global (flavour (F), R-symmetry (R) and gravity (g)) contributions.
• Gauge and mixed gauge anomalies. Collecting the various powers of Z we get All these terms have to vanish on physical theories theories, leading to conditions on the R-charge and on the flavour fugacities.
• Global anomalies. For the Z independent terms we have In [48] it was observed that partition functions on M 3 × S 1 β have a divergent limit when the S 1 radius β shrinks to zero. The leading term is Tr(U (1))L F [M 3 ] + subleading , (4.57) where L R,F [M 3 ] are integrals of local quantities which can be computed for the given 3d (Seifert) manifold M 3 and supergravity background. In the where m is a real mass for the U (1) symmetry and r 3 the S 3 b scale. By using the asymptotics of Φ 3 , Φ 2 , it is not difficult to verify that reproducing the expected universal divergent factor with the identifications β = 2π , the volume being rescaled by 1 r. Finally we consider the extra exponential quadratic terms appearing in the definition ofẐ 4d χ in (4.13). We already observed that in the 3d limit ω 3 → +∞ R , these polynomials contribute the expected half CS units. These polynomials are actually ω 3 independent, and for convenience we refer to their total contribution as 3d anomaly contribution. Each chiral of weights ρ i , φ i , contributes with where the sign ∓ depends on the choice (4.22) or (4.23) respectively. In total we find On physical 4d theories, where the 4d gauge anomaly is cancelled, the would be 3d parity anomaly is also automatically cancelled, namely in the 3d limit e −iπP 3d loc would contribute integer CS units. This implies that the factor e −iπP 3d loc can always be factorised in Theta functions as in (2.20).
We arrive at the conclusion that, on physical theories where there is no obstruction from anomalies, the lens index integrand can be expressed in terms of the holomorphic variables and arranged in the factorised form up to prefactors due to the non-dynamical anomalies. As we will see in some explicit case, for anomaly free theories we also have (4.63) We are thus led to try to use the integrand Υ 4d to define 4d blocks via block integrals as in the 3d case. We will return to this in section 6.
In [46] it was pointed out that the anomaly cancellation conditions are necessary to express the partition function on Hopf surfaces H p,q ≃ S 1 ×S 3 in terms of periodic variables (under S 1 shifts) consistent with the invariance under large gauge transformations.
To understand the effect of large gauge transformations at the level of the blocks, it is useful to look first at the semiclassical limit τ = R 1 → 0, where we remove the Ωdeformation on the disk by turning off the equivariant parameter ( → 0). In this limit the theory is effectively described by a twisted superpotential obtained by summing over the KK masses i R 1 and iσ R 1 due to the torus compactification of the 4d theory [49]. The contribution of a chiral multiplet to the twisted superpotential is given bỹ This sum needs to be regularised, in appendix B.3 we briefly review how one can do that, the result isW where We can immediately identify in (4.65) the semiclassical limit of the anomaly free chiral while P 3 contributes to the anomaly polynomial on R 2 × T 2 σ . As it will become important later on, we observe that while the twisted superpotential as defined in (4.64) is invariant under large gauge transformations being manifestly doubly periodic on the torus T 2 σ , i.e. invariant under a → a + i R 1 (σn + m), the regularisation produces polynomial terms which explicitly break the periodicity. Therefore the semiclassical analysis shows that anomalies represent an obstruction to the periodicity/gauge invariance of the superpotential. 12 We then see that the block integrands of anomaly free theories defined in (4.62), in the semiclassical limit are doubly periodic on the torus. In section 6 we will return to this point and see that at the quantum level, the invariance under large gauge transformation will be preserved only up to q τ -phases.

SQED
We will now study two interacting theories to illustrate the general mechanism of factorisation. Our first example will be the U (1) theory with N f chirals and N f antichirals, with R-charge R and an FI terms (SQED). In this case the lens index reads where we parametrise the fugacities as with associated holonomies , H a ,H b . It is also useful to introduce the combinations We evaluate the lens index by taking the sum of the residues inside the unit circle at the poles where j, k ∈ Z ≥0 . The detailed computation is performed in appendix B.4, here we report the key steps. We first perform the modular transformation using (4.22) for the fundamentals and (4.23) for the antifundamentals, and we get a,bÎ (R) . (4.73) As we discussed, the modular transformation produces polynomials contributing to the global and local anomalies. The dynamical part of the 4d anomaly (P loc ) must vanish on this physical theory. In fact, as this theory is non-chiral, the GGG anomaly vanishes automatically, while the cancellation of the GGF anomaly requires the balancing of the U (1) flavour charges of fundamentals and antifundamentals In order to cancel the GGR anomaly the condition is 13 which fixes R = 1. For the vanishing of the GFF anomaly we must require The other anomalies also vanish without imposing any further constraint. What is left of the 4d anomaly is the global part (P gl ), which reduces just to the FFF term.
Since we used (4.22) for the fundamentals and (4.23) for the antifundamentals, the Z 2 terms in P 3d loc are automatically cancelled. We could have also used (4.23) (or (4.22)) for both fundamentals and antifundamentals as well. This would have led to a different but of course equivalent form of the integrand. Altogether the 3d anomaly contributions yield the global factor P 3d gl and a renormalisation of ξ 4d , θ, which are however trivial once we impose (4.74), (4.75), (4.77) and (4.78).
Finally we find where we introduced the holomorphic variables

81) and used (A.49) to write
(4.82) as in 3d. Notice the integrand Υ 4d SQED in (4.80) could have been assembled by adding a 4d block B 4d D for each chiral and a block B 4d N for each anti-chiral plus the FI contribution. In this case the polynomial P 3d loc defined in (4.61) vanishes. Finally by taking the sum of the residues at the poles (4.72), we obtain 84) where the elliptic series N E N −1 is defined in (A.67). For r = 1 our result agrees with [17] (after a modular transformation). Notice that the cancellation of the GGF anomaly is related to the balancing condition (A.68) of the elliptic series, while the GFF anomaly cancellation to its modular properties (A.73). The sum over c runs over the supersymmetric vacua given by the minima of the the twisted superpotential discussed in the previous section.
It is easy to write down a difference operator for these blocks. We find that the elliptic hypergeometric series (A.67) is annihilated by the operator where for convenience we denoted we see that the blocks B 4d c are solutions to the difference operator for c = 1, . . . , N f . As we have already noticed in the case of the free chiral, if we define the blocks B 4d c as solutions to this difference operator with the additional requirement that their r-square reproduces the partition function (4.83), we still have the q τ -phases ambiguity. For example we can multiply the blocks by the elliptic ratio of theta functions which satisfies c(q τ u 4d ; q τ ) = c(u 4d ; q τ ) and has unit r-square when the anomaly cancellation conditions (4.74), (4.75), (4.77), (4.78) are imposed. It is also easy to check that , eq. (4.90) has a trivial semiclassical limit. Indeed in general q τ -phases are not visible in the the semiclassical asymptotics.
We conclude by checking the 3d limit of our results. At the level of the 4d blocks this amounts to take q σ → 0, yielding with the obvious identifications .

(4.92)
Notice that the 3d mass parameters are still restricted to satisfy the 4d anomaly cancellation conditions. As explained in [50], the reduction of the 4d index to 3d generates theories with the same gauge and matter content of the original theory but with a compact Coulomb branch and with non-trivial superpotential terms enforcing the restriction on the masses [50]. Moreover the relation between 4d and 3d FI parameters is consistent with a continuous 3d FI.

SQCD
We now move to the SU (2) theory with N f chirals and N f antichirals. The lens index reads: We can collect the flavour fugacities and background holonomies into We also define where M a ′ = (M a , −M b ) = −M b ′ . In this notation the matter sector reads exactly the same as the SQED theory with the replacements a → a ′ and b → b ′ , the only differences being the different R charge and the "reality" constraints X a ′ = −X b ′ , H a ′ = −H b ′ . The set of poles inside the unit circle we will sum over is also formally unchanged with respect to the abelian case (4.72) because the vector does not bring any pole.
The first step is to perform the modular transformation, which upon imposing the anomaly cancellation allows us to factorise the integrand as The GGF cancellation parallels the abelian case. The GGR anomaly cancellation for SU (N c ). All other anomalies vanish without imposing further conditions. Also in this case we observe that the integrand Υ 4d SQCD in (4.98) can be obtained by adding a 4d block B 4d D N for each chiral/anti-chiral plus the vector multiplet contribution. In this case however we need to take into account the polynomial P 3d loc , which, once the 4d anomaly cancellation conditions are imposed, contributes a factor s 2 2 r to the partition function.
We then take the sum of the residues at the poles. The detailed computation is performed in appendix B.5, here we give the final result in the fully factorised form where we introduced the very-well-poised elliptic hypergeometric series defined in (A.74). For r = 1 our result agrees with [17] (after a modular transformation).

N = 1 theories on S 2 × T 2
We now turn to the manifold S 2 × T 2 which supports N = 1 supersymmetric theories with R-symmetry. To preserve supersymmetry the theories need to be topologically twisted on S 2 and the R-charges need to be quantised. This background has been studied in [36], [37] and more recently in [15] and [38].
As in the twisted index case reviewed in section 3, the localising locus is parameterised by continuous variables Z in the Cartan and discrete variables in the maximal torus of the gauge algebra. The integer variables parameterise the quantised magnetic flux while z = e 2πiZ is a combination of the two holonomies on the torus. We also turn on analogous continuous and discrete variables for the non-dynamical symmetries. The partition function reads The contributions to the classical part come only from possible FI terms for U (1) factors e −Vol(T 2 )ζ = ξ .
The contribution of a chiral multiplet with R-charge R, U (1) fugacity z and flux H is given by 14 where we used the definition of Θ-factorials in (A.58) and defined B = H − R + 1. The vector multiplet contribution is given by 15 In the above expressions q σ = e 2πiσ is identified with the torus complex modulus and q τ = e 2πiτ with the angular momentum fugacity. By using that Θ(x; 0) = 1 − x, it is immediate to check that, in the q σ → 0 limit, the 1-loop contributions (5.3) and (5.4) tend to their counterpart on S 2 A × S 1 (up to the zero-point energy factor). Geometrically, the S 2 × τ T 2 σ background is realised by gluing two solid tori D 2 × τ T 2 σ twisted in the same direction so that to realise the A-twist on S 2 . We then expect that also in this case partition functions can be expressed in terms of the universal blocks B 4d c fused with the A-gluing defined by As clear from our discussion on anomalies, the free chiral alone is not expected to factorise, we need instead to look at an anomaly free object, for example The relation between our Theta function Θ(x; q σ ) and the theta function ϑ 1 (x; q σ ) appearing in [15,[36][37][38] is ϑ 1 (x; q σ ) = iη(q σ )q 1 12 15 Up to a zero-point energy contribution η(q σ ) 2 G ∏ α q 1 12 σ which can be absorbed in the integration measure. In [15] an extra (−1) α appears in the definition of the vector multiplet.
where we identified the holomorphic variable x with the combination x = z −1 q −H 2 τ . As expected showing that we need to multiply the anomaly free chiral by the factor z B 2 , which in the 3d twisted index limit we identified with a half CS unit, and by the zero-point energy.
FI terms can also be expressed as A-squares as in (3.8). Similarly, the vector multiplet contribution can be re-obtained by fusing two 4d blocks B 4d vec (4.35) with So we arrive at the conjectured relation The first equality states the factorisation of the integrand of the Coulomb branch partition function. This follows from the above discussion on chiral and vector multiplets. For anomaly free theories, the induced effective half CS units either cancel between chirals and antichirals or add up to integer values and can be factorised as in (3.8).
The second non-trivial equality states the factorisation of the S 2 ×T 2 partition function in terms of the very same 4d blocks B 4d c found in the L r × S 1 case. Let us explicitly check this relation in the SQED case. The partition function is given by where In this case the anomaly cancellation conditions are By using the definition of Θ-factorials in (A.58) it is easy to show that we can equivalently rewrite the partition function as with the SQED integrand defined in (4.80) with the identifications and The integration contour is determined by the Jeffrey-Kirwan residue prescription, which in this case simply amounts in taking the contribution from the simple poles associated to the fundamental matter (mod q Z σ ). Such factors have poles only for B c = +h c +1 > 0, which are then at and we can replace Substituting s * = q 2 z * = q k 1 τ x c ,s * = q − 2 z * = q −k 2 τxc into (5.17), with the help of (A.58), (A.59), one can finally show that with the very same B 4d c defined in (4.84). This is result agrees perfectly with the expected result following our analysis.
The SU (2) case is essentially the same, since the vector multiplet does not bring new poles to the integrand. We define and x a ′ = (x a ,x −1 b ) =x −1 b ′ with the same parametrisation as in (5.14). The anomaly cancellation requires As expected also the SQCD can be expressed in terms of the blocks B 4d c ′ given in (4.102)

4d holomorphic blocks
In this section we would like to develop a formalism to compute the holomorphic blocks from first principles by extending to 4d the 3d formalism introduced in [8]. We tentatively define 4d blocks via block integrals as where Υ 4d is the "square root" of the compact space integrand. As we have seen in sections 4.3 and 5, when there are no obstructions from anomalies it is always possible to factorise the compact space integrand. Alternatively one can assemble directly Υ 4d . For each chiral multiplet we insert a factor B 4d D or B 4d N and adding an appropriate ratio of Theta functions associated to P 3d loc to cancel the induced mixed CS units. We then add B 4d vec for each vector multiplet and in presence of U (1) gauge factors we multiply by the FI contributions given in (4.39).
Before discussing the integration contour it is important to make the following observation. In section 4.3 we observed that as a result of invariance under large gauge transformations, block integrals are semiclassically doubly periodic on the torus T 2 σ . As we anticipated, at the quantum level there is a mild modification, that is under the shift s → sq σ the blocks are multiplied by q τ -phases with unit r, A-square, representing the intrinsic ambiguity in their definition.
For example consider the SQCD block integrand .

(6.2)
It is easy to check that the effect of the shift s → sq σ is simply to multiply the integrand by the q τ -phase To see this we observe that thanks to the anomaly cancellation condition ∑ a ′ (Q−2X a ′ ) = 4Q we have and similarly As q τ -phases have trivial semiclassical limit, the doubly periodicity is indeed restored in the semiclassical limit.
This observation will guide us in the definition of the integration contour. For example the SQCD block integrand (6.2) has poles at s = x c ′ q k τ q n+1 σ and s =x c ′ q −k τ q −n σ , k, n ∈ Z ≥0 . However our discussion indicates that we should restrict to a q σ period. Indeed a shift by q n σ (where n may be negative) would only multiply the integrand and the integrated result by a q τ -phase. We then suggest that the proper integration contour Γ c will encircle the poles located at s = x c ′ q k τ coming from the fundamental chirals. Indeed it is easy to check that and integrating over Γ c we recover the SQCD blocks defined in (4.102) In general determining convergent contours could be quite delicate. For example the analogy with the 3d case suggests that by moving in the moduli we could encounter Stokes walls where contours jump [8]. We leave the general discussion of integration contours to future analysis. However, we can check that our prescription works also in the SQED case where blocks can be obtained by integrating the SQED integrand (4.79) , (6.8) along the contour Γ c encircling the poles located at z = x c q k τ ∮ Γc ds 2πis with B 4d c defined in (4.84). Notice that also in this case we are using the prescription to restrict to a q σ period. However, in this case the FI term explicitly breaks the periodicity already at the semiclassical level. Nevertheless we find that also in this case a q σ -shift has a trivial effect: . (6.10) Indeed the second factor is a q τ -phase once we impose all the anomaly cancellations. The first factor also has unit square 12) since ξ 4d r is integer on the lens index.
Summarising we have argued that for L r × S 1 (which includes S 3 × S 1 ) and S 2 × T 2 we have the following remarkable Riemann bilinear-like relations (6.14) This identities seem to be quite ubiquitous for these backgrounds and it would be important to have a deeper understanding of their geometrical meaning. Riemannbilinear like identities appear also in the analytic continuation of Chern-Simons theory [51] and in the the study of tt * geometries [21].
While 3d holomorphic blocks have been relatively well studied, here we have only initiated the study of 4d blocks and there are various directions to explore. For example it would be interesting to study the behaviour of 4d blocks under 4d dualities. It should be also fairly simple to re-derive our 4d block integrand prescription via localisation on D 2 × T 2 , however the general definition of integration contours seems quite challenging. Another aspect to investigate is the relation of 4d blocks to integrable systems and to CFT correlators. 3d block integrals have been identified with q-deformed Virasoro free-field correlators in [52], [53]. The possibility to interpret 4d block integrals as freefield correlators in an elliptic deformation of the Virasoro algebra will be investigated in [54].

Acknowledgments
SP would like to thank T Dimofte for collaboration on related topics. FB and SP would like to thank G Bonelli and F Benini for discussions. The work of FN is partially supported by the EPSRC -EP/K503186/1.

A Special functions
A.1 Bernoulli polynomials The quadratic Bernoulli polynomial B 22 is Useful properties are We define the combination We also have The cubic Bernoulli polynomial B 33 is (A.7) Useful properties are We define the combination We also have

(A.27)
Another useful function is the shifted double Sine function s b 28) in which case it is usually assumed

A.3 Generalised double Sine function
The following ζ-regularised product S 2,h (X) = n 1 ,n 2 ≥0 n 2 −n 1 =h mod r n 1 ω 1 + n 2 ω 2 + X n 2 ω 1 + n 1 ω 2 + Q − X , (A.29) defines a generalisation of the S 2 function (which is recovered for r = 1). 16 The parameters ω 1 , ω 2 and r are not displayed amongst the arguments for compactness. For irrational ω 1 ω 2 , it has simple zeros and poles at zeros ∶ X = −n 1 ω 1 − n 2 ω 2 poles ∶ X = Q + n 1 ω 2 + n 2 ω 1 , n 2 − n 1 = h mod r , n 1 , n 2 ∈ Z ≥0 . (A.30) We can rewrite S 2,h in terms of the ordinary S 2 as follows. First of all, we can resolve the constraint n 2 − n 1 = h mod r as where [h] denotes the smallest non negative number mod r. 17 Then we can write (A.29) as where in the last step we used that in the denominator s ∈ [0, r −1] < r so that ⌊s r⌋ = 0. Substituting the actual expression (A.32) for f s,k , we finally get where we used the definition (A.17) of S 2 and repeatedly used the relation (A.15). It is easy to check the following reflection property From (A.34) we see that zeros and poles are located at for k, n ∈ Z ≥0 , which are all simple and distinct as long as ω 1 ω 2 is irrational. Using (A.26) we can obtain the factorised form This leads us to define the r-pairing exchanging ω 1 , ω 2 and reflecting the holonomy variable, so that S 2,h can be compactly represented as Notice we may remove the [⋅] inside the q-Pochhammer symbols because of the periodicity. Moreover, the asymptotic behaviour of S 2,h for X → ∞ can be deduced from (A.27) .
(A. 40) In the main text we need also to introduce an improved S 2,h , defined bŷ where σ(h) is a sign factor, namely σ(h) = ±1 depending on the value of h. Also, it is convenient to introduce the improved s b function In the particular case r = 1 (and hence h = 0), we obtain an interesting identity for the ordinary S 2 . In fact, for r = 1 the product in (A.29) is not actually restricted, and we obtain the relation 44) or, in terms of the modular parameter τ = ω 2 where we rescaled χ = X ω 1 . This identity appears in eq. (3.38) of [56], where 46) in their notation.

A.4 Elliptic functions
The short Jacobi Theta function is defined by where m ∈ Z ≥0 . We will be using the generalised modular transformation property of the theta function For r = 1 this formula reduce to the standar modular transformation of the theta function (see for example [57]).
The elliptic Gamma function is defined by where the double q-Pochhammer symbol is defined by It is assumed p , q < 1 for convergence, and it can be extended to q > 1 by means of The elliptic Gamma function Γ(x; p, q) has zeros and poles outside and inside the unit circle at zeros ∶ x = p m+1 q n+1 , For m, n ∈ Z ≥0 , useful properties of the elliptic Gamma function are where we introduced the Θ-factorial Θ(x; p, q) n = Γ(q n x; p, q) A useful propety which can be derived from the definition is The elliptic Gamma function has a very non-trivial behaviour under modular transformations [39,57] Γ(e 2πi ω 1 , (A.60) Expression (A.60) is valid for Im ω i ω j≠i ≠ 0. In particular, by assuming Im ω 1 cq ; u with q > 1. In this case we have Also, for q > 1 we have the following identity

A.5 Elliptic series
Let us consider the elliptic hypergeometric series [58] This series is usually considered to be balanced, namely i,j We now introduce the parametrisation q τ = e 2πiτ , q σ = e 2πiσ , x i = e 2πiX i , y j = e 2πiY j , (A.69) and study the modular properties of the series under Using the modular transformation property Θ(e 2πiX i ; e 2πiσ , e 2πiτ ) n Θ(e 2πiY j ; e 2πiσ , e 2πiτ ) n × × N i,j=1 or by a suitable transformation of the expansion parameter u .

B.1 Fundamental Abelian relation
The free chiral theory with −1 2 Chern-Simons units has a mirror given by the U (1) theory with 1 chiral and 1 2 Chern-Simons units (also for the holonomies).
At the level of lens space partition functions the duality reads (up to a trivial proportionality constant) r−1 =0 R dZ 2πi e − iπ r (Z 2 +2Z(ξ−iQ 2)) e −(r−1) iπ r ( 2 +2 θ) Z ∆ (Z, ) = Z ∆ (ξ, θ) , (B.1) where we have also turned on the FI and θ terms. To prove this identity we evaluate the l.h.s. integral by closing the contour in the lower half plane (assuming ξ > 0) and taking the sum of the residues at the poles of Z ∆ . By using (A.36) we can see that there are two sets of poles located at Using (q n x; q) ∞ = (x;q)∞ (x;q)n , we get Therefore we find Z SQED can be expressed in terms of the r-square of the q-hypergeometric series

B.3 Twisted superpotential
In this appendix we briefly review how the double sum defining the twisted superpotential (4.64) can be regularized in two steps, first regularizing the sum over m, and then over n. 20 In order to regularise the sum over m, let us consider the exponential derivative  We regularize the other infinite sums by means of Hurwitz ζ-function 21 and we get 1 2πR 1 n≥1 π 2 3 + 2π 2 (nσ − iR 1 a) + 2π 2 (nσ − iR 1 a) 2 + n∈Z πR 1 2 a + i R 1 nσ 2 = P 3 (iR 1 a) . (B.25)
text. First of all, expanding the polynomials Φ 2 we get the exponential factor , (B.31) 22 It is understood that we are taking the residue of the a = c term. and similarly on the second family. We can now resolve the sum by using (B.6) as in 3d, and we find I SQED can be written in terms of the r-square of the elliptic hypergeometric series N E N −1 defined in (A.67)