Curve counting and S-duality

We work on a projective threefold $X$ which satisfies the Bogomolov-Gieseker conjecture of Bayer-Macr\`i-Toda, such as $\mathbb P^3$ or the quintic threefold. We prove certain moduli spaces of 2-dimensional torsion sheaves on $X$ are smooth bundles over Hilbert schemes of ideal sheaves of curves and points in $X$. When $X$ is Calabi-Yau this gives a simple wall crossing formula expressing curve counts (and so ultimately Gromov-Witten invariants) in terms of counts of D4-D2-D0 branes. These latter invariants are predicted to have modular properties which we discuss from the point of view of S-duality and Noether-Lefschetz theory.


Introduction
A naive way to relate different moduli spaces of coherent sheaves on an algebraic variety is to replace sheaves by cokernels of their sections (after twisting by an appropriately positive line bundle to ensure the sheaves have predictable numbers of sections).This would give useful relations between enumerative invariants counting sheaves, but it very rarely works due to stability issues.This is one of a series of papers [Fey22,FT21a,FT21b,FT21c] showing it can be made to work -modulo the wall-crossing formulae required to move to a stability condition for which such cokernels are stableon a threefold X satisfying (a weakening of) Bayer-Macrì-Toda's Bogomolov-Gieseker conjecture [BMT14].When X is Calabi-Yau, this gives relations between invariants involving unwieldy formulae.In this paper we concentrate on the one case where the formulae are very simple.They equate the (virtual) counting of ideal sheaves (of curves and points) with the counting of 2-dimensional pure sheaves, (1.1) #(ideal sheaves) = c • #(2-dimensional pure sheaves), with c an explicit topological constant.The formula reflects the fact that in this case we are ultimately able to prove (by crossing many walls) that no wall-crossing is necessary -the cokernels are stable and are the only stable sheaves of the same topological type.Thus the relationship between the moduli spaces is also very simple, with one being a projective bundle over the other.We explain below why this is so surprising (to us).
The counts of ideal sheaves on the left-hand side of (1.1) are heavily studied, being equivalent, via the MNOP conjecture [MNOP06], to the Gromov-Witten theory of X.On the right-hand side, we have counts of "D4-D2-D0 branes", which the string-theoretic "S-duality conjecture" predicts are coefficients of (vector-valued mock) modular forms.Thus (1.1) opens up the potential of governing the Gromov-Witten theory of X by modular forms.This is discussed in Section 6, alongside a conjectural approach to proving S-duality geometrically using Noether-Lefschetz theory.
In the sequel [FT21b,FT21c] we apply the same methods to DT invariants counting higher-rank sheaves.Here the wall-crossing formulae are much more complicated, but ultimately express arbitrary rank DT invariants in terms of the same data.That is, we can express them in terms of the rank 1 invariants on the left-hand side of (1.1) (or, by the MNOP conjecture, the Gromov-Witten invariants of X).Or we can express them in terms of the (conjecturally modular) rank 0 invariants counting D4-D2-D0 branes on the right-hand side of (1.1).

Statement of results
Let (X, O(1)) be a smooth polarised complex projective threefold.Gieseker and slope (semi)stability of sheaves will always be defined by H := c 1 (O(1)).
Fix β in the image of H 4 (X, Z) → H 4 (X, Q) and m ∈ Z.Let I m (X, β) denote the Hilbert scheme of subschemes C ⊂ X of dimension at most 1 and topological type It is the moduli space of ideal sheaves I C .Torsion-free sheaves of the same Chern character v := (1, 0, −β, −m) ∈ 3 i=0 H 2i (X, Q) are all of the form I C ⊗ T , where T is a line bundle with torsion c 1 (T ) ∈ H 2 (X, Z).Their moduli space is I m (X, β) × Pic 0 (X), where Pic 0 (X) := T ∈ Pic(X) : c 1 (T ) = 0 ∈ H 2 (X, Q) .
For n 0 the generic section has cokernel a rank 0 Gieseker semistable 2-dimensional sheaf cok(s) of Chern character Let M X,H (v n ) denote the moduli space of Gieseker semistable sheaves of class v n .
Theorem 1.For X satisfying the Bogomolov-Gieseker conjecture of [BMT14] and n 0, • cok(s) ⊗ L is slope and Gieseker stable for any s 0 and any L ∈ Pic 0 (X); • all points of M X,H (v n ) are of the form cok(s) ⊗ L for unique data ((I C ⊗ T , s), L); • mapping cok(s) ⊗ L to (I C , T , L) defines a morphism which is a smooth projective bundle with fibre P χ(v(n))−1 .
We use the weak stability conditions of Bayer-Macrì-Toda [BMT14] on the bounded derived category of coherent sheaves D(X).Their conjectural Bogomolov-Gieseker inequality for weak semistable objects is the key to proving the existence of Bridgeland stability conditions on D(X), and is now known to hold for many threefolds, see [BMS16, Kos18, Kos20, Kos22, Li19a, Li19b, MP16, Mac14, Sch14], such as P 3 or the quintic threefold.In fact we only need its weakening stated in Conjecture BG n below.
For weak stability conditions in the large volume limit, semistable objects F of Chern character v n are slope semistable sheaves, giving the moduli space M X,H (v n ).Several applications of the Bogomolov-Gieseker inequality show there is a single wall of instability for the class v n .Below this there are no semistable objects, while on the wall F is destabilised by an exact triangle expressing it as the cokernel of a section (1.2) tensored by L ∈ Pic 0 (X).
By [GST14] such sheaves F = cok(s) ⊗ L are all of the form for some subscheme C of a divisor ι : D → X in the linear system |T (n)| and L = T ⊗ L in Pic 0 (X).(Here I C denotes the ideal sheaf of C on D rather than X, and the H 2 class of the pushforward of [C] to X is β.) So, remarkably, such sheaves are always Gieseker and slope stable, and these are the only sheaves in M X,H (v n ).
In other words, semistable sheaves with Chern character v n must have rank 1 on their support.This came as a surprise to us.The support D can have reducible components which are non-reduced.For instance, consider one of the form D = D 1 ∪rD 2 for r > 1.Then there are sheaves with Chern character v n which have support on the reduced divisor D 1 ∪ D 2 but rank r on D 2 .Theorem 1 says they are necessarily unstable. (1) (Furthermore, there is a unique L ∈ Pic 0 (X) such that after ⊗(L ) * , this rank 1 sheaf on D is anti-effective: its dual has a section.In particular, if β • H < 0, then M X,H (v n ) must be empty.)We do not know of other situations in which whole series of different moduli spaces of sheaves have been systematically shown to have such a simple geometric relation as in Theorem 1.
Suppose now that X is a Calabi-Yau threefold: K X O X and H 1 (O X ) = 0. Since semistability equals stability for our moduli spaces, they carry symmetric obstruction theories and virtual cycles of dimension 0, see [HT10,MNOP06,Tho00], and degrees The first is the count of (ideal sheaves of) curves and points on X conjectured by Maulik-Nekrasov-Okounkov-Pandharipande to be equivalent to the Gromov-Witten theory of X; see [MNOP06].This MNOP conjecture has now been proved for most Calabi-Yau threefolds by Pandharipande and Pixton [PP17].The second counts D4-D2-D0-branes, or 2-dimensional torsion sheaves, and is subject to the famous S-duality conjectures of physicists.
Write these invariants as Behrend-weighted Euler characteristics; see [Beh09].As Theorem 1 gives a smooth fibration M X,H (v n ) → I m (X, β) with fibres of signed Euler characteristic an immediate corollary is the following precise form of equation (1.1).
Theorem 2. Fix β, m, then n 0. Suppose Conjecture BG n holds on X.Then In Section 6 we discuss the conjectural modular properties of the invariants Ω v n from two points of view: (i) S-duality from physics and (ii) Noether-Lefschetz theory [MP10].

Weak stability conditions
Let (X, O(1)) be a smooth polarised complex threefold and H = c 1 (O(1)).Denote the bounded derived category of coherent sheaves on X by D(X) and its Grothendieck group by K(X) := K(D(X)).In this section we review the notion of a weak stability condition on D(X).The main references are [BMT14,BMS16].
We define the µ H -slope of a coherent sheaf E on X to be (1) Of course, stable sheaves do exist with rank r > 1 on D 2 , but if they have the same ch 1 , ch 2 as v n , then by Theorem 1 they Associated to this slope, every sheaf E has a Harder-Narasimhan filtration.Its graded pieces have slopes whose maximum we denote by µ + H (E) and minimum by µ − H (E). For any b ∈ R, let A(b) ⊂ D(X) denote the abelian category of complexes (2.1) Then A(b) is the heart of a t-structure on D(X) by [Bri08, Lemma 6.1].Let w ∈ R \ {0}.On A(b) we have the slope function ( 2) where ch bH (E) := ch(E)e −bH .This defines a Harder-Narasimhan filtration on A(b) by [BMT14, Lemma 3.2.4].
It will be convenient to replace this by has a denominator that is linear in b and numerator linear in w, so the walls of ν b,w -instability will turn out to be linear; see Proposition 2.5.Note that if ch i (E) • H n−i = 0 for i = 0, 1, 2, the slope ν b,w (E) is defined by (2.3) to be +∞.Since (2.2) only rescales and adds a constant, it defines the same Harder-Narasimhan filtration as N b,σ , so it too defines a weak stability condition on A(b).
Remark 2.2.Given (b, w) ∈ R 2 with w > 1 2 b 2 , the argument in [Bri07, Proposition 5.3] describes A(b).It is generated by the ν b,w -stable two-term complexes E = {E −1 → E 0 } in D(X) satisfying the following conditions on the denominator and numerator of ν b,w from (2.3): is the extension-closure of the set of these complexes.
Although this conjecture is known not to hold for all classes on all threefolds [Sch17], it is possible it always holds for the special classes required to prove Theorem 1. Setting we require the following.
, and E a torsion-free sheaf with In fact an even weaker version of BG n in enough to conclude Theorems 1 and 2, as shown in [FT21b, Section 3.1].Conjecture 2.3 follows from [BMS16, Conjecture 4.1], which has now been proved in the following cases: • X is projective space P 3 (see [Mac14]), the quadric threefold (see [Sch14]) or, more generally, any Fano threefold of Picard rank 1 (see [Li19b]), • X is an abelian threefold (see [MP16]), a Calabi-Yau threefold of abelian type (see [BMS16]), a Kummer threefold (see [BMS16]), or a product of an abelian variety and P n (see [Kos18]), • X has nef tangent bundle (see [Kos20]), • X is one of the Calabi-Yau threefolds considered in [Kos22]; with some work, one can show the weakening of Conjecture 2.3 proved in [Kos22, Theorem 1.2] is still strong enough to give Theorem 1 for n 0, and • X is a quintic threefold (see [Li19a]), or a (2,4) complete intersection in P 5 (see [Liu22]), and (b, w) are described below.
In Figure 1 we plot the (b, w)-plane simultaneously with the image of the projection map Note that for any weak stability condition ν b,w , the pair (b, w) is in the shaded open subset Conversely, the image Π(E) of ν b,w -semistable objects E with ch 0 (E) 0 is outside U due to the classical Bogomolov-Gieseker-type inequality for the H-discriminant, proved for ν b,w -semistable objects E in [BMS16, Theorem 3.5].
(3) By Remark 2.2 they lie to the right of (or on) the vertical line through (b, w) if ch 0 (E) > 0, to the left if ch 0 (E) < 0, and at infinity if ch 0 (E) = 0.The slope ν b,w (E) of E is the gradient of the line connecting (b, w) to Π(E).
Objects of D(X) give the space of weak stability conditions a wall and chamber structure, explained in [FT21a, Proposition 4.1] for instance.
Proposition 2.5 (Wall and chamber structure).Fix an object E ∈ D(X) such that the vector There exists a set of lines { i } i∈I in R 2 such that the segments i ∩ U (called " walls" ) are locally finite and satisfy: (3) [BMS16, Theorem 3.5] states (2.7) with ch replaced by ch bH , but the result is still ∆ H (E). We use the stronger Bogomolov for (b, w) in one of the two chambers adjacent to the wall i .
The line segments i ∩ U are walls for E.

From sheaves to Joyce-Song pairs
Let (X, O(1)) be a smooth polarised complex threefold, and let H := c 1 (O(1)).Fix β in the image of H 4 (X, Z) → H 4 (X, Q) and m ∈ Z.In this section we investigate walls of instability for sheaves of Chern character when n 0. For any sheaf F of rank 0, we define its ν H -slope as We say that a sheaf F of rank 0 is slope (semi)stable if for all non-trivial quotients This section is devoted to proving the following half of Theorem 1.
Then any slope semistable sheaf F of Chern character v n is slope stable, and there exist unique (L, I, s) such that where We call (I, s) a Joyce-Song pair when 0 s ∈ H 0 (I(n)).Joyce and Song [JS12, Section 5.4] studied pairs consisting of a sheaf and a section (of a very positive twist of the sheaf) satisfying a version of Gieseker stability for pairs.We use weak stability conditions instead, but ultimately we prove that in this simplified rank 1 situation, both conditions amount to the same: that I is torsion-free and s is non-zero.
To prove Theorem 3.1, we start in the large volume limit, where a very similar argument to [Bri08, Proposition 14.2] implies that a rank 0 sheaf is slope (semi)stable if and only if it is ν b,w -(semi)stable for any b ∈ R and w 0.
Conjecture BG n gives the Bogomolov-Gieseker inequality (2.4) for the stability parameters Rearranging gives We may assume we chose n 0 sufficiently large that , so the point (b 0 , w f ) lies inside U .Therefore, moving down the line b = b 0 , there is a point w 0 ≥ w f where F is first destabilised.Our ultimate aim (achieved in Proposition 3.7) will be to show that this point is and passes through the point (b 0 , w 0 ), where On this wall there is a destabilising sequence , where F 2 is a 2-term complex with dim supp H 0 (F 2 ) ≤ 1 and F 1 is a rank 1 torsion-free sheaf with for some w 0 ≥ w f .By Proposition 2.5 the corresponding wall is ∩ U for the line pictured in Figure 3 with equation Let b 2 < b 1 be the values of b at the intersection points of and the boundary ∂U = w = 1 2 b 2 of the space of weak stability conditions U , We claim that 2 , and thus to Both of these follow from (3.4) for n 0.
To finish the proof, we consider the projected point . Since it lies on the line This proves that the line cannot be above the red uppermost line in Figure 3; i.e.
so the inequalities (3.10) and (3.4) imply For n 0 the second inequality becomes 3) gives a contradiction, showing that no such F exists and M X,H (v n ) is empty.But then I m (X, β) is also empty since there are no sheaves I C ⊗ T with [C] = β when β • H < 0. Thus Theorem 1 holds in this case, so from now on we will assume β • H ≥ 0.
We now borrow some results from [FT21a, Section 8].There we explain why it is profitable to work on the vertical line {b = b } ∩ U , where b := − 1 H 3 ; see Figure 4.In particular, a simple numerical argument (precisely analogous to the argument that rank 1 sheaves can only be slope destabilised by their rank 0 torsion subsheaves) shows that rank 1 objects with ch 1 •H 2 = 0 are ν b ,w -semistable at a point of this vertical line if and only if they are ν b ,w -stable everywhere on the line.
By (3.5), we have b 1 > − 1 2H 3 > b , so Figure 4 shows that our wall of instability for F intersects {b = b } at an interior point of U .Therefore, the ν b,w -semistability of F 1 along the line segment ∩ U and Lemma 3.4 show that F 1 is ν b ,w -semistable for all w > 1 2 (b ) 2 .Let 1 be the line connecting Π(F 1 ) = 0, to the point b , 1 2 (b ) 2 where {b = b } intersects ∂U .By Proposition 2.5 the w ↓ 1 2(H 3 ) 2 limit of Lemma 3.4 shows that F 1 is ν b,w -semistable for any (b, w) So by Conjecture BG n (ii) we can apply the Bogomolov-Gieseker inequality (2.4) to F 1 , so long as we can find a point of 1 ∩ U satisfying ch bH 2 (F 1 ) This gives the lower parabola in blue in Figure 4.It intersects 1 at (b * , w * ), where the point (b * , w * ) is in the interior of U .As in [FT21a, Proposition 8.3], Conjecture BG n (ii) then gives the following.
A similar argument given in [FT21a, Proposition 8.4] gives a similar inequality for F 2 (n).
, so the right-hand side of (3.17) is bounded while on the left-hand side, n appears multiplied by −(β • H + c) ≥ 0. This gives a contradiction for n 0 unless Lemma 3.8.The sheaf H 0 (F 2 ) is supported in dimension 0, and Proof.Proposition 3.2 and the long exact sequence (3.6) show that H −1 (F 2 ) is a torsion-free sheaf of rank 1.Therefore, it is µ H -semistable, and the classical Bogomolov inequality applies, ).Take i = 2 and intersect with H; then Proposition 3.7 gives Take i = 1 and intersect with H 2 ; then Proposition 3.2 kills the first and third terms, so Therefore, by the Hodge index theorem, (3.21) Lemma 3.9.We have ch 3 (F 2 ) with Q a 0-dimensional sheaf and E a ν b ,w -semistable object of A(b ) for w 0. Since rank E = 1, it is a torsion-free sheaf by [BMS16, Lemma 2.7].Moreover, Lemma 3.8 and Proposition 3.7 give Hence ch 3 (E) ≤ 0, which by (3.23) gives ch 3 (F 2 (n)) ≤ 0.

Thus our destabilising sequence in
for some L ∈ Pic 0 (X) and rank 1 torsion-free sheaf

Uniqueness
To finish the proof of Theorem 3.1, we should prove the uniqueness of the sequence (3.25) and the slope stability of F.
By [BMS16, Lemma 2.7(c)] the slope semistable sheaf I is ν b ,w -semistable for w 0. Let be the red line segment in Figure 3 which passes through Π(O X (−n)) and Π(v).By Lemma 3.4 -and the fact noted there that ∩ U intersects {b = b } -it is strictly stable all along ∩ U .In particular, it is ν b 0 ,w 0 -stable.The same is true of L(−n) As we move below the wall to w = w 0 − , they remain stable for 0 < 1 but by an elementary calculation with (2.3).Therefore, (3.25) is the Harder-Narasimhan filtration of F with respect to ν b 0 ,w 0 − .The uniqueness of the Harder-Narasimhan filtration gives the uniqueness of I and L.

Slope stability
It remains to prove that F is not strictly slope semistable in the sense of (3.1).Suppose F F is a proper quotient sheaf with ν H (F ) = ν H (F).
Since rank F = 0 = rank F, the formula (2.3) gives for all (b, w) ∈ U .Since all torsion sheaves are in A(b 0 ), F is a quotient of F in the abelian category A(b 0 ), and any quotient of F in A(b 0 ) is also a quotient of F. Therefore, F is also ν b 0 ,w 0 -semistable.Since I is ν b 0 ,w 0 -stable, the composition in A(b 0 ) must be either zero or injective.And it cannot be zero because this would give a surjection So it is injective.Let C denote its cokernel in A(b 0 ), sitting in a commutative diagram Since F and I are ν b 0 ,w 0 -semistable of the same phase, C is also ν b 0 ,w 0 -semistable.Therefore, the right-hand surjection contradicts the ν b 0 ,w 0 -stability (3.26

Proof of the main theorem
In this section we prove the rest of Theorem 1.Let JS n (v) be the moduli space of pairs (I, s), where I = I C ⊗ T is a torsion-free sheaf of Chern character v = (1, 0, −β, −m) and s : O X (−n) → I is a non-zero section.Since there are no strictly semistable sheaves of rank 1, this is a special case of the projective moduli space constructed in [JS12, Section 12.1].For n 0 it is a projective bundle over I m (X, β) × Pic 0 (X) with fibre P H 0 (I(n)) ; see [GST14, Lemma 3.2] for instance.For any such pair (I, s) the cokernel cok(s) is a sheaf of Chern character v n .Proposition 4.1.Take a pair (I, s) ∈ JS n (v) for n 0. Then cok(s) is slope stable.
Proof.By the same argument as in (3.26),I and O X (−n)[1] are ν b 0 ,w 0 -stable of the same phase, where (nH 3 ) 2 .Hence the exact sequence (4.1) in A(b 0 ) shows that cok(s) is also ν b 0 ,w 0 -semistable.Therefore, it is also slope semistable: any quotient sheaf cok(s) F is torsion, so lies in A(b 0 ) and satisfies As we just proved in Theorem 3.1, this implies that cok(s) is actually slope stable.
Proof of Theorem 1.By Theorem 3.1 and Proposition 4.1 we have now proved that any slope or Gieseker semistable sheaf F of Chern character v n is slope (and so Gieseker) stable, and we have established a bijection Next we make the arrow into a morphism.By [LeP95,Theorem 4.11] the product JS n (v) × X carries a universal Joyce-Song pair.Tensoring with (the pull back of) a Poincaré sheaf on X ×Pic 0 (X) gives a universal complex on JS n (v) × Pic 0 (X) × X.Its cokernel is a flat family of sheaves over JS n (v) × Pic 0 (X) whose closed fibres are slope and Gieseker stable sheaves of Chern character v n .It is therefore classified by a map to the moduli space M X,H (v n ), which gives (4.2).
We are left with finding the inverse morphism.Start with F ∈ M X,H (v n ).By Theorem 3.1 we find a unique L ∈ Pic 0 (X) with non-zero Ext 1 (F, L(−n)) C defining an extension I ∈ I m (X, β) × Pic 0 (X), As noted in the proof of Proposition 4.1, I and L(−n) [1] are ν b 0 ,w 0 -stable of the same phase, so Ext 1 (I, L(−n)) = 0. Therefore, applying Ext( • , L(−n)) to (4.3) gives (4.4) We would like to do this in families, as the pairs is the non-zero Ext group of lowest degree by (4.4), so basechange issues mean it does not show up in the relative Exts of the family version.Instead, we use its Serre dual To set up its family version (4.6) below, we let F be a universal twisted sheaf (4) over X × M X,H (v n ) and let L be a Poincaré sheaf on X × Pic 0 (X).Suppressing some obvious pull back maps for clarity and pushing forward along the map (4.5) we consider the twisted sheaf By Serre duality applied to (4.4), there are no higher-degree push down cohomology sheaves, so basechange applies to show that on restriction to any closed point (4) Working with twisted sheaves is no harder than working with ordinary sheaves; the formalism is set up in [Cal00], for instance.
Eventually we will be able to remove the twisting to make F a coherent sheaf.
Therefore, G is a (twisted) line bundle on its support S G , where is a set-theoretic section of p, i.e. a single point in each Pic 0 (X) fibre over M X,H (v n ).We want to upgrade this statement to one about schemes instead of sets.
Lemma 4.2.The support S G of G is a section of p, so is scheme-theoretically isomorphic to M X,H (v n ).
Proof.We first prove S G → M X,H (v n ) is an embedding by showing that the fibre over any closed point Here L is the unique line bundle such that Ext 1 (F, L(−n)) is non-zero.Let e be a generator of Ext 1 (F, L(−n)), defining the extension (4.3).Applying Ext * ( • , L(−n)) to (4.3) gives an isomorphism because Ext ≤2 (I, L(−n)) = 0 for I ∈ I m (X, β)×Pic 0 (X) and n 0. This map takes any first-order deformation of L in Pic 0 (X) to the obstruction (in the right-hand group) to deforming e ∈ Ext 1 X (F, L(−n)) with it.Thus e is totally obstructed -it does not deform to first order with L. That is, the Zariski tangent space to the fibre of S G over {F} -the kernel of (4.7) -is trivial.This shows that and assume inductively that we have proved S k := S G × M X,H (v n ) M k → M k is an epimorphism (and so an isomorphism).We want to show the same is true for k + 1.
Let F k , L k be the restrictions of the universal sheaves to X × M k × Pic 0 (X).By our inductive assumption and basechange, we know that G| S k is a line bundle on S k .By relative Serre duality down π k -the basechange of π (4.5) to S k -its dual is the line bundle Since Pic 0 (X) is smooth, the classifying map M k → Pic 0 (X) of L k can be extended to M k+1 → Pic 0 (X), thus defining a preliminary L k+1 over X × M k+1 .We already have F k+1 := F | X×M k+1 .The obstruction to extending the extension class e k to any Here the isomorphism follows from applying Ext * • , L k (−n) ⊗ (m k /m k+1 ) to (4.8); cf.(4.7).Now the space of choices of L k+1 extending L k (i.e.maps M k+1 → Pic 0 (X) extending the given map from M k ) is a torsor over the right-hand group of (4.9).Therefore, the class of (− ob) in this group defines a new L k+1 for which the obstruction to the existence of e k+1 now vanishes.This e k+1 then trivialises showing it is a line bundle and that we have defined an extension is an epimorphism after basechange to M k+1 , as required.
By basechange G = ι * T , where T is the twisted line bundle Denote the composition of ι with the projection to Pic 0 (X) by f : M X,H (v n ) → Pic 0 (X), and let π : So replacing F by F ⊗ (π ) * T * gives a new universal sheaf (the twistings cancel) such that, by relative Serre duality down π , The section 1 ∈ Γ (O) defines an extension . By construction, its product with f is the inverse of (4.2).

Relationship to the work of Toda
This paper, its predecessor [FT21a] and its sequel [Fey22] use methods pioneered by Yukinobu Toda.In [Tod12] he also studied 2-dimensional sheaves on threefolds X satisfying the Bogomolov-Gieseker inequality, under the additional assumption that X is Calabi-Yau with Pic X = Z.Like us, he starts in the large volume region and then moves down a vertical line in the space of weak stability conditions to find walls of instability by applying the Bogomolov-Gieseker inequality to weakly semistable objects.In this way, he gave a mathematical formulation and proof of Denef-Moore's version [DM11] of the famous OSV conjecture [OSV04].
In our work we move down the same vertical line {b = b 0 } but diverge from Toda's method in two main ways: • Toda uses Pic(X) = Z and the Bogomolov-Gieseker inequality at the point (b 0 , w 0 ) of ∩ U to constrain the Chern characters of the destabilising objects F 1 , F 2 .Instead, we employed a wallcrossing argument to analyse F 1 , F 2 along ∩ U , using the fact that they stay in A(b) to constrain ch(F i ) (Proposition 3.2).Further, we then moved down {b = b }, showing F 1 remains semistable to apply the Bogomolov-Gieseker inequality to it at (b * , w * ) as in (3.12).This gave a stronger bound for ch 3 (F 1 ).A similar argument (replacing b = − 1 H 3 by −n + 1 H 3 as in [FT21a, Section 8]) did the same for ch 3 (F 2 (n)) (Propositions 3.5 and 3.6).Together, these completely specified ch 2 (F 1 ) • In turn this allows us to show that all semistable sheaves of class v n are destabilised by Joyce-Song pairs on the first wall.Since Toda does not take n 0 as large as we do, he also has to analyse many subsequent walls.
As a result, our wall-crossing formula (1.5) of Theorem 2 is much simpler than Toda's.If we specialise his result to our situation by fixing his parameters ξ = 2, µ = 12 H 3 and taking n 0 (while noting that his Conjecture 1.4 has now been proved, see [BBB + 15]), his wall-crossing formula becomes the following.
Theorem 5.1 (cf.[Tod12, Theorem 3.18]).Let X be a smooth projective Calabi-Yau threefold such that Pic(X) = Z • H and Conjecture 2.3 holds.Fix n 0, and let Then Ω v n (X) is given by (5.2) Here P m,β (X) is the stable pairs invariant, see [PT09], the degree of the virtual cycle on the moduli space P m (X, β) of stable pairs (F, s) with χ(F) = m and [F] = β.
Toda pointed out to us how (5.2) can be made compatible with our simplification (1.5).By another application of the Bogomolov-Gieseker-type inequality one can prove Castelnuovo-type bounds to show that P k (X, β 1 ) and I k (X, β 2 ) are empty for k sufficiently small.Since the bounds β i • H ≤ 6β • H in the definition (5.1) of the cone C are independent of n, we can therefore choose a uniform n 0 so that each term in the sum (5.2) has at least one of P −m 1 (X, This would give another (ultimately lengthier) proof of Theorem 2 when X is a Calabi-Yau threefold with Pic = Z.
In [Fey22] the first author extends our methods and Toda's to prove an OSV-like result for general Calabi-Yau threefolds, without the Pic(X) = Z condition.

Modularity
On Calabi-Yau threefolds, the invariants Ω v n (X) are expected to have modular properties.There are two points of view on this: one physical ("S-duality") and one mathematical (Noether-Lefschetz theory).We describe these now on a Calabi-Yau threefold X with H 1 (O X ) = 0 and H 2 (X, Z) tors = 0 for simplicity.

S-duality
Physicists have long conjectured that counts of D4-D2-D0 branes should have modular properties; see [MSW97, GSY07, dBCD + 06, DM11].In [GSY07] the proposal was to use Gieseker stable sheaves, i.e. the invariants Ω(v n ) := Ω v n (X).Some suggestive examples on the quintic threefold were calculated and shown to be compatible with the conjecture in [GY07].Over time the conjecture has evolved somewhat; see [AMP20] for the state of the art (and extension to refined counting invariants).It is now expected that one should replace Gieseker stability by stability at the "large volume attractor point" for the charge v n .Here the central charge of E can be found by pairing with minus the exponential of minus the complexified Kähler form of [AMP20, Equation 2.6], giving to leading order in their parameter λ → ∞.After scaling and adding a constant, this corresponds to the slope function As n → ∞ with E fixed, this tends to ν H (E), defined in (3.1), and by Theorem 1 M X,H (v n ) is precisely the moduli space of ν H -stable sheaves.Furthermore, there are no strictly ν H -semistable sheaves, so we can perturb ν H a little without changing this result.However, the sheaves whose stability we test also depend on n, so this argument is suggestive but not a proof that sheaves in M X,H (v n ) might be "attractor stable" (and describe all attractor semistable sheaves of class v n ) for large n.So we might expect the invariants Ω(v n ) to be the "MSW invariants" of [MSW97,AMP20].(We return to this point in Remark 6.1.)Although Gieseker stability is not always preserved by tensoring by a line bundle, slope stability is.Therefore, by Theorem 1, for n 0 we have (6.1) where e v n is the cup product of e ∈ H * (X, Q) with v n .Note that e v n has the same Therefore, the invariance (6.1) shows the data of all invariants Ω(v n ), over all β and m (for fixed n 0), (5) is in fact captured in the smaller set of invariants Ω(0, nH, ch 2 , ch 3 ) for (6.2) The group Γ is finite by the hard Lefschetz isomorphism ∪ nH : We let β/nH denote the inverse image of β under this map.Therefore, all the enumerative information can be encoded in the vector of generating series where m is the following normalisation of ch 3 : (6.4) which is easily checked to be invariant under v n → e v n .The series (6.3) are the product of Laurent series in q with a prefactor q c , c ∈ Q. Setting q = e 2πiτ , we think of them as meromorphic functions of τ in the upper half plane.In [GSY07], (6.3) was conjectured to be a vector-valued modular form of weight −b 2 (X) − 1 2 .This is now expected to be true only for irreducible ch 1 , which is far from our case of ch 1 = nH.
For more general ch 1 , the current expectation is that (6.3) should be a vector-valued mock modular form of depth k − 1, where k is the maximum over all non-trivial decompositions (6.5) That is, it should admit a non-holomorphic modular completion β∈Γ h nH,β (q) made from k − 1 iterated Eichler integrals involving the functions h [D 1 ],β 1 (q), . . ., h [D k ],β k (q).Explicit formulae for the h in terms of h are given in [AMP20, Equation 2.11] and inverted to express h in terms of h in [AMP20, Equation 2.15].Under the modular group, the h should transform as in [AMP20, Equation 2.10] with weight and It is further predicted that, apart from their poles of order 1 24 ((nH) 3 + c 2 (X) • nH) at q = 0, the functions h and h are bounded.Since they are vectors of length dim Γ = nH 3 and have modular weight −b 2 (X)/2 − 1, the dimension of the relevant space of (mock) modular forms can be analysed; see [Man08].In our case its dimension works out as O(n 4 ), so the first O(n 4 ) Fourier coefficients Ω(v n ) should determine the rest.
The hope would be to use this as a method for determining the MNOP invariants I m,β (X) for m > O(n 4 ) in terms of those with smaller m.This does not currently work in general because once m becomes large, we have to increase n in Theorem 2 to get the relationship between Ω(v n ) and I m,β (X).We would need the bound n 0 required in Theorem 2 to be improved to n > O(m 1/4 ) or better.But very recent work (5) Since we choose n 0 only after fixing m, we may need to truncate our generating series, considering bounded m ≤ M(n) for a given n.We return to this issue in Remark 6.1.
[AFK + 23] manages to improve the bounds for small m, n in specific examples and thus use modularity to calculate new Gromov-Witten invariants.

Noether-Lefschetz theory
Here we flesh out a suggestion of Davesh Maulik to explain, or perhaps one day prove, the modularity properties of the generating series of invariants Ω(v n ) directly.We thank Luis Garcia for his insight and generous expert assistance with this section.
Again let X be a Calabi-Yau threefold with H 1 (O X ) = 0, and again we work with bounded m and then large n 0. We return to this point in Remark 6.1.By Theorem 1 all sheaves in M X,H (v n ) are of rank 1 on their scheme-theoretic support, and that support is a divisor D ∈ |O(n)|.The generic ι : D → X is smooth and supports precisely the stable sheaves where the intersections are taken on D. (Of course, h 2 and h • can be expressed on X as nH 3 and H • β, respectively, but 2 cannot be determined by its image β = ι * in X).
We briefly review some Noether-Lefschetz theory.We suppose H 2 (X, Z) = Z • H for simplicity.Set Λ := h ⊥ ⊂ H 2 (D, Z) to be the primitive cohomology.The Lefschetz theorems give H 4 (X, Z) H 2 (D, Z)/Λ, which surjects onto Λ * /Λ by the unimodular intersection pairing on D. The kernel is h , so we can describe the finite group Γ from (6.2) as where N = nH 3 .Then, up to the action of Aut H 2 (D, Z), h , the data of the 2-dimensional sublattice , h ⊂ H 2 (D, Z) is equivalent to the data of its discriminant disc and its coset -the image of in the quotient of the group Λ * /Λ from (6.8) by ±1.
we could imagine defining their intersection by pulling back the Thom forms of the Hodge loci constructed in [Gar18] and integrating over |O(n)| • .Below we will come back to the obvious problems of non-compactness of the Hodge loci in showing such integrals converge; for now we ignore them and just work with smooth D in the interior of the period domain.
The constraints of Griffiths transversality mean we can probably never expect the intersection of Φ n |O(n)| • and NL d,γ to be of the correct dimension 0. However, in order to formulate a conjecture, one can imagine (6) Here X Λ is the quotient of the period domain by Aut(H 2 (D, Z), h) = ker(Aut Λ → Aut(Λ * /Λ)). (7)These are called Hodge loci in the paper [Gar18], which extends results of Borcherds and Kudla-Millson from hermitian symmetric spaces to the period domains of interest to us.perturbing the complex structure on X to a non-integrable almost complex structure (compatible with the symplectic structure dual to H) to ensure the intersection is 0-dimensional.Since the virtual-dimension-0 deformation theory of ι * L, or of the pair (D, L), can be matched with the deformation theory of the intersection (see [KT14, Section 2.1], for instance), we would, as usual, expect to be able to avoid such non-algebraic deformations by working in situ with the virtual cycle, yielding the same intersection numbers via excess intersection.
So we imagine Φ * n [NL d,γ ] reduced isolated intersection points (D, L) with an extra Hodge class = c 1 (L) of discriminant disc , h = d and coset γ.Each such point would generate a component of a moduli space M X,H (v n ) given by (6.9) Hilb k D {L ⊗ I Z : |Z| = k} parameterising the sheaves (6.6).Here we take the charge m in v n , see (1.3), to be by calculating ch 3 = 1 6 n 3 H 3 − m of (6.6).Taking the Euler characteristic of (6.9), weighting by q m , with m as in (6.4), and summing gives, by the Göttsche formula, the generating series (6.10) (As in the last section, we should really truncate this sum over m ≤ M(n) if we want to use Theorem 1 to identify M X,H (v n ) with unions of Hilbert schemes (6.9), but see Remark 6.1.)Summing (6.10) over the divisors D, by summing over all discriminants and cosets in (6.8), the vector of generating series (6.3) becomes (6.11) q c η(q) −e(D) So we conclude that (6.11) is modular of total weight − 3 2 if we can make finite sense of Φ * n NL d,γ .This will involve further work studying degenerations of Hodge structure at the boundary of the space of Hodge structures.It is natural to expect non-holomorphic corrections, turning modular forms into mock modular forms.One point of view is that the Thom forms of the Hodge loci are not precisely holomorphictaking ∂ gives exact forms da on the moduli space of Hodge structures, see [Gar18,Equation 4.39], which are therefore exact on pull back to |O(n)| • but may not be on the boundary of |O(n)| (where d(Φ * n a) may have poles with non-zero residues).In a special case (Sym 2 of the Hodge structures of elliptic curves), the boundary and convergence analysis was carried out successfully in [Fun02] and indeed found to give mock modular forms.
In particular, taking account of reducible and non-reduced D at the boundary of |O(n)| will necessarily add cross-terms involving all non-trivial decompositions This is the same data used in (6.5) to generate the non-holomorphic mock modular completions h of the generating series h from (6.3).So it seems reasonable to expect the Noether-Lefschetz story to be compatible with, or one day even prove, S-duality.Gholampour and Sheshmani have been exploring example calculations along related lines in recent years; see for instance [GST14,GS18].Remark 6.1.In our modularity discussions of the last two sections, two issues have arisen which we consider to be related.In Section 6.1 it was not clear we had the right stability condition for our invariants Ω(v n ) to be the MSW invariants.In both Sections 6.1 and 6.2 there was the issue that our description of M X,H (v n ) in Theorem 1 was only valid for bounded m ≤ M(n).
Given the discussion in this section, it seems natural to suggest the solution to both problems should be the following.We should take moduli spaces of sheaves ι * (L ⊗ I Z ) (6.6) for any m and n, and their invariants should have mock modular generating series.In other words, we expect that the physicists' attractor stable objects should be precisely the sheaves (6.6) with rank 1 on their support, independently of m, n. (When D is non-reduced or irreducible, we should also use a stability condition on the line bundle L, probably ν H -slope stability.)Their virtual counts would then be the MSW invariants.
For small m ≤ M(n) Theorem 1 gives precisely the sheaves ι * (L ⊗ I Z ) (6.6) with L * effective. (9)For m ∈ (M 1 (n), M 2 (n)], we find M X,H (v n ) parameterises sheaves of the same form ι * (L ⊗ I Z ), see (6.6), but with L = O D (C 1 − C 2 ) possibly non-effective; this is proved in [Tod12] when Pic X = Z and [Fey22] in general.For m > M 2 (n) we expect to have to change the stability condition to get a moduli space consisting of only the sheaves (6.6) and to get the MSW invariants.

Figure 1 .
Figure 1.(b, w)-plane and the projection Π(E) when ch 0 (E) > 0 So now take a slope semistable sheaf F of Chern character v n .It is in the heart A(b) for any b ∈ R and ν b,w -semistable for w 0. By Proposition 2.5 the walls of instability for F are all line segments of slope b 0 := − n 2 − β•H nH 3 ; see Figure 3.The lowest such wall is tangent to ∂U at b 0 , 1 2 b 2 0 .So it makes sense to move down the vertical line b = b 0 which intersects all the walls of instability for F. Since ch 0 (F) = 0 and ch b

(
nH 3 ) 2 where {b = b 0 } intersects the upper (red) line in Figure 3.This is where F can be destabilised by O(−n)[1] in (a rotation of ) a triangle O(−n) → I → F made by a Joyce-Song pair for some sheaf I of Chern character v.The next proposition gets us part of the way to this goal.Proposition 3.2.The wall that bounds the large volume limit chamber w 0 for F has slope b 0 = − n 2 − β•H nH 3