Exact results for ${\cal N}=2$ supersymmetric gauge theories on compact toric manifolds and equivariant Donaldson invariants

We provide a contour integral formula for the exact partition function of ${\cal N}=2$ supersymmetric $U(N)$ gauge theories on compact toric four-manifolds by means of supersymmetric localisation. We perform the explicit evaluation of the contour integral for $U(2)$ ${\cal N}=2$ theory on $\mathbb{P}^2$ for all instanton numbers. In the zero mass case, corresponding to the ${\cal N}=4$ supersymmetric gauge theory, we obtain the generating function of the Euler characteristics of instanton moduli spaces in terms of mock-modular forms. In the decoupling limit of infinite mass we find that the generating function of local and surface observables computes equivariant Donaldson invariants, thus proving in this case a long-standing conjecture by N. Nekrasov. In the case of vanishing first Chern class the resulting equivariant Donaldson polynomials are new.

On the other hand, it is known since the seminal paper [24] that twisted N = 2 supersymmetric gauge theories can be formulated on any Riemannian four-manifold and their observables realise many interesting topological invariants such as Donaldson invariants [25] and knot invariants [26,27]. A refinement of these invariants can be provided on four-manifolds admitting isometries by considering their equivariant extension, which in physical language corresponds to turning on the Ω-background [12]. However, few explicit calculations are availble in this case.
The aim of this paper is to apply the supersymmetric localization technique to a suitable class of compact four manifolds. In [23] (see also [28]) Killing spinor solutions implementing an equivariant extension of the Witten twist were found on any Riemannian four manifold admitting a U(1) action and this was used to study the case of S 2 × S 2 . In this paper we discuss more general toric complex surfaces and perform explicit computations in the case of P 2 as a testing ground. An important difference between compact and non-compact four-manifolds is obviously related to the issue of boundary conditions. For N = 2 gauge theories on non-compact manifolds the partition function depends on the v.e.v. of the scalars a ρ sitting in the vector multiplet.
The presence of this v.e.v. is indeed crucial in order to localize to isolated fixed points in the instanton moduli space and reduces the evaluation of the partition function to a combinatorial problem. In this context, a ρ s represent the equivariant weights associated to the action of the Cartan torus of the gauge group.
On the other hand, on compact manifolds, in order to have exact smooth instanton solutions one sets a ρ = 0 [24]. The supersymmetric fixed-locus in this case is given by the full instanton moduli space. However, the contribution to the evaluation of 1/2 BPS observables in N = 2 theories is fully captured by singular gauge field configurations sitting at the boundary of the instanton moduli space [29,30]. A suitable (partial) compactification and desingularization of this space is provided by considering the moduli space of torsion free sheaves on the fourmanifold, which locally corresponds to turning on a non-commutative deformation [31]. The boundary is in this case provided by ideal sheaves, which correspond to copies of point-like U(1) non-commutative instantons.
The strategy we follow is then to use the equivariant twisted supersymmetry of [23] to directly localize the path integral to point-like instantons sitting at the zeroes of the vector field generating the U(1) action. The contribution of each of these points is given by a Nekrasov partition function on the corresponding affine patch ∼ C 2 . In this context, the equivariant parameters a ρ are intended as classical solutions to the fixed point equations and as such have to be integrated over. This result is in agreement with a proposal made by Nekrasov [32] for the calculation of the N = 2 partition function on compact toric manifolds 1 .
Let us notice that another important issue arising in the study of N = 2 supersymmetric gauge theories on compact manifolds is the appearance of extra gaugino zero modes. As we will show in the following, a proper treatment of these modes provides the prescription for the contour integration on the Coulomb branch parameters a ρ .
On the mathematical side, the difference between the non-compact and compact cases is that in the former one has to consider the moduli space of framed instantons and correspondingly of framed torsion-free sheaves for its compactification, while in the latter there is no framing.
We recall that the framing correspond to a trivialization of the fiber at a point, which implies that the moduli space includes global gauge transformations acting on the framing. Framed instanton moduli spaces are hyperkähler and have deep links to representation theory of infinite dimensional Lie algebrae and Geometric Invariant Theory [34]. They are much more amenable to equivariant localization than the corresponding unframed moduli spaces. On the other hand, the latter bring important information, as for example Donaldson invariants are formulated via intersection theory on them. In [32] Nekrasov conjectured that the integration over the Coulomb branch parameters in the N = 2 partition function over compact toric surfaces produces precisely the corresponding Donaldson invariants. In this paper we will prove this conjecture for U(2) gauge theories on P 2 by specifying the integration contour and by spelling out the conditions imposed on the fixed point data by the stability conditions on the equivariant sheaves. For U(2) gauge theory the contour integral evaluation corresponds to taking the residue at a ρ = a 1 − a 2 = 0, in line with Witten's arguments [24]. We will find that for odd first Chern class the N = 2 generating function of local and surface observables indeed calculate the equivariant Donaldson invariants obtained in [35]. This follows by comparing our formula (3.43) with the results of theorem 6.15 in [35] as explained in detail in section 3.5. Let us underline that our approach holds also in presence of reducible connections, which contribute for even first Chern class, where the method of [35] does not apply. We calculate the equivariant Donaldson polynomials in this case too and we match their non-equivariant limit with the SU(2) Donaldson polynomials computed in [36]. Let us remark that the pure partition functions are expected to count the zero dimensional components of the instanton moduli space [24]. Our findings are in full agreement with this expectation implying non trivial cubic identities on the Nekrasov partition functions.
We also consider N = 2 * gauge theory, that is Super-Yang-Mills theory in presence of a 1 N = 2 theories on toric Kähler manifolds have been recently analyzed also in [33].
hypermultiplet of mass M. This theory interpolates between pure N = 2 in the decoupling limit M → ∞ and N = 4 for M → 0. In the latter case the partition function is expected to be the generating function of the Euler characteristics of the moduli space of unframed sheaves.
We provide a check of this for U(2) gauge theories on P 2 . For odd first Chern class we get results in agreement with [37], and for even first Chern class we compare with the results obtained by Yoshioka using finite field methods [38,39].

⋆ ⋆ ⋆
The paper is organised as follows. In Sect. 2 we discuss the general features of N = 2 gauge theories on complex four-manifolds and discuss equivariant observables. We then specialise to compact toric surfaces discussing the supersymmetric fixed points and the contour integral formula obtained by properly treating the fermionic zero-modes. The master formula for the generating function of local and surface observables is presented in equation (3.9), specialising to U(2) gauge theories on P 2 . In Sect. 3 we focus on U(2) Super Yang-Mills on P 2 .
We study in detail the analytic structure of the integrand by making use of Zamolodchikov's recursion relations for Virasoro conformal blocks. We then evaluate explicitly the contour integral. Our main results are equation (3.43) and (3.70) for odd and even first Chern class respectively. We then proceed to the non-equivariant limit ǫ 1 , ǫ 2 → 0 and compare with the results in the mathematical literature. In subsection (3.8) we discuss the calculation of the pure partition function on P 2 which implies remarkable cubic identities for the Nekrasov partition function. In Sect. 4 we study the N = 2 * theory and discuss the zero mass limit which we find to calculate the generating function of Euler characteristics of moduli spaces of rank-two sheaves. Our main result is (4.20) which includes also the contribution of strictly semi-stable sheaves. We finally discuss the (mock-)modular properties of the N = 4 partition function.
Sect. 5 contains a discussion on open problems and the Appendix describes the relation between the supersymmetric fixed point data and Klyachko's classification of semi-stable equivariant sheaves.
2 N = 2 gauge theories on complex surfaces and

Hermitian Yang Mills bundles
In this section we discuss U(N) N = 2 gauge theories on complex surfaces and specify the results of [23] to toric surfaces.
Four dimensional N = 2 gauge theories can be considered on any orientable four manifold M upon a proper choice of the R-symmetry bundle [24]. The sum over the physical vacua contributing to the supersymmetric path-integral depends of course on the specific gauge group at hand. In the case of SU(N) gauge theories, these are completely described in terms of anti-selfdual connections F + = 0, once the orientation on M is chosen. In the U(N) case extra contributions arise from gauge bundles with non trivial first Chern class. Indeed, beyond anti-instantons, one has to consider gauge bundles with first Chern class aligned along H + (X, Z). This led in [23] to consider the gauge fixing of the supersymmetric path-integral in a split form, where the U(1) sector is treated separately. If M is an hermitian manifold , an equivalent procedure is given by gauge fixing the path-integral to Hermitian-Yang-Mills (HYM) connections where F (2,0) is the (2, 0) component of the gauge curvature in a given complex structure, g is the hermitian metric on M and λ is a real parameter.
If the manifold M is Kähler, then (2.1) reads is the slope of the vector bundle. Here r(E) = N is the rank of E and c 1 (E) = 1 2π TrF E its first Chern class. In the rest of the paper we consider Kähler four manifolds admitting a U(1) action with isolated fixed points. In this case, as shown in [23], one can improve the supersymmetric localization technique by making it equivariant with respect to such a U(1) action and localize on point-like instantons. The resulting partition function is obtained by a suitable gluing of Nekrasov partition functions which includes the sum over fluxes and the integration over the Coulomb parameters.
In the twisted variables, the supersymmetry reads as In (2.3) ι V is the contraction with the vector field V and L V = Dι V + ι V D is the covariant Lie derivative. On a Kähler four manifold self-dual forms split as Let us notice that the supercharge (2.3) manifestly satisfies

Consistency
of the last line implies that the V -action preserves the self-duality of B + and χ + , that is where ⋆ is the Hodge-⋆ and L V = dι V + ι V d is the Lie derivative. This condition coincides with the requirement that V generates an isometry of the four manifold.
The supersymmetric Lagrangian we consider is where c is a constant 2 , τ is the complexified coupling constant, γ ∈ H 2 (M) is the source for the c 1 of the vector bundle and V is a gauge invariant localizing term, chosen in order to implement the Hermitean-Yang-Mills equations, namely The integration over B (0,2) and b in (2.5) implies the Hermitean Yang-Mills equations (2.2) as delta-gauge conditions. In particular, the path integral over the field b ensures the semistability of the bundle 3 . Recall that [43] a bundle E is said to be (slope) semistable if for every proper sub-bundle G ⊂ E, the slope of the bundle µ(E), defined below (2.2), is greater or equal than the slope of the sub-bundle µ(G). If it is stricly greater E is said to be stable. If the bundle E admits a sub-bundle G, then the b field has an integration mode proportional to the projector onto G, namely ib 0 Π G . The connection splits as and the curvature accordingly as Let us focus on the integral along the above integration mode. The corresponding term in the action comes from and reads 2 Different values of c in (2.5) produce different expansion in the final formula. The usual choice is c = 0, which produces an expansion in the instaton number, or equivalently in the second Chern character ch 2 = c 2 2 − 1 2 c 2 1 of the bundle. The choice c = 1 produces an expansion in the second Chern class c 2 and the choice c = 1 2 produces an expansion on the discriminant D of the bundle. In comparing the result of the paper with the literature we will use the last two choices. 3 The semi-stability of the bundle and HYM condition are actually equivalent. This is the so called Hitchin-Kobayashi correspondence, that was proven in [40,41,42].
Therefore the path integral includes the term which, because of M |n| 2 ≥ 0, implies that the partition function is supported on vector bundles for any sub-bundle G, that is on semi-stable vector bundles. Notice that this condition depends on the point in the Kähler cone defining the polarization ω.

Equivariant observables
In this subsection we discuss equivariant observables in the topologically twisted gauge theory.
These are obtained by the equivariant version of the usual descent equations.
The scalar supercharge action can be written as the equivariant Bianchi identity for the curvature F of the universal bundle as [44] DF where D is the covariant derivative. Therefore, for any given ad-invariant polynomial P on the Lie algebra of the gauge group, we have As far as the U(N) gauge theory is concerned, we can consider the basis of single trace observables P n (x) = 1 n Tr x n with n = 1, . . . N. The equivariant cohomology splits in even and odd parts which can be discussed separately.
We focus on the relevant observables corresponding to the even cohomology. The two cases to discuss in the U(2) theory are n = 1, 2. The first M Tr F ∧ Ω is the source term for the first • for Ω = (ω + H) ∧ (ω ′ + H ′ ) + K, with ω + H and ω ′ + H ′ as in the previous item and K a quadratic, coordinate independent, polynomial in the weights of the V-action, we get • local observables at the fixed points Tr Φ 2 (P ), for Ω = δ P the Poincaré dual of any fixed point P under the V -action.
Let us remark that local observables in the equivariant case depend on the insertion point via the equivariant weights of the fixed point. This is due to the fact that the equivariant classes of different fixed points are distinct. From the gauge theory viewpoint one has so that the standard argument of point location independence is flawed by the first term in the r.h.s.
Indeed the set of equivariant observables is richer than the set of non-equivariant ones. Also the observables in (2.18) reduce in the non equivariant limit to local observables up to a volume factor.
The mathematical meaning of these facts is that the equivariant Donaldson polynomials give a finer characterization of differentiable manifolds. The physical one is that the Ω-background probes the gauge theory via a finer BPS structure.

Gluino zero modes and contour integral prescription
An issue that we have not analyzed till now is the existence of gluino zero modes and its consequences in the evaluation of the path integral.
The fermionic fields are the scalar η, the 1-form Ψ and the selfdual 2-form χ + . The number of zero modes is given by the respective Betti numbers b 0 = 1, b 1 = 0 and b + 2 = 1 times the rank of the gauge group 4 . Specifically, the χ + zero mode is proportional to the Kähler form ω. 4 We remind the reader that b + 2 = 1 for all toric surfaces.
The discussion on the integration on the zero-modes for the complete U(N) theory is naturally split in the U(1) sector and the SU(N) sector. Actually, the two sectors are different in nature. The first is related to a global symmetry of the theory while the second to the structure of the moduli space at the fixed points of the supercharge of the microscopic theory.

The zero modes in the U(1) sector
The zero modes in the U(1) sector come as a quartet of symmetry parameters of the whole twisted super-algebra. The c-number BRST charge implementing this shift symmetry is given by 20) and the action of Q on the c-number parameters above is given by so that the gauge fixing action (Q + q)ν gives a suitable measure to integrate out these modes as a perfect quartet.
The only U(1) zero mode who survives is that of the B field which is still playing as a Lagrange multiplier for the HYM equations.

Zero modes in the SU(N) sector and integration contour prescription
In this subsection we show that by correctly treating the issue of gaugino zero modes in the SU(N) sector we get precise instructions about the integration on the leftover N − 1 Cartan The presence of gaugino zero modes implies a ghost number anomaly that has to be compensated by the insertion of appropriate supersymmetric terms which cancel the ghost number excess and soak-up the fermionic zero modes. The path integral as it stands is indeed undefined and its measure has to be improved. In order to do this we add to the localizing action the further term where ρ spans the su(N) Cartan subalgebra. By renamingā →ā/s and letting s → ∞ we then get Similar arguments appeared in the evaluation of the low-energy effective Seiberg-Witten theory [45]. The integrals over the N − 1 zero modes of b are taken by evaluating at b = 0 by Cauchy theorem. This implies that the leftover integral over the Cartan parameters is a total differential in theΦ zero-mode variables, namely inā ρ , so that it gets reduced to a contour integral along the boundary of the moduli space of solutions of the fixed points equations that will be discussed in the next subsection.
Let us notice that the way in which we have soaked up the (η, χ) fermionic zero modes in (2.23) implies that the path integral localizes on configurations satisfying a more general condition than the Hermitian Yang-Mills equation. This is due to the fact that the b-field zero modes along the Cartan of su(N) are not playing the role of Lagrange multipliers anymore. Therefore the gauge fixing condition results to be F + = ωt, where t is a constant Cartan element in u(N), instead of (2.2). The former is indeed the condition satisfied by the supersymmetric fixed points that we will discuss in the next subsection.

Localization onto the fixed points
The localization proceeds as follows: by setting the fermions to zero, the fixed points of the supercharge read and their integrability conditions By using the reality condition for the scalar fieldsΦ = −Φ † and the first of (2.27), the first of (2.26) splits in two, that is which imply that Φ andΦ lie in the same Cartan subalgebra. By reasoning in an analogous way on the second equation in (2.27), we get that the gauge curvature too is aligned along the Cartan subalgebra.
We now describe the solution in detail for compact toric manifolds. These latter are described by their toric fan [46]. The supersymmetry algebra is equivariant with respect to the maximal torus U(1) N +2 , where the first factor is the Cartan torus of the gauge group and the second is the isometry V of the four manifold 5 . In components, labeled by α = 1, . . . , N, we Let us denote by H (ℓ) the zero-form part of ω (ℓ) . We get The values of Φ α at each fixed point P (κ) will be denoted by In ( We remind the reader that the Chern classes of the point-like instantons are given by (2.32) Summarizing, we find that the localization procedure implies that the partition function is written as a product of copies of the Nekrasov partition function in the appropriate shifted variables glued by the integration over the Cartan parameters {a αβ }.
The integration contour is specified according to the discussion in the previous subsection as follows. Solving the fixed point equations we bounded the field theory phase to the deep Coulomb branch by declaring Φ andΦ to lie at a generic point in the Cartan subalgebra where the gauge symmetry is maximally broken as U(N) → U(1) N . This implies the integral over (a,ā) to be in C N −1 \ T where T is a tubular neighborhood of the hyperplanes set ∆ = {a α − a β = 0}. This choice guarantees maximal gauge symmetry breaking. Henceforth, by using Stokes theorem in formula (2.25), we find that the complete partition function is given by a contour integral around the above regions of the leftover terms in the path integral evaluation.
In particular, for N = 2 we find a single contour integral around the origin in C.
Moreover, the stability condition on the equivariant unframed sheaves induces constraints on the allowed values of the fixed points data k (ℓ) . We will describe in Sect. 3 the details of all this for U(2) gauge theories on P 2 . 6 Locally this compactification can be regarded as a non-commutative deformation in the affine patch of M .

Exact partition function on P 2 and equivariant Donaldson Invariants
Let us denote the homogeneous coordinates of P 2 by [z 0 : z 1 : z 2 ]. The (C * ) 2 torus action, generated by the vector 7 , acts on homogeneus coordinates as [z 0 : e ǫ 1 z 1 : e ǫ 2 z 2 ]. In local . The fixed points under the V -action are denoted by and, setting k The fixed point data on P 2 are described in terms of a collection of Young diagrams { Y ℓ }, and of integer numbers { k (ℓ) } ℓ = 0, 1, 2 describing respectively the (C * ) N +2 -invariant point-like 7 In local coordinates x (0) = z 1 /z 0 , y (0) = z 2 /z 0 in the patch z 0 = 0 the vector has the following expression instantons in each patch and the magnetic fluxes of the gauge field, which correspond to the first Chern class c 1 as prescribed by (2.32).
The explicit expression at the three fixed points P (ℓ) of the V -equivariant local and surface observables introduced in section 2.1 is given as follows. By calling for brevity where H was defined in formula (2.17), we can write the most general equivariant extension α where ω is the Fubini-Study form of P 2 and h a linear, coordinate independent, polynomial in the weights of the V -action. The evaluation at the fixed points of the observables α, p, with The full U(2) partition function on P 2 is given by where q = exp(2πiτ ) is the exponential of the gauge coupling and q (ℓ) = q e ı * P (ℓ) (αz+px) is the one shifted by the observable (3.8) evaluated at the fixed points P (ℓ) of P 2 . Finally y is the source term corresponding to the Kähler form tω with t the complexified Kälher parameter, so that y = e 2πt .
The integration in (3.9) realizes an isomorphism between the fixed points of the unframed moduli space of equivariant rank two sheaves on P 2 and copies of the fixed points of the framed moduli space on P 2 . Details of this isomorphism are presented in the explicit computation below and, in the case of odd c 1 , reproduce exactly the results of [35].
The stability conditions constraining the fixed point data k (ℓ) α 's are obtained by mapping these latter to the data describing unframed equivariant sheaves in terms of filtrations as in [47]. More details are provided in the Appendix.
The factors appearing in (3.9) are the Nekrasov full partition functions whose explicit expressions we report below.
In the following we will compute the integral (3.9) with x = z = 0 (so q (ℓ) = q) and y = 1.
The case with x, z = 0, y = 1 is a straightforward modification of the calculations below. In particular if one keeps x, z = 0 the result of the integration will give the generating function for equivariant Donaldson invariants for P 2 .

Classical action
The classical part of the partition function coming from (3.10) is given by evaluating (2.5) on the supersymmetric minima (2.29) Inserting the values of the equivariant weights (3.1) and (3.5) we obtain where we defined and 1 defined in (2.32). The sum in front of the full partition function can be rewritten as where we have performed a zeta function regularization of the sum over two integers, since the full partition function will depend only on p, q, r, c 1 . Moreover is enough to consider only the cases c 1 = {0, 1}, because we are considering a rank two bundle, therefore the moduli spaces of two bundles with both c 1 = 0 (or 1) mod 2 are isomorphic after the twist by a line bundle. 9 As discussed in section 2 the Hermitian-Yang-Mills equation implies semi-stability of the bundle. This in turn consists in some restrictions on the integers {k} in the summation of (3.9) which will be discussed in subsections 3.5, 3.6 and in the Appendix. 9 The case c 1 = 0 or equivalently c 1 = even hides some subtleties since the bundle can be reducible and the moduli space becomes singular [48]. We will in fact treat this case separately.

One-loop contribution
The one-loop contribution in (3.9) is given by where a αβ := a α − a β and the double gamma-function is defined as with Re(ǫ 1 ) and Re(ǫ 2 ) positive. We have a αβ = {a 12 , a 21 } =: {a, −a} and similarly p αβ =: {p, −p} etc. 10 Inserting the values of the equivariant weights (3.1), (3.5) and using the definition of γ ǫ 1 ,ǫ 2 (3.17) we can write where we defined 11 x := e ǫ 1 t and y := e ǫ 2 t , and P ± (x, y) is a rational function in x and y with N := p + q + r an integer with the same parity of c 1 (3.15). The values of P ± (x, y) on we arrive at the following expression for P ± (x, y): • N ≥ 0.
10 Note that this differs from the usual convention a αβ =: {2a, −2a}. 11 This choice of analytic continuation implies that γ ǫ1ǫ2 (x) has a branch cut for x > 0.
Inserting this result back in (3.18) and using the definition of the Gamma function: we obtain for Z P 2 1-loop of (3.16) the following results • N = 0 where the symbols ⋄ over the products in the second lines of formulas (3.25), (3.26) mean that those products are equal to 1 if |N| < 3. The only relevant case is actually that with p, q, r ∈ Z ≥0 . This can be seen by a direct computation which shows that the final result does depend on the absolute values of p, q, r only. Therefore from now on we assume N ≥ 0.

Instanton contribution
The instanton contribution in (3.9) is given by where Z C 2 inst is the Nekrasov partition function defined as follows. Let Y = {λ 1 ≥ λ 2 ≥ . . . } be a Young diagram, and Y ′ = {λ ′ 1 ≥ λ ′ 2 ≥ . . . } its transposed. λ i is the length of the i-column and λ ′ j the length of the j-row of Y . For a given box s = {i, j} we define respectively the arm and leg length functions Note that these quantities can also be negative when s does not belong to the diagram Y . The fixed points data for each patch are given by a collection of Young diagrams α }, and the instanton contribution is [12,49,13] where q = exp(2iπτ ) and (3.30)

Analytic structure of the integrand
In order to integrate the full partition function (3.9) along a we need to study the analytic structure of the integrand.
The instanton partition function (3.29) has simple poles at a ≡ a 12 = mǫ 1 + nǫ 2 , m, n ∈ Z , m · n > 0. (3.31) This behavior can be displayed explicitly by the Zamolodchikov's recursion relation [50] which was analyzed for gauge theories in [51]. In the evaluation of the integral it will be very useful to write it as Therefore the product of the three instanton partition functions coming from the three patches in all the points of the lattice that are not along the three straight lines (3.35). This implies that the integration of Z full will be given by the sum of the residues of simple poles inside the 12 We consider ǫ 1 , ǫ 2 to be incommensurable. 13 Indeed in the case N = 0 the integrand in (3.9) does not display any pole at the origin. 14 Of course if N < 3 there is none interior of the triangle, so only simple poles.  Res Z full (q; a, ǫ 1 , ǫ 2 ) a = iǫ 1 + jǫ 2 = (i,j)∈C lim a→iǫ 1 +jǫ 2 (a − iǫ 1 − jǫ 2 )Z full (q; a, ǫ 1 , ǫ 2 ), (3.36) and from the discussion in section 2.2.2 the only residue to evaluate is the one relative to the pole at the origin.

Exact results for odd c 1
Now we can perform the integration by residues evaluation as anticipated in (3.36). We are focusing on the case with c 1 = 1, the other case c 1 = 0 is more subtle and will be studied in a separate section.
From the analysis of the previous section we know that the full partition function has a pole at the origin only if the integers p = p 12 , q = q 12 , r = r 12 are strictly positive. Moreover we have to impose the stability conditions, which are discussed in the Appendix, see (A.13).
These, together with p + q + r + c 1 = even imply that the integers p, q, r have to satisfy strict triangle inequalities, namely p + q > r > 0, p + r > q > 0, q + r > p > 0.
where • the sum is over positive integers p, q, r satisfying the triangle inequality (3.37) and also p + q + r = odd, • the product is over the points of the lattice (i, j) ∈ (D (p,q,r) ∩Z 2 )\(0, 0); where the regions D (p,q,r) are the intersections of two triangles T 1 and T 2 , one of side p + q + r and the other of side p + q + r − 3: T 1 is delimited by the three straight lines T 2 is delimited by the three straight lines • we used the following notation We can compare the expression (3.38) with theorem 6.15 in [35]. Indeed, (3.38) coincide with the formula in [35] with x, z set to zero. Indeed the region D (p,q,r) defined above coincides with the one in Lemma 6.12 of [35].
To reproduce the full generating function of equivariant Donaldson invariant in [35] one should repeat the computation and the integration of Z P 2 full with x, z = 0 in (3.9). This implies a light modification in the calculations, namely one should replace q with q (ℓ) in every copy of Z C 2 full , with q (ℓ) defined below (3.9). Moreover we need to expand in the discriminant of the bundle (see (A.9) in appendix A), that is choosing c = 1 2 in (2.5). The result in this case is where sum and product are the same of (3.38). Since q = Λ 4 , formula (3.43) matches completely with the theorem 6.15 of [35]. 15 15 To be meticulous in [35] there is also an extra factor Λ −3 because that is a generating function in the dimension of the moduli space of unframed instantons, that for a generic metric is precisely dim = 2pq + 2pr + 2qr − p 2 − q 2 − r 2 − 3.

Proof of (3.38)
We evaluate the residue of Z full at a = 0, namely (3.44) We know from section 3.4 that p, q, r are strictly positive. Therefore we see from (3.31) and (3.34) that the three instanton partition functions have a simple pole each, which identifies the region with triple poles in figure 2. Moreover so we get a double zero from the one-loop part. Using (3.32) the instanton part is where similarly to (3.33) The triple pole is obtained by picking respectively from the three sums the terms (m = p, n = q), (m = q, n = r), (m = r, n = p) giving and we defined Note that Z Res is equal to the last line of (3.38).
When calculated at the point a = 0 the three factorsR (ℓ) can be rewritten as where the three regions U ℓ are depicted in figure 5 and are defined as: • U 0 is a rectangle 2p − 1 × 2q − 1 delimited by the four straight lines • U 1 is a parallelogram delimited by the four straight lines • U 2 is a parallelogram delimited by the four straight lines Since N ≥ 3 (3.45), from (3.25) we get for the one-loop part The double zero in a = 0 is hidden in the products (3.56) When evaluated in a = 0 the two products in (3.56) can be rewritten as where V 1 , V 2 are two triangles depicted in figure 6 and defined as: It is delimited by the three straight lines It is delimited by the three straight lines The residue evaluation is therefore (3.60) Comment: it is simple to verify that the number of points different from (0, 0) in the regions U ℓ ∩ Z 2 and V 1,2 ∩ Z 2 sum together to an even number. This means that the total product over these regions in (3.60) is invariant under the reflection (i, j) → (−i, −j).

The final result (3.38) is recovered by imposing the stability conditions (3.37) on (3.60).
The detailed derivation of these conditions is performed in the Appendix. Due to the strict triangle inequality we have and This means that (3.60) reduces to In formulae, we define the region r i , r j , r k . . . as the convex hull of the intersection points of all the straight lines r i , r j , r k . . . and call (3.64) Then we have U 0 = r 1 , r 2 , r 3 , r 4 , U 1 = r 3 , r 4 , r 5 , r 6 , U 2 = r 1 , r 2 , r 5 , r 6 , V 1 = r 2 , r 4 , r 6 , V 2 = r 1 , r 3 , r 5 , (3.65) from which (3.61) directly follows.
We will now show that (3.62) is equivalent to the triangle inequality. Indeed in general in (3.63)). This does not happen if the following three conditions are satisfied: 1. the segment between the vertex (p, −q + 1) of U 0 and the vertex (p, r − p − 1) of U 2 has distance strictly less than 2 (so that it cannot contain points of the lattice), so 2. the distance between the vertex (−p + 1, q) of U 0 and the vertex (r − q − 1, q) of U 1 must be strictly less than 2 3. the distance between the vertex (−p+1, −r+p−1) of U 2 and the vertex (−r+q−1, −q+1) of U 1 must be strictly less than 2 Indeed one can saturate one of the three inequalities, and so define a strict semi -stable bundle, only if the sum of the three integers p, q, r is even Technically nothing changes in the calculation since we already noticed that the full partition function Z P 2 full has a pole at the origin only if p, q, r > 0. We have only to add the contribution saturating (3.69). These kind of configurations have non trivial automorphism group, that is the action of a Z 2 -group. 16 Therefore in counting gauge invariant configurations one has to divide by the order of the automorphism group, namely ♯Z 2 = 2. This appears as a coefficient 16 A reducible U (2)-bundle splits in the sum of two line bundles as E = L 1 ⊕ L 2 . There is a Z 2 gauge symmetry exchanging the two line bundles as where p + q + r = even, a Let us underline that imposing the stability condition is crucial in order to get a finite ǫ 1 , ǫ 2 → 0 limit for the gauge theory partition function. Indeed we checked that removing the stability condition from (3.43) and (3.70) would produce partition functions which are diverging in that limit.

Non equivariant limit
In this section we will compare our results in the limit ǫ 1 , ǫ 2 → 0 with Donaldson invariants.
We start with the example of formula (3.43), that is known [35] to be the generating function of equivariant Donaldson invariants in the case of U(2)-bundle with c 1 = 1. This bundle can be reduced to a projective unitary group bundle P U(2) = SU(2)/Z 2 = SO(3). Therefore, in the limit ǫ 1 , ǫ 2 → 0 (3.43) should produce SO(3)-Donaldson invariants on P 2 . Indeed expanding 17 To obtain the partition function on P 2 is enough to put to zero x and z in (3.70) so that also q (ℓ) → q.

Remarkable identities from the evaluation of the partition function
In this subsection we specify our computation to the partition functions without any inserion of observables.
It was noticed in [24] that the partition function of twisted N = 2 Super Yang-Mills theory on a differentiable oriented four manifold is vanishing, due to the presence of ψ-zero modes.
These span the tangent space of the instanton moduli space. Therfore the only case in which the partition function is non vanishing correspondes to zero-dimensional components of the moduli space. The partition function is a topological invariant counting, with signs dictated by their relative orientation, the number of the above connected components.
By inspecting our results on the pure partition functions, we obtain results in agreement with the above observation. This in turn implies some remarkable cubic identities on the Nekrasov partition function that we display below.
More explicitly, by computing the coefficients of the power series in q of the partition function (i.e. formula (3.38) for c 1 = 1 and formula (3.70) in the limit x, z → 0 for c 1 = 0), one can see that they are almost all equal to zero! Actually only one term survives, namely p = q = r = 1 that contributes to the c 1 = 1 case. So we can rewrite the partition function for the pure N = 2 theory as This result is in full agreement with the expected behavior of the equivariant partition function in the limit ǫ 1 , ǫ 2 → 0. In this limit the partition function is expected to be a finite function of the gauge coupling. Indeed, looking at (3.38) at fixed power in the expansion in q, all the dependence on ǫ 1 , ǫ 2 appears in the product and in the Z inst , the latter depending on ǫ 1 , ǫ 2 in the denominators only. So, to obtain a finite limit for ǫ 1 , ǫ 2 → 0, these terms should sum up to zero but for the term p = q = r = 1 in which case both the product and the instanton partition functions contribute as 1. A similar argument holds for the case with c 1 = 0. As expected, the non zero term is the contribution of the zero dimensional moduli space components, since dim M = D − 3 (where the discriminant D is given in (A.9)).
These results imply the following cubic identities for the Nekrasov partition function where the product on {i, j} and {k, l} in (3.74) and (3.75) can be read from (3.38) and (3.70) respectively.

N = 2 ⋆ theory and Euler characteristics
In this section we extend our results to the presence of a hypermultiplet in the adjoint representation with mass M, namely to the so-called N = 2 ⋆ theory. In the limit M → 0, one gets N = 4 gauge theory whose partition function is the generating function of the Euler characteristics of the moduli spaces of unframed semi-stable equivariant torsion free sheaves [39].
In the following we will compute the full U(2) partition function of the N = 2 ⋆ theory on P 2 and, after an integration over the v.e.v. of the scalar field, analogous to the one performed in the previous section, we will take the massless limit checking the relation with the Euler characteristics computed in [37,38,39]. Following the same steps as in section 3.2, and assuming again N > 2 as in (3.45), we obtain similarly to (3.55) 2) where N = p + q + r with p, q, r defined in (3.14). For the instanton part we should consider the appropriate recursion relation in the presence of an adjoint hypermultiplet that generalizes (3.32). The instanton partition function on C 2 (3.29) in the presence of an adjoint hypermultiplet becomes where q = exp(2iπτ ) and (4.4) A recursion relation for (4.4) similar to (3.32) is also reported in [51], and has the form The instanton partition function for P 2 is obtained by multiplying (4.5) over the three patches because in a = mǫ 1 − nǫ 2 we are away from the poles of H.
We will now compute the residue of Z full in the origin as we did in section 3.5. We assume M > 0 and, since we want to take eventually the massless limit, M small enough not to meet poles of Z 1loop,hyp . We recall that with components reported in (3.13), (3.55), (4.2) and (4.8) respectively. At the origin: • Z class and Z 1loop,hyp have neither poles nor zeros, • Z 1loop has a double zero, • Z inst,adj has a triple pole.
All in all, Z N =2 ⋆ full has a simple pole located at the origin whose residue is 19 (4.18) Taking the limit M → 0, and using the fact that from (4.11) H Res (q; M) → 1, we obtain where 6 = χ(P 2 ) · rank (U(2)).
The complete result holds with both c 1 = 0, 1, once the contribution of the stricly semi-  where p, q, r are positive integers with p + q + r + c 1 = even, and they satisfy respectively strict triangle inequalities in the stable case and large triangle inequalities in the semi-stable one.
In the case with only strictly stables configurations this result reduce to the one computed by Kool in [37] when we take the expansion in the second Chern class c 2 (c = 1).
Moreover we have checked up to high orders in the power series that for both c 1 = 0, 1 (4.20) is in agreement with the mock-modular form of [39] Z 0 (q) = η(q) where H(n) is the Hurwitz class number [52]. 19 We normalize the integrated partition function with M −1 to get dimensionless quantities.

Discussion
Let us discuss some further directions and open issues. The next natural step to take is to analyse in detail a general compact toric surface M. The conjectural master formula arising from the supersymmetric localisation discussed in Sect. 2 reads (αz+px) . Equation (5.1) has to be supplemented by suitable stability conditions constraining the sum over k (ℓ) α s. Notice that for b + 2 = 1, the partition function exhibits the wall crossing phenomenon which one should evaluate from the gauge theory path integral and compare with the known results in mathematics, see [35] for the rank two case. Indeed we remind the reader that for manifolds with b + 2 = 1 Donaldson invariants are only piece-wise metric independent. Their behavior is described by a chamber structure in H 2 (M, R) with walls located at H 2 (M, Z) ∩ H 2,− (M, R). A common strategy to calculate Donaldson invariants is then given by identifying a vanishing chamber and then compute the invariants in the other chambers via wall crossing. In these cases, our formulas for rank two should reproduce the wall crossing terms as computed in [35]. Notice that for M = P 2 there is a single chamber and the above procedure is not available. Moreover, it is neither possible to deform to N = 1 supersymmetry with mass terms as in [25]. This makes this case particularly interesting since it has to be computed directly and we focused on it in this paper.
Let us also notice that E-strings BPS state counting in terms of elliptic genera can be realized as twisted N = 4 partition functions [53,54,55]. These partition functions enjoy interesting and non-trivial modular properties [56]. It would be useful to explore if and how these properties are realized for non-vanishing mass M = 0.
The AGT correspondence relates the partition function of N = 2 four dimensional SU (2) gauge theories on S 4 with the correlation functions of primary fields in Liouville conformal field theory [5]. In particular, the instanton contributions are realized to be conformal blocks of the Virasoro algebra with central charge 20 c = 1+6 (ǫ 1 +ǫ 2 ) 2 ǫ 1 ǫ 2 . This correspondence has been extended to other four dimensional manifolds M the central charge being computed from the reduction of the M5-brane anomaly polynomial by compactification on M [57,58]. Explicit examples are provided by toric singularities C 2 /Γ with Γ a discrete subgroup in SU(2), whose most studied case is Γ = Z 2 . The conformal field theory of the latter case has been shown to be N = 1 SuperLiouville theory [59,60,61,62,63]. 20 In the round S 4 metric ǫ 1 = ǫ 2 = 1 r , r being the S 4 radius [21]. The case of arbitrary independent real values is obtained by squashing the four sphere [22].
Another case which has been studied is that of S 2 ×S 2 whose gauge theory partition function is build out of chiral copies of Liouville gravity conformal blocks and three point functions [23].
In the same spirit one can try to find a general pattern for this correspondence in the partition function of the N = 2 four dimensional SU(2) gauge theories on a general compact toric manifold. Our result suggests to read the gauge theory partition function in terms of a chiral CFT whose sectors are in one-to-one correspondence with the toric patches. The contribution of each sector to the correlation number is given by a copy of Virasoro conformal block with central charge c (ℓ) = 1 + 6 in the ℓ-th sector and three point functions related to the corresponding one-loop contributions of the gauge theory. The change of (ǫ We finally remark that we expect that our approach can be uplifted to BPS state counting of gauge theories in higher dimensions, for example by considering supersymmetric gauge theories on five-manifolds given by circle fibrations over toric surfaces. A noticeable example is S 5 , whose study is expected to provide information about the M5-brane superconformal index [65,66,67].

A Stability conditions for equivariant vector bundles
In this Appendix we make a dictionary between Klyachko's classification of semi-stable equivariant vector bundles on P 2 [47] (for a review see [43], section 4) and the gauge theory fixed point data we sum over in the partition function, in order to discover the constraints to be imposed because of the stability conditions. Klyachko's main result is that equivariant vector bundles on P 2 can be completely described by sets of decreasing filtrations of vector spaces E ℓ (i), one filtration for each open subset of the standard cover U ℓ (ℓ = 0, 1, 2). Explicitly E = E ℓ (I ℓ ) E ℓ (I ℓ + 1) ⊃ · · · ⊃ E ℓ (I ℓ + n ℓ ) E ℓ (I ℓ + n ℓ + 1) = 0 (A.1) where E ≃ C N is the fiber of the bundle (N is the rank of the bundle) at the ℓ-th point and E ℓ (i) = E, ∀i ≤ I ℓ and E ℓ (i) = 0, ∀i > I ℓ + n ℓ . The explicit form of the vector subspaces E ℓ (i) in the filtration (A.1) for a given equivariant bundle is reported in [47]. Starting from the filtration (A.1) it is possible to compute the Chern classes of the vector bundle by the following formulae Let us consider in detail the case of N = 2. The relevant steps of the filtration are the ones where the dimension of the subspaces jumps. In the rank two case these are two of them: i = I ℓ in which the dimension jumps from 2 to 1, and i = I ℓ + n ℓ when it jumps from 1 to 0.
In particular n ℓ = ♯{i| dim E ℓ (i) = 1}. We then obtain To extract the ch 2 for unframed sheaves E 0 we just expand Z full = q ch 2 (E 0 ) × · · · (A.7) so that ch 2 (E 0 ) can be directly obtained from (3.60) By using the dictionary (A.10) it is possible to finally read the stability conditions for the equivariant vector bundles directly from the following Theorem (Klyachko [47]): The equivariant vector bundle on P 2 defined by the filtrations (A.1) is slope-stable iff for any proper subspace 0 F E one has forĩ ≪ 0 The slope-semi-stable case has a large inequality in (A.11).
We can assume that all W ℓ (ℓ = 0, 1, 2) are distinct 21 and also that n ℓ > 0, ∀ℓ. Indeed it turns out that this is the only relevant case for stability. Either if two or more W ℓ are equal, or if at least one n ℓ = 0, the bundle described by such a filtration does not admit stability, i.e.
the strict inequalities (A.11) are mutually incompatible.
Finally we apply the theorem ∀ F E = C 2 . The relevant conditions come from the choices F = W ℓ , ℓ = 0, 1, 2. The only contribution in (A.11) that is not equal on the r.h.s. and l.h.s. of the inequality is the one relative to the one-dimensional n ℓ subspaces W ℓ of the filtrations. Eventually we obtain conditions on n 0 , n 1 , n 2 , namely they have to satisfy strict triangle inequalities n ℓ + n ℓ ′ > n ℓ ′′ , for all the choices {ℓ, ℓ ′ , ℓ ′′ } = {0, 1, 2}. (A.13) The dictionary (A.10) implies that the gauge parameters k (0) , k (1) , k (2) (often called p, q, r in the main text) have to satisfy the same inequalities.