D3-instantons, Mock Theta Series and Twistors

The D-instanton corrected hypermultiplet moduli space of type II string theory compactified on a Calabi-Yau threefold is known in the type IIA picture to be determined in terms of the generalized Donaldson-Thomas invariants, through a twistorial construction. At the same time, in the mirror type IIB picture, and in the limit where only D3-D1-D(-1)-instanton corrections are retained, it should carry an isometric action of the S-duality group SL(2,Z). We prove that this is the case in the one-instanton approximation, by constructing a holomorphic action of SL(2,Z) on the linearized twistor space. Using the modular invariance of the D4-D2-D0 black hole partition function, we show that the standard Darboux coordinates in twistor space have modular anomalies controlled by period integrals of a Siegel-Narain theta series, which can be canceled by a contact transformation generated by a holomorphic mock theta series.


Introduction
In type II string vacua with N = 2 supersymmetry in four dimensions, the moduli space spanned by massless scalar fields famously factorizes as the product M V × M H of the vector multiplet (VM) and hypermultiplet (HM) moduli spaces, respectively [1,2]. A complete understanding of the former was achieved by the end of the last millenium, and has led to key developments in black hole physics and algebraic geometry. By contrast, until recently our understanding of the latter was confined to the tree-level [3,4,5] and one-loop [6,7,8,9,10] approximations to the metric, together with some general expectations about the form of instanton corrections [11,12]. While it has been clear to many that an exact solution for the quaternion-Kähler (QK) metric on M H would have considerable impact both for physics and geometry, progress was hindered mainly by the lack of a convenient parametrization of this class of metrics.
The situation has improved dramatically in recent years, as projective superspace and twistorial techniques [13,14,15,16,17,18,19] were brought to bear on this problem. The key idea behind these methods is that the QK metric on M H is encoded in the complex contact structure on the twistor space Z, a P 1 bundle over M H [16]. The latter is in turn specified by a set of holomorphic generating functions for complex contact transformations between local Darboux coordinate systems, subject to certain global consistency and reality requirements [20]. These gluing conditions can be converted into a system of integral equations, which can often be solved by iteration. The QK metric on M H is then obtained by expanding the resulting Darboux coordinates around any fixed section of Z, similar to the usual twistorial construction of HK manifolds [15,21].
Using these techniques, combining earlier results on the twistorial description of the perturbative metric and of D1-D(-1)-instantons [22,23,24,25] and taking inspiration from a similar construction in the context of gauge theories [26], a general construction of the D-instanton corrected HM moduli space was laid out in [27,28], in terms of the generalized Donaldson-Thomas (DT) invariants Ω(γ; z) which count D-instantons. For reasons that will become clear below, we refer to the construction of [27,28] as the 'type IIA' construction. In type IIA string theory compactified on a Calabi-Yau (CY) threefold Y, D-instantons come from D2-branes wrapping special Lagrangian cycles, while in type IIB string theory compactified on the mirror threefoldŶ, they come from D5-D3-D1-D(-1)-branes wrapping even-dimensional cycles, or more generally coherent sheaves onŶ. Although the DT invariants typically depend on the complex structure moduli (in type IIA) or Kähler moduli (in type IIB), they are piecewise constant away from walls of marginal stability, and their discontinuity is such that the resulting contact structure on Z (and hence, the QK metric on M H ) is smooth [26]. In fact, the type IIA construction of [27,28] is essentially dictated by consistency with wall-crossing, and is isomorphic to the gauge theory construction of [26] under the QK/HK correspondence [29,30].
In addition to these D-instantons, one also expects contributions from NS5-brane instantons wrapped on the CY threefold. Those effects are in principle determined from the known D5instanton corrections, by requiring that the QK metric should carry an isometric action of SL(2, Z), originating from S-duality in ten-dimensional type IIB string theory. NS5-brane corrections were constructed at linear order in [31] (see also [32,33,34]), but an understanding of these effects at non-linear level is still missing.
In this work, we focus on a subset of the allowed instanton corrections, namely those corre-sponding to D3-D1-D(-1)-instantons on the type IIB side. Although these effects are exponentially suppressed compared to D1-D(-1)-instantons in the large volume limit, they are still exponentially larger than D5 and NS5-brane instantons. Thus, a natural question is whether the twistorial construction of [27,28] produces a modular invariant quaternion-Kähler metric, in the large volume limit where D5-NS5-instantons are ignored but the effects of D3-D1-D(-1)-instantons with non-zero D3-brane charge are still retained. 1 In this work, we shall answer this question in the affirmative, at least in the one-instanton approximation. As will become clear shortly, even in this simplified setting, modular invariance is achieved in a very non-trivial way, and depends on the sophisticated machinery of Eichler integrals and indefinite theta series. We expect an even richer structure beyond the one-instanton approximation, but we shall hardly touch upon it in this work. The reason why this problem is non-trivial is that modular invariance is far from manifest in the 'type IIA' twistorial construction [27,28]. Indeed, when lifted to a holomorphic action on twistor space, the action of S-duality involves a SU(2) rotation along the fiber, and therefore relates Darboux coordinate systems on different patches. The only exception are the patches around the points t = ±i, where t is the usual stereographic coordinate on the fiber, which are mapped onto themselves under S-duality. But even in these patches the Darboux coordinates need only be modular covariant up to a local complex contact transformation. Finally, a technical but serious difficulty is that the natural type IIA coordinates parametrizing the twistor fiber need not have simple transformation properties under S-duality, and it is a priori unclear how to construct a basis of type IIB fields which would transform covariantly. Put differently, there is no general method to construct the quantum mirror map (see however [36] for recent progress in a closely related set-up).
Fortunately, we find that this picture drastically simplifies in the large volume limit V → ∞, provided one simultaneously scales z ∼ (t ± i) → 0 keeping the product zV 1/3 fixed. In this case all BPS rays (the contours on P 1 associated to D-instantons [26,27]) coincide with the real axis in the complex z plane, shifted slightly above or below the origin z = 0 depending on the D1-brane charge. The corrections to Darboux coordinates are then given by integrals of certain Siegel-Narain theta series along these contours, corresponding to the sum over D1-brane charges at fixed D3-brane charge. These Gaussian theta series are far simpler than the non-Gaussian sums which would otherwise arise at finite volume.
Another simplification of the large volume limit is that the moduli-dependent DT invariants can be traded for another set of invariants, which we call the MSW invariants, which are independent of the Kähler moduli in type IIB (or complex structure moduli in type IIA), and have simple modular properties. The idea is that D3-D1-D(-1)-instantons are governed by the same DT invariants which count D4-D2-D0 black holes in type IIA string theory compactified on the same CY threefoldŶ. At large volume, the latter can be described by micro-states of the MSW superconformal field theory (SCFT) [37], and bound states thereof [38,39]. We define the multi-instanton expansion in the large volume limit in such a way that only elementary MSW states contribute in the one-instanton approximation. With this definition, the Gaussian theta series alluded to in the previous paragraph reconstruct the elliptic genus of the SCFT (or modular derivatives thereof), and the corrections to Darboux coordinates are now identified as Eichler integral of the MSW elliptic genus. For illustration, we display the result for the correction to the Darboux coordinates ξ conjugate to the D1-brane charges q, evaluated for simplicity at the point z = 0 on the twistor fiber, where S cl is the classical D3-instanton action (4.11). It involves the Siegel-Narain type theta series , analytically continued away from the slice w = τ , and the partition function of the MSW invariants h p,µ (τ ), which is a vector-valued modular form of weight (− b 2 2 − 1, 0). As a consequence, the Darboux coordinates around t = ±i are not modular covariant, but transform with a specific modular anomaly given by the period integral of the MSW elliptic genus. In the example above, this implies The final step in the proof is to show that the modular anomalies in the Darboux coordinates can be absorbed by a complex contact transformation, which will then ensure that the complex contact structure on Z transforms covariantly under S-duality. For this purpose, we observe that the Eichler integral which determines the corrections to the Darboux coordinates is in fact the modular completion of the holomorphic mock theta series introduced in [40], 3) where t are physical Kähler moduli and t ′ is an arbitrary reference point on the boundary of the Kähler cone. In an amusing role reversal, we find that this holomorphic mock theta series provides the generating function of a complex contact transformation which cancels the modular anomaly in the Darboux coordinates. This establishes the modular invariance of the QK metric in the large volume, one-instanton approximation.
Clearly, an important challenge for the future is to establish modularity at the non-linear level. One possible strategy would be to recast the type IIA twistorial construction into the manifestly SL(2, Z)-invariant type IIB formalism presented in [36]. As a first step in this direction, one may try to use the Poincaré series representation (also known as Farey tail [41,42]) of the generating functions of the MSW invariants to represent the section of H 1 (Z, O(2)) describing D3-instanton corrections at linear order as a sum H = m,n G m,n , such that S-duality acts by permuting these contributions. Unfortunately, this manipulation is formal since Poincaré series with negative weight are divergent without a suitable regularization. Even though this naive idea fails, it nevertheless provides very useful guidance for determining the quantum mirror map, as we explain in Appendices B and C.
The remainder of this work is organized as follows. In §2, we review the general properties of the HM moduli space in type IIB string theory compactified on a CY threefold, with particular emphasis on the discrete symmetries under S-duality and large gauge transformations, and recall the type IIA twistorial construction of D-instantons. In §3, we recall the geometric description of D3-brane instantons in terms of coherent sheaves, the definition of the generalized DT invariants which count them and their relation to the MSW invariants, which are independent of the moduli and have simple modular properties. We define a multi-instanton expansion which is best suited for studying modularity, and give a heuristic explanation of modular invariance in twistor space. In §4, we analyze the instanton corrections to the Darboux coordinates in the large volume, oneinstanton limit, zooming in near the S-duality invariant points t = ±i. We express these instanton corrections in terms of Eichler integrals of Siegel-Narain theta series, and construct their modular invariant completion. Some open problems are discussed in §5. The relevant properties of indefinite theta series and Eichler integrals are reviewed in Appendix A, while Appendix B contains details about the derivation of instanton corrections and quantum mirror map in the large volume limit. Finally, Appendix C gives a preliminary attempt to recast the type IIA twistorial construction of D3-instantons in the type IIB framework of [36].

HM moduli space in type IIB CY vacua
In this section, we briefly recall some basic facts about the hypermultiplet moduli space in type IIB CY vacua. We mainly follow [27], incorporating further improvements introduced in [28,31,30], as well as some new insights on the action of S-duality on the tree level geometry.

Tree-level metric
Recall that the hypermultiplet moduli space in type IIB string theory compactified on a CY three-foldŶ is a quaternion-Kähler manifold M H of dimension 4b 2 +4, where b 2 ≡ b 2 (Ŷ), which describes the dynamics of 1. the ten-dimensional dilaton g s ; 2. the Kähler moduli b a + it a ≡ γ a J (a = 1, . . . , b 2 ) where J ≡ B + i J is the complexified Kähler form onŶ and γ a is a basis of H 2 (Ŷ, Z); 3. the Ramond-Ramond (RR) scalars c 0 , c a ,c a ,c 0 , corresponding to periods of the RR 0-form, 2-form, 4-form and 6-form on a basis of H even (Ŷ, Z); 4. the NS axion ψ, dual to the NS 2-form B in four dimensions.
The ten-dimensional string coupling τ 2 ≡ 1/g s and the RR axion τ 1 ≡ c 0 combine into the tendimensional axio-dilaton field τ = τ 1 + iτ 2 . The resulting field basis τ, t a , b a , c a ,c a ,c 0 , ψ is adapted to the action of S-duality in ten dimensions, as will become apparent below. At tree level in type IIB string perturbation theory, the metric on M H is obtained from the moduli space M SK of complexified Kähler deformations (which also describes the vector multiplet moduli space in Type IIA string theory compactified on the same CY threefoldŶ) via the c-map construction [3,5]. In the large volume limit, the special Kähler manifold M SK is characterized by the holomorphic prepotential where X Λ are homogeneous complex coordinates on M SK such that X Λ /X 0 = z Λ (with z 0 = 1), κ abc is the triple intersection product in H 4 (Ŷ, Z), and A ΛΣ is a constant, real symmetric matrix which satisfies the quantization conditions [43,31] The c-map construction [5] produces the QK metric is the Weil period matrix, τ ΛΣ ≡ ∂ X Λ ∂ X Σ F cl (X) the Griffiths period matrix, and Here V is the volume of the threefoldŶ in string units, and the variable r is related to the fourdimensional string coupling by r = 1/g 2 4 . The variables z a , ζ Λ ,ζ Λ , σ appearing in (2.3) are the natural variables in type IIA string theory compactified on the threefold Y mirror toŶ, and are related to the type IIB fields τ 1 , t a , b a , c a ,c a ,c 0 , ψ by the 'classical mirror map' [44] (2.6) Here the primed coordinatesζ ′ Λ ≡ζ Λ − A ΛΣ ζ Λ are the RR fields in a non-integer homology basis on the type IIA side, which is best suited for comparison with type IIB [31]. The electric charges q ′ Λ in this basis are related to the electric charges q Λ in the integer basis by q ′ Λ = q Λ − A ΛΣ p Σ , and therefore satisfy the quantization properties The prepotential in the non-integer basis is given by (2.1) with A ΛΣ = 0, which we henceforth denote by F ′cl (X Λ ).

Continuous symmetries at tree-level
The tree-level metric (2.3) is invariant under a large group of continuous isometries which is generated by three subgroups: • continuous shifts of the RR and NS axions
In the presence of quantum corrections, all these continuous isometries are lifted, but a discrete subgroup of these symmetries is conjectured to remain unbroken, as will be discussed in §2.4.

Twistorial description of the tree-level metric
In studying instanton corrections to hypermultiplet moduli spaces, it has proven very useful to encode the metric on a QK manifold M in terms of the complex contact structure on its twistor space Z, the total space of the P 1 -bundle over M twisted with the projectivized SU(2) connection (see [46] for a review of this approach). This contact structure is represented by a (twisted) holomorphic one-form X , which locally can always be expressed in terms of complex Darboux coordinates as ) for the contact transformations between Darboux coordinate systems on the overlap U i ∩ U j . For QK manifolds with one quaternionic isometry, which in our case is realized as constant shifts of the NS axion σ, the transition functions H [ij] should be independent of α [j] . In this case, the corresponding contact transformation takes the following form (2.13) and reduces to a complex symplectomorphism in the subspace spanned by (ξ Λ ,ξ Λ ) variables. In addition to the set of transition functions H [ij] , one must also specify a real constant c α , known as the anomalous dimension, which characterizes the singular behavior of α near the poles of P 1 . The QK metric is then obtained by 'parametrizing the twistor lines', i.e. solving the gluing conditions (2.13) for the Darboux coordinates as functions of coordinates on the base M and the P 1 coordinate t, and expanding the contact one-form in the vicinity of any fixed point on P 1 . A useful construct in this procedure is the contact potential e Φ , which determines a Kähler potential on Z (see [20] for more details on this procedure). As explained in [20,27], the QK metric (2.3) can be cast in this twistorial framework by choosing a covering of P 1 consisting of two patches U + , U − around the north and south poles, t = 0 and t = ∞, and a third patch U 0 which covers the equator. The transition functions between complex Darboux coordinates on each patch are given by whereas the corresponding Darboux coordinates in the patch U 0 read as [47,20] where W cl denotes the 'superpotential' and we have traded the Darboux coordinate α forα ≡ −2α −ξ Λ ξ Λ . Moreover, the contact potential e Φ turns out to coincide with the four-dimensional string coupling r given in (2.5).
A very useful property of this twistorial framework is that isometries of M can always be lifted to a holomorphic contact transformation on the twistor space Z, by a suitable choice of action on the P 1 fiber. Thus, the nilpotent generators (2.8) and (2.9) (supplemented with the trivial action on P 1 ) lift to the holomorphic contact transformations respectively, where we defined the Darboux coordinates in the non-integer symplectic basis in the same way as in (2.6),ξ Similarly, the isometric SL(2, R) action (2.10) lifts to the following holomorphic action on Z (here expressed in terms of the Darboux coordinates in the patch U 0 ): (2.20) This action agrees with (2.10) provided the latter is supplemented with a SU(2) rotation along the fiber, where the coordinate z is related to the coordinate t appearing in (2.15) by the Cayley transformation: Under this action, the complex contact one-form (2.12) transforms by an overall holomorphic factor , leaving the complex contact structure invariant, while the contact potential e Φ transforms with modular weight (− 1 2 , − 1 2 ), It will be key to note that the points z = 0, ∞ (corresponding to t = ±i) are invariant under SL(2, R). As a result, the leading Taylor coefficients of the Darboux coordinates around these points have simple modular transformations, e.g. ξ a = τ b a − c a + O(z) transforms with modular weight (−1, 0).

Quantum corrections and S-duality
Away from the large volume, weak coupling limit, the continuous SL(2, R) isometric action is broken by several types of quantum corrections. Firstly, due to worldsheet instantons the holomorphic prepotential (2.1) entering the c-map metric The first term, proportional to the Euler number χŶ ofŶ, corresponds to a perturbative correction in the α ′ -expansion around large volume. The second term corresponds to a sum of worldsheet instantons, labeled by their effective 4 homology class k a γ a ∈ H + 2 (Ŷ, Z), and weighted by the genus zero Gopakumar-Vafa invariants n (0) ka ∈ Z. These instantons contribute through the tri-logarithm function Li 3 (x) = ∞ m=1 m −3 x m , which takes into account multi-covering effects. Note that the two terms in (2.24) may be combined by including the zero class k a = 0 in the sum and setting n (0) 0 = −χŶ/2. In the presence of these worldsheet instantons, the twistor space is still described by three patches related by the transition functions (2.14), where F cl (ξ Λ ) is replaced by F (ξ Λ ).
Secondly, the HM moduli space receives corrections controlled by the string coupling g s . At the perturbative level, it is believed [7,9,20] that the only corrections occurs at one-loop, and is proportional to the Euler number χŶ [6,7]. Its effect on the metric was explicitly calculated in [9,10]. At the level of the twistor space, the one-loop correction is simply incorporated by allowing a logarithmic singularity in the Darboux coordinateα with prescribed coefficient, Including both worldsheet instantons and the one-loop correction, the contact potential (equivalently the one-loop corrected four-dimensional dilaton) is now given by In addition to these perturbative corrections, one expects instanton corrections from Euclidean D(-1), D1, D3, D5-branes wrapping supersymmetric 0,2,4,6-cycles onŶ, as well as from Euclidean NS5-branes wrappingŶ. Lacking a non-perturbative definition of string theory, an effective way of computing these effects is to assume that a certain discrete subgroup of the classical symmetry group SL(2, R) × N stays unbroken at the quantum level, and investigate how this symmetry constrains quantum contributions.
For what concerns the nilpotent algebra of isometries N, it is natural to assume that quantum corrections will be invariant under the unipotent group N(Z) consisting of integer monodromies around the large volume point, and large gauge transformations of the RR and NS axions. The former consists of monodromies M ǫ a in (2.9) with ǫ a integer. The latter were analyzed in [34,31] using properties of the five-brane partition function. It was found that large gauge transformations act by integer shifts of the RR axions ζ Λ ,ζ Λ , but require an additional shift of the NS-axion, where θ Λ , φ Λ are the characteristics entering the fivebrane partition function, and κ is an arbitrary integer. Clearly, the same correction must also affect the transformation of the Darboux coordinatẽ α in (2.17). Finally, since the SL(2, R) action (2.10) descends from the S-duality of ten-dimensional type IIB string theory (or, in the T-dual picture, from the diffeomorphism symmetry of M-theory compactified onŶ × T 2 ), it is natural to assume that the modular subgroup SL(2, Z) remains a symmetry at the quantum level. It was noted in [31], and will be further confirmed in this paper, that the action of S-duality must however differ from the naive action (2.10) by an additional shift in the RR axion dual to D3-branesc a →c a − c 2,a ε(g) , (2.29) where ε(g) ∈ − 1 2 , 1 2 is defined in terms of the multiplier system of the Dedekind eta function η(τ ): Of course, the same correction must affect the Darboux coordinateξ ′ a , These additional shifts are closely related to the quantization condition (2.7) for the charge q ′ 0 , and ensure the coincidence of the Heisenberg shift ζ 0 → ζ 0 + η 0 with the SL(2, Z) transformation τ → τ + η 0 , which was noticed at the classical level. Moreover, it was observed that the characteristics θ Λ must vanish, and that φ a must transform under monodromies M ǫ a as φ a → φ a + 1 2 κ aab ǫ b . Based on these considerations, it is therefore natural to expect that the instanton corrected moduli space wil be invariant under the action of 5 SL(2, Z) ⋉ N(Z), where the action of the unipotent group N(Z) in the type IIB field basis is summarized in the following table: In the remainder of this paper, we shall ignore the action of this discrete symmetry on the axionsc 0 and ψ, since they couple only to D5-brane and NS5-branes. In this sector, the generators T (3) η 0 ,κ act trivially, and the remaining generators satisfy the Heisenberg-type relations (not to be confused with the Heisenberg algebra satisfied by the generators (2.8)) It is interesting to note that this Heisenberg-type algebra is isomorphic to the one which appears in the Coulomb branch of five-dimensional gauge theories compactified on a torus [45]. We comment on the relation between the string theory and field theory set-ups in §5.

Twistorial construction of D-instanton corrections
Using the twistorial methods reviewed above and the symmetry restrictions discussed in the previous subsection, in [27,28] it was shown how to incorporate all D-brane multi-instanton corrections. For convenience we shall phrase this construction in the language of type IIA string theory compactified on the mirror threefold Y, where D-instantons correspond to Euclidean D2-branes wrapping special Lagrangian cycles with homology class γ = (p Λ , q Λ ) ∈ H 3 (Y, Z) (or more generally, elements in the Fukaya category of Y).
To specify the twistor space corrected by these D2-brane contributions, one should replace the patch U 0 , appearing in the above perturbative construction, by a (in general infinite) set of angular sectors which extend between two consecutive BPS rays evaluated at a fixed point z a in M SK . Across each BPS ray ℓ γ , the Darboux coordinates are required to jump by the following complex contact transformation and we introduced the notation E(x) = e 2πix which will be extensively used below. In [28] it was shown how to integrate the contact transformation (2.35) to a generating function While the result is somewhat cumbersome, we will only require its limit in the one-instanton approximation, Using the fact that the Darboux coordinates must approach the classical answer (2.15), (2.25) exponentially fast at t = 0, t = ∞, the gluing conditions (2.35) can be rewritten as integral equations for the Fourier modes X γ , having the form of the Thermodynamical Bethe Ansatz equations [26,49], are the Fourier modes constructed from the perturbative Darboux coordinates (2.15). Eq. (2.38) uniquely determines the Darboux coordinates in each angular sector in terms of the DT invariants Ω(γ; z a ). In the weak coupling limit, it can be solved iteratively, leading to a (formal) multiinstanton series. The one-instanton approximation is obtained by substituting X γ → X sf γ ′ on the r.h.s. and evaluating the integral over t ′ . The latter is dominated by a saddle point at leading to a correction of order O(e −2πSγ ) consistent with the expected semi-classical action for single-centered D-instantons. Having solved these equations, the contact potential is then obtained from the Penrose-type integral Since the HM moduli spaces of type IIA and type IIB string theories compactified on mirror Calabi-Yau threefolds must be identical, the above construction also defines in principle the Dinstanton corrections in the type IIB formulation. In practice however, this is complicated by the fact that the relation between the coordinates z a , ζ Λ ,ζ Λ , σ appearing in the boundary conditions (2.15) and the physical type IIB fields 7 is a priori unknown beyond the classical mirror map (2.6). One way to specify this relation is to require that the physical type IIB fields τ, c a , t a , b a ,c a ,c 0 , ψ should satisfy the same transformation rules (2.10) as at tree-level. But then, one faces the second shortcoming of the construction above, namely that of the lack of manifest S-duality invariance. This problem was solved in the D1-D(-1) sector in [35,36] where both, a manifestly S-duality invariant twistor construction and the quantum corrected mirror map were found. In this paper we address the more complicated case of D3-instantons and uncover their S-duality invariant description in the linearized approximation.

Modularity of DT invariants for D3-instantons
In this section, we establish the modular properties satisfied by the generalized DT invariants which count D3-instantons. The arguments are very similar to those which allow to establish the modularity of the partition function of D4-D2-D0 black holes in type IIA/Ŷ, or equivalently of M5-branes in M-theory onŶ [37,50,51,52,53]. This is not a surprise, since T-duality relates the HM moduli space in type IIB onŶ × S 1 to the VM moduli space in type IIA onŶ × S 1 , and maps D3-brane instantons wrapping a divisor D in type IIB to a D4-brane instanton wrapping D × S 1 in type IIA. In §3.1, we recall the geometric representation of D3-instantons as coherent sheaves on divisors, and recall the main properties of the generalized DT invariants which count them. This subsection may be skipped by the reader uninterested in mathematical aspects of D3-instantons. In §3.2, we express the DT invariants in the large volume limit in terms of the MSW invariants, which have simple modularity properties, and define a novel multi-instanton expansion which is well suited for modularity. In §3.3, we give a heuristic description of D3-instanton corrections in twistor space, formally summing up the transition functions while ignoring the fact that each of them is associated to a different contour. A more rigorous treatment of modularity in twistor space is deferred till §4.

D3-instantons, coherent sheaves and DT invariants
First, we recall the description of D3-brane instantons in type IIB string theory compactified on a Calabi-Yau threefoldŶ in the large volume limit. Similarly to their D4-brane cousins [54,55,56,53], D3-instantons are described by pure, dimension-two, semi-stable sheaves E supported on a divisor D ⊂Ŷ, i.e. a complex hypersurface inŶ (more generally, objects in the derived category of coherent sheaves [57,54].). Let the 4-cycles γ a (Poincaré dual to 2-forms ω a ) denote an integer basis of H 4 (Ŷ, Z) ≡ Λ, and the 2-cycles γ a (Poincaré dual to 4-forms ω a ) denote an integer basis of H 2 (Ŷ, Z) ≡ Λ * , such that where ωŶ is the volume form, normalized to Ŷ ωŶ = 1, and κ abc = Ŷ ω a ω b ω c = γ a , γ b , γ c . The homology class of the divisor D may be expanded on the basis of 4-cycles as D = d a γ a , or equivalently its Poincaré dual may be expanded on a basis of 2-forms, [D] = d a ω a . We denote by d the vector (d 1 , . . . , d b 2 ). We assume that D is an ample divisor, i.e. that [D] belongs to the Kähler cone, for all effective divisors r a γ a ∈ H 4 (Ŷ, Z) and effective curves q a γ a ∈ H 2 (Ŷ, Z). The intersection matrix of 2-cycles of an ample divisor D provides a natural quadratic form κ abc d c on Λ, which has signature (1, b 2 − 1). This also provides the quadratic form κ ab = (κ abc d c ) −1 of Λ * . In the following, we shall use this quadratic form to identify Λ as a sublattice of Λ * , k a → k a ≡ κ abc p b k c . Given any coherent sheaf E onŶ, the D-brane charges are given by the components of the generalized Mukai charge vector γ ′ on a basis of H even (Ŷ, Z), and satisfy the quantization conditions (2.7). D3-brane instantons correspond to dimension-two sheaves with p 0 = 0. Such a sheaf E can be considered as the push forward E = ι * (F ) of a coherent sheaf F on D, where ι : D →Ŷ is the embedding of the surface D in the Calabi-Yau. The Chern character ch E is related to the Chern character of the sheaf F onŶ by the Grothendieck-Riemann-Roch formula [58,59] ch(E) = ι * (ch(F ) Td(D)) / Td(Ŷ) , (3.4) where ι * is the push-forward in cohomology, obtained by first Poincaré dualizing on D, then pushingforward in homology, then Poincaré dualizing onŶ (thereby increasing the form degree by 2). The Chern character ch(F ) is given in terms of the rank r of F and Chern classes c i (F ) by: We recall that the first Chern class of F must satisfy where N is the normal bundle of D inŶ. The components of the charge vector γ ′ are then [56,60] where ι * denotes the pull-back map in cohomology, and while ∆(F ) is the Bogomolov discriminant, invariant under tensoring by line bundles, Similarly to BPS D4-brane black holes, D3-instantons with the minimal number of fermionic zero modes (namely, four) correspond to semi-stable sheaves. Recall that a sheaf F is semi-stable if all subsheaves F ′ ⊂ F satisfy µ(F ′ ) ≤ µ(F ). The (generalized) slope 8 for D3-instantons is defined by In particular the Bogomolov discriminant (3.7) of a semi-stable sheaf is positive, which can be stated physically as a boundq where q ′2 = κ ab q ′ a q ′ b . A useful property ofq 0 is that it is, like the Bogomolov discriminant, invariant under tensoring of F by a line bundle L on D. If c 1 (L) = −ǫ ∈ Λ, the corresponding change of the Chern character ch(E) is the 'spectral flow' Note that the residue class of q ′ ∈ Λ * modulo Λ is unaffected by this flow. This operation however does not leave invariant the stability condition for sheaves E onŶ, unless one also changes the moduli z accordingly: z → z + ǫ [38].
The moduli space of semi-stable dimension-two sheaves E onŶ is a complex space of finite dimension. The generalized Donaldson-Thomas invariant Ω(0, p, q ′ , q ′ 0 ; z) is an integer given, informally, by the Euler characteristics of this moduli space. It is also useful to consider the rational DT invariant [48,61,62],Ω which coincides with the integer Ω(γ/d; z) whenever γ is a primitive vector, but in general is a rational number. Both Ω andΩ are piecewise constant as a function of the Kähler moduli z, but are discontinuous across walls of marginal stability where the sheaf becomes unstable. This moduli dependence persists even in the large volume limit, with the exception of CY threefolds with b 2 = 1, where the invariants Ω(p, q ′ , q ′ 0 ; z) are independent of z at large volume.

MSW invariants and modularity
The moduli dependence of the DT invariants makes it difficult to state their modular properties directly. Fortunately, it is possible to express the DT invariants in the large volume limit in terms of a different set of invariantsΩ p (q, q ′ 0 ), which we call the MSW invariants. They are moduli independent and given by Fourier coefficients of a certain Jacobi form, namely the elliptic genus of the MSW superconformal field theory which describes D4-D2-D0 black holes [37,50,51,52,53], Here, the summation runs over where (p) a ≡ κ abc p b p c , subject to the bound (3.9). For a general vector k ∈ Λ, the vectors k ± ∈ Λ ⊗ R are projections of k onto the positive and negative definite subspaces of Λ ⊗ R defined by the magnetic charge vector p and the Kähler moduli 9 t, which satisfy We also use the notation k + to denote the modulus of the vector k + . It follows from general properties of the CFT that the elliptic genus (3.13) is a Jacobi form of weight (− 3 2 , 1 2 ) under SL(2, Z), with multiplier system M Z = E(ε(g) c 2 · p), where ε(g) is the multiplier system (2.30) of the Dedekind eta function.
The MSW invariantsΩ p (q ′ , q ′ 0 ) coincide with the generalized DT invariants at the so-called 'large volume attractor point' [64] where z(γ) = b(γ) + it(γ) is the standard attractor point. In particular,Ω p (q ′ , q ′ 0 ) is invariant under tensoring by a line bundle (3.11), which corresponds to the spectral flow symmetry in the SCFT. Decomposing where µ ∈ Λ * /Λ is the residue class 10 of q ′ − 1 2 p modulo ǫ, it follows that the MSW invariant Ω p (q ′ , q ′ 0 ) ≡Ω p,µ (q 0 ) depends only on p, µ andq 0 . As a result, the elliptic genus has a theta function decomposition: where θ p,µ is the Siegel-Narain theta series 11 associated to the lattice Λ equipped with the quadratic form κ ab of signature (1, b 2 − 1), 20) and the y-independent coefficients are given by unitary. The Fourier coefficients of h p,µ withq 0 > 0 are known as the polar degeneracies [53], and determine the remaining MSW invariants by the usual Rademacher representation. 13 10 The quotient Λ * /Λ is a finite group of order | det κ ab |, sometimes known as the discriminant group. 11 Note that (3.20) coincides with the theta series (A.6) with y . 12 Non-compact directions in the target space of the CFT could potentially lead to mock modular forms and thus holomorphic anomalies [65]. For local Calabi-Yau manifolds, e.g. O(−K P 2 ) → P 2 , it is known that the holomorphic generating series of DT-invariants for sheaves with rank > 1 requires a non-holomorphic addition in order to transform as a modular form [66]. We assume that this issue does not arise here. 13 The most polar term q −rχ(D)/24 , arises in the CFT from the fact that L 0 ≥ 0 and that c L = rχ(D). Application of the Cardy formula shows that the asymptotic growth of states is dominated by r = 1 for given magnetic charge p, therefore the contribution of non-Abelian D3-instantons is exponentially suppressed compared to Abelian instantons.
Away from the large volume attractor point z ∞ (γ) (but still at large volume), the DT invariant Ω(0, p, q ′ , q ′ 0 ; z) differs from the MSW invariantΩ p,µ (q 0 ) by terms of higher order in the MSW invariants [38,39]: where γ i = (0, p i , q ′ i , q ′ 0,i ), and therefore γ 1 , γ 2 = p 1 · q ′ 2 − p 2 · q ′ 1 . Moreover one recognizes on the second line the difference of the slopes (3.8) of the constituents. The higher order terms can be thought of as describing bound states of the MSW constituents, which exist away from the large volume attractor point z ∞ (γ). This decomposition is analogous to the decomposition of the index in terms of the multi-centered black hole bound states, although the elementary MSW constituents may themselves arise as bound states of more basic constituents such as D6-anti D6 bound states [53], which may decay across walls in the interior of the Kähler cone. The decomposition (3.22) hinges on the fact that walls for constituents with p 1 = 0, p 2 = 0 lie on the boundary or outside the Kähler cone, such that the only relevant walls are those between D3-instantons, i.e. constituents with charges p i > 0 [38]. As shown in [38], the 'two-centered' contribution in (3.22) (after smoothing out the sign function into a error function as in Eq. (A.8)) leads to a modular invariant partition function with the same modular properties as the elliptic genus, and it is expected that modularity persists to all orders. It is worthwhile to note that the expansion (3.22) has a finite number of terms in any chamber related by a finite number of wall-crossings from the large volume attractor chamber.
Having expressed the generalized DT invariants in terms of the moduli-independent MSW invariants, which have simple modular properties, it is thus natural to reorganize the multi-instanton series expansion of the integral equations (2.38) by first expressing Ω(γ; z) in terms ofΩ p,µ (q 0 ) using (3.22), and then expanding in powers of the MSW invariantsΩ p,µ . In terms of the usual multi-instanton expansion of (2.38), the n-th order in this reorganized multi-instanton expansion will contain the usual n-instanton contribution weighted by products of MSW degeneraciesΩ p,µ , together with terms with n ′ < n instantons weighted by terms of order n−n ′ in the expansion (3.22). In the remainder of this work, we shall be concerned with only the first term in this expansion, which we dub the 'one-instanton approximation'.

One-instanton approximation: heuristics
In the one-instanton approximation introduced in the previous subsection, quantum corrections to the perturbative metric are effectively encoded by the set of holomorphic functions 14

23)
14 Indeed, the multi-covering contributions induced by the dilogarithm function in (2.37) are described just as well by replacing Li 2 (σ γ X γ ) → σ γ X γ and using the rational DT invariants (3.12) in place of the integer DT invariants. Due to (3.22), the rational DT invariants can then be replaced byΩ p,µ . which generate the infinitesimal complex contact transformation across the BPS ray ℓ γ . The set of all (ℓ γ , H γ ) can be viewed as a Cech representative of H 1 (Z, O(2)), which is known to classify the linear deformations of QK manifolds. In this subsection, we take a heuristic approach and consider the formal sum H = γ H γ , ignoring the important fact that the functions H γ are attached to different contours. This will allow us to highlight the main mechanism which ensures invariance under S-duality, deferring a rigorous treatment to §4.1 onward.
Ignoring the contributions of D5 and NS5-instantons, which are exponentially suppressed at large volume with respect to D3-D1-D(-1)-instantons, and restricting to a fixed D3-brane charge p, the D3-D1-D(-1) one-instanton corrections are thus described by the formal sum 15 whereΩ p,µ (q 0 ) are the MSW invariants introduced in the previous subsection. In writing (3.24), we identified the quadratic refinement σ γ with the phase (−1) p·q ′ by setting the characteristics θ Λ , φ Λ to zero. We also omit the phase E 1 2 A ΛΣ p Λ p Σ which is unimportant for fixed magnetic charges p Λ . The assumption φ Λ = 0 is for simplicity, since φ Λ couples only to magnetic charges which are kept constant in our set-up. In contrast, the condition θ Λ = 0 is necessary for modular invariance, which requires the phase factor (−1) p·q ′ in the sum (3.24). The vanishing of θ Λ was also seen to be necessary in the linear analysis of NS5-instanton corrections in [31].
Using the same steps as before, we can therefore trade the sum over q ′ , q ′ 0 in (3.24) for a sum over µ,q 0 and k ≡ ǫ + µ + 1 2 p, and represent (3.24) as a sum of theta series analogous to (3.19), and h p,µ (ξ 0 ) is the same modular function which was defined in (3.21), evaluated at τ = ξ 0 . It therefore transforms as a vector-valued holomorphic modular form of modular weight − b 2 2 − 1 and multiplier system M(g) = M Z × M θ under the S-duality action (2.20). On the other hand, Ξ p,µ (ξ 0 , ξ) is formally a holomorphic theta series for the lattice Λ of rank b 2 with quadratic form −κ ab , with modular parameter τ = ξ 0 and elliptic parameters ξ a . Thus, under the action (2.20), it is expected to transform as a holomorphic Jacobi form of weight b 2 2 , multiplier system M −1 θ and index m ab = − 1 2 κ ab . Finally, thanks to the term proportional to c 2,a in the transformation ofξ ′ , the exponential prefactor in (3.25) transforms as the automorphy factor of a multi-variable holomorphic Jacobi theta series with the index m ab = 1 2 κ ab and multiplier system M −1 Z . We thus conclude that, under the action of S-duality in twistor space, the formal sum (3.24) transforms as a holomorphic Jacobi form of weight −1 and trivial multiplier system. In [36] it was shown that this is precisely the condition ensuring the presence of the SL(2, Z) isometry group. Thus, H (1) is expected to generate an S-duality invariant deformation of the perturbative HM metric. 15 The symbol ! indicates a divergent sum.
However, this analysis overlooks the important fact that the quadratic form κ ab has indefinite signature (1, b 2 − 1), and therefore the theta series (3.26) is formally divergent. Fortunately, the theta series (3.26) never arises as such in the computation of the metric, rather each of the terms in (3.26) must be integrated along a different contour, which renders the resulting series convergent. Another fortunate circumstance is that there does exist a natural holomorphic 'mock' theta series of signature (1, b 2 − 1), the convergence of which is ensured by restricting the sum to lattice vectors lying in a certain cone where the quadratic form is definite positive [40]. While each of these two series transform with modular anomalies, their sum is in fact modular invariant, ensuring the modular invariance of the D3-instanton corrected metric, as the next section will aim to demonstrate.

D3-instantons, period integrals and mock theta series
In this section, we discuss how S-duality is realized in the presence of D3-D1-D(-1) instantons, but in the absence of D5 and NS5-instantons. This situation arises in the large volume limit, where D5 and NS5-brane instantons are suppressed compared to D3-D1-D(-1) and worldsheet instantons. In §4.1 we introduce a large volume limit which retains modular invariance but reduces the D3instanton sums to (generalized) Gaussian theta series, and obtain the instanton corrections to the Darboux coordinates and contact potential in this limit. We establish their modularity (or lack thereof) in §4.2, §4.3. Finally, in §4.4 we show how modular anomalies can be canceled by a contact transformation generated by a mock theta series.

Instanton corrections in the large volume limit
In order to analyze the action of S-duality on the D-instanton corrected twistor space, it is useful to focus on the Darboux coordinates around the point t = −i, or equivalently z = 0, which is invariant under the S-duality action (2.21) on the P 1 fiber. In the large volume limit t a → ∞, it may be checked that the saddle points (2.40) dominating the integral equations (2.38), for D3-D1-D(-1) charges γ = (0, p, q, q 0 ) such that p · t 2 > 0, accumulate near the same point Thus, it is natural to expand the Darboux coordinates around the point z = 0, t a → ∞, keeping the product zt a fixed. Retaining all the terms from the perturbative result (2.15) which are finite or divergent in this limit, we find where δξ a , etc, denote the instanton corrections which include two types of contributions: from the integral terms in (2.38) and from instanton corrections to the classical mirror map (2.6). Note that the former contributions can be split into two parts. The first corresponds to D-branes with charge γ with p · t 2 > 0, while the second comes from anti D-branes with opposite charge −γ. In the former case, the integrals are dominated by a saddle point at t ′ γ , which approaches t ′ = −i in the large volume limit, while in the latter case, they are dominated by a saddle point at the antipodal point t ′ −γ = −1/t ′ γ , which approaches t ′ = i or z ′ = ∞ in the large volume limit. This suggests to keep fixed inside these integrals a different combination, t a /z ′ .
Besides the Darboux coordinates, it is important to consider also the contact potential e Φ . In our approximation, it is dominated by the classical term in (2.26), so we can write it as Our task will be to compute the corrections δξ a , etc. in the one-instanton and large volume approximation, and to show that the resulting instanton corrected Darboux coordinates (4.2) and contact potential For what concerns the other coordinatesξ ′ a ,ξ ′ 0 , α ′ , the corresponding constraints are best expressed by forming suitable linear combinations 16 (4.5) These linear combinations are designed to transform canonically under S-duality aŝ if and only if the corrected Darboux coordinates (4.2) transform according to (2.20). As was mentioned above, the instanton corrections acquire two types of contributions. The first is computed by replacing X γ by X sf γ on the r.h.s. of the integral equations (2.38) and (2.41), taking the large volume limit, and evaluating the integrals in terms of the type IIA coordinates τ 2 , z a , ζ Λ ,ζ Λ , σ. The latter can then be replaced by the type IIB coordinates τ, t a , b a , c a ,c a ,c 0 , ψ, adapted for S-duality, using the classical mirror map (2.6). However, there are further contributions stemming from instanton corrections to this mirror map and coming from the tree level terms on the type IIA side. In Appendix B we extend the procedure of [36] and compute these corrections to the mirror map in our approximation. The result is presented explicitly in (B.15). In the same appendix it is shown that, adding up the two types of contributions, the instanton corrections to the Darboux coordinates and the contact potential can be written as Moreover, H ±γ is the large volume limit of (3.23) where one keeps fixed z ±1 t a , respectively. Explicitly, these two functions are given by where S cl is the leading part of the Euclidean D3-brane action in the large volume limit, and Q ±γ (z) is the only part which depends on z, (4.11) The notation ℓγ signifies that each term must be integrated on a contour which extends from z ′ = −∞ to z ′ = +∞ and goes through the saddle point z ′ γ = −i(k +b) + / p · t 2 . This corresponds to the BPS ray ℓ γ in the large volume limit.
As we shall see momentarily, the corrections (4.7) do not quite transform as required in (4.6), but the modular anomaly can be absorbed by a contact transformation. This issue however does not arise in the case of the contact potential, which we consider first.

Modular invariance of the contact potential
The one-instanton correction to the contact potential in (4.7) involves a Gaussian integral over z ′ (renamed as z) which is easily calculated. Rewriting the integrand (4.12) and dropping the total derivative, we arrive at (4.13) The sum over q Λ is recognized as the partition function (3.19), except for the insertion in the square bracket. The latter in turn arises by acting with the covariant derivative D − 3 2 , obtaining 14) The action of D − 3 2 on h p,µ (τ )θ p,µ (τ, t, b, c) raises the modular weight from (− 3 2 , 1 2 ) to ( 1 2 , 1 2 ), while the overall factor of τ 2 reduces this to (− 1 2 , − 1 2 ) (recall that the combination τ 2 p · t 2 is modular invariant). Therefore, the correction δe Φ transforms as required in (4.4).

Instanton corrections to Darboux coordinates and period integrals
We now turn to the instanton corrections to the Darboux coordinates. Unlike the contact potential, which is modular covariant, it will turn out that the Darboux coordinates have anomalous modular transformations, due to the fact that the contour ℓ γ is not invariant. However, we shall be able to give a precise characterization of this modular anomaly, by rewriting the Penrose-type integral over z ′ as an Eichler integral.
For simplicity we start from the last term inδ − α ′ (4.7). It is given by a Gaussian integral in 1/z ′ which can be easily evaluated. The result is It transforms as a modular function of weight (0, −1) in full agreement with the required transformation properties (4.6).
All the other instanton corrections to Darboux coordinates in the large volume limit are determined by the function J p (z) (4.8). Therefore, our prime interest is to understand its modular properties. To this aim, let us consider the integral appearing in this function, namely By shifting the contour, this may be rewritten as Since z can be absorbed by a shift of α, we shall first consider the value of I at z = 0. Using the identity e −β 2 z 2 = iπ sgn( Re (α)) e α 2 β 2 Erfc sgn( Re (αβ)) αβ , (4.18) valid for α, β ∈ C with Re (β 2 ) > 0 and Re (α) = 0, the integral representation and changing variable from u tow = τ − iu/(k + b) 2 + , valued in the lower half plane, one may cast I(0) in the form of an Eichler integral (A.14) 18 Inserting the representation (4.21) into (4.8), restricting to z = 0 for simplicity, and carrying out the sum over q Λ in the same fashion as in §3.2, we arrive at More generally, using this type of manipulations, one may rewrite the full function J p (z) away from z = 0 as In fact, the integral over z ′ (4.18) can be rewritten as an integral overw without ever evaluating it in terms of the error function, upon representing both factors in the integrand in terms of their Fourier transforms where η is the Heaviside step function, and carrying out the integral over z ′ , ω, ω ′ . Thus, the integration variablew in (4.21) is Fourier dual to the twistor coordinate z ′ in (4.16).

(4.24)
It is easy to see that the integral is identical to the complex conjugate of the generating function G Φ p,µ (y) (A.27) evaluated at y = 2τ 2 p · t 2z , i.e.
In Appendix A it is shown that provided y transforms with the modular weight (0, −1), which is indeed the case for our identification between y and z, the generating function G Φ p,µ (y) transforms as an Eichler integral of weight (0, b 2 /2). As a result, the full function (4.25) possesses the following transformation property i.e. transforms with modular weight (−1, 0) and an anomaly given by a period integral. Recalling the properties of the covariant derivative operators D h , D, D mentioned in footnote 17, this allows to conclude that the corrections δξ,δξ ′ ,δ ± α ′ transform as required in (4.6), except for the modular anomaly (4.26), acted upon by the corresponding covariant derivatives.

Anomaly cancelation from mock theta series
Having expressed the corrections to the Darboux coordinates as Eichler integrals, or modular derivative thereof, it remains to show how the modular anomalies can be canceled by a suitable contact transformation. As explained in Appendix A, the modular anomaly of an Eichler integral can be canceled by adding to it a certain mock theta series. Typically it appears as a theta series with insertion of a difference of two sign functions defined by two Kähler moduli t and t ′ , with one of them chosen to lie on the boundary of the Kähler cone, i.e. p · t ′2 = 0. The simplest example is provided by (A.11) and (A.10), respectively, which describe the instanton corrections to J p (0).
Similarly, the modular anomaly in (4.26) can be canceled by replacing the generating function G Φ p,µ in (4.25) by its modular completion G Φ p,µ − G Θ p,µ , where the second term is the generating function defined in (A.24), evaluated at y = 2τ 2 p · t 2z . In this way, we find that the modular completion of J p (z) is given byĴ where (4.28) Using (A.26), this can be rewritten as which shows that miraculously, H anom is a holomorphic function of the Darboux coordinates. In fact, H anom is proportional to the holomorphic mock theta series (A.10) evaluated at τ = ξ 0 , y = ξ (upon taking into account the identification between y and b, c mentioned in footnote 11). Moreover, one can show that the corresponding modular completions of the Darboux coordinates δξ, δξ ′ 0 , δα ′ , following from (4.5), (4.7) and obtained by substitution of J p byĴ p , have the following form and transform according to (2.20), without any further anomaly. Moreover, the modular completion (4.30) is recognized as a holomorphic contact transformation (2.13). It is interesting to note that the theta series (4.29) can be written as and differs from the formal sum (3.24) only by an insertion of the two signs which makes the sum over charges convergent. As a result, the compensating contact transformation is generated by a proper subset of the original transition functions, and the modular covariant Darboux coordinates differ from the original type IIA Darboux coordinates by a sequence of symplectomorphisms associated to the BPS states for which the two signs are different. This mimicks the situation in the D1-D(-1) sector [36]. Thus, we have demonstrated that the modular anomaly is canceled by performing the transformation (2.13) generated by the mock theta series (4.29). In fact, we have a continuous family of modular completions labeled by the parameter t ′ on the boundary of the Kähler cone. It would be interesting if this ambiguity was fixed by some physical principle. This concludes the proof of the modular invariance of the HM moduli space corrected by D3-instantons in the large volume, one-instanton approximation.

Discussion
In this work, we investigated the modular invariance of D3-D1-D(-1)-instanton corrections to the hypermultiplet moduli space of type IIB string theory compactified on a CY threefoldŶ. We focused on the large volume limit, where D5-NS5-instantons can be consistently ignored. Using similar arguments as the ones which enter in the proof of modular invariance of the partition function of D4-D2-D0 black holes in type IIA string theory compactified on the same threefoldŶ, we showed that the DT invariants which govern D3-instanton corrections are expressible in terms of the Fourier coefficients of the elliptic genus of the MSW superconformal field theory, which we refer to as MSW invariants. Unlike the DT invariants, the MSW invariants are independent of the moduli and have simple modular properties. In the one-instanton approximation, we found that the D3-instanton corrections to the standard Darboux coordinates are expressible as Eichler integrals of the MSW elliptic genus, and modular derivatives thereof. Thus, they suffer from modular anomalies, which can however be absorbed by a local complex contact transformation. The generating function for this contact transformation was recognized as the holomorphic mock theta series of signature (1, b 2 − 1) introduced in [40]. In this physical set-up, the Eichler integral which provides the modular completion of the mock theta series arises as a Penrose-type integral along the twistor fiber, or rather its Fourier transform. 19 Unlike Darboux coordinates, the contact potential (also known as the four-dimensional dilaton) transforms covariantly, and is proportional to the (modular derivative of the) MSW elliptic genus.
While it is very satisfying to see modularity emerge in the large volume, one-instanton approximation, an outstanding problem is to extend the results of this paper beyond this regime. This can be in principle addressed by expanding the integral equations (2.38) to higher order in the MSW invariants, as indicated in §3.2. There are two contributions at next-to-leading order, namely (i) the two-instanton correction in the usual iterative expansion of (2.38), with the DT invariantΩ(γ; z) replaced by the MSW invariantΩ p,µ , and (ii) the usual one-instanton correction, withΩ(γ; z) replaced by the quadratic term in (3.22). The first contribution is weighted by e −2πτ 2 (|Z(γ 1 ,z)|+|Z(γ 2 ,z)|) , whereas the second contribution is weighted by e −2πτ 2 |Z(γ 1 +γ 2 ,z)| . By construction, the sum of these contributions is continuous across walls of marginal stability, although they are separately discontinuous. We expect that the D3-instanton correction at two-instanton order will be modular invariant, and will be related to the two-center D4-brane partition function in the same fashion as at one-instanton order, with the two-center Siegel-Narain theta series replaced by an indefinite theta series. It is encouraging that the partition function for two-center D4-black holes, corresponding to the contribution of (i), indeed becomes modular invariant and continuous after adding a suitable non-holomorphic completion [38], which should arise from contributions of type (ii).
More ambitiously, it would be very interesting to show that S-duality invariance holds at the non-linear level. One way to achieve this would be to recast the standard type IIA twistorial construction into the manifestly invariant framework developed in [36]. A naive attempt using the standard representation of the MSW elliptic genus as a Poincaré series [42] fails, due to the necessity of regulating the Poincaré series (see Appendix C). It is conceivable that this obstruction may be avoided by taking into account the constraints on the polar degeneracies from modular invariance. Eventually, we hope that it will be possible to formulate all D5-D3-D1-D(-1) and NS5brane instanton corrections in a manifestly invariant S-duality fashion, going beyond the linear order analysis of [31] and providing a tight set of constraints on the generalized Donaldson-Thomas invariants on Calabi-Yau threefolds.
Finally, we expect that the structure uncovered in this paper in the context of the HM moduli space in type II string theories on a compact CY threefold will continue to exist in the rigid limit near singularities ofŶ. Specifically, the Coulomb branch of N = 2 five-dimensional SU(2) gauge theories compactified to a two-torus [45], obtained by considering type IIA string theory on a non-compact CY threefold given by the anti-canonical bundle O(−K S ) → S over a rational surface S [67], gives a family of hyperkähler manifolds parametrized by the modular parameter of the torus, which must be invariant under modular transformations. We expect this family of HK metrics to be described by a similar twistorial construction as in this paper, using the generalization of the QK/HK correspondence put forward in [36]. For such line bundles over rational surfaces, the DT invariants Ω(γ; z a ) with p 0 = 0 can be computed explicitly [68], and the analogue of the MSW CFT is a (0,4)-supersymmetric sigma model with target space given by the Atiyah-Hitchin moduli space of monopoles in three dimensions [45,69]. An important difference between the rigid case and the assumptions in this paper is that the generating function h p,µ (τ ) of DT invariants for rational surfaces is mock modular [66,70]. It is natural to expect that its non-holomorphic modular completion will arise from multi-instanton corrections. Finally, by the general logic of the QK/HK correspondence, this family of HK metrics will be naturally endowed with a rank two modular invariant hyperholomorphic line bundle analogous to the rank one hyperholomorphic line bundle which arises in 4D gauge theories [30,71], whose physical role remains to be understood. Now, let us assume that P(x) e πx 2 decays sufficiently fast 20 at infinity, and that P(x) is annihilated by the differential operator where ∆ = ∂ 2 x is the Laplacian operator on R n . Then, using the same methods as in [72], one may show that the family of theta series (A.1), with µ running over all cosets in Λ * /Λ, transforms as a vector-valued Jacobi form of weight (0, λ + n/2) under the full modular group. This means that it satisfies the modular properties on top of the elliptic properties (A.2). In the next subsections, we present the relevant instances of this general construction relevant for the present work.

A.2 Siegel-Narain Theta series
The simplest example arises for P(x) = e −π(x (t) + is the projection of x along a fixed time-like vector t in R n (t 2 > 0): In case no confusion arises, we write x (t) + = x + . The corresponding theta series (A.1) is then, up to a power of τ 2 and lattice shift, the standard Siegel-Narain theta series, Thus, θ p,µ transforms as a vector-valued Jacobi form of weight ( 1 2 , n−1 2 ).

A.3 Zwegers' mock theta series
The other prime example is Zwegers' indefinite theta series of weight (0, n 2 ) [40] (based on earlier works [73,74]), where t and t ′ are two time-like vectors and Erf( √ πx) = 2 x 0 e −π t 2 dt is the standard error function. This series again belongs to the class (A.1) with P(x) = Erf( √ πx (t) . Each of the two terms in P(x) satisfies the differential equation (A.3) for λ = 0, and the sum of the two terms satisfies the decay conditions, although this is not true for each term separately. Using one may decompose (A.7) into a sum of three terms where the middle term is holomorphic in τ , (A.10) while the first and last term are given by (A.11) It is useful to note that both (A.10) and (A.11) are of the form (A.1) with a function P(x) which is square integrable 21 and obeys the differential equation (A.3) everywhere, except on the locus where x (t) + vanishes. As a result, the three terms in (A.9) are not separately modular invariant, although their sum is.
The modular anomaly of (A.11) may be exposed by using the identity (A.12) to rewrite (A.11) as a (generalized) Eichler integral, Recall that if F (τ,τ ) is an analytic modular form of weight (h,h), and if F (w,τ) is its analytic continuation away from the slice w = τ , the Eichler integral transforms with modular weight (0,h + 2 − h), up to modular anomaly given by a period integral, The function F (τ,τ ) is known as the shadow of the Eichler integral (A.14), and can be extracted from Φ(τ ) by acting with the operator −(2τ 2 ) 2−h ∂ τ .
Returning to (A.13), Φ p,µ (τ, t, b, c) is then identified as an Eichler integral of weight (0, n 2 ), with shadow proportional to the theta series of weight ( 3 2 , n−1 2 ), (A. 16) Let us now consider what happens with (A.9) when one of the time-like vectors, say t ′ , approaches the boundary of the Kähler cone, i.e. becomes light-like t ′2 = 0. Then (k + b) (t ′ ) + diverges and, since Erfc(|x|) is exponentially suppressed as x → ∞, the last term in (A.9) vanishes, leaving only the first two. Thus, for any choice of light-like vector t ′ , the holomorphic theta series Θ p,µ (τ, t, t ′ , b, c) in (A.10) gives a modular completion of the Eichler integral Φ p,µ (τ, t, b, c) (or conversely, the Eichler integral gives a modular completion of the holomorphic theta series).

A.4 An infinite sequence of mock theta series
Finally, let us describe an infinite sequence of indefinite theta series similar to (A.7), obtained by applying the projectionD (t) + of the covariant derivative D (4.9) along a time-like vector t. This derivative acts on any Jacobi form of weight (h,h) by changing its modular weight to (h,h + 1). In particular, it preserves the class (A.1) of theta series and acts on them in the following waȳ (A.17) Using this result as well as the identity where H m are the Hermite polynomials, one finds that the m-th derivative of (A.10) is given by Similarly, the m-th derivative of (A.11) is found to be (A. 21) B. Instanton corrections in the large volume limit

B.1 S-duality and mirror map
To establish the modularity of the type IIA construction of D-instantons, we have to find instanton corrections to the classical mirror map (2.6) such that the Darboux coordinates on the twistor space expressed in terms of the type IIB fields transform as in (2.20). For this purpose, it will be useful to borrow some methods from the work [36] where a manifestly S-duality invariant twistorial construction of a QK manifold with two commuting isometries was provided. This is despite the fact that the Poincaré series representation is not immediately applicable to our framework, as further discussed in appendix C. One of the main insights of the construction in [36] was that the kernel dt ′ and transition functions where F cl (X) = −κ abc is an arbitrary cubic prepotential, Λ = (0, a) = 0, 1, . . . n − 1. Here U ± are the usual patches around the poles of P 1 , U ± m,n are two sets of patches which are mapped to each other under SL(2, Z)-transformations, and U 0 covers the rest. They must be chosen so that U 0 is mapped to itself under the antipodal map and S-duality, whereas U m,n are mapped to each other according to The holomorphic functions G ± m,n are assumed to transform as 22 where +reg. denotes equality up to terms which are regular in U ± m ′ ,n ′ . Given these conditions, the associated QK manifold M can be shown to carry an isometric action of SL(2, Z). The only difference with [36] is the presence of two sets of twistorial data, labeled by + and −, which are mapped to each other by the antipodal map. Physically, they can be interpreted as contributions of branes and anti-branes. The Darboux coordinates in the patch U 0 then satisfy the following integral equations: where C ± m,n are contours on P 1 surrounding U ± m,n counter-clockwise and (τ 2 , Y a , ζ 0 , ζ a cl ,ζ cl Λ ,σ cl ) are coordinates on M.
The key to prove the presence of S-duality is to find expressions of the coordinates (Y a , ζ a cl ,ζ cl Λ ,σ cl ) in terms of (τ, b a , t a , c a ,c a , ψ) which ensure the proper transformations of the Darboux coordinates. Let us do this explicitly for the coordinates entering ξ a . To this end, note that the derivative 22 We refrain from writing the full non-linear transformation of G ± m,n , since we are interested only in the linear approximation in this paper. The transformation property required for modular invariance at the non-linear level can be found in [36].

B.2 Large volume limit
We shall now use the above results, in particular (B.2) and (B.12), as a guidance for finding the mirror map between type IIA and type IIB fields. To apply them to our situation, we replace (C ± m,n , G ± m,n ) by (ℓ ±γ , H ±γ ) where γ = (0, p a , q ′ a , q 0 ) with p · t 2 > 0. After this replacement, the Darboux coordinates are given by the same integral equations (B.9) where ζ a cl ,ζ cl Λ ,σ cl differ from the type IIA fields ζ a ,ζ Λ , σ by the terms coming from the redefinition of the kernel. 23 Our aim here is to study their large volume limit t a → ∞.
In this limit we concentrate on the infinitely small region of the P 1 fiber around the S-duality invariant point z = 0 such that the combination zt a stays finite. Moreover, all integrals along ℓ ±γ are dominated by a saddle point at z ′ = 0 for the set of charges γ and at z ′ = ∞ for the set of charges −γ. Using this fact and the relations (B.12) (with the above replacements), the Darboux coordinates of the type IIA construction in the one-instanton, large volume approximation are given 23σcl also contains an additional classical term (2.6) in the large volume, one-instanton approximation to be Plugging these relations into (B.14), one arrives at the expressions (4.7) given in the main text. Note that the integrals over ℓ γ are Gaussian and can be easily computed. It is worth stressing that δz a gives a correction to the mirror map between the type IIA complex structure moduli z a and the type IIB Kähler moduli b a + it a . Such corrections do not arise for D1-D(-1)-instantons, but are in general necessary in the presence of D3-instantons [36].

C. Relation to the Poincaré series construction
In this section, we make a first attempt at recasting the type IIA twistorial construction into the manifestly S-duality invariant framework developed in [36]. The basic idea is to represent the partition function (3.19) as a Poincaré series, and assign each term in the sum over cosets to a different transition function G m,n . For this purpose, recall that the partition function of MSW invariants (3.21) is a vector-valued holomorphic modular form of negative weight h = −b 2 /2 − 1, therefore the positive frequency Fourier coefficients can be expressed in terms of the polar (negative frequency) coefficients by the Rademacher formula [75] Ω p,µ (q 0 ) = 2πi −h , (C. 6) and the action of g ∈ Γ ∞ \SL(2, Z) on ξ 0 , ξ andξ ′ is given by (2.20). Although the series (C.5) is divergent due to the sum over D1-brane charges k, it formally transforms like a holomorphic modular form of weight −1.
The representation (C.5) suggests a natural Ansatz for the holomorphic transition functions (B.6) that enter the manifestly S-duality invariant twistorial construction outlined in §B.1, namely G ± m,n = G m,n;±γ , (C.7) and choose the contours C ± m,n as the geodesic circles joining the two essential singularities of (C.6), namely the two roots t ± m,n of the quadratic polynomial t(mξ 0 (t)+n). In particular, it is easy to check that the contact potential generated by these twistorial data in the large volume limit coincides with (4.14). Unfortunately, the transition functions (C.6) do not satisfy the transformation property (B.8) due to the presence of the R-factor (C.4) which transforms as a period integral. As a result, the SL(2, Z) invariance of the construction is not guaranteed, and indeed the Darboux coordinates computed from (C.6) acquire a modular anomaly. This anomaly should however be cancelable by a similar holomorphic contact transformation as the one described in §4.4. We hope to put this construction on a more solid basis in future work.