Topological twists of massive SQCD, Part I

We consider topological twists of four-dimensional $\mathcal{N}=2$ supersymmetric QCD with gauge group SU(2) and $N_f\leq 3$ fundamental hypermultiplets. The twists are labelled by a choice of background fluxes for the flavour group, which provides an infinite family of topological partition functions. In this Part I, we demonstrate that in the presence of such fluxes the theories can be formulated for arbitrary gauge bundles on a compact four-manifold. Moreover, we consider arbitrary masses for the hypermultiplets, which introduce new intricacies for the evaluation of the low-energy path integral on the Coulomb branch. We develop techniques for the evaluation of these path integrals. In the forthcoming Part II, we will deal with the explicit evaluation.

The starting point of our approach is the low-energy effective field theory on the Coulomb branch. This phase of the theory contributes for a compact four-manifold X with the topological condition that b + 2 (X) = 1 [12]. In this way, the classical Donaldson invariants can be derived starting from the Seiberg-Witten (SW) solution to N = 2 supersymmetric Yang-Mills theory with gauge group SU (2). The Coulomb branch integral (or u-plane integral) reduces to an integral over zero modes [12], and reads schematically Φ = B da ∧ dā ρ(a) Ψ(a,ā), (1.1) where B is the Coulomb branch with local coordinates a andā, ρ(a) contains the couplings to the background and Ψ(a,ā) is a sum over fluxes of the unbroken U(1) gauge group. For simplicity, we have suppressed the dependence on the metric and not included observables here. For the pure SU(2) theory, the Coulomb branch integral can be formulated and evaluated for arbitrary four-manifolds, without a requirement for Kähler or toric properties.
As mentioned above, we aim to apply this approach to N = 2 supersymmetric SU (2) theories with N f ≤ 3 hypermultiplets in the fundamental representation. Topological correlators of these asymptotically free theories have been considered in various papers before, in particular the formulation of the low energy path integral in [12,13], SW contributions for four-manifolds with b + 2 > 1 [12,20,21,25], the u-plane integral for P 2 [43], and the calculation of the partition function of the AD theory within the N f = 1 theory [24]. Since no background fluxes are included in these works, the 't Hooft flux necessarily matches the second Stiefel-Whitney class of the four-manifold, w 2 (E) = w 2 (X), since the twisted hypermultiplets are not well-defined otherwise.
Extending to generic 't Hooft fluxes, and application of the above approach (1.2) to fundamental hypermultiplets with generic masses, gives rise to several new aspects. In particular: 1. The fundamental domain of the effective coupling constant becomes more intricate for massive theories, and does for generic masses not correspond to a modular fundamental domain for a subgroup of PSL(2, Z). The domain contains generically a set of branch points, and branch cuts starting from these points [52][53][54]. These aspects have to be dealt with appropriately.
2. We couple the hypermultiplets to background fluxes k j for the flavour group to formulate the theories for arbitrary 't Hooft fluxes. This gives rise to additional couplings in (1.1) and (1.2), where F is the prepotential of the massive theory, and B(·, ·) is the quadratic form associated to the intersection form on the middle homology H 2 (X, Z) of X. Such couplings were suggested by Shapere and Tachikawa [55], and are also essential for the formulation of the N = 2 * Yang-Mills theory on a non-spin four-manifold [26]. Similarly to [26], we also deduce a non-holomorphic coupling to k j . Moreover, for arriving at a single-valued integrand, we fix an ambiguity in the quadratic terms of the prepotential. These terms have appeared earlier in the literature in the context of singularities of the SW differential and winding numbers [11,56]. 3. Special points on the Coulomb branch give rise to superconformal theories, such as the Argyres-Douglas (AD) theories [57,58] and the massless N f = 4 theory [11]. Their topological partition functions and correlators can be found by considering them in certain mass deformations. The case of N f = 1 is analysed in [42].
The paper is organised as follows. In Section 2, we present the Seiberg-Witten solution of SU(2) N = 2 SQCD in flat space, focusing on the fundamental domains for the effective coupling, which we illustrate in several interesting examples. In Section 3, we formulate the topological twist by coupling the hypermultiplets to external fluxes, such that the topological field theory is well-defined for arbitrary 't Hooft flux and non-spin manifolds. The topological low-energy effective theory coupled to N f background fluxes is then modelled in Section 4 as a SU(2) × U(1) N f theory, with the matter fields corresponding to frozen U(1) factors. This allows to compute the path integral explicitly as an integral over the u-plane. In Section 5, we formulate the u-plane integral as an integral over the fundamental domains. We prove that the single-valuedness under monodromies holds for a specific choice of magnetic winding numbers. Finally, in Section 6 we demonstrate that such integrals may be evaluated using mock modular forms, and we show that they localise at the cusps, elliptic points and interior singularities of the fundamental domains.
A following paper, Part II, will be dedicated to explicit analyses and computations for specific examples. There, we will give a detailed discussion on the contribution from the AD points for each type, as briefly mentioned in point 3 above, as well as calculating the u-plane integrals for a number of examples.

Special geometry and SW theories
In this Section, we review aspects of the non-perturbative solution for the low energy effective theory of N = 2 SQCD with gauge group SU(2) and 0 ≤ N f ≤ 3 fundamental hypermultiplets [10,11]. See [59] for a review. Throughout, we let Λ N f denote the scale of the theory with N f hypermultiplets having masses m j , j = 1, . . . , N f , and a the mass of the W-boson on the Coulomb branch.

Field content
The N = 2 theories we consider contain a vector multiplet and N f ≤ 3 hypermultiplets. The fields in these multiplets form representations of Spin(4) = SU(2) + × SU(2) − and SU(2) R , which we denote by (k, l, m), with k, l and m dimensions of the representations.
The vector multiplet consists of a gauge field A µ , complex scalar field φ, and a pair of Weyl fermions Ψ I α ,Ψ Iα . This multiplet transforms under the adjoint representation of the gauge group G. The representation of SU(2) + × SU(2) − × SU(2) R formed by the bosonic fields is, while the representation for the fermions is The hypermultiplet consist of a pair of complex scalar fields, q andq, and Weyl fermions, λ α ,λα, χ α andχα. We fix the gauge group G = SU (2), and let the hypermultiplets transform under the fundamental representation of this group. With the same notation as above, the bosonic fields of this multiplet form the representation, while the fermions form the representation

Seiberg-Witten geometry
The Seiberg-Witten geometry underlies the Coulomb branch of N = 2 gauge theory. The Coulomb branch is the phase of the theory where SU(2) is broken to U(1) by a vacuum expectation value (vev) of the vector multiplet scalar φ. The vev is semiclassically parametrised by a complex parameter a, φ = a 0 0 −a , (2.5) up to gauge transformations. In particular, a → −a is a gauge transformation. The gauge invariant order parameter is the Coulomb branch expectation value of the theory in R 4 , The non-perturbative effective action of N = 2 SQCD is characterised by the prepotential F (a, m), with m the mass vector m = (m 1 , . . . , m N f ). The semiclassical part of F reads [56,[60][61][62] where the . . . indicate further non-perturbative corrections. The n j ∈ Z in (2.7) are the magnetic winding numbers of the periods a D := ∂F ∂a dual to a [56,60,63]. These numbers seem to be only rarely discussed in the literature beyond these references. 2 Generally, the theory allows for N f electric winding numbers for a and N f magnetic winding numbers for a D . These appear in the massive N f > 0 theories since the Seiberg-Witten differentials now have poles with nonzero residues [60]. See also Appendix C. The choice (2.7) of the prepotential corresponds to fixing the electric winding numbers to be zero, or equivalently fixing the monodromy at infinity to map a → e πi a. Compare for example with [60,Eq. (2.17)]. In Section 5, we will discuss that the single-valuedness of the u-plane integral requires n j ≡ −1 mod 4. We introduce the period a D dual to a, and the parameters m D,j dual to m j by These parameters are further combined into the (2 + 2N f )−dimensional vector Π, This vector forms a local system over the u-plane. The elements of the vector form the symplectic form, The effective gauge coupling is related to the prepotential through We also introduce the couplings v j and w jk with j, k ∈ 1, . . . , (2.12) 2 Nekrasov's partition function gives a specific choice upon expanding the function γ (x; Λ) in the perturbative part [62,64]. 3 If we consider F as a function of (a, 1 √ 2 m 1 , . . . , 1 √ 2 m N f ), then the dual parameters are encoded in the Jacobian J F = (a D , m D ), while the couplings are the elements of the Hessian The derivative of the prepotential with respect to the scale Λ N f provides the order parameter u (2.6) on the Coulomb branch, Using the different relations introduced above together with the fact that the prepotential satisfies the homogeneity equation [65][66][67] we can find some non-trivial relations between the respective quantities. For instance, from the perturbative prepotential (2.7), we deduce that the leading terms of u are The weak-coupling limit then becomes in our conventions 4 (2.16) The Seiberg-Witten (SW) solution provides a family of elliptic curves parametrised by the order parameter u and the masses m i , whose complex structure corresponds to the running coupling τ = θ π + 8πi g 2 . For the theories of interest in this paper, the curves are given by [11] N f = 0 : (2.17) The family of SW curves (2.17) are Jacobian rational elliptic surfaces with singular fibres [68][69][70]. These surfaces are well studied in the mathematical literature [71][72][73]. Rational in this context means that g 2 and g 3 are polynomials in u of degree at most 4 and 6, respectively [74]. In Appendix B, we summarise the class S representation of the SW curves [75].
The curve for N f hypermultiplets reduces to the curve for N f −1 hypermultiplets upon decoupling a hypermultiplet in the double scaling limit [76] (2.18) The curves (2.17) provide the exact results for the vevs of the scalar a and its dual a D as period integrals. We have explicitly, with λ the SW differential, for which we refer to [11,56,60].

Characteristic functions on the Coulomb branch
In this subsection, we discuss various characteristic functions on the Coulomb branch, which are instrumental for determining the u-plane integral. They are: • the physical discriminant ∆ N f , • the order parameter u, • the period da/du, and • the derivatives du/dτ and da/dτ .

The physical discriminant ∆ N f
We define the physical discriminant ∆ N f as the monic polynomial where u j for j = 1, . . . , N f + 2 are the singular points of the effective theory. We let j = 1, . . . , N f label the singular points where one of the matter hypermultiplets becomes massless; and j = N f + 1, N f + 2 denote the strong coupling singularities where a monopole and a dyon, respectively, becomes massless. The discriminant is a polynomial of degree 2+N f in u. It can also be determined directly from the SW curve [52], where g 2 and g 3 are the Weierstraß invariants of the SW curve. Up to the sign and scale, the physical discriminant ∆ N f equals the mathematical discriminant g 3 2 − 27g 2 As the masses are tuned, some of the singularities on the Coulomb branch can collide. If we consider ∆ N f as a polynomial in u, its discriminant D(∆ N f ) vanishes if and only if two roots coincide. It is straightforward to show that for N f ≤ 3, This factorises the locus in mass space where singularities collide into two orthogonal components: The first component is the Argyres-Douglas (AD) locus given by the polynomial equation D AD N f = 0, where mutually non-local singularities collide [52,58,77]. The other component is characterised by the equations m i = ±m j , and one can check that this gives rise to mutually local singularities colliding. Here, the flavour symmetry gets enhanced and a Higgs branch opens up [11]. This extends the analysis of [52].
Given a mass configuration m = (m 1 , . . . , m N f ), we can denote by k l the weight (or multiplicity) of the l-th singularity, and by k(m) = (k 1 , k 2 , . . . ) the vector of those weights. Since the Coulomb branch B N f (m) contains 2 + N f singularities aside from weak coupling u = ∞, it is clear that k(m) provides a partition of 2 + N f . This in turn partitions the mass space C N f m into finitely many regions where k(m) is locally constant. As an example, in Fig. 1 we plot the contours of (2.22) for N f = 2 in the real m = (m 1 , m 2 ) plane.
The possible singularity structures of the rational elliptic curves (2.17) are classified in Persson's list of allowed configurations of singular fibres [78,79]. From Kodaira's classification, it follows that any solution to (2.22) gives rise to a singularity on the Coulomb branch of Kodaira type I k , II, III, or IV . As described in [52,70], the solutions to 0 = D AD N f give rise to AD points of Kodaira type II, III and IV . The second component 0 = i<j (m i − m j )(m i + m j ) can be studied in more detail. These are 2(N f − 1) independent equations. Whenever one of the factors vanishes, the SW surface contains an I k singularity with k ≥ 2. For N f = 2, the only possibility is I 2 , while for N f = 3 singularities of type I 2 , I 3 and I 4 are possible. The point in the Coulomb branch B N f corresponding to an I k singularity with k ≥ 2 intersects with a Higgs branch of quaternionic dimension k − 1 ≥ 1 [11]. Further merging these I k singularities with a mutually non-local singularity does not affect the Higgs branch, such that the points with a III or IV singularity also intersect with a Higgs branch of quaternionic dimension one or two, respectively, while the points with AD theories of type II do not intersect with any Higgs branch.
Order parameter u The order parameter u, introduced in (2.6), is invariant under monodromies on the Coulomb branch. By bringing the SW curve to Weierstraß form, u can be expressed in terms of the running coupling τ ∈ H (2.11) [52,54,[80][81][82]. As in [52], we restrict the domain for τ ∈ H to F(m) ⊆ H, such that u is 1-to-1. In specific cases, u can be expressed in terms of modular forms. We follow the conventions of [52, Section 2.2] in picking the solutions. We discuss the order parameters in more detail in the following Subsection 2.4.

The period da/du
The period da du can be related to the complex structure τ of the curve through [81] da du = 1 6 where the Weierstraß invariants g 2 , g 3 are polynomials in u, and E 4 = E 4 (τ ), E 6 = E 6 (τ ) are the Eisenstein series of modular weights four and six respectively, defined in Eq. (A.7). The square root in (2.23) leads to an ambiguity in the sign of da/du. This can be resolved by taking a branch of the square root, for example at weak coupling. On the other hand, da/du is not a single-valued function on the u-plane. It changes by a sign under monodromies at weak coupling, and transforms with a modular weight under monodromies around strong coupling singularities.
The derivatives du/dτ and da/dτ The derivative du/dτ is related to the period da du through [52,83] where the prime denotes differentiation with respect to u. When u is known in terms of modular forms, it is also straightforward to determine du dτ by differentiating modular forms [52]. For generic masses m, we can compute the q-series of u and thus du dτ to any order. We will not explicitly need du/dτ for evaluating the u-plane integral, but through we can use it to evaluate da/dτ . This derivative appears as the Jacobian for the change of integration variables from the periods a to the couplings τ .

Fundamental domains
The recent progress in computing u-plane integrals has been enabled by mapping the u-plane to a modular fundamental domain, on which the u-plane integrand can be related to mock modular forms and thus be efficiently evaluated [24,26,[43][44][45][46][47][48][49][50][51]. It has been known since the 1990s that the u-planes for N = 2 SQCD with N f = 0, 2, 3 massless hypermultiplets are modular and correspond to fundamental domains for congruence subgroups of PSL(2, Z) [80]. On the other hand, the generic mass case including the peculiar role of massless N f = 1 have remained elusive. The order parameter u for a given mass m = (m 1 , . . . , m N f ) can be considered as a function u : H → B N f (m), (2.27) where B N f (m) is the Coulomb branch of the theory with N f hypermultiplets of mass m. In [52], it was found that for N f ≥ 1 and generic masses the duality group does not act on τ by fractional linear transformations. This prevents the preimage u −1 (B N f (m)) from being a modular fundamental domain for a subgroup of PSL(2, Z). Instead, we can define a fundamental domain F N f (m) through the equivalence relation τ ∼ τ ⇔ u(τ ) = u(τ ), such that u : In [52,54], such fundamental domains for the effective gauge coupling have been found explicitly for N = 2 SQCD with N f ≤ 4 generic masses. They decompose as where F = PSL(2, Z)\H is the key-hole fundamental domain of PSL(2, Z), and α j ∈ PSL(2, Z) are n ≤ 6 maps that are locally constant as functions of the masses m. More precisely, F N f (m) is constant on any of the finitely many connected components is the complex plane with 2 + N f singular points removed. In (2.28), those singularities are reflected in the cusps α j (∞), where the number of α j with the same α j (∞) (giving the width of the cusp) agrees with the multiplicity of the singularity u(α j (∞)).
The domains F(m) := F N f (m) are endowed with further data. For generic masses m, there are N f pairs of branch points on F(m) that are connected by branch cuts. The branch points are determined by the non-removable singularities of the rational function ∆ , as it appears in Matone's relation (2.24). They correspond to the nontrivial zeros of the discriminant of the sextic equation associated with the SW curve [52]. As the masses are varied, the branch points move on continuous paths in the fundamental domain.
When two branch points collide, there appears an elliptic point, which is a further dedicated point on the domain F(m). These elliptic points correspond to the superconformal Argyres-Douglas (AD) points [57,58]. By Kodaira's classification of singular fibres, they are always in the PSL(2, Z) orbit of i or e πi/3 . Their presence is also responsible for the index n of the domain to be reduced. The possible values are n = 2, 3, 4 if F(m) contains such an elliptic point, and n = 6 otherwise.
The N f = 4 theory furthermore contains a UV coupling τ UV . Since u(τ ) → ∞ for τ → τ UV , it can be viewed as a puncture of the fundamental domain, and has to be excluded from the integration domain.
Let us review the explicit construction of F(m) in a few important examples. Many more examples can be found in [52,54]. Here, we are mainly considering the masses to be small compared to the period a, such that the mass singularities discussed in previous sections can be considered as strong coupling singularities, or in other words as cusps on the real line of the fundamental domains. When the masses are increased it is more natural to think of the mass singularities as weakly coupled.
The pure SU(2) N f = 0 theory It is well-known that the pure SU(2) Coulomb branch corresponds to the fundamental domain for the congruence subgroup Γ 0 (4) of PSL(2, Z). The order parameter can be explicitly determined in terms of a modular function for the duality group [84], where the Jacobi theta functions ϑ i are defined in Appendix A.1. A fundamental domain for the pure SU(2) theory is given in Fig. 2. Since the domain is modular, the branch points are absent. Figure 2: Fundamental domain of Γ 0 (4). This is the duality group of the pure SU(2) theory. The two cusps on the real line correspond to the strong coupling singularities of the gauge theory, while the cusp at τ = i∞ corresponds to weak coupling. Boundaries of the same colour are identified.
The massless N f = 1 theory From the massless N f = 1 SW curve, one directly finds [80] u where E 4 and E 6 are the Eisenstein series defined in (A.7). This function also appears as an order parameter in pure SU(3) SW theory [53] as well as in the description of certain elliptically fibred Calabi-Yau spaces [85]. Due to the presence of the square root, this function is not modular. The massless N f = 1 curve has three distinct strongly coupled singularities, which become the three cusps of the fundamental domain aside from the weakly coupled region u → ∞. The fundamental domain is plotted in Fig. 3. Note that, this is not the fundamental domain of any subgroup of PSL(2, Z). When a positive mass m is turned on, the branch points move in the fundamental domain emerging from those of the massless case. They move as a function of the mass as shown in [52], and depicted in Fig. 4. This further incorporates the hypermultiplet decoupling on the level of the fundamental domain.
The equal mass N f = 2 theory For N f = 2 with m 1 = m 2 = m, the order parameter can be determined explicitly [52], for some constant c(τ bp ).
The massless limit in N f = 2 In the limit where m 1 = m 2 = m → 0, one finds from (2.31) that This expression is a modular function for the principal congruence subgroup Γ(2) of PSL(2, Z). The holomorphy of (2.33) is explained by the fact that the pair of branch points for m = 0 collides in the limit m → 0, which annihilates the branch cut. This is because the mutually local singularities u ± → − Λ 2 2 8 collide, and thus the singularities corresponding to τ → 0 and τ → 2 in Fig. 5 are identified. The fundamental domain of the massless theory is thus the modular fundamental domain for the duality group Γ(2), as depicted in Fig. 6.
2 , the singularities u * and u + collide and form the superconformal AD point (A 1 , A 3 ) of Kodaira type III. As studied in detail in [52,70,86], this AD point forms an elliptic point of the fundamental domain. Since three mutually non-local singularities collide for this mass, the index of the domain F(m AD , m AD ) is reduced by 3, giving a domain of index 6 − 3 = 3. By taking the limit from (2.31), one finds that the square root resolves by virtue of the Jacobi identity (A.4). This restores holomorphy and even modularity. One finds that the order parameter is a modular function for the congruence subgroup Γ 0 (2) of PSL(2, Z) [52]. Its elliptic fixed point τ AD = 1 + i is precisely the AD point. We depict the corresponding fundamental domain in Fig. 7.  In N f = 4, the fundamental domain for the effective coupling τ can be found analogously to the asymptotically free cases. One notable new feature is the additional singularity of the theory when τ approaches the UV coupling τ UV . For example, with the mass configuration m = (m, m, 0, 0) one finds [54] . This function is a meromorphic Γ(2) modular form of weight 2 in It is the modular fundamental domain for the congruence subgroup Γ 0 (2) of PSL(2, Z). The AD point τ AD = 1 + i is the elliptic fixed point of Γ 0 (2). The three singularities collided in u AD results in a reduction of the index from 6 to 3.

Monodromies
This section determines the monodromies around the N f + 2 monodromies. We leave the winding numbers n j , j = 1, . . . , N f , for a D generic. Starting with the monodromy around infinity, a → e πi a, we deduce from the (2.7) that the vector Π transforms as Π → M ∞ Π, with M ∞ given by The monodromy matrix M ∞ is in SL(2 + 2N f , Z), while it acts on the couplings by a symplectic transformation, i.e. it preserves the symplectic form (2.10). This can be checked by requiring that any monodromy M ∞ satisfies M T JM = J, with The action on the couplings τ (2.11), v j and w jk (2.12) is thus with δ jk the Kronecker delta. If we assume that the mass m j is large, we can also deduce the monodromies around a = m j √ 2 , j = 1, . . . , N f from the perturbative prepotential (2.7). For a encircling m 1 √ 2 counterclockwise, Π → M 1 Π, we find for the monodromy matrix M 1 , while the M j for other values of j are given by permutations. Its action on the couplings is (2.40) To visualise the monodromies with large Im(τ ) for N f = 1, we refer to Fig. 4(d). In this regime of the masses, there is one monodromy with periodicity 3 and one with periodicity 1.
Besides the monodromies M ∞ and M j , there are monodromies M m and M d around the points where a monopole and a dyon becomes massless, respectively. By requiring that the electro-magnetic charges of the massless particles are (n m , n e ) = (1, 0) and (1, −2), respectively, we can fix the upper left blocks of the monodromies. We fix the remaining entries by assuming that the masses remains invariant, m j → m j , and that the other periods only change by a multiple of the vanishing cycle at the corresponding cusp, together with the requirement that (2.41) For N f = 1 and n 1 = n, this gives for M m , This acts on the couplings as The monodromy M d around the dyon singularity for N f = 1 is This acts on the couplings as We can note that all the above monodromy matrices leave the symplectic form (2.10) invariant and are independent of the masses.
For a small mass m, the fourth "hypermultiplet" cusp of the fundamental domain for N f = 1 lies naturally near the real axis, τ → 1. See for example Fig. 4(a). Having determined M ∞ , M m and M d , we can easily determine the monodromyM 1 in this regime asM Thus for n = −1, the massless particle has charge ±(−1, 1, 0, 1). We get similar monodromies for N f = 2, 3. The action on the running couplings τ are the same for all N f , by construction. The transformations of v j and w jk also take the same form for all N f and can be summarised as The UV theory on a four-manifold We review various aspects of the formulation of the UV theory on a compact smooth four-manifold.

Aspects of four-manifolds
We let X be a smooth, compact, oriented Riemannian four-manifold, with Euler number χ = χ(X) and signature σ = σ( The u-plane integral is non-vanishing only for four-manifolds X with b + 2 ≤ 1. In this article, we consider manifolds with b + 2 = 1. Such four-manifolds admit a linear complex structure J on the tangent space T X p at each point p of X. The complex structure varies smoothly on X, such that T X is a complex bundle. We introduce furthermore the canonical class K X = −c 1 (T X) of X, with c 1 (T X) the first Chern class of T X. For a manifold X with (b 1 , b + 2 ) = (0, 1), we have that The middle cohomology H 2 (X, Z) of X gives rise to the uni-modular lattice L. More precisely, we identify L with the natural embedding of H 2 (X, Z) in H 2 (X, Z) ⊗ R, which mods out the torsion of H 2 (X, Z). A characteristic element K ∈ L is an element which satisfies l 2 + B(K, l) ∈ 2Z for all l ∈ L. The Riemann-Roch theorem demonstrates that the canonical class K X of X is a characteristic element of L. The Wu formula furthermore shows that any characteristic vector K of L is a lift of w 2 (X).
The quadratic form Q of the lattice L for a 4-manifold with (b 1 , b + 2 ) = (0, 1) can be brought to a simple standard form depending on whether Q is even or odd [87]. This divides such manifolds into two classes, for which the evaluation of their u-plane integrals needs to be done separately [49,88]. The period point J ∈ H 2 (X, R) is defined as the unique class in the forward light cone of H 2 (X, R) that satisfies J = * J and J 2 = 1.
All four-manifolds without torsion and even intersection form admit a Spin structure. More generally, for any oriented four-manifold one can define a Spin c -structure. The group Spin c (4) can be defined as pairs of unitary 2 × 2 matrices with coinciding determinant, There exists a short exact sequence A Spin c -structure s on a four-manifold X is then a reduction of the structure group of the tangent bundle on X, i.e. SO (4), to the group Spin c (4). The different Spin cstructures correspond to the inequivalent ways of choosing transition functions of the tangent bundle such that the cocycle condition is satisfied. The Spin c -structure defines two rank two hermitian vector bundles W ± . We let c(s) be the first Chern class of the determinant bundles, c(s) := c 1 (det W ± ) ∈ H 2 (X, Z). If s is the canonical Spin c structure associated to an almost complex structure on X, then c(s) 2 = 2χ + 3σ. More generally, (3.4)

Topological twisting with background fluxes
We discuss in this section topological twisting of theories with fundamental hypermultiplets including background fluxes. The discussion is parallel to the case of N = 2 * [26], where the hypermultiplet is in the adjoint representation of the gauge group.
We let (E → X, ∇) be a principal SU(2)/Z 2 ∼ = SO(3)-bundle with connection ∇. The second Stiefel-Whitney class w 2 (E) ∈ H 2 (X, Z 2 ) measures the obstruction to lift E to an SU(2) bundle, which will exist locally but not globally if w 2 (E) = 0. We denote a lift of w 2 (E) to the middle cohomology lattice L byw 2 (E) ∈ L, and define the 't Hooft flux µ =w 2 (E)/2 ∈ L/2. The instanton number of the principal bundle is defined as k = − 1 4 X p 1 (E) and satisfies k ∈ −µ 2 + Z, where p 1 is the first Pontryagin class.
To formulate the theories with N f fundamental hypermultiplets on a compact four-manifold, we perform a topological twist. Coupling the four-dimensional N = 2 SU(2) theory to background fields means choosing two sets of data: • A principal SU(2) R R-symmetry bundle, with connection ∇ R , • and a principal bundle L with connection for global symmetries (the flavour symmetries) [26]. bosons: Thus the bosons remain unchanged, a vector and a complex scalar, while the fermions reorganise to a vector, self-dual two-form and real scalar, which we denote as ψ, χ and η, respectively. We note that none of these fields are spinors, and can thus be considered on a non-spin four-manifold. The original supersymmetry generators also transform in the representations for the fermions above. Thus the theory contains a scalar fermionic supercharge Q = ȦḂ QȦḂ, whose cohomology provides the operators in the topological theory [1]. For the fields of a hypermultiplet, (2.3) and (2.4), one finds bosons: (1, 2) ⊕ (1, 2), fermions: Thus hypermultiplet bosons become spinors, i.e. sections of the spin bundle S + , while the fermions are sections of S + and S − . Thus the twisted hypermultiplets can in this case only be formulated on four-manifolds which are spin, i.e. w 2 (X) = 0 [12,16]. However, if the hypermultiplets are charged under a gauge field or flux, the product of these bundles with S ± may be a Spin c bundle, W + or W − [16,26,39]. The latter are defined for arbitrary four-manifolds. For example, an almost complex structure on X determines two canonical Spin c bundles W ± S ± ⊗ K −1/2 X with K X the canonical class determined by the almost complex structure. Since the hypermultiplets are in the fundamental, two-dimensional representation of SU(2), the topologically twisted hypermultiplets are well-defined on a non-spin four-manifold if µ = −K X /2 [12].
Let us state this also in terms of the gauge bundle E. To this end, we label the two components of the fundamental, two-dimensional representation of SU(2) by ±. The two components are sections of a line bundle L On the other hand, the physical requirement is that S + ⊗ L 1/2 E is well defined, orw 2 (X) +w 2 (E) ∈ 2L. Therefore, the obstructions can cancel each other for a suitable choice of w 2 (E). Thus the topological twisted theory is not well-defined for an arbitrary choice of 't Hooft flux µ := 1 2w 2 (E); but rather µ has to satisfy µ = 1 2w 2 (X) mod L [12], or To consider more general 't Hooft fluxes µ or equivalently w 2 (E), we can couple the j'th hypermultiplet to a background flux or line bundle L j , with L j possibly different for each j. We let E j = L E ⊗ L j . Then the requirement that S ± ⊗ E ±1/2 j is globally well-defined is that (1 + c 1 (L j )). (3.10) The scalar generators of the equivariant cohomology of Spin(2N f ) are the masses m j , which generate the N f -dimensional Cartan subalgebra of Spin(2N f ). The gauge bundle E k is also Spin(2N f ) equivariant. For generic masses, the flavour group is U(1) N f , and is enhanced for special loci of the masses, for example to U(N f ) for equal masses [11]. The Q-fixed equations are the non-Abelian monopole equations with N f matter fields in the fundamental representation. For generic gauge group G and with representation R, these equations read [15] where T a is a generator of the Lie algebra in the representation R. Including the sum over matrix elements, we have We denote the moduli space of solutions to (3.11) by M Q,N f k,L j , and leave the dependence on the 't Hooft flux µ and the metric J implicit. For N f = 4 on X = CP 2 , such moduli spaces are studied in [32].
The moduli spaces M Q,N f k,L j is non-compact for vanishing masses [25,36,89]. This is improved upon turning on masses and localizing with respect to the U(1) N f flavour symmetry, M j α → e i ϕ j M j α , which leave invariant the Q-fixed equations (3.11). There are two components: • the instanton component, with F + = 0 and M j = 0, j = 1, . . . , N f . The moduli space for this component is denoted M i k . Since the hypermultiplet fields vanish, this component is associated to the Coulomb branch.
• the abelian or monopole component, for which a U(1) subgroup of the flavour group acts as pure gauge. Here the connection is reducible, and a U(1) subgroup of the SU(2) gauge group is preserved. For generic masses, there are N f such components, where M is upper or lower triangular for some , and M j = 0 for all j = . The moduli space of this component is denoted M a,j k , j = 1, . . . , N f . Since some of the hypermultiplet fields are non-vanishing, this component is associated to the Higgs branch [22,90].
The instanton component M i k is non-compact due to point-like instantons. This can be cured using the Uhlenbeck compactification or algebraic-geometric compactifications. We assume that the physical path integral chooses a specific compactification, whose details are however not manifest at the level of the low energy effective field theory other than that the compactification must be in agreement with the correlation functions.
The topological twist for N = 2 supersymmetric QCD can be further made dependent on a cocycle ζ gauge αβγ representing the 't Hooft flux, and ζ s αβγ a cocycle representing w 2 (X) (the cocycles are the U(1) valued functions measuring the obstruction of the cocycle condition for transition functions) [26]. Without additional line bundles,w 2 (X) =w 2 (E) is equivalent to the cocycle ζ gauge αβγ ζ s αβγ being trivialisable. We leave it for future work to explore whether the invariants depend on the choice of trivialisation.

Correlation functions and moduli spaces
The Q-fixed equations (3.11) include a Dirac equation for each hypermultiplet j = 1, . . . , N f in the fundamental representation. The corresponding index bundle W j k defines an element of the K-group of M i k . Its virtual rank rk(W j k ) is the formal difference of two infinite dimensions. It is given by an index theorem and reads where c 1 (L j ) is the first Chern class of the bundle L j . Note that the rhs is not an integer for an arbitrary c 1 (L j ) ∈ H 2 (X, Z). To verify that the rhs is integral for the c 1 (L j )'s satisfying (3.9), we rewrite rk(W j k ) as (3.14) Then the first term on the rhs is an integer since k ∈ − 1 4 w 2 (E) 2 + Z for an SO(3) bundle. The second term is an integer because c 1 (L j ) · µ = (w 2 (X) − 2µ) · µ mod Z ∈ Z, and the third term is an integer using (3.4) and the fact that c 1 (L j ) + 2µ equals the characteristic class of a Spin c -structure s j by (3.9), c 1 (L j ) + 2µ = c(s j ), (3.15) for each j.
The mass m j is the equivariant parameter of the U(1) flavour symmetry associated to the j'th hypermultiplet. The equivariant Chern class of W j k reads in terms of the splitting class x l , (3.16) We abbreviate c l (W j k ) to c l,j , and let c(W k ) = N f j=1 c(W j k ). The moduli space M Q k,µ,L j for N f hypermultiplets corresponds to the vanishing locus of the obstructions for the existence of N f zero modes of the Dirac operator. As a result, the virtual complex dimension of the moduli space M Q k,µ,L j is that of the instanton moduli space plus the sum of (typically negative) ranks of the index bundles W j k , vdim(M [17,26,31,36]. This gives It is argued in [13] that the inclusion of massive matter amounts to inserting an integral of the equivariant Euler class of the Dirac index bundle over the moduli space. Therefore, the correlation functions are the generating functions for the intersection numbers of the standard Donaldson observables and the Poincaré duals to the Chern classes of the various vector bundles.
The correlation functions on X in the theory with N f massive fundamental hypermultiplets are conjectured to be We deduce from (3.19) that The overall factor can be accounted for by an overall renormalization in the decoupling limit.
The correlation function has a smooth massless limit m j → 0, for which only terms with the top Chern classes contribute. These are given by with l j = −rk(W j k ) for each c l,j . For a non-vanishing result, the degree of ω 1 . . . ω p must equal vdim(M Q,N f k,L j ).

The effective theory on a four-manifold
We consider in this Section the low energy effective field theory on a four-manifold. We derive the semi-classical action of the theory coupled to background U(1) fields. As in previous cases [12,26,55,96], the final expression takes the form of a Siegel-Narain theta series multiplied by a measure factor.

Hypermultiplets and background fields
The effective theory coupled to N f background fluxes can be modelled as that of a theory with gauge group SU(2) × U(1) N f , where the fields of the U(1) factors have been frozen in a special way [26,97]. To derive the precise form, we recall the low-energy effective Lagrangian for the r multiplets (φ J , η J , χ J , ψ J , F J ) of the topologically twisted U(1) r SYM theory [98]. Since the u-plane integral reduces to an integral over zero-modes [12], it suffices to only include the zero-modes in the Lagrangian. For simply connected four-manifolds, there is no contribution from the one-form fields ψ J . The Lagrangian is then given in terms of the prepotential F ({a J }) and its derivatives to the vevs φ J = a J , as . It is left invariant by the BRST operator Q, which acts on the zero modes as Using this operator, we can write L as the sum of a topological, holomorphic term and a Q-exact term, The low-energy theory of SU(2) gauge theory with N f hypermultiplets coupled to N f background fluxes can then be modelled by the above rank r description with F (a, m). We let the indices J, K run from 0 to N f and identify the index 0 with the unbroken U(1) of the SU(2) gauge group and the indices j, k, l = 1, . . . , N f with that of the frozen U(1) N f factors. We further set φ 0 := φ for any field φ. We will proceed by using lower indices for j, k, l, except where the summation convention is explicitly used, to avoid confusion with powers of the fields.
The masses of the hypermultiplets are the vevs of the frozen scalar fields of the corresponding vector multiplets, To make the BRST variations of the fields from the frozen U(1) factors vanish, we set η j = χ j = 0, as well as D j = F j + . With these identifications, the Lagrangian becomes (4.6) Integrating over D, η and χ in the standard way [12,26,98], we end up with where and we identified τ := τ 00 , y = Im(τ ) = y 00 , v j := τ 0j and w jk := τ jk . Thus the coupling w jk is holomorphic, but the coupling v j is non-holomorphic. This is similar to the couplings for N = 2 * [26].

Sum over fluxes
The path integral includes a sum over fluxes k = [F ]/4π ∈ L/2. After summing the exponentiated action (4.7) over the fluxes k and multiplying by dā dτ , we find that this takes the form The couplings C jk are given in terms of w jk (2.12) by C jk = e −πiw jk , (4.10) for j, k = 1, . . . , N f . Such couplings were first put forward in [55], and were also crucial in [26]. The term Ψ J µ is an example of a Siegel-Narain theta function. It reads explicitly 11) and discussed in more detail in Appendix A.2. The elliptic variable reads in terms of v j and k j , thus inducing a non-holomorphic dependence on v j . Furthermore, K appearing in the fourth root of unity (−1) B(k,K) is a characteristic vector of L. Note that Ψ J µ changes by the sign (−1) B(µ,K−K ) upon replacing K by a different characteristic vector K [12,26,99]. For N f = 0, this phase can be understood as arising from integrating out massive fermionic modes [96]. It also appears naturally in decoupling the adjoint hypermultiplet in the analogous function for N = 2 * [26]. For N f > 0, the constant part of the couplings v j (2.12) effectively contribute to the phase, such that the total phase reads e πiB(k,K) N f j=1 e πi n j B(k j ,k) , (4.13) with n j the magnetic winding numbers. For arbitrary n j ∈ Z, the phase is an eighth root of unity. It would be interesting to understand this phase from integrating out massive modes. We deduce from (4.13) that the summand of Ψ J µ changes by a phase e πi(n j −n j )B(k j ,k) (4.14) if the winding numbers n j are replaced by n j . Since k j ∈ K/2−µ mod L (see (3.9)) and k ∈ L + µ, this phase is 1 if n j − n j = 0 mod 4. We can therefore restrict to n j ∈ Z 4 . For specific choices of µ and k j , the n j can lie in a subgroup of Z 4 . The modular transformations of Ψ J µ are discussed in Appendix A.2, which are crucial input for single-valuedness of the u-plane integrand. We will demonstrate in Section 5.2 that the u-plane integrand is single-valued if we impose further constraints on the winding numbers n j .
Finally, if the theory is considered on a curved background, topological couplings arise in the effective field theory [96]. These terms couple to the Euler characteristic and the signature of the four-manifold X, respectively denoted A and B. These take the form [12,96], Here, ∆ N f is the physical discriminant incorporating the singularities of the effective theory, while du da is the (reciprocal of) the periods of the SW curves as introduced in Section 2. Both can be determined directly from the SW curve, as described in Section 2.3. The prefactors α and β are independent of u, but can be functions of other moduli such as the masses m, the dynamical scale Λ N f or the UV coupling τ UV . However, it turns out that for the theories with fundamental matter they are independent of the masses and only depend on the scale [21,100]. They satisfy several constraints from holomorphy, RG flow, homogeneity and dimensional analysis, and can in principle be fixed for any Lagrangian theory from a computation in the Ωbackground [21,24,70,100].

Observables and contact terms
The observables in the topologically twisted theories are the point observable or 0observable u, as well as d-observables supported on a d-dimensional submanifold of X. The d-observables are only non-vanishing if the submanifold corresponds to a non-trivial homology class. For b 1 = 0, the d-observables with d odd therefore do not contribute.
To introduce the surface observable, let x ∈ H 2 (X, Q). Then the surface observable reads in terms of the UV fields, In the effective infrared theory, this operator becomes,  in the path integral. The surface observable leads to a change in the argument of the sum over fluxes (4.11), (4. 19) and to analytically continue b (4.12) to the complex number by setting b = (z − z)/(2iy). The inclusion of the surface observable also gives rise to a contact term [2,12,93], which in particular ensures that the u-plane integrand is single-valued. For 0 ≤ N f ≤ 3, the contact term is exp(x 2 G N f ) with [13,23,101] 20) while for N f = 4 it is given by [23,102] This expression (4.20) is valid for the theories with N f arbitrary hypermultiplet masses. The reason for it is the following [23,98,103]: G is guaranteed to beQ-closed and hence locally holomorphic. First, notice that ∂F ∂τ 0 = u 4 , where Λ 4−N f =: e πiτ 0 for the asymptotically free theories (N f ≤ 3) and τ 0 = τ UV for N f = 4. The real part of the exponential prefactor of Ψ J µ can be added to G to give a monodromy-invariant contributionĜ which multiplies the intersection x 2 . From the action of a duality transformation onĜ it can be inferred that (4.22) The expressions (4.20) follow by direct computation. A more general scheme to fix the contact terms is proposed in [13]. Contact terms can also be derived from the corresponding Whitham hierarchies [101,104]. In the presence of surface observables, there are additional mixed contact terms ∂ 2 F ∂τ 0 ∂m for the external fluxes {k j } as encountered in [26] for the N = 2 * theory.

The u-plane integral
In this section, we set up the u-plane integral schematically given in (1.2), and demonstrate that it is well-defined on the integration domain for any µ with appropriate background fluxes. The case µ =w 2 (X)/2 and k j = 0 was analyzed in [12].

Definition of the integrand
As discussed in the previous sections, the u-plane integral on a closed four-manifold X with (b 1 , b + 2 ) = (0, 1) depends on many parameters. We summarise: • The scale Λ N f and masses m = (m 1 , . . . , m N f ) of the theory. See Section 2.
• The fugacities for the point and surface observables p and x. See Section 4.3.
In terms of these parameters, the u-plane path integral reduces to the following finite dimensional integral over F N f (m), We summarise the different elements on the rhs: • K N f is an overall normalisation factor. For N f = 0, it is fixed by matching to known Donaldson invariants. Due to χ + σ = 4, there is an ambiguity [24] ( with α and β the u-independent prefactors in (4.15).
• The integration domain F N f (m) in (5.1) is crucially the fundamental domain of the effective gauge coupling. As discussed in Section 2.4, this domain requires new aspects compared to integration domains for earlier discussions of u-plane integrals. The evaluation of integrals over F N f (m) will be discussed in more detail in Section 6.
• The function Ψ J µ arises from the sum over U (1) fluxes. It is a Siegel-Narain theta function (4.11) and discussed in detail in Section 4.2. The elliptic parameter z of the Siegel-Narain theta function reads • Finally, G N f is the contact term, discussed in more detail in Section 4.3.
While the path integral set up in Section 4 integrates the exponentiated action over the local coordinates a andā, in (5.1) we have changed variables to τ andτ . This change of variables (a,ā) → (τ,τ ) is valid as long as the Jacobian is nonsingular in the integration region. Since the coordinates a andā are holomorphic and antiholomorphic respectively, the Jacobian is diagonal and the functional determinant accordingly reads da dτ dā dτ . We thus need to show that da dτ is not singular away from isolated points in F N f (m), which in (5.1) we remove implicitly from the integration domain.
Using da du = da du du dτ , we can study the singular points in detail. First, it is shown in [52] that the singularities of du dτ are in one-to-one correspondence with the branch points. In fact, both du dτ = 0 and du dτ = ∞ are realised as branch points in N = 2 SQCD. In the following Section 6, we remove a small circle in F N f (m) around the branch points, and show that they do not give an extra contribution. Furthermore, the solutions to du da = 0 are shown to be the Argyres-Douglas (AD) points. We exclude them from the integration region, and study their contribution also in Section 6. Finally, we know that η 24 ∝ da du 12 ∆ N f [52], with η the Dedekind eta-function as defined in (A.5). Since η = 0 and ∆ N f does not have poles, we find that da du never vanishes. This agrees with the fact that da du is the period of a holomorphic differential and therefore is never zero.
We conclude that the functional determinant is singular in H precisely at the branch points and AD points, however with the proper exclusion of those as done in the following Section, it is non-singular and the change of variables is well-defined. This furthermore conveniently solves the problem that there is no natural integration region in (a,ā) space [12].

Monodromy transformations of the integrand
We continue by explicitly verifying that the u-plane integral is single-valued around the singular points of the moduli space. We find that this puts a constraint on the magnetic winding numbers n j , in addition to the constraints on the background fluxes k j discussed in Section 3.3.

Monodromy around infinity
Let us determine how the u-plane integrand transforms under the monodromy around infinity. As a function of the effective coupling τ , the measure factor (5.3) is proportional to da dτ du da χ 2 ∆ σ 8 times the product over the couplings C ij . We take the monodromy at infinity to be oriented as u → e 2πi u and a → e πi a, as in Section 2.5. Then this path also encircles all singularities u j , which are the roots of the physical discriminant, ∆ = Next, since u → e 2πi and a → e πi a we find du da → e πi du da , and therefore du da For da dτ we have that a → e πi a, while dτ → dτ , and thus da dτ From (2.38) we recall that w ij → w ij + δ ij , such that with the definition (4.10) we find C ij → e −πiδ ij C ij . The couplings C ij transform in the measure factor as This phase for k j = 0 can be checked directly by taking q-expansions from the SW curves, for generic masses. From (2.38) we recall that under the monodromy around infinity v j → −v j − n j , and thus (5.10) For the sum over fluxes we can now deduce using (A.12) that where we suppressed the dependence on the anti-holomorphic parts. Recall from (3.9) that c 1 (L j ) ≡ K − 2µ mod 2L. (5.12) and as such we can express k j = c 1 (L j )/2 as We have then where we used that K is a characteristic vector of L, and K 2 = σ mod 8. Using (A.12) and substitution of (5.13) in this expression, (5.11) equals Our aim is to write this as a phase times Ψ J µ (τ, z). The constraints on the winding numbers should be independent of µ and k j , since the prepotential is. From (A.15), we therefore get the first constraint j n j = N f mod 2. (5.16) Using identity (A.15), 2µ 2 − K · µ ∈ Z and 4(µ − K 2 ) ∈ 2L, this simplifies to (5.17) Finally using (5.14), we can express the phase in terms of k j , By multiplying (5.9) with (5.18), we find Combining (3.15) with (3.4), we have that 4(k j + µ) 2 ≡ σ mod 8 for every j = 1, . . . , N f . We insert this into the second exponential of (5.19), such that 20) and the u-plane integrand is invariant under T N f −4 if and only if µ j (n j +1)k j ∈ Z. Using (5.13) and the fact that K is a characteristic vector of L, we find n j = 1 mod 2 (5.21) for all j = 1, . . . , N f , which implies the above constraint (5.16).

Monodromy M j
Let us determine how the integrand transforms under the monodromy M j around the mass singularity m j / √ 2. Since the mass singularity corresponds to a singularity u j on the u-plane, we have that (u − u j ) → e 2πi (u − u j ). This implies that ∆ = (u − u j ) While u → u j , both g 2 and g 3 remain finite and nonzero (otherwise u j would be an AD point). This implies that g 3 g 2 contains no factors of (u − u j ), and thus du da → du da . Similarly, we have that da dτ → da dτ . From (2.40) we finally have that w ik → w ik + δ ij δ ik . We combine M j : ν → e πiσ/4 e −πik 2 j ν. (5.22) For the monodromy around the mass singularity m j / √ 2, we find for Ψ J µ with (A.12) The phases thus cancel precisely, without any constraints.

Monodromy M m
For the monopole singularity in N f = 1 we find that where we have used (A.16). Then using (A.13), we arrive at µ is required to transform to itself up to an overall factor, we must demand that (n + 1)k 1 /2 ∈ L. Therefore for k 1 ∈ L/2, we find the requirement that n = −1 ∈ Z 4 . This simplifies the transformations considerably, and we find The k j -independent part of the measure factor transforms precisely as under M j (see (5.22)), as the same argument holds. However, due to the transformation τ → τ −τ +1 , the measure also picks up its modular weight σ 2 + 1. From (2.43) we furthermore find the transformation of C 11 , such that ν(τ, k 1 ) → e πiσ/4 e −πik 2 where we have already used n = −1 ∈ Z 4 . If we multiply (5.27) and (5.28) with dτ ∧ dτ (which has modular weight (−2, −2)), then where we have used σ + b 2 = 2. Thus, the u-plane integrand is also invariant under M m . For N f > 1 we find the same condition, namely that n j = −1 mod 4 for all j.

Monodromy M d
Given the relation (2.41), it is not necessary to explicitly check single-valuedness of the integrand under this monodromy, as it is a product of the above monodromies.
To conclude this section, let us stress the constraints for the winding number n j , such that the u-plane integral is invariant under all monodromies in N f ≤ 3. To this end, we need to satisfy the constraints n j = 1 mod 2 (5.21) from M ∞ , and n j = −1 mod 4 for M m . Since the latter is the stronger constraint, we require for all j = 1, . . . , N f .

Integration over fundamental domains
As discussed in Sections 2 and 5, u-plane integrals for massive N = 2 theories with fundamental hypermultiplets include new aspects. This section discusses how to evaluate such integrals (5.1). More concretely, we aim to define and evaluate integrals of the form with s ≤ 1. The domain F(m) is the fundamental domain for the effective coupling constant as discussed in Section 2.4, and f a non-holomorphic function of weight (2 − s, 2 − s) arising from the topologically twisted Yang-Mills theory. For F(m) a fundamental domain of a congruence subgroup, such integrals (6.1) have been studied in the context of theta lifts of weakly holomorphic modular forms and harmonic Maass forms [105][106][107] as well as one-loop amplitudes in string theory [108][109][110]. We assume that the integrand y −s f (τ,τ ) can be expressed as for a suitable function h(τ,τ ) using mock modular forms. This was indeed the case in [26,47,48], and will be demonstrated for massive N = 2 theories with fundamental hypermultiplets. The integral I f then reads with ∂F(m) the boundary of F(m). We will carry this out evaluation in Part II [88].
There are a number of aspects to be addressed in order to evaluate integrals over F(m): 1. Identifications of boundary components of F(m) due to monodromies on the u-plane.
3. Contributions from a singular point in the interior of F(m).

Branch points and branch cuts.
We will discuss these aspects 1.-5. in the following.

Identifications
The modular transformation induced by monodromies identify components of the boundary of the fundamental domain ∂F(m) pairwise. Their contributions to the integral (6.3) vanish, which is, for example, familiar from deriving valence formulas for modular forms [111, Fig. 2]. See Fig. 4 for an example.

Cusps
Contributions near the cusps require a regularisation [12,48]. Such regularisations have been developed in the context of string amplitudes [108][109][110] and analytic number theory [111][112][113]. Let us first consider the cusp τ → i∞. To regularise the divergence, one introduces a cut-off Im τ = Y 1, and takes the limit Y → ∞ after evaluation. We require that f near i∞ has a Fourier expansion of the form 5 f (τ,τ ) = m −∞,n≥0 c(m, n) q mqn . (6.4) Then the function h has the form, where h(τ ) is a weakly holomorphic q-series, with expansion The cusp τ → i∞ then contributes with d(0) the constant term of h(τ ) (6.6), and w ∞ the width of the cusp F(m) at i∞.
The other cusps can be treated in a similar fashion using modular transformations. We label the n c cusps in F(m) by j = 1, . . . , n c . If the cusp is on the horizontal axis at − d j c j ∈ Q with relative prime (c j , d j ) ∈ Z 2 , we can map the cusp to i∞ by a modular transformation We let τ j = γ j τ . Then the holomorphic part h j (τ j ) of (c j τ + d j ) −2 h(γτ j , γτ j ) can be As a result, the cusp j contributes

Singular points in the interior of F(m)
The integrand can be singular at a point τ s in the interior of F(m). Such singularities appear typically for deformations of superconformal theories, such as the N = 2 * theory and the N f = 4 theory, where the UV coupling τ UV gives rise to such a singularity [26,54]. See Fig. 8 for an example. We require that the expansion of f near such a singularity reads, Then, the anti-derivative h(τ,τ ) has similar expansion, The contour integral for a small contour around τ s , is bounded for such a function. Moreover, in the limit ε → 0, the contour integral is finite. We define the "residue" of a non-holomorphic function g(τ,τ ) nRes with d s (−1, 0) the coefficient in the expansion (6.12).

Elliptic points
For N = 2 QCD, AD points are the elliptic points of the duality group, and lie on the boundary of F(m). See Fig. 7 for an example. The elliptic points are α = e πi/3 and i, and their images under PSL(2, Z). Contour integrals around such points can be regularised using a cut-off ε. We assume that the anti-derivative h has the following expansion near an elliptic point τ e , As a result, the boundary arc around τ AD in H is a fraction of 2π, which needs to be properly accounted for. These neighbourhoods have an angle 2π ke , with k e = 2 for τ e = i, and k e = 6 for τ e = α [114]. Furthermore, it is important how many images of F in F(m) coincide at the elliptic point. We denote this number by n e . For N = 2 SQCD, we found examples with n e = 2 and 4 for τ e ∼ α, while for τ e ∼ i, n e = 1 [52]. The contribution from an elliptic point is then, n e k e nRes τ =τe h(τ,τ ) = n e k e d e (−1, 0), (6.17)

Branch points and cuts
Branch points and cuts are a new aspect compared to previous analyses (see for instance Fig. 4 and 5). We will demonstrate that their contribution vanishes for the integrands of interest. We assume that the integrand f satisfies h(τ,τ ) = (τ − τ bp ) n g(τ,τ ), (6.18) with n ∈ Z/2 and n ≥ −1/2, g(τ,τ ) being a real analytic function near τ bp . This assumption is satisfied for the twisted Yang-Mills theories [88]. To treat this type of singularity, we remove a δ neighbourhood and analyse the δ → 0 limit. Let C δ be the contour C δ = {τ bp + δ e iθ | θ ∈ (0, 2π)} (6.19) around τ bp with radius δ > 0. Therefore, on the contour |y −s f | is bounded by | h| ≤ δ n K (6.20) for some K > 0. The integral around the branch point therefore vanishes in the limit, The branch points necessarily give rise to branch cuts. For the purpose of integration, we remove a neighbourhood with distance r from the cut, and take the limit r → 0 after determining the integral. Since the value of the integrand is finite near the branch cut, the contribution to the integral vanishes.

Summary
Combining all the contributions discussed above, we find This formula generalises [12] for the pure N f = 0 theory on a smooth four-manifold X that admits a metric of positive scalar curvature, [49,Equation (5.10)] for the pure theory on generic X, [26,Equation (4.88)] for the N = 2 * theory on X, and [43] for the massless N f = 2 and N f = 3 theories on X = CP 2 .

A.1 Theta functions and Eisenstein series
We make use of modular forms for the congruence subgroups Γ 0 (n) and Γ 0 (n) of PSL(2, Z). These subgroups are defined as and are related by conjugation with the matrix diag(n, 1). We furthermore define the principal congruence subgroup Γ(n) as the subgroup of SL(2, Z) A with A ≡ 1 mod n. A subgroup Γ of SL(2, Z) is called a congruence subgroup if it contains Γ(n) for some n ∈ N.

Eisenstein series
We let τ ∈ H and define q = e 2πiτ . Then the Eisenstein series E k : H → C for even k ≥ 2 are defined as the q-series where B k are the Bernoulli numbers and σ k (n) = d|n d k is the divisor sum. For k ≥ 4 even, E k is a modular form of weight k for SL(2, Z). Any modular form for SL(2, Z) can be related to the Jacobi theta functions (A.2) by . (A.9)

C Winding numbers
In this Appendix, we discuss the winding numbers appearing in (2.7) in some more detail. As mentioned in Section 2.2, generally the theory admits N f electric winding numbers and N f magnetic winding numbers. While in the main text we set the electric winding numbers to zero, in this Appendix we keep the possibility open for them to be nonzero. The N = 2 supersymmetry algebra requires that the central charge Z is a linear combination of conserved charges. The U(1) conserved charges S i of the hypermultiplets must appear in Z as follows [11], We note that Z is an inner product of periods (a D , a, 1 √ 2 m) and conserved charges (n m , n e , S). The periods are given by contour integrals where γ 1 , γ 2 generate H 1 (E, Z), and λ is a meromorphic 1-form, the SW differential. In massive SQCD, λ has poles with nonzero residues. If the contours γ i are deformed across poles of λ, then a and a D pick up contributions from the residues. By invariance of (C.1), these jumps are linear combinations of the masses, where x i are the N f poles of λ, and n i ∈ Z are the winding numbers of the contour deformation. Since both a D and a are given by contour integrals of the same differential, a deformation of either γ 1 or γ 2 or both results in such a shift.
Example. In order to see how n i and ∆S j are related, let us study N f = 2 as an example. In N f = 2, the S j are integers for fundamental particles and half-integers for monopoles [11]. The two poles of λ are x ± = ± 1 8 Λ 2 2 , with residue [11, (15. such that ∆S j = n 1 −n 2 2 ∈ Z/2 for both j = 1, 2. Constraints on the n i entail constraints on the change ∆S j . For instance, if both n 1 and n 2 are odd, or if both are even, then ∆S 1 and ∆S 2 are integers. In the main text of this paper, we find such a constraint.
For generic N f ≤ 3, by construction of the SW curves the residues of λ are linear combinations of the masses 2πiRes(λ, with i = 1, . . . , N f , and l ij ∈ Z/2 [11, (17.1)]. Then we can compute We find that the change in the abelian global charges ∆S j is given by a half-integral linear combination of winding numbers, In order to relate the winding numbers n i to those for the periods a i and a D,i as found in [56], we can expand Since in (C.10) we divide and multiply by n a j , we cannot directly relate the two expressions by setting n a j = 0. However, if we relate first In this case, it is well-defined to set n a j = 0, such that the action of M Ohta ∞ and M ∞ coincide for n j = n a D j , as anticipated. The N f − 1 conditions (C.12) reproduce the constraints on the winding numbers in [56, (5.3)]: For N f = 1, the condition is empty. For N f = 2, it agrees precisely with Ohta. For N f = 3 finally, the N f − 1 = 2 equations (C.12) are equivalent to those found in [56]. It seems however that our result n a j = 0, n a D j = −1 (5.30) is merely one particular of the infinitely many solutions to the geometric constraint (C.12). 7 Thus it appears that the formulation of the theory on a compact four-manifold introduces further constraints. It would be interesting to understand whether it is possible to introduce non-vanishing electric winding numbers in the u-plane integral, and whether this leads to different correlation functions.