The $u$-plane integral, mock modularity and enumerative geometry

We revisit the low-energy effective $U(1)$ action of topologically twisted $\mathcal N=2$ SYM theory with gauge group of rank one on a generic oriented smooth 4-manifold $X$ with nontrivial fundamental group. After including a specific new set of $\mathcal Q$-exact operators to the known action, we express the integrand of the path integral of the low-energy $U(1)$ theory as an anti-holomorphic derivative. This allows us to use the theory of mock modular forms and indefinite theta functions for the explicit evaluation of correlation functions of the theory, including but not restricted to those that physically reproduce Donaldson invariants, thus facilitating the computations compared to previously used methods. As an explicit check of our results, we compute the path integral for the product ruled surfaces $X=\Sigma_g \times \mathbb{CP}^1$ for the reduction on either factor and compare the results with existing literature. In the case of reduction on the Riemann surface $\Sigma_g$, via an equivalent topological A-model on $\mathbb{CP}^1$, we will be able to express the generating function of genus zero Gromov-Witten invariants of the moduli space of flat rank one connections over $\Sigma_g$ in terms of an indefinite theta function, whence we would be able to make concrete numerical predictions of these enumerative invariants in terms of modular data, thereby allowing us to derive results in enumerative geometry from number theory.


Abstract
We revisit the low-energy effective U (1) action of topologically twisted N = 2 SYM theory with gauge group of rank one on a generic oriented smooth 4-manifold X with nontrivial fundamental group. After including a specific new set of Q-exact operators to the known action, we express the integrand of the path integral of the low-energy U (1) theory as an anti-holomorphic derivative. This allows us to use the theory of mock modular forms and indefinite theta functions for the explicit evaluation of correlation functions of the theory, thus facilitating the computations compared to previously used methods. As an explicit check of our results, we compute the path integral for the product ruled surfaces X = Σg × CP 1 for the reduction on either factor and compare the results with existing literature. In the case of reduction on the Riemann surface Σg, via an equivalent topological A-model on CP 1 , we will be able to express the generating function of genus zero Gromov-Witten invariants of the moduli space of flat rank one connections over Σg in terms of an indefinite theta function, whence we would be able to make concrete numerical predictions of these enumerative invariants in terms of modular data, thereby allowing us to derive results in enumerative geometry from number theory.

Introduction, Summary and Plan
The role of topological quantum field theory in modern physics and mathematics is unambiguously important. One example is Donaldson-Witten (DW) theory, which is a topological formulation of the N = 2 supersymmetric Yang-Mills theory on an oriented smooth four-manifold X. Its equivalent IR (long distance) counterpart is an abelian theory where Seiberg-Witten (SW) geometry dictates the physics [1]. Due to an electric-magnetic duality in the IR, characteristic functions of the theory enjoy powerful modular properties [2]. In the seminal paper [3], the solution of the IR theory was derived using the technique of lattice reduction for simply connected X. In the same paper, the famous relation was found, where Z SW denotes the generating function of SW invariants of the four-manifold [4], while Z u denotes the contribution to Z DW from the Coulomb branch of the low-energy effective U (1) theory, the so-called u-plane. The uplane and its contribution to the path integral were studied in detail in [3,[5][6][7]. The u-plane integral Z u is of particular interest since it is non-vanishing only for 4-manifolds with b + 2 (X) ∈ {0, 1}. In turn, such four-manifolds are of particular interest since they are the only candidate topologies that probe the Coulomb branch B of the theory.
Recently, interest in DW theory, and in particular the u-plane integral, was revived due to observations relating the latter for special four-manifolds to the theory of mock theta functions and harmonic Maass forms [8,9]. For more generic, but simply connected, compact four-manifolds, it was later reformulated in terms of the modular completion of a mock modular form [10][11][12]. In this series of papers, the possibility of adding Q-exact operators to the action without affecting the correlation functions was studied in detail. In particular, a specific new Q-exact operator related to the 2-cycles of the background geometry was added to the action of the low-energy U (1) theory, which makes the connection to mock modular forms apparent and elegant [10,12]. This technique circumvents the cumbersome method of lattice reduction, and allows to evaluate correlation functions efficiently. To the best of our knowledge, all of the recent results relating Z u and mock modular forms are restricted to the case where the low-energy U (1) theory is formulated on simply connected 4-manifolds only.
Taking inspiration from [7], we ask the natural question how these recent results carry over to the case when the four-manifold X has a non-trivial fundamental group and non-zero first Betti number b 1 (X). When the fourmanifold is non-simply connected, the theory is more complicated. This is due to the fact that the manifold now admits more structures, in the form of 1-form fields and 1-and 3-cycles, which are not present in the simply connected case. These cycles give rise to further contact terms in the low-energy U (1) action [5,7]. As a result, we will consider more general Q-exact operators related to these cycles. Below, we give a summary of the paper highlighting our results.

Summary of the Paper
In this paper, we present a natural extension of the recent results [10,12] to the case of non-simply connected four-manifolds with b + 2 = 1. Specifically, we introduce a number of new Q-exact operators in the low-energy effective U (1) theory that allow us to express the integrand of the u-plane integral elegantly as the non-holomorphic completion of a mock modular form. This further allows us to derive a closed-form expression for the u-plane integral for any such four-manifold and for arbitrary period point J, as is evident from the result of this paper, Equation (52). This solution depends on H 1 (X), a fact that is easily seen in the case of product ruled surfaces where it manifests as a genus dependence, while when H 1 (X) is trivial, (52) reduces to Equation (4.10) of [10]. As a byproduct of our computations, we present a complete classification of all Q-exact operators that the theory admits.
DW theory on product ruled surfaces X = CP 1 × Σ g , with Σ g a genus g Riemann surface, has been argued to be equivalent to a 2d topological A-model on CP 1 in the limit of vanishing volume for Σ g [5,13,14]. In this paper, we present a concrete derivation of this equivalence, and in turn show that due to the relation between DW theory and its low-energy U (1) effective theory as given by Eq. (1), a connection between Gromov-Witten (GW) theory (realised physically by the A-model) and mock modular forms (appearing in the lowenergy effective action) exists, such that one can compute GW invariants using modular data originating from the 4d theory, thereby deriving results in enumerative geometry from number theory. As an example, we make concrete numerical predictions of the genus zero GW invariants of the moduli space of flat SU (2)-connections on Σ 2 via their relation to an indefinite theta function. The GW invariants studied here involve local and non-local operators which, as far as we know, have not been studied elsewhere.

Plan of the Paper
The plan of the paper is as follows. In Section 2, we review the effective DW theory and the low-energy SW geometry. We further discuss the new specific Q-exact operators that we add to the action.
In Section 3, we rederive the u-plane integral Z u by including the Q-exact operators, and show how Z u can be written in terms of a mock modular form.
In Section 4, we apply our results to the two possible reductions of the product ruled surfaces X = CP 1 ×Σ g and check them against existing literature The u-plane integral, mock modularity and enumerative geometry [7,15]. The second reduction, where the volume of Σ g shrinks, will be related to the genus zero GW invariants realised by the correlation functions of the A-model on CP 1 .
In Section 5, we discuss the A-model on CP 1 , and perform the computations that produce the generating function of GW invariants. Together with the findings of Section 4, we make concrete numerical predictions of the genus zero GW invariants of the moduli space of flat SU (2)-connections on Σ 2 via modular data.
In Section 6, we conclude our paper, where useful appendices follow thereafter.
2 Effective DW theory DW theory is the topologically twisted formulation of the pure N = 2 supersymmetric Yang-Mills theory with gauge group G of rank r G = 1 on a smooth four-manifold X [1]. In the IR, the theory becomes a U (1) gauge theory that depends on the complexified effective gauge coupling τ = θ π + 8πi g 2 ∈ H, where H denotes the Poincaré half-plane. DW theory contains a scalar fermionic BRST operator Q := ȦḂ QȦḂ that obeys Q 2 = 0. 1 The field content of the theory is a collection of bosonic and fermionic degree 0, 1 and 2 operator valued differential forms on X, where the degree of the differential form is equal to the ghost number of the physical operator. In Table 1 we summarise the field content of the DW theory. The BRST transformations on these fields are Bosons Fermions Form degree a,ā η 0 A ψ 1 D χ 2 Table 1 Field content of DW theory. The a,ā fields originate from the vacuum expectation value of the scalar field of the UV theory. The D field is an auxiliary field.
The physical observables of the theory belong to the Q-cohomology. We are interested in computing the path integral of the theory, the u-plane integral or Coulomb branch integral, when evaluated on a non-simply connected fourmanifold. To this end, let us first introduce some notation. Let b j := b j (X) = dim H j (X) be the Betti numbers of the smooth, closed and oriented four-manifold X with b 2 (X) = b + 2 (X) + b − 2 (X), where the first (second) summand corresponds to the number of positive (negative) eigenvalues of the quadratic form Q of X. For a ∈ H i (X) and b ∈ H 4−i (X) we define For a ∈ H 2 (X) the quadratic form Q of X corresponds to Q(a) := B(a, a).
Furthermore, the signature of X is defined as σ( Hereafter we consider four-manifolds with b + 2 (X) = 1. By Poincaré duality, we have that b 0 = b 4 , b 1 = b 3 . We can assume b 1 to be even, since the correlation function of the theory are known to vanish unless 1 − b 1 + b + 2 is even [3]. The Coulomb branch integral is the path integral of the low-energy U (1) theory with the insertion of the observables arising from the descent formalism as well as contact terms and Q-exact operators. It takes the form where Φ = {a,ā, A, η, ψ, χ, D} is the collection of fields of the theory (as in Table 1). Below, Sections 2.1-2.5 are devoted to reviewing and explaining in detail all the ingredients of the u-plane integral (5). Finally, in Section 2.6 we introduce the new Q-exact operators I S following [10] as well as its generalisation I(S, Y ) that will allow us to reformulate Z u as an integral over a mock modular form.

Seiberg-Witten geometry
In the seminal papers [2,16], Seiberg and Witten found the exact low-energy solution of N = 2 supersymmetric Yang-Mills with gauge group SU (2). The N = 2 vector multiplet consists of a gauge field A, a scalar φ and Weyl fermions λ and ψ, all in the adjoint representation. The potential of the theory is V (φ) = 1 g 2 Tr[φ, φ † ] 2 and we are interested in the moduli space of flat directions. These are found by setting φ = aσ 3 , with σ 3 the third Pauli matrix and a a complex parameter. However, note that the Weyl group of SU (2) acts on a by a → −a. We can then construct a gauge invariant parameter as This serves as a good coordinate on the moduli space. There are two strong coupling singularities in the gauge theory, located at u = ±Λ 2 , where a monopole and a dyon become massless, respectively The u-plane integral, mock modularity and enumerative geometry [2]. Here, Λ is the dynamical scale of the theory, which is generated by the renormalisation group flow. This will be set equal to one later in the paper. The central charge of a dyonic state with electric and magnetic charges (n e , n m ) is given by Z = n e a + n m a D , (7) where a D is the magnetic dual of a, a D = ∂F ∂a , with F the prepotential of the theory.
The quantum moduli space of the gauge theory can be described in terms of a certain family of elliptic curves, the so-called Seiberg-Witten (SW) curves, The complex structure of the curve is identified with the complex coupling τ of the gauge theory. The fields a and a D can be determined from the SW differential λ SW as where A and B are the canonical basis of homology cycles on the elliptic curve. By relating the j-invariant of the SW curve (8) to that of the Weierstraß curve, we can solve for u in terms of Jacobi theta functions, where q = e 2πi τ . See Appendix A for the definitions of the theta functions. Using this formula it is straightforward to show that u is a modular function for the congruence subgroup Γ 0 (4) ⊂ SL(2, Z). The fundamental domain of this group is shown in Figure 1. The cusp at τ =i ∞ corresponds to weak coupling, while the cusps at τ = 0 and τ = 2 correspond to the monopole and dyon singularities, respectively. From the curve (8) we can directly find other quantities that will be important for the analysis in the paper, such as du da or du dτ . See for example [17] for a more detailed discussion on how these quantities can be retrieved from the curve. These expressions and their transformation properties under Γ 0 (4) are collected in Appendix A.2.
The u-plane integral can also be formulated for theories other than pure N = 2 SYM with gauge group SU (2). For pure N = 2 SYM with gauge group SU (N ) and N > 2, integrals over the respective Coulomb branches have been performed in [18]. The modular structure for those theories is however much more involved, as was recently elaborated in [19]. More tractable Coulomb branches are rank one theories with matter hypermultiplets, such as N = 2 * (with one adjoint hypermultiplet) and N = 2 supersymmetric QCD (with N f ≤ 4 fundamental hypermultiplets), both with gauge group SU (2) [16]. Rank 1 Argyres-Douglas theories are non-Lagrangian examples of N = 2 Fundamental domain Γ 0 (4)\H of the congruence subgroup Γ 0 (4), the duality group of the pure SW theory. It consists of six images of the key-hole fundamental domain F of SL (2, Z). The cusp at τ =i ∞ corresponds to weak coupling, while the cusps at τ = 0 and 2 correspond to the monopole and dyon points.
theories with 1-dimensional Coulomb branches [20,21]. The partition function has been studied only for the simplest of those, the (A 1 , A 2 ) theory [22]. The extension of such Coulomb branch integrals to manifolds with b 1 (X) > 0 is interesting because the ghost number selection rule admits the possibility of an infinite number of non-vanishing correlation functions, in sharp contrast to the case b 1 (X) = 0. The u-plane integral for N = 2 * theory has been formulated in [23] and evaluated in [24], based on the Coulomb branch geometry found in [25]. The modular structure of N = 2 QCD on the other hand has been established much more recently [17]. Integration over those Coulomb branches has yet to be completed [26].

Effective Lagrangian
The low-energy U (1) effective Lagrangian L of the twisted theory is given in [3, (2.15)]. The Q-exact terms as well as the kinetic terms do not contribute since the zero modes are constant in DW theory on a four-manifold X with b + 2 (X) = 1. For such manifolds there is a useful fact stating that for any β 1 , β 2 , β 3 , β 4 ∈ H 1 (X, Z), we have [27] We will make extensive use of this fact below.
Springer Nature 2021 L A T E X template 8 The u-plane integral, mock modularity and enumerative geometry Let us define L as the part of the zero-mode low-energy U (1) effective Lagrangian that contributes to the u-plane integral. It is given by [3] where F ± = 4πk ± and for any two-form x we abbreviate B(x, x) = x 2 as defined in Eq. (3). In L , we disregard any summands of L containing Qexact terms, exact differential forms and ∧-products of four 1-forms. Here and throughout the rest of the paper we use units where the dynamical scale Λ of the low-energy effective U (1) theory is equal to one. The gravitational contributions to L are described in the following section.

Measure factors
Assuming X is connected, the (holomorphic) measure factor [3,28] is Here we used χ(X) + σ(X) = 4 − 2b 1 to eliminate the Euler character of X, χ(X). This expression reduces to Eq. (2.9) in [10] if we take b 1 = 0. For the simply connected theory one can use the microscopic definition of the theory to determine the effective gravitational couplings (e.g. by considering expansions of the Nekrasov partition function) [29,30]. The zero modes of the one-forms ψ live in the tangent space of a b 1dimensional torus T b1 = H 1 (X, R)/H 1 (X, Z) = H 1 (X, O * X ) which corresponds to isomorphism classes of invertible sheaves (for X a smooth complex variety that is holomorphic line bundles) on X which are topologically trivial. We can expand ψ in zero-modes as ψ = b1 i=1 c i β i with β i an integral basis of harmonic one-forms, and c i Grassmann variables. We then have the measure The photon partition function will also include an integration over b 1 zero modes of the gauge field corresponding to flat connections [7]. These zero modes span the tangent space of T b1 . As a consequence of this, the photon partition function will have an overall factor of y 1 2 (b1−1) [31]. Combining this with the measure factor (14) we see that in the end there will only be a factor of y −1/2 surviving.
We can also consider the c j in the expansion of ψ as a basis of one-forms β # j ∈ H 1 (T b1 , Z), dual to β j , such that A useful fact about four-manifolds with b + 2 = 1 is that the image of the map is generated by a single rational cohomology class, which we denote as W [27]. 2 This means that we can write β i ∧ β j = a ij W , i, j = 1, . . . , b 1 , where a ij is an anti-symmetric matrix. This further implies that the two-form on T b1 can be written as where Below, we will study four-manifolds of the type X = CP 1 × Σ g with Σ g a genus g Riemann surface. For these manifolds we have that W = [CP 1 ] and vol(T b1 ) = 1 [7]. Using the analysis above we can now write ψ ∧ ψ = 2(W ⊗ Ω) [7]. This will be very useful later on when we want to perform the integral over T b1 for the product ruled surfaces.

Observables
Q-invariant observables can be constructed using the celebrated descent formalism. By starting with the zero-form operator O (0) = 2u, we find all k-form valued observables O (k) for k = 1, 2, 3, 4 that are Q-invariant modulo exact forms by solving the descent equations inductively. This ensures that for a k-cycle Σ (k) ∈ H k (X) in X, the integrals Σ (k) O (k) are Q-invariant and only depend on Σ (k) . Fortunately, there is a canonical solution to the descent equations: Due to the fact that the translation generator is Q-exact, there is the one-form valued descent operator K, which satisfies d = {Q, K} [3]. This implies that (19) can be solved by The u-plane integral, mock modularity and enumerative geometry where the iterated (anti)-commutators are implicit. The action of the operator K can be inferred from the BRST transformations (2) as [3] [K, a] = 1 4 (20) Let us study the insertion of all possible observables. For ease of notation, let us denote p = Σ (0) a point class, γ = Σ (1) a 1-cycle, S = Σ (2) a 2-cycle and Y = Σ (3) a 3-cycle. The cycles γ, S and Y can be expanded in formal sums as where γ i , S i and Y i are a basis of one-, two-and three-cycles respectively, λ i are complex numbers, while ζ i and θ i are Grassmann variables. By the common abuse of notation, we use the same notation for the 3-, 2-, and 1-forms Poincaré dual to the cycles, and use the convention The most general Q-invariant observable we can add is then where a 2 =i √ 2π is fixed from matching with the mathematical literature [3]

Contact terms
The existence of the canonical solution to the descent equations allows to map an observable of the UV theory to the low-energy U (1) effective theory on the u-plane. For instance, the operator I(S) = S K 2 u of the UV theory is mapped to the same observableĨ(S) = S K 2 u in the IR. This is not quite true for products I(S 1 )I(S 2 ) . . . I(S n ) of such operators for distinct Riemann surfaces S i ∈ H 2 (X, Z). At the intersection of the surfaces, contact terms will appear [3,5]. When mapping a product of surface operators to the IR, the product is corrected by a sum over the intersection points. Due to the Q-invariance, the inserted operator is holomorphic and the point at which it is inserted is irrelevant. Such contact terms appear for all cycles in X that can intersect. They have been classified and the corresponding contact terms have been found in Here τ 0 is the deformation parameter of the prepotential, related to the dynamical scale by Λ 4 = e πi τ0 . The coefficient functions can all be expressed as quasi-modular functions on the u-plane. For instance, the contact term for S ∩ S is In terms of the prepotential F, it is given by T (τ ) = 4 πi ∂ 2 F ∂τ 2 0 [32]. It furthermore satisfies the identities [7] 4πi We can use the action (20) to find The u-plane integral, mock modularity and enumerative geometry The intersection constants can be obtained from duality invariance [7] Due to the identity (11), the two last terms in (25) vanish and we can disregard them. Thus, from (25) and (28) we see that all terms in I ∩ except for one are only integrated over ψ and τ , which we we do in a later step. The remaining term is to be integrated over D, χ and η.

Q-exact operators
As we will later see, the photon path integral combines with the insertion of the surface observable to a Siegel-Narain theta function Ψ J µ (τ, z). See (47) for the definition. This function can be expressed as a total derivative to a non-holomorphic modular completion of an indefinite theta function, as has been previously shown in the simply connected case [10,12]. To facilitate the calculation further the authors of those papers add the Q-exact operator I S . 4 In this section we will generalise this operator insertion to simplify the calculations also in the case of non-simply connected manifolds. This then allows us to evaluate correlation functions efficiently using mock modular forms [10][11][12].
Since our computations should be valid for any b 1 ≥ 0 and in particular b 1 = 0, this suggests that it is instructive to add the same Q-exact operator [10, (2.11) and (2.12)] The u-plane integrand (5) with I S inserted can also in the case where b 1 = 0 be written as an anti-holomorphic derivative. However, it does not give the same kind of Siegel-Narain theta function as in the simply-connected case. The reason is that the putative elliptic argument z of Ψ J µ does not couple to H 2 − (X) symmetrically to how its conjugatez couples to H 2 + (X). The insertion of I S in the case b 1 = 0 can be viewed as the unique correction to the path integral that symmetrises the couplings to H 2 ± (X). Without such an insertion, the resulting theta functions are not symmetric, see for instance [3,Equation (3.18)]. As we demonstrate below, for b 1 = 0 this issue can be cured by introducing additional Q-exact operators. More precisely, the new observables and related contact terms require three new Q-exact terms. The first two compensate the observables (23). From the collection of contact terms (25), only the one from the intersection Y ∩ Y gives a term (30) that is integrated over D, η and χ. This term requires the addition of the Q-exact operator We can note that, according to (29),ā 33 = −a 33 . The sum of these additional Q-exact terms can be compactly written as where we introduced the 2-form This 2-form has the property that yω is holomorphic and thus yω is antiholomorphic. The form of (32) is derived in Appendix C, where we furthermore show that its one-point function evaluates to zero, such that it is safe to include it into the path integral, following the analysis in [11,12]. We furthermore find it useful to follow [10] and introduce the notation Anticipating the result as a Siegel-Narain theta function, the elliptic variable will turn out to be z = ρ + 2i yω, which is a 2-form with holomorphic coefficients. In terms of this variable, the sum of all Q-exact insertions (31), (32) The u-plane integral, mock modularity and enumerative geometry and (33) combine nicely as It is clear that this is purely anti-holomorphic. The operator I(S, Y ) is then included into the path integral, as in (5).
3 The u-plane integral for π 1 (X) = 0 The u-plane integral (5) can be expressed as where Pic(X) denotes a sum over isomorphism classes of line bundles, equivalent to a sum over H 2 (X, Z), followed by an integration over T b1 . 5 The ψ zero modes are tangent to Pic(X), so the integral over these modes is understood as the integral of a differential form on Pic(X) [3]. At this point let us make a remark. The Q-exact operator I(S, Y ) is not strictly required in order to derive our end result (52). As a matter of fact, as shown in [12] this operator can be added freely as αI(S, Y ), with α any number. 6 However, the case of α = 1 makes the analysis simpler and more elegant, why we choose to include it.
Let us perform the integrals above in steps, using an economical notation. We integrate first over the auxiliary field D, and then over the fermionic 0and 2-forms, η and χ.

Integration over D, η and χ
Using (35) and (36), we can expand the terms in the exponential of (38) that are affected by the integrals over D, η and χ as (ignoring the remaining terms for now) At any point we discard terms that vanish identically, such as 4-fermion terms or any instance of (11) such as This can be found by differentiating (39) with respect to D and setting it to zero. Inserting D in (39) gives 7 (41) The third line are the only terms involving η and χ, which we will integrate over next. Before, we can combine those terms in the expression Integrating over η and χ, we can rewrite this in a compact way as a total anti-holomorphic derivative times an overall factor that, as we discuss below, cancels with contributions from the rest of the measure, √ 2i 4 where ∂τ acts on everything to its right and J = J/ Q(J) ∈ H 2 + (X) is the normalised self-dual harmonic form on X. This result follows directly from the the identities (44) As previously discussed, the photon path integral together with the measure for the zero modes of ψ contains a sum over all fluxes times a factor of 1/ √ y, and additionally contributes (−1) B(k,K) , where K is the canonical class of X [31]. The 1/ √ y factor is thus absorbed by the √ y on the rhs of (43). 7 If we integrate over D instead of inserting the equations of motion we get an additional factor of 2πi 2 y in front of the integral [11]. The result of the integration does not change otherwise since both methods agree for Gaußian integrals up to an overall factor of π ai , if we integrate e aD 2 over D. It is the same factor as in the simply-connected case because the quadratic D-term is the same. According to [3, p. 68] the D determinant should be ignored because it cancels in any case with the fermionic determinants.
The u-plane integral, mock modularity and enumerative geometry Using the change of variables provided by (10), we can further integrate over dτ ∧dτ rather than over da∧dā. This motivates the definition of the transformed measurẽ such that da ∧ dā ν = dτ ∧ dτ dā dτν . The factor dā dτ cancels with the dτ dā of (43).

Siegel-Narain theta function
Let us demonstrate that the u-plane integrand for π 1 (X) = 0, as in the simplyconnected case [10], evaluates to a Siegel-Narain theta function. To this end, let us define with q = e 2πi τ and β = Imz . For the elliptic variable z = ρ + 2i yω, we have β = b + ω +ω (here, we use that yω is holomorphic). Both variables appear naturally in (41) and (43). In fact, we can combine everything to find Here, and are the (holomorphic) remainders of the collections of 0, . . . , 3-form observables and their contact terms that has not yet been integrated over, and we eliminated all terms that do not contribute. Let us check that (48) is indeed true from the computations in Section 3.1. Aside from the ψ ∧ ψ term, the exponential of the first two lines in (41) immediately combine into the definition (47) with said parameters, z = ρ + 2i yω andz =ρ − 2i yω. Everything not exponentiated is given by theτ derivative term in (43), which precisely gives the derivative term in (47). This proves (48).
The expression (48) generalises the result of the u-plane integral [12, (4.32)] to four-manifolds X with b 1 (X) > 0 by giving a decomposition of the integrand into a holomorphic and metric-independent measureν e I O +I ∩ and a metricdependent, non-holomorphic component Ψ J µ (τ, z). Therefore, the evaluation techniques of [12] apply. Namely, we can express the integrand of the u-plane integral as an anti-holomorphic derivative, The holomorphic exponential e I O +I ∩ does not affect the anti-holomorphic derivative, and thus the extension to π 1 (X) = 0 is simply through the elliptic argument z = ρ + 2i yω.
Once H J µ (τ,τ ) is found, we can use coset representatives of SL(2, Z)/Γ 0 (4) to map the six images of F = SL(2, Z)\H back to F (see Fig. 1). The regularisation and renormalisation of such integrals originating from insertions of Q-exact operators has been rigorously established in [11], and we review it in Appendix B. This then allows to evaluate the partition function as where by | q 0 we denote the q 0 coefficient of the resulting Fourier expansion, and the τ -integrand of (48) is given by 8 The prefactors in (52) can be recognised as the widths of the cuspsi ∞, 0 and 1 of the modular curve Γ 0 (4)\H.
To derive a suitable anti-derivative H J µ (τ,τ ), it is auxiliary to choose a convenient period point J. The u-plane integral for a different choice J is then related to the one for J by a wall-crossing formula, given explicitly in [7]. It is shown in [12] that for convenient choices of J, Ψ J µ (τ, z) factors into holomorphic and anti-holomorphic terms, and the anti-derivative H J µ can be found for both L even and odd. Furthermore, the u-plane integral can be evaluated using mock modular forms for point observables p ∈ H 0 (X) and Appell-Lerch sums for surface observables z ∈ H 2 (X) [12].
In [11] it is furthermore shown that in the above mentioned renormalisation, any Q-exact operator (such as I(S, Y )) decouples in DW theory. However, it is clear that the insertion of I(S, Y ) crucially changes the integrand, making The u-plane integral, mock modularity and enumerative geometry the Siegel-Narain theta function symmetric. Instead of inserting I(S, Y ), we can contemplate adding αI(S, Y ) for an arbitrary constant α. It was noticed in [12] that the Siegel-Narain theta function Ψ J µ,α for b 1 = 0 with the insertion αI S remains finite at weak coupling (Imτ → ∞) if and only if α = 1. This can be seen from the exponential prefactor in (47), whose exponent is negative definite if and only ifz (which we suppress in the notation) is the complex conjugate of z.

Single-valuedness of the integrand
An essential requirement, for the consistency of the theory, is that the path integral (48) is single-valued. For this it is advantageous to first change variables in the ψ-integral as This is because the coefficient function of ψ∧ψ in yω is modular, while the ψ∧Y and Y ∧ Y coefficients of yω are only quasi-modular. Such shifts (54) leave the measure of [dψ] invariant, as dψ = dψ . Due to the order of integration in (48), the change of variables (54) is well-defined. Since Y is also Grassmann-odd, ψ and Y ∧-commute. Using (29) and (27), this gives Let us use the notation of Appendix A.2. It is argued in [7] that ψ transforms as (−1, 1) (1,0) . Using (112), one then finds that yω = (−1, 1) (−1,0) transforms precisely as ρ = (−1, 1) (−1,0) , such that z = ρ + 2i yω = (−1, 1) (−1,0) is a modular form and transforms exactly as in the π 1 (X) = 0 case. Furthermore, it is auxiliary to define [7, (2.14)] It is well-defined, as S = (1, 1) (0,0) is fully invariant. In contrast to (54), this is not a change of variables or a redefinition, but rather a substitution to simplify some expressions. For instance, the elliptic variable now reads which takes the same form (36) as in the simply-connected case.
By incorporating the shift of ψ → ψ together with (56) we find that the contact terms and observables in (49) and (50) can be written as (58) All terms but S 2 T are modular functions with trivial multipliers. Due to (57), the quasi-modular shift of T combines precisely with the one of Ψ(τ, z).
We also need to consider the fermion measure. As we have discussed earlier, this comes with an overall factor of y − b 1 2 which gets absorbed by a similar factor coming from the photon partition function. This leaves us with b1 i=1 dc i , which has weight (−b 1 , 0), since ψ has weight (1, 0) [31]. So after the integration over D, η and χ, and after changing integration variables from da∧dā to dτ ∧dτ the measure of the integral will have weight (−2 − b 1 , −2), and we thus need the rest of the integrand to have weight (2+b 1 , 2). Finally, the transformations of the Siegel-Narain theta function Ψ J µ (τ, z) can be found in Appendix A.3. The integrand of the u-plane integral (48) reads Since it is integrated over the fundamental domain of Γ 0 (4), in order to check whether the integral is well-defined J J µ must transform as a modular function for Γ 0 (4) with no phases. In Table 2 we collect the phases and weights of the individual factors as discussed above. This shows that the integral is indeed well-defined.

Computation for product ruled surfaces
As an interesting application of our results we can study the u-plane integral for a four-manifold of the type X = CP 1 × Σ g , where Σ g is a genus g Riemann surface. This is a product ruled surface with b + 2 (X) = 1 (see Appendix D.1). 9 The DW theory for these manifolds was worked out in [7,15] and we can use these results as a check of our formula. By shrinking the size of the Riemann surface Σ g we get a topological σ-model, more specifically the topological Amodel, on CP 1 [13]. By calculating certain correlation functions on both sides we will be able to make an indirect connection between mock modular forms and the topological σ-model on CP 1 in Section 5.
The product ruled surfaces that we consider have b 1 = 2g, b 2 = 2, b + 2 = 1, K X = 0, which in turn means that σ = 0 and χ = 4(1 − g) [7]. We consider a general period point where [CP 1 ] and [Σ g ] are the cohomology classes that generate H 2 (X, Z) [7]. 10 For these manifolds we further have that the rational cohomology class W, discussed in Sec. 2.3, is simply given by W = [CP 1 ] [27]. The intersection matrix is The scalar curvature for this metric is 8π(e θ − e −θ (g − 1)). We see that this is positive for e 2θ > g − 1, such that we do not get any contributions from the 9 One could alternatively consider products Σg × Σ h of Riemann surfaces, however those have b + 2 = 1 if and only if either g = 0 or h = 0, such that for g, h ≥ 1 the u-plane integral vanishes. 10 Sometimes we will be sloppy and write simply CP 1 and Σg for these classes, and hope that this does not confuse the reader.
Seiberg-Witten invariants in these chambers. In particular, this is true when the volume of CP 1 is small, since this has θ large and positive.
The connection to the topological σ-model is made in the chamber where we shrink the volume of Σ g [13]. For completeness, we will calculate the u-plane integral in both chambers, where either of the factors shrink. The calculations are similar in both cases and we will start with the chamber where the volume of CP 1 is small.
From Eq. (13) we find that the measure factor for these manifolds simplifies toν For these manifolds we also have that the Ψ J µ of (48) can be written as a total derivative of the indefinite theta function [34] Θ where k 2 = k 2 + + k 2 − , J is a reference vector 11 lying in the negative cone such that Q(J ) < 0, and is a reparametrisation of the error function. See also Appendix A.4 for more details on these indefinite theta functions. This means that we can take as For the evaluation of the u-plane integral using this H J µ , one may replace Θ JJ µ in (68) after the modular transformations as in (52)   The u-plane integral, mock modularity and enumerative geometry B(S , J ) = B(S, W ). As above, we denote z = ρ + 2i yω and β = b + ω +ω. We can introduce the split k = m + nW , with m chosen such that With this split the mock modular form Θ JJ µ coming from (68) can be written as where, in the second equality, we performed the sum over n. This is an Appell-Lerch sum [34]. The u-plane vanishes in chambers where w 2 (E) · [CP 1 ] = 0 [3]. This means that we only have solutions for w 2 (E) = 0 or w 2 (E) = W , implying that B(µ, W ) ∈ Z. The only solutions for the conditions on m are then m = 0 for w 2 (E) = 0 and m = 1 2 W for w 2 (E) = W , this means that the contributions from the theta function are We note that these are independent of ψ. The u-plane integral in this chamber can now be written as with Θ JW µ as above. If we only include point and surface observables it is straightforward to do the integral over the torus. The final result is

Shrinking Σ g
We now go on to discuss the chamber where we instead shrink the volume of Σ g . For this chamber we pick the primitive null vector to be J = [Σ g ]. The procedure is similar to the above. However, note that now B(ψ ∧ ψ, J ) = 0. We start as before by splitting k = m + nΣ g with m chosen such that Let us start by looking at the contribution from infinity. After performing the sum over n we find that the indefinite theta function becomes This is again an Appell-Lerch sum [34]. Following [15] we now pick ω 2 (E) = [CP 1 ] + [Σ g ], with = 0, 1. For this flux there is no contribution from infinity, as can be seen from the above by realising that there are now no solutions to the conditions on m. We therefore turn to the other cusps. For the monopole cusp at τ = 0 we can use the formulas in the appendix to define the dual indefinite theta function as where we used that K X = 0 and b 2 (X) = 2 together with the transformation formulas of the appendix. Following the procedure from above, splitting and summing over n, and simplifying by only including point and surface observables, we eventually find that Here we have used that B(µ, Σ g ) = 1 2 and that ψ ∧ ψ = 2W ⊗ Ω together with the explicit expressions for ω when only including points and surfaces as observables. We also continue to denote dual functions with a subscript D. The explicit expressions for these are given in the appendix, Eq.(115).
Next, we want to integrate over the torus. If we only write down the parts that are actually dependent on ψ, or equivalently Ω, the integral over the torus is The u-plane integral, mock modularity and enumerative geometry A neat trick we can use is to realise that where Li n (y) is the polylogarithm [15]. Using this and again splitting S = s[Σ g ] + t[CP 1 ] we find that the integral over the torus evaluates to where we dropped the first term coming from (79) since this does not contribute to the u-plane integral (it will give a term whose q-series starts with a positive exponent). Combining this with the other terms in the u-plane integral we find that the contribution from the cusp at τ = 0 is given by The contribution from the other cusp is easily calculated using the same procedure. The result is The full u-plane integral in this chamber is then the sum of these two terms. 13

Genus one
For g = 1 the Seiberg-Witten contributions vanish and the only contributions comes from the u-plane integral [15]. The above expressions simplifies to (84) 13 These expressions again differ from that of the older literature [15] by an overall phase (−1) (−i) g .
For p = 0 we instead find (expanding in small t) . (85)

Genus two
For g = 2 we find where by a D we actually meani π da dτ D d 2 u da 2 D , by use of the relation (114) [35]. For s = t = 0 we simply get zero, but for p = 0 we get , . (88) The first few terms in the expansion for small s and t, and p = 0, are and The u-plane integral, mock modularity and enumerative geometry

Revisiting the A-model computations
The previous discussion is focused on the low-energy U (1) effective action of DW theory on a generic oriented and non-simply connected four-manifold X ie, the u-plane formalism. There were indications that for X a product ruled surface, the correlation functions calculated in the previous section are related to Gromov-Witten invariants [13][14][15][36][37][38], that correspond to correlation functions of an N = (2, 2) topological A-model in two dimensions, at the limit where the volume of one of the factors of X vanishes. The aim of this section is to obtain Gromov-Witten invariants, i.e., values of correlation functions of an N = (2, 2) topological A-model in two dimensions, by direct comparison with results obtained from the previous section. There, an explicit calculation was carried out in the case of a product four-manifold, X = CP 1 × Σ g with g = 2, where both the u-plane and Seiberg-Witten terms contribute, shown in (87), (89) and (90). These expressions are the ones we shall use to obtain Gromov-Witten invariants.
Using the fact that the twisted N = 2 gauge theory is topological, we are free to shrink Σ g . We thus obtain an effective 2d theory on CP 1 : the N = (2, 2) topological A-model on worldsheet CP 1 , with the target space being the moduli space M flat (Σ g ) of flat SU (2) connections on Σ g . As a consequence, flat SU (2) connections along the directions tangent to Σ g are required to prevent the effective 2d action from blowing up when the limit of small Σ g is taken. This result is rederived in Appendix E, following [13].
There is however a subtle point about the relation of the 2d A-model to both 4d theories, in that the relation should hold only within the limit of Σ g → 0. More will be said about this further on. Nevertheless, what we can achieve with this relation are predictions for Gromov-Witten invariants via coefficients from the expansion of a 4d low-energy U (1) effective theory. This also offers an alternative approach in the calculation of Gromov-Witten invariants from 4d theories via physical principles, as illustrated in Figure 2.  We will now proceed to obtain Gromov-Witten invariants in a similar fashion to the steps in the previous sections in obtaining the u-plane integral. The N = (2, 2) topologically twisted A-model has the action with z,z as worldsheet coordinates and i,ī etc, are coordinates on M flat (Σ g ) for the map ϕ : CP 1 → M flat (Σ g ). In Eq. (91), e denotes the gauge coupling and θ the instanton theta angle. The last term is a pullback of a Kähler form ω that directly descends from the instanton term of F ∧ F in 4d. The bosonic field is the worldsheet scalar ϕ, and fermionic fields are the scalar χ and 1-form ρ. The covariant derivative on the worldsheet is defined as ∇ z χī = ∂ z χī+χjΓījk∂ z ϕk and R ijkl is the Riemann curvature tensor on M flat (Σ g ). The BPS condition of the A-model localizes (91) to a moduli space of holomorphic maps with the condition coming directly from that of the 4d theory, namely F + = 0. Here, β is the homology class of the map ϕ into the moduli space of flat connections on Σ g : The class β can be further indexed as β I according to the dimension of each stratum of M flat , that is where I = dim(M flat ).
Since we wish to obtain the Gromov-Witten invariants by comparison with coefficients from (87), (89) and (90) as obtained via calculations in the u-plane from the previous sections, only the dimensionally reduced version of the 4d surface operators on Σ g × CP 1 as S = s[Σ g ] + t[CP 1 ] will be considered in this section. Note that surface operator insertions on Σ g are non-local operators in 4d (on Σ g ), but get reduced to local point operators in 2d on CP 1 as Σ g → 0.
The surface operator inserted is Tr s (ψ µ ψ ν + φF µν )dx µ ∧ dx ν . When inserted on S ∈ Σ g , it becomes a point operator on CP 1 , as mentioned: Here F ww = 0 was used, where w,w are complex coordinates on Σ g , and ω ij is the Kähler form (see appendix E). Note that O (0) is consistent with the The u-plane integral, mock modularity and enumerative geometry features required for being a point operator on the worldsheet, since it does not contain worldsheet indices. The presence of worldsheet indices require a contraction with the worldsheet metric g zz , thereby making the operator Qexact. Hence this operator is indeed Q-closed. The ghost number of O (0) is two, reflecting the fact that it is a 2-form on M maps .
On the other hand, when inserted into S ∈ CP 1 , it remains as a surface operator: Here the ψ z , ψz drop out since they do not survive the reduction, while F zz contains the components of the gauge field A z , Az on CP 1 which are auxiliary fields (see Eq. (187)). The fermionic parts of A z , Az do not contribute since there are no ρ zero modes, to be explained below). Using F µν = ∂ µ A ν −∂ ν A µ + [A µ , A ν ], F zz can then be written in terms of ϕ i , ϕī.
Next, we have to look at which fermionic zero-modes exists in the 2d theory after dimensional reduction. The self-dual 2-form fermions χ µν descend down to ρ ī z , ρī z , which are one-forms over CP 1 . This dimensional reduction is coming from the high energy theory, in which the gauge group SU (2) is still left unbroken. Connections in this regime then remain irreducible and regular [1], and hence we should not expect ρ zero-modes. The only other fermionic zeromodes are from the χ fields from the vertex operators, which can be absorbed by the measure of the fermionic zero-modes in the path integral. The path integral that generates the GW invariants takes the form where Φ represents all fields we integrate over and we also perform a discrete sum over β. This is equivalent to summing over the 4d instanton numbers k.
In the evaluation of Eq. (97), all fields will have both zero-and fluctuating modes. However, due to the independence of (97) on the coupling, we are free to take the weak coupling limit. The functional integral over the fluctuating modes in the action then equals ±1 and zero-modes for both bosons and fermions are annihilated in the kinetic terms in the action when we take the quadratic approximation. With this approximation, fluctuating modes in the operators O (0) and O (2) can be suppressed, and we are then left with fields in terms of zero-modes only. These shall henceforth be labelled as O (0) and O (2) as well. It is necessary to have fields only in terms of zero-modes since both bosonic and fermionic zero-modes correspond to tangent vectors in M maps .
The resulting fields should then correspond to differential forms in this moduli space which, when combined together to obtain the correct index for the absorption of fermionic zero-modes give us a top form on M maps to be integrated over. In particular, recall that the ghost numbers of O (0) and O (2) are two, reflecting their degree as differential forms in M maps . To achieve that, we expand the vertex operators in powers of O (i) from the vertex to soak up the extra zero-modes of χ i and χī in the measure. We then obtain correlation functions, for each β, that localizes on M maps . Only the terms which allow for the correct absorption of fermionic zero-modes give a non-zero contribution to Eq. (97). In the end, we obtain the usual Gromov-Witten invariants associated with a 2d topological A-model. From the relation in dotted lines in Figure 2, we are able to conclude, in the limit of small Σ g : On both sides of Eq. (98), we have generating functions which contain terms that are graded by the instanton numbers. This is because the instanton term in the 4d action also descends down to a corresponding term in the 2d effective action. One can thus identify terms on both sides of (98) and we can then see that modular forms appearing in the u-plane integral can play an indirect (computation facilitating) role in Gromov-Witten invariants for holomorphic maps to the moduli space of flat connections on a Riemann surface.
With regards to wall-crossing, despite the condition of b + 2 = 1, where wallcrossing phenomena are expected in Z u + Z SW , we should not expect to see wall-crossing behaviour for Z GW . This is due to the fact that in shrinking Σ g , we are restricting ourselves to the chamber of small Σ g and we should not expect any walls within a chamber, by definition. Hence the relation (98) should only be understood to hold within this particular chamber.
We can make a further comparison of (98) in another way: looking at how the operators O (0) and O (2) in 2d were derived, we see that they come from dimensional reduction of the operators in the four-dimensional high-energy theory. As mentioned, we consider only surface operators on Σ g × CP 1 as S = s[Σ g ] + t[CP 1 ]. The Gromov-Witten generating functional Eq. (97) with only (4d) surface operators inserted will then be The u-plane integral, mock modularity and enumerative geometry the u-plane and Seiberg-Witten contributions, we can compare (99) with (87), (89) and (90). Performing the procedure mentioned above of taking the weak coupling limit and integrating out fluctuating modes in the action, we are left with O (0) and O (2) insertions in the path integral. The operators in the vertex will just be expanded and collected to match the different index numbers for the absorption of the correct number of fermionic zero-modes. For example, for a map of index 0, where M maps = M flat (Σ 2 ), we can have an invariant with the usual point operators that are inserted at x i ∈ CP 1 . These are identified with the pullback of ω i ∈ H * (M flat ) by the evaluation map ev i : M maps → M flat at x i .
In the s 3 term, we have We can also look at the less commonly studied non-local surface operators. Collecting the s 3 t 2 terms, we require terms from (99) to have a total of index 10: In (100) and (101), β 6 and β 10 are the homology classes for terms of index 6 and 10, respectively. We can identify β I with d, the degree of the map. From [36,37,39], the given formula for the index I = dim(M maps ) and degree d ≥ 0 of ϕ : CP 1 → M maps (Σ 2 ) is I = 6 + 4d. This formula relates dim(M maps ) to the instanton number (degree of the map). The example in (101) then corresponds to an invariant (H 0 Mmaps of a degree 1 map. The prescription for comparison is thus simple: since O (0) and O (2) are labelled by s and t, respectively, we just have to insert the relevant number of O (0) 's and O (2) 's based on the corresponding powers in the polynomial.
Hence, for an index 14 term, we can have to define a M flat (Σ1) without punctures, albeit with certain complications that we wish to avoid. Since there are no punctures being considered on Σg, we shall only consider cases of g ≥ 2. The formula for dimM flat (Σg) is dimM flat (Σg) = rank(G)(2g − 2) and rank(G) = 3 for gauge group G = SU (2).
Mmaps of a degree 2 map. And an index 18 term as Mmaps of a degree 3 map. At first glance, the existence of a negative sign in (102) might be a surprise, since these numbers actually represent values of correlation functions between operators, i.e. scattering amplitudes. The A-model considered, however, is non-unitary [40], implying the existence of negative norm states.
As a consistency check, we can see that the lowest dimension of M maps is 6, which agrees with (87), (89) and (90) since the lowest combined power of s and t is cubic, which have an index of I = 6. This is because terms with I < 6 (equivalently, maps of negative degree d < 0) vanish. In fact, a quick examination of the combined powers of s and t of various terms in (87), (89) and (90) show that the index of all terms obey the formula. This thus provides further evidence of having a direct correspondence between values obtained via computations in the 4d low-energy regime from previous sections and that of the 2d A-model.

Conclusions
In this paper, we studied the low-energy U (1) path integral of DW theory evaluated on non-simply connected four-manifolds. Following the analysis of [10,11], we derived the full solution for the correlation functions of the theory in terms of the modular completion of a mock modular form. The result can be readily extended to the case with surface defects [41] or theories with matter hypermultiplets [3,5,16,17,24,26,[42][43][44] and even class S theories [45,46], although we leave this for future work.
We also presented a concrete reduction of the theory on CP 1 × Σ g over Σ g , whence we obtained a topological A-model on CP 1 , thereby demonstrating a novel connection between mock modular forms and genus zero Gromov-Witten invariants.
We can also consider 4-manifolds of the form X = M 3 × M 1 with suitable topological numbers that allow probing the Coulomb branch. We expect that the mock modular form reformulation of Z u can be applied in this case too, whence relations between mock modular forms and topological invariants of 3manifolds M 3 can be precisely formulated, thereby allowing us to derive results in geometric topology from number theory. We will leave this for future work as well.

A Automorphic forms
In this Appendix, we collect some important aspects of modular and automorphic forms.
Under the generators T 4 , ST −1 S of Γ 0 (4) they transform as The Eisenstein series E k : H → C for even k ≥ 2 are defined as the q-series with σ k (n) = d|n d k the divisor sum. For k ≥ 4, E k is a modular form of SL(2, Z) of weight k. On the other hand E 2 is a quasi-modular form, which means that the SL(2, Z) transformation of E 2 includes a shift in addition to the weight, A.2 Ingredients of the u-plane integrand In this section, we give explicit modular expressions for the ingredients of the u-plane integrand. The integrand transforms under the duality group Γ 0 (4), which is generated by T 4 and S −1 T −1 S. Let us introduce the shorthand f = (φ 1 , φ 2 ) (k,l) if a function f is a non-holomorphic modular form of weight (k, l) for Γ 0 (4) with multipliers, i.e. transforms as It is clear that since |φ i | = 1. The functions transform as The derivative d 2 u da 2 is invariant under T 4 but quasi-modular, We also have that [35,47] a =i π The u-plane integral, mock modularity and enumerative geometry We will also need what we call the dual expressions for the above quantities. These are the expressions for the dual variable τ D = −1/τ , disregarding the modular weights. They are as well as

A.3 Siegel-Narain theta function
Siegel-Narain theta functions form a large class of theta functions of which the Jacobi theta functions are a special case (see [10]) . We restrict here to a specific Siegel-Narain theta function for which the associated lattice L is a unimodular lattice of signature (1, n − 1) (or a Lorentzian lattice). We denote the bilinear form by B(x, y) and the quadratic form Given an element J ∈ L ⊗ R with Q(J) > 0, we may decompose the space L ⊗ R in a positive definite subspace L + spanned by J, and a negative definite subspace L − , orthogonal to L + . Let J = J/ Q(J) be the normalization of J. The projections of a vector k ∈ L to L + and L − are then given by Given this notation, we can introduce the Siegel-Narain theta function of our interest Ψ J µ : H × C → C. Let J be as discussed above (117) and µ ∈ L ⊗ R. Then Ψ J µ is defined by 15 where b = Im(z)/y ∈ L ⊗ R. 15 For brevity we list in Ψ J µ only the holomorphic arguments τ and z, even though the function does also depend onτ andz.
One finds for the modular transformations of Ψ J µ under the generators of SL(2, Z) the following identities For µ ∈ L/2 one can show that Ψ J µ is a modular form of the congruence subgroup Γ 0 (4). The action of the generators of Γ 0 (4) on Ψ J µ with µ ∈ L/2 is given by Notice that for = 4 we can use that 2µ 2 + B(µ, K) ∈ Z.

A.4 Indefinite theta functions
In this appendix we present various aspects of indefinite theta functions and their modular completions. We assume that the associated lattice L is unimodular and of signature (1, n − 1). To define the indefinite theta function, we choose two positive definite vectors J and J ∈ L ⊗ R with B(J, J ) > 0, such that they both lie in the same positive cone of L. Let J and J be their normalizations as before. The arguments of theta function are τ ∈ H, z ∈ L ⊗ C and µ ∈ L ⊗ R. We let b = Im(z)/y ∈ L ⊗ R. In terms of this data, the indefinite theta function Θ JJ µ is defined as It is possible to show that the sum over L is convergent [34]. However, Θ JJ µ does only transform as a modular form after the addition of certain nonholomorphic terms. References [34,48] explain that the modular completion Θ JJ µ of Θ JJ µ is obtained by substituting (rescaled) error functions for the sgnfunctions in (123). The completion Θ JJ µ then transforms as a modular form The u-plane integral, mock modularity and enumerative geometry of weight n/2, and is explicitly given by where E is a reparametrization of the error function (67). Note that in the limit y → ∞, E in (124) approaches the original sgn-function of (123), lim y→∞ E 2y u = sgn(u).
If we analytically continue E to a function with complex argument, then this limit is only convergent for − π 4 < Arg(u) < π 4 . The transformation properties under SL(2, Z) follow from chapter 2 of Zwegers' thesis [34] or Vignéras [49]. One finds for the action of the generators on Θ JJ µ+K/2 (τ, z) For our application, theτ -derivative of Θ JJ µ is of particular interest. This gives the "shadow" of Θ JJ µ , whose modular properties are easier to determine than those of Θ JJ µ . We obtain here with Ψ J µ defined in (118). The modular properties of Ψ J µ are given in (119), and can be obtained using standard Poisson resummation.
The completion (124) may simplify if the lattice L contains vectors k 0 ∈ L with norm k 2 0 = 0. For such lattices J and/or J can be chosen to equal such a vector, and careful analysis of the limit shows that the error function reduces to the original sgn-function [34]. We assume now that J ∈ L such that (J ) 2 = 0. To ensure convergence of the sum, one needs to require furthermore that B(k +b, J ) = 0 for any k ∈ L+K/2+µ, except if one also has B(k +b, J) = 0. Then the completion Θ JJ µ is given by with shadow ∂τ Θ JJ µ (τ, z) = Ψ J µ (τ, z). (128)

B Regularising the u-plane integral
The u-plane integrand can diverge at the cusps. We therefore need to be careful about regularising the integral. This procedure was worked out in detail in [11] for the simply connected case, but the analysis goes through without alteration when allowing for π 1 (X) = 0. For completeness, we summarise the important steps, and refer the reader to [11] for more details.
We are interested in evaluating integrals on the form (52) or (161). To make the analysis simpler, we map these integrals over the fundamental domain H/Γ 0 (4) to integrals over the ordinary key-hole domain F of SL(2, Z) by mapping the six copies of F in H/Γ 0 (4) back to F (see Fig. 1). This means that the integrals now take the form with c(m, n) only non-zero for m − n ∈ Z. These coefficients are bounded for some constant K > 0 and the sum over m and n is therefore absolute convergent for y < ∞. The integral does however diverge when m + n ≤ 0. Which is the domain of our integrals when considering addition of the Q-exact operators. To deal with this we start by compactifying F to a domain F Y by introducing a cut-off Y ≥ y for τ →i ∞ and some Y 1 and defining the integral We can now regularise our integrals by using the generalised exponential integral E l (z), defined by The u-plane integral, mock modularity and enumerative geometry where for non-integral l, the branch of t −l is fixed by restricting the argument of any complex number ρ ∈ C * to lie in the domain (−π, π]. The regularised integral is Now, to evaluate the integrals we can make use of Stokes theorem. Since in our case we have ∂τĥ = y −s f for someĥ a modular form of weight 2 and f as in the above. This can be integrated using E l (z) to givê for s = 1 and when s = 1 we need to change the terms with n = 0 in the sum to Here, h is a (weakly) holomorphic function with Fourier expansion and h(τ ) is uniquely determined by the coefficients d(m) with m < 0. We can now use Stokes theorem and the integral over F Y becomes and regularising this as in (134) we find that the only contribution of the regularised integral is the constant term of h(τ ), In Appendix C.3 we demonstrate that the correlation function of the Qexact operator I(S, Y ) that we add can be written as where F I (τ,τ ) = y −s m,n c(m, n)q mqn .
We then have that which in the above prescription allow us to identify F I with someĥ 1 +ĥ 2 .
Where bothĥ 1 andĥ 2 are of the form (135) but with s replaced by s + 1 in the later case. But, since F I is a modular form of weight 2 the sum h 1 + h 2 should vanish, as there is no such holomorphic modular form, and in particular the sum of the constant terms d 1 (0) + d 2 (0) = 0, which in term shows us that I(S, Y ) = 0. We can thus safely add this operator to the action.

C Construction of I(S, Y )
In this appendix, we explain the construction of the Q-exact operator I(S, Y ) in (37), which aids the evaluation of the u-plane integral using mock modular forms. A constructive approach is to classify all Q-exact operators in DW theory, add all of them to the path integral, evaluate the path integral and solve for all coefficient functions that lead to the desired properties. For two reasons, this is fortunately not necessary. First, it is convenient that most such operators do not even alter the u-plane integrand after integrating out the fermions and the auxiliary field. Second, the path integral can be performed without insertions of any additional operators, or with the insertion of just I S as was done in the case that b 1 (X) = 0 [10]. Such calculations lead to integrands that do not contain the Siegel-Narain theta function Ψ J µ (τ, z) for any z, however only a few terms are missing with an educated guess of z. Only very specific Q-exact operators can provide the necessary terms for the new integrands to complete into Ψ J µ (τ, z). In Section C.1, we classify all possible Q-exact operators that contribute to the u-plane integrand. In Section C.2 we demonstrate how the correct Q-exact operators can be selected, for the simplified example where the intersection Y ∩ Y is empty (such that there is no intersection term for Y ∩ Y ). In Section C.3 we finally show that the Q-exact operators we add do not alter the u-plane integral.

C.1 Q-exact observables
Let us complete the result of [11] by computing the all Q-exact observables on a four-manifold X with π 1 (X) = 0. Let us first collect The u-plane integral, mock modularity and enumerative geometry These are all 1 . . . 4-forms that can be constructed out of the field content in Table 1. Since any operator must be gauge invariant, we do not use the 1-form A to construct operators but only F = dA. Furthermore, some operators are identically zero due to fermion saturation. The sets C k are then generating sets for the spaces of k-form observables [11], Here, f X,j (a,ā) are real-analytic functions without singularities away from strong and weak coupling. The most generic 0-form observable is O 0 = f 0 (a,ā) + f 1 (a,ā)η. Let us restrict now to the Q-exact k-observables [Q, O k } that survive integration. These do in particular either contain ηχ or neither, since otherwise they would not survive the fermionic integration, and they do not contain any derivative term dX, as we consider b + 2 (X) = 1 and thus their zero modes vanish. By the notation [Q, O} we furthermore mean either {Q, O} or [Q, O], depending on whether O is Grassmann odd or even.
Recall the action (2) The general Q-exact observable [Q, O k } from (143) is very tedious to compute, luckily in [Q, O k } generally not many terms survive. Furthermore, (143) has 2|C k | terms, however due to (2) and (144) These are all Q-exact operators in DW theory. The following Q-exact terms can then be added to the action C.2 Solution for I Y By adding only I S as suggested in [10,11,41], the u-plane integrand can be written as a total derivative, however it does not complete to a Siegel-Narain theta function. Let us construct the operator I Y such that this becomes true. For simplicity, we ignore the contact terms I ∩ . This is possible since all contact terms other than the Y ∩ Y are integrated over ψ and τ only and therefore do not affect the path integral calculation. For simplicity and only in this section, we take the intersection Y ∩ Y to be empty. We therefore aim to find the functions f 1 , . . . f 5 . In the case π 1 (X) = 0, the total integrand must go back to (38). If f 4 and f 5 are nonzero, this is not the case since they alter the integral. 16 We therefore set f 4 = f 5 = 0. Thus, in the simply connected case, we have I 2 = I S , which implies f 1 = − 1 4π dū dā . We shall therefore consider adding the correction to the exponential in (38). The terms ψ ∧ Y and ψ ∧ ψ are precisely the terms that lead to the problems if only I S is added. We can organise h := The u-plane integral, mock modularity and enumerative geometry Inserting it into the path integral we find After integrating out D, this produces new terms to (41) (notice that ω ∧ h = h ∧ h = 0). The first term is only integrated over ψ and τ , so it will not play a role immediately. The second and third term yield after the fermionic integration, In view of (43) and the above discussion, we can aim this new contribution to give the missing factor √ y dτ dā ∂τ 2yω = dτ dā such that the Siegel-Narain theta function has an elliptic variable z = ρ+2i yω and β = b + ω +ω. 17 Motivated by the computation (44), we make the ansatz h =i cyω, with c ∈ C some number. From this it follows that y∂τω = −i c ∂τ h −i 2ω . Notice that h is purely anti-holomorphic, whileω is not. We find that (153) equals (154) precisely for c = 1. From this, it is easy to find In the simply connected case, the correction I 2 = I S is necessary in order for the surface observableĨ − (S) to combine into a Siegel-Narain function such that the u-plane integral is a total derivative. In the case π 1 (X) = 0, an analogous procedure is required for the 3-cycle Y , which combines to a 2-form as ψ ∧ Y . In the π 1 (X) = 0 Lagrangian (12) there is a new term ψ ∧ ψ that is integrated over η, χ and D, such that the u-plane integral is a total derivative but does not contain a SN theta function. After the insertion of an anti-holomorphic Q-exact 4-form operator, the integrand indeed becomes a Siegel-Narain theta function.

C.3 Ward-Takahashi identity for I Y
In [11] it was shown that the vacuum expectation value of any Q-exact operators vanish in the simply connected case. This then allows one to safely add such operators to the u-plane integral. In this appendix we only consider the operator insertion I Y , the analyses is similar for the other factors in I(S, Y ).
To this end, we will demonstrate that I Y can be written as an integral where the integrand can be written as a total derivative. We can then use the renormalisation procedure of [11], as discussed in Sec. B, to show that I Y = 0, such that the insertion of this operator does not change the u-plane integral.
To see that the one-point function can be written as a total derivative we start from with L as in (12) and ν(τ ) as in (13). The integration over D yields where now Next, we integrate over η and χ. This yields where by k 2 + and ψ 4 we mean B(k + , k + ) and B(ψ ∧ ψ, ψ ∧ ψ) and we now have and its now straightforward to recognise that we indeed can write the integrand as a total derivative We can now use the renormalisation procedure of [11] to show that I Y in fact vanishes. The broad strokes are summarised in Sec. B, and further details can be found in [11,Sec. 5].

D Classical topological invariants
Let X and Y be topological spaces, and consider the homology over a field K. The Künneth theorem states that there exists an isomorphism Written in terms of Poincaré polynomials p X (z) := ∞ k=0 b k (X)z k , that is, generating functions of Betti numbers b k (X) := rank H k (X), we have The Betti numbers are then related as Poincaré duality states that b k (M ) = b n−k (M ) for any oriented closed nmanifold M . The manifolds M under consideration satisfy b + 2 (M ) = 1 and vanish unless b 1 (M ) is even. The topological invariants are then related as σ + b 2 = 2 and χ + σ = 4 − 2b 1 .
Example. Note that p X (−1) = χ(X) gives the Euler characteristic of X.
Example. The circle S 1 has Betti numbers b 0 (S 1 ) = b 1 (S 1 ) = 1 and all other zero. We therefore have p S 1 (z) = 1+z (more generally, p S n (z) = 1+z n ). For the torus T n := (S 1 ) ×n , it follows from (163) that that is, b k (T n ) = n k .

D.2 Gromov-Witten invariants as A-model correlation functions
For a smooth projective variety X, GW invariants essentially count, in a refined way, algebraic curves with certain incidence conditions. Physically, GW invariants are given in terms of specific correlation functions in the topological A-model and count specific holomorphic curves. This construction is well known [39] but we will provide a small review in this section. 18 Sketch of the proof: From (162) we have that Since H2(X ×Y ) is symmetric in X and Y , the intersection form H 2 (X ×Y, R)×H 2 (X ×Y, R) → R has equally many positive as negative eigenvalues, b The u-plane integral, mock modularity and enumerative geometry The action of the A-model is written explicitly in (91) for our case of interest in the main body of the paper. For the purposes of this subsection, we can recast it as S ∼ with V = g ij (ρī z ∂zϕ j + ∂ z ϕīρ j z ) and ϕ : Σ → X where Σ is the worldsheet and X is the target space. The second summand corresponds to the pullback of the Kähler form of X and it only depends on the cohomology class of ω as well as the homotopy type of ϕ making it invariant under continuous deformations of g = g(Σ). As discussed in the main body of the paper, the correlation functions are given in the form: The fixed loci of the supersymmetry transformations (see [39]) are given as and ϕ that satisfy these equations are called worldsheet instantons. For an image of ϕ(Σ) in X, there is a class β ∈ H 2 (X, Z) whose basis is given by where p i and q i are the holomorphic (chiral) and anti-holomorphic (anti-chiral) degrees of the operator O i . For example, a three-point function gives where exp (B(ω, β)) is the instanton contribution to the correlation function. The correlation function essentially contains the information on the counts the number of holomorphic maps of genus g at n intersection points to the class β such that the operator insertions O i are mapped into divisors D i of X.

E Reduction of DW theory to 2d
Using A, B and a, b to denote indices on the large and small Riemann surfaces, respectively, for a four-manifold M 4 of the form Σ × C, where each factor is a real 2d surface, the metric can be written in a block diagonal form Eventually, we want to let → 0 in order to shrink C. The high energy DW action (after twisting) can be written as Using (180), we have √ G C → √ G C , g ab → −1 g ab . Thus for the inner product of two 2-form terms O (2) , we have The u-plane integral, mock modularity and enumerative geometry Taking → 0, we see that only the terms O (2)Ab with mixed indices survive. Repeating the same process for the inner product of 1-forms gives us O (1)a , where only 1-forms with a small index survives. Note also that the scalar interaction terms [φ, φ † ] 2 and η[φ, η] in (181) do not survive when the metric is deformed.
Upon reduction on C for M 4 = Σ × C, the fields φ, φ † , η and A Σ have no derivatives on Σ, and become auxiliary fields which can be integrated out. What is left of the fermionic fields are ψ C and χ ΣC which can be interpreted as a 0-form, 1-form on Σ, respectively. The bosonic field left will be the gauge field A C . From (182), we see that deformation of the metric forces us to have O (2)ab = 0. For the field strength F µν , we thus have Since A C is the only leftover bosonic field on Σ, we must have configurations of A C that gives us SU (2) flat connections on C. We can thus take A C to be a map A C : Σ → M C , where M C is the moduli space of flat connections on C. We can express variations of A C about configurations that give flat connections on C in terms of basis cotangent vectors α IC on M C by where E I are connections on M C , and the indices i,ī etc, are for collective complex coordinates on M C , z,z are complex coordinates on Σ, and w,w are complex coordinates on C. The connection E i helps define a covariant derivative on M C , The remaining fermionic fields ψ C and χ ΣC , being cotangent vectors on M C , can be expressed as linear combinations of α iw , αī w : ψw = χ i α iw , ψ w = χīαī w χ zw = ρī z αī w , χzw = ρ ī z α iw .
Next, we integrate out the fields in 4d that do not depend on derivatives on Σ, namely φ, φ † , η and A z . The equation of motion for A z gives [13,50] (and corresponding terms for Az) where Φ ij is the curvature on M C , defined by Φ ij =i ∇ i , ∇j .
Since the moduli spaces of flat connections on Riemann surfaces are Kähler manifolds, we introduce a metric (symmetric in its indices) and symplectic form on M C as respectively. Given these two objects, we can also obtain the connection coefficients and the Riemann tensor on M C These (and the conjugates with barred indices) are the only components of the connection and the Riemann tensor due to the fact that M C is a Kähler manifold. We now use (187) and the constraints from integrating η out to obtain the field strength as where the relation DwΦ ij = ∇jα iw has been used. Next, with the identity [αw i , α wk ] =i DwD w Φ ik and (189), we obtain φ = χ i χjΦ ij , φ † = g zz ρj z ρ ī z Φ ij .
Dealing with the kinetic terms in the 4d theory, we can substitute (193) into D w φDwφ † , and together with the square of the second term in (192) that comes from F ∧ F , we will obtain the Riemann tensor of M C as shown in (191). Similarly, the square of the first term in (192) with the Kähler metric will give the kinetic term for the bosonic field in the 2d A-model. The only fermionic kinetic term left in 4d after reduction on C is χ zw Dzψw and χzwD z ψ w . Since there is a covariant derivative on Σ, we make use of the expression for A z in (187), and together with the cross terms of (192) from F ∧ F , we obtain the kinetic terms for the fermion fields χ i , χī, ρī z and ρ ī z . In particular, we obtain the covariant derivative on Σ as ∇zχ i = ∂zχ i + χ j Γ i jk ∂zϕ i . One can also add an instanton termi θ 8π 2 M4 Tr (F ∧ F ) to the DW action in (181), which then translates to the pullback of the Kähler form in the A-model [51].
Explicitly, the pullback of the Kähler form goes as (with I, J as real coordinates on M C )i This term is the same as the corresponding one in the purely bosonic nonlinear sigma model, even after adding supersymmetry. There are no fermions despite it being supersymmetric. This is due to the fact that it is a topological term which does not change under small continuous variations of the fields. Hence, there are neither bosonic nor fermionic degrees of freedom which allows it to remain supersymmetric. We can compare the fields from both theories in table 3. Fields that become auxiliary after reduction are left out from the 2d side of the table. On the 2d side, the bosonic field is the map X : Σ → M C and from the ghost charge, can be identified with the leftover gauge field A C . Similarly, we can identify the corresponding fermionic fields as well.  Table 3 Fields and ghost charges of the 4d and 2d actions.