# Refinement and modularity of immortal dyons

Sergey Alexandrov, Suresh Nampuri

► To cite this version:

Sergey Alexandrov, Suresh Nampuri. Refinement and modularity of immortal dyons. Journal of High Energy Physics, 2021, 2021, pp.147. 10.1007/JHEP01(2021)147. hal-02930775

HAL Id: hal-02930775

https://hal.science/hal-02930775

Submitted on 7 Jun 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
RECEIVED: October 14, 2020

ACCEPTED: December 14, 2020

PUBLISHED: January 25, 2021

Refinement and modularity of immortal dyons

Sergei Alexandrovª and Suresh Nampuriᵇ

ªLaboratoire Charles Coulomb (L2C), Université de Montpellier,
CNRS, F-34095, Montpellier, France

ᵇCAMGSD-IST,
Av. Rovisco Pais 1, 1049-001 Lisboa, Portugal

E-mail: sergey.alexandrov@umontpellier.fr, nampuri@gmail.com

**ABSTRACT:** Extending recent results in $\mathcal{N} = 2$ string compactifications, we propose that the holomorphic anomaly equation satisfied by the modular completions of the generating functions of *refined* BPS indices has a universal structure independent of the number $\mathcal{N}$ of supersymmetries. We show that this equation allows to recover all known results about modularity (under SL(2, $\mathbb{Z}$) duality group) of BPS states in $\mathcal{N} = 4$ string theory. In particular, we reproduce the holomorphic anomaly characterizing the mock modular behavior of quarter-BPS dyons and generalize it to the case of non-trivial torsion invariant.

**KEYWORDS:** Black Holes in String Theory, Extended Supersymmetry, String Duality, Superstrings and Heterotic Strings

ARXIV ePRINT: 2009.01172
# Contents

1 Introduction 1

2 BPS states in $\mathcal{N} = 4$ string compactifications 4

2.1 Charges and generating functions 4

2.2 Mock modularity of immortal dyons 7

3 Refined BPS index and modularity 8

3.1 D4-D2-D0 black holes in $\mathcal{N} = 2$ setup 8

3.2 Helicity supertraces and refined index 12

3.3 Proposal 14

3.4 The unrefined limit 16

4 Modularity of immortal dyons from refinement 18

4.1 Half-BPS states 18

4.2 Quarter-BPS states: holomorphic anomaly 20

5 Discussion 24

A Dualities and charges 25

B Modular transformations 27

C Attractor equations and electric charges 28

## 1 Introduction

The spectra of BPS states in theories with extended supersymmetry contain vital information about their non-perturbative structures and strong coupling regimes. These in turn provide valuable insights into the mathematical structures that encode the organization of the fundamental degrees of freedom in these theories. Hence, determining these spectra constitutes an active avenue of research initiating a rich interplay between theoretical and mathematical physics. The BPS spectrum in any such theory is strongly constrained by symmetry requirements. Specifically, in superstring theory compactifications the BPS spectrum is expected to be invariant under the U-duality group acting on charges carried by the BPS states. The duality group also manifests itself in the same context, when it acts on generating functions of BPS indices restricting them to be modular or mock modular forms.

The mock modular behavior [1, 2] of the generating functions under SL(2, $\mathbb{Z}$) duality group has, in fact, been found to be a very generic phenomenon. It features prominently
in the counting functions of black hole degeneracies in string compactifications with $\mathcal{N} = 2$ and $\mathcal{N} = 4$ supersymmetry [3–5], Vafa-Witten theory [6, 7], Donaldson-Witten theory [8, 9], moonshine phenomenon [10] and numerous other setups. Mock modularity implies that the holomorphic generating functions are not quite modular forms. They have a very specific modular anomaly which can be cancelled by the addition of a suitably chosen non-holomorphic term. The resulting functions, called modular completions, do transform as modular forms, but by construction fail to be holomorphic and satisfy certain holomorphic anomaly equations. These modular completions and the associated anomaly equations are of paramount significance both from a physical and mathematical standpoint. On the one hand, they are building blocks of physical quantities such as partition functions while on the other hand, they facilitate access to the precise modular transformation properties of BPS indices which can notably be used to determine these indices exactly.

Recently, in [5] a quite general result about these modular completions has been obtained in the context of D4-D2-D0 black holes in type IIA string theory compactified on a generic Calabi-Yau (CY) threefold $\mathfrak{Z}$). This result took the form of a formula for expressing the modular completions $\hat{h}_{p,\mu}(\tau, \bar{\tau})$ of the generating functions<fnref n="1" /> $h_{p,\mu}(\tau)$ of BPS indices for these black holes, evaluated at the large volume attractor point (see section 3.1 for precise definitions), in terms of the generating functions $h_{p,\mu}(\tau)$ themselves. This formula in particular implies that as soon as the divisor $\mathcal{D} \subset \mathfrak{Z}$ wrapped by D4-brane is reducible, i.e. it can be decomposed into a sum with positive coefficients of other divisors, the corresponding generating function is a vector valued (higher depth) mock modular form. This result was subsequently generalized in [11] to include a refinement parameter $y = e^{2\pi i z}$ conjugate to the angular momentum. Although in the case of compact CY threefolds the refined BPS indices $\Omega(\gamma, y)$, where $\gamma$ is an electromagnetic charge, are not protected by supersymmetry, they can still be defined [12–14] and their generating functions possess very similar modular properties provided the parameter $z$ transforms as an elliptic parameter. As a result, the generating functions $h_{p,\mu}^{\text{ref}}(\tau, z)$ of refined BPS indices were shown to behave as *mock Jacobi forms* [3].

Although the formula for the modular completion has been found in the case of a *generic compact* CY, i.e. a threefold with SU(3) holonomy and not its proper subgroup, and for an *ample* divisor, it turned out that it has a wider range of applicability. In particular, it can be extended to non-compact CYs given by the canonical bundle over a projective surface $S$. In this case it provides the modular completion of generating functions of (refined) Vafa-Witten invariants of the surface $S$ with gauge group $U(N)$ [11]. In [15, 16] this result has been used to actually find these generating functions as well as their completions explicitly, for *any* rank $N$ and $S = \mathbb{P}^2$, Hirzebruch or del Pezzo.

In this paper we study another extension of that construction. While it was originally formulated in the context of 4d $\mathcal{N} = 2$ supergravity, it is natural to ask whether it also captures the modular properties of BPS indices in theories with larger amount of supersymmetry, which are obtained by compactifying type II string theory either on $\mathfrak{Z} = K3 \times \mathbb{T}^2$

<footnote n="1">¹The indices of $h_{p,\mu}$ label the divisor wrapped by D4-brane $\mathcal{D} = p^a\gamma_a \in \Lambda \equiv H_4(\mathfrak{Z}, \mathbb{Z})$ and the residue flux $\mu \in \Lambda^*/\Lambda$.</footnote>
or on $T^6$. This amounts to dropping the condition that the holonomy group of $\mathfrak{g}$ is exactly SU(3). Here we mostly restrict our analysis to the case $\mathfrak{g} = K3 \times T^2$ corresponding to $\mathcal{N} = 4$ supersymmetry in four dimensions, and reserve the case $\mathfrak{g} = T^6$ for future work.

$\mathcal{N} = 4$ superstring compactifications have been extensively studied in the literature and there is, at present, a substantial body of knowledge about their BPS indices and the duality transformation properties of their generating functions. As we review below in section 2, there are two types of BPS states for both of which the counting functions are known exactly. For $\frac{1}{2}$-BPS states the generating function is a weakly holomorphic SL(2, $\mathbb{Z}$) modular form of weight $-12$, whereas the degeneracies of $\frac{1}{4}$-BPS states are given by Fourier coefficients of $Z(\tau, z, \sigma)$, the inverse of an Igusa cusp Seigel modular form of weight 10, which transforms under the larger group $\text{Sp}(2, \mathbb{Z})$ [17]. Expanding this function only in $\sigma$, one finds that the coefficients $\psi_m(\tau, z)$ are Jacobi forms of weight $-10$ and index $m$ with respect to the usual modular group SL(2, $\mathbb{Z}$). Although everything appears to be modular at this stage, the remarkable work [3] revealed a hidden mock modularity. It turns out that each meromorphic function $\psi_m$ has a canonical decomposition into two parts, $\psi_m^P$ and $\psi_m^F$. While the former only counts bound states, the single centred black holes, known as immortal dyons, are encoded in the latter. Both $\psi_m^P$ and $\psi_m^F$ are mock Jacobi forms and the work [3] provides the holomorphic anomaly equations satisfied by their completions, $\hat{\psi}_m^P$ and $\hat{\psi}_m^F$.

As will be shown below, all the results concerning the modular properties of BPS dyons under SL(2, $\mathbb{Z}$) can be derived from a simple extension of the holomorphic anomaly equation satisfied by the modular completions $\hat{h}_{p,\mu}^{\text{ref}}$ of the generating functions of refined BPS indices. This extension allows to drop restrictions on $\mathfrak{g}$ and the divisor $\mathcal{D}$. The derivation is based on two observations. First, we note that the BPS indices counting black hole degeneracies are given by helicity supertraces $B_{2K}$ [18] with the center of mass contribution factored out. Which helicity supertrace is relevant depends on the number of broken supersymmetries, but all of them can be obtained from the refined BPS index $\Omega(\gamma, y)$ by taking appropriate number of derivatives with respect to $y$, needed to kill fermionic zero modes, and then setting it to $y = 1$. In particular, in this way we arrive at generating functions which transform as (mock) modular forms of weight

$$w = 2K - 3 - \frac{1}{2} \text{rk}, \qquad (1.1)$$

where $2K$ is the label of the relevant helicity supertrace and rk is the rank of the electric charge lattice $\Lambda_p$ assigned to the magnetic charge $p$. Secondly, it is well known that in the chamber of the moduli space containing the large volume attractor point, the indices counting BPS black holes with non-vanishing area in $\mathcal{N} = 4$ theory receive no contribution from bound states. Combining these two observations, we get a direct way to relate the generating functions $h_{p,\mu}^{\text{ref}}$ to the functions $\psi_m^F$ or their $\frac{1}{2}$-BPS counterpart.

As a result, we show that the proposed holomorphic anomaly equation and the formula for weight (1.1) enable us to reproduce the generating function of $\frac{1}{2}$-BPS states. For $\frac{1}{4}$-BPS states we recover the correct modular weight as well and demonstrate that the holomorphic anomaly equation satisfied by the functions $\hat{\psi}_m^F$ counting immortal dyons follows from the
one satisfied by the completions $\hat{h}_{p,\mu}^{\text{ref}}$. Furthermore, whereas the holomorphic anomaly equation for $\hat{\psi}_m^F$ derived in [3] holds only for charge vectors with the trivial torsion invariant $I(\gamma) = 1$ (see (2.7)), we generalize it to arbitrary values of $I(\gamma)$. To the best of our knowledge, this result, provided in eq. (4.26), did not appear in the literature before.

The organization of the paper is as follows. In the next section we recall relevant aspects of string compactifications with $\mathcal{N} = 4$ supersymmetry. In particular, we introduce the generating functions counting immortal dyons and the holomorphic anomaly equation satisfied by their completions. In section 3 we review the construction of the completion of the generating functions of refined BPS indices in $\mathcal{N} = 2$ string compactifications, extend it to cases with more supersymmetries, and derive consequences of this extension in the unrefined limit. Subsequently, in section 4 we apply these results in the $\mathcal{N} = 4$ case where we reproduce the counting function of $\frac{1}{2}$-BPS dyons, derive the holomorphic anomaly equation for $\frac{1}{4}$-BPS dyons, demonstrate its consistency with [3] and provide a generalization for $I(\gamma) > 1$. We conclude with a discussion in section 5. The few appendices herein contain useful details on the chain of dualities between different formulations with $\mathcal{N} = 4$ supersymmetry, modular transformations of generating functions, as well as restrictions on charges implied by the attractor mechanism.

# 2 BPS states in $\mathcal{N} = 4$ string compactifications

## 2.1 Charges and generating functions

Type IIA string theory compactified on $K3 \times T^2$ reduces in four dimensions to $\mathcal{N} = 4$ supergravity coupled to 22 vector multiplets. The number 22 is the dimension of the second homology lattice of $K3$, which has signature (3,19) and is composed by two lattices of $E_8$ and three two-dimensional even lattices of signature (1,1), which will be denoted by $U_{1,1}$:

$$ H_2(K3, \mathbb{Z}) = \Lambda_{3,19} = U_{1,1}^{\oplus 3} \oplus (-E_8) \oplus (-E_8). \qquad (2.1) $$

The corresponding vector fields $A^i$, $i = 1, \dots, 22$, arise from the ten-dimensional 3-form gauge field after its reduction on the 2-cycles of $K3$. In addition, there are also 6 vector fields $(A^0, A^\flat, A^x)$, $x = 23, \dots, 26$, in the supergravity multiplet related to the geometry of the torus: they originate from the ten-dimensional 1-form, the 3-form reduced on $T^2$, the B-field reduced along the two circles of $T^2$ and the two KK gauge fields on $T^2$, respectively. Thus, in total there are 28 gauge fields $A^I$, $I \in \{0, \flat, 1, \dots, 26\}$, so that the electro-magnetic charge vector $\gamma = (p^I, q_I)$ has 56 components.

In fact, many features of the compactified theory, including its symmetries, are better seen in the dual heterotic formulation which is obtained by compactifying heterotic super-string on $T^6$ [19]. The 28 gauge fields now arise from the Cartan subalgebra of the rank 16 ten-dimensional gauge group, the reduction of the B-field and the KK gauge fields on $T^6$. They transform as a vector under T-duality group $SO(6, 22)$, whereas the full U-duality group includes also $SL(2, \mathbb{Z})$ S-duality which acts on the heterotic axio-dilaton

$$ G_4(\mathbb{Z}) = \text{SL}(2, \mathbb{Z}) \times \text{O}(6, 22; \mathbb{Z}). \qquad (2.2) $$
Note that in the type II formulation, the SL(2, $\mathbb{Z}$) factor is just the modular group of the torus $T^2$.

In this heterotic frame, the electro-magnetic charge belongs to the representation (2, 28) of the U-duality group and hence can be represented as a doublet of two vectors under the orthogonal group

$$ \gamma = \begin{pmatrix} Q_I \\ P_I \end{pmatrix} \in \Lambda_{em} = \Lambda_e \oplus \Lambda_m, \qquad (2.3) $$

where

$$ \Lambda_e = \Lambda_{6,22} = U_{1,1}^{\oplus 6} \oplus (-E_8) \oplus (-E_8) \qquad (2.4) $$

and $\Lambda_m = \Lambda_e^* = \Lambda_e$ because $\Lambda_e$ is unimodular. The bilinear form on $\Lambda_e$ is given by an O(6, 22) invariant matrix

$$ \eta_{IJ} = \begin{pmatrix} I_{1,1}^{\oplus 6} & 0 \\ 0 & -C_{16} \end{pmatrix}, \qquad I_{1,1} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad (2.5) $$

where $C_{16}$ is the Cartan matrix of $E_8 \times E_8$. Using this bilinear form, one can define three T-duality invariants and one their U-duality invariant combination

$$ \begin{align} n &= \frac{1}{2} Q^2 = \frac{1}{2} Q_I \eta^{IJ} Q_J, \notag \\ m &= \frac{1}{2} P^2 = \frac{1}{2} P_I \eta^{IJ} P_J, \qquad \Delta = 4mn - \ell^2. \tag{2.6} \\ \ell &= Q \cdot P = Q_I \eta^{IJ} P_J, \notag \end{align} $$

Besides, there is also another U-duality invariant, the torsion, which is defined as follows [20]

$$ I(\gamma) = \gcd\{Q_I P_J - Q_J P_I\}. \qquad (2.7) $$

Taken together, these invariants are sufficient to characterize uniquely the duality orbit of the charge vector [21, 22].

The heterotic frame is particularly convenient to classify BPS states. There are two classes of them: $\frac{1}{2}$-BPS and $\frac{1}{4}$-BPS. The former are characterized by the charges (2.3) which have parallel electric and magnetic charge vectors, $Q \parallel P$. This implies that there is a duality frame where one of them, e.g. $P$, can be set to zero. Thus, the $\frac{1}{2}$-BPS index, which is invariant under the full U-duality group, depends only on one T-duality invariant $n$ and, moreover, it is known to be independent of the moduli. Thus, the $\frac{1}{2}$-BPS spectrum can be encoded into a generating function of one variable

$$ Z^{(4|2)}(\tau) = \sum_{n=-1}^{\infty} \Omega^{(4|2)}(n) q^n, \qquad (2.8) $$

where $q = e^{2\pi i \tau}$ and we accepted the convention, which will be extensively used below, that the upper index of type $(\mathcal{N}|r)$ refers to $\frac{1}{r}$-BPS states in a theory with $\mathcal{N}$ extended
supersymmetry. The generating function (2.8) has been found explicitly [23] and is given by a modular form of weight −12,

$$Z^{(4|2)}(\tau) = q^{-1} \prod_{n=1}^{\infty} (1 - q^n)^{-24} = \eta(\tau)^{-24}, \qquad (2.9)$$

where $\eta(\tau)$ is the Dedekind eta function. The coefficients in (2.8) can be computed in terms of the partition function

$$\Omega^{(4|2)}(n) = p_{24}(n+1), \qquad (2.10)$$

where $p_{24}(N)$ is the number of partitions of a positive integer $N$ into 24 colored integers.

The spectrum of $\frac{1}{4}$-BPS states, which have $Q$ and $P$ non-parallel, is much more complicated. First of all, their degeneracies depend on all duality invariants introduced above so that we can write$^2 \Omega^{(4|4)}(\gamma) = \Omega_I^{(4|4)}(n, m, \ell)$. Thus, they can be combined into a generating function of three variables labelled by the torsion invariant$^3$

$$Z_I^{(4|4)}(\tau, z, \sigma) = \sum_{n,m,\ell} (-1)^\ell \Omega_I^{(4|4)}(n, m, \ell) q^n y^\ell p^m, \qquad (2.11)$$

where $y = e^{2\pi i z}$, $p = e^{2\pi i \sigma}$ and $q$ is as in (2.8). The famous result of [17] expresses this function for $I = 1$ in terms of the so-called Igusa cusp form

$$Z_1^{(4|4)}(\tau, z, \sigma) = \frac{1}{\Phi_{10}(\tau, z, \sigma)}, \qquad (2.12)$$

which is a modular form with respect to $Sp(2, \mathbb{Z})$ acting on the Seigel upper half-plane parametrized by $\tau$, $z$ and $\sigma$. We will not use this fact in this paper since our analysis is restricted to the modularity with respect to the usual S-duality group $SL(2, \mathbb{Z})$. The degeneracies of $\frac{1}{4}$-BPS states with $I > 1$ have been found in [26] and can be expressed through those with $I = 1$ determined by (2.12),

$$\Omega_I^{(4|4)}(n, m, \ell) = \sum_{d|I} d \Omega_1^{(4|4)} \left(n, \frac{m}{d^2}, \frac{\ell}{d}\right). \qquad (2.13)$$

Another complication compared to the $\frac{1}{2}$-BPS case is that the indices $\Omega_I^{(4|4)}$ are actually moduli dependent. The physical reason for this is that a $\frac{1}{4}$-BPS state can be a bound state of two $\frac{1}{2}$-BPS ones [27]. Such bound states do not exist throughout all the moduli space and decay after crossing the lines of their marginal stability [28]. Mathematically, this dependence is manifested by the existence of second order poles in the generating function (2.12). As a result, its Fourier coefficients are not defined uniquely, but depend on the integration contour in the Seigel upper half-plane which in turn is determined by the moduli [29].

<footnote>$^2$The index $I$ here denotes the value of the discrete torsion invariant and should not be confused with the index labelling charges.</footnote>

<footnote>$^3$We introduced the sign $(-1)^\ell$ consistently with [24] where it was argued on the basis of a connection between 5d and 4d black holes [25]. We will see below that it is also crucial for the relation with the generating functions of refined BPS indices.</footnote>
While the heterotic frame is very convenient for formulating results about BPS states, for our purposes we need to relate it to the type IIA frame. To this end, we express the charge vector (2.3) through the charges ($p^I, q_I$) introduced in the beginning of this section. The resulting charge vector reads [30]

$$ \gamma = \begin{pmatrix} q_0, & -p^b, & q_\alpha \\ q_b, & p^0, & \eta_{\alpha\beta} p^\beta \end{pmatrix}, \qquad (2.14) $$

where $\alpha = 1, \dots, 26$. In appendix A we recall the chain of dualities leading to this result.

## 2.2 Mock modularity of immortal dyons

Let us return to $\frac{1}{4}$-BPS states and expand their generating function (2.12) for the trivial torsion invariant in Fourier series in $\sigma$

$$ \frac{1}{\Phi_{10}(\tau, z, \sigma)} = \sum_{m=-1}^{\infty} \psi_m(\tau, z) p^m. \qquad (2.15) $$

From the modularity of $\Phi_{10}$ with respect to $\mathrm{Sp}(2, \mathbb{Z})$ it follows that the coefficients $\psi_m(\tau, z)$ are Jacobi forms of weight $-10$ and index $m$ (see (B.1) for the definition of a general Jacobi form). Note that if we considered the generating function $Z_I^{(4|4)}$ with $I > 1$ and performed a similar expansion, due to (2.13) the corresponding coefficients would be Jacobi forms only with respect to a congruence subgroup $\Gamma^0(I) \subset \mathrm{SL}(2, \mathbb{Z})$ [26] defined by

$$ \Gamma^0(I) = \left\{ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \in \mathrm{SL}(2, \mathbb{Z}) : b = 0 \mod I \right\}. \qquad (2.16) $$

The Jacobi forms $\psi_m$ inherit the double poles from $Z_I^{(4|4)}$ and hence are meromorphic functions in $z$. In [3] it was shown that they admit a canonical decomposition

$$ \psi_m = \psi_m^P + \psi_m^F, \qquad (2.17) $$

where $\psi_m^P$ contains the “polar” part of the original function and is captured by the so-called Appell-Lerch sum, whereas $\psi_m^F$ is holomorphic. This decomposition was also given a physical interpretation: all contributions of single centered black holes are encoded in $\psi_m^F$ while $\psi_m^P$ only contains contributions of bound states. Since the bound states decay at lines of marginal stability, it is possible to choose a region of moduli space where $\psi_m^P$ vanishes. Single-centered black holes exist in all regions of moduli space and hence, $\psi_m^P$ can be viewed as the counting function of immortal dyons.

An important result of [3] is that both functions $\psi_m^P$ and $\psi_m^F$ are mock Jacobi forms, i.e. their modular transformations are anomalous. The corresponding modular anomalies must be equal and opposite so as to cancel each other on adding the corresponding mock Jacobi forms to give a fully modular object as in (2.17). Furthermore, there is a canonical way to construct modular completions $\hat{\psi}_m^P$ and $\hat{\psi}_m^F$ which do transform as Jacobi forms, but are not holomorphic. In particular, the modular completion $\hat{\psi}_m^F$ was shown to satisfy
the following holomorphic anomaly equation<fnref n="4" />

$$ \tau_2^{3/2} \partial_\tau \hat{\psi}_m^F(\tau, z) = \frac{\sqrt{m}}{8\pi i} \frac{\Omega^{(4|2)}(m)}{\eta(\tau)^{24}} \sum_{\ell=0}^{2m-1} \overline{\theta_{m,\ell}(\tau, 0)} \theta_{m,\ell}(\tau, z) \equiv \mathcal{A}_m(\tau, z), \quad (2.18) $$

where

$$ \theta_{m,\ell}(\tau, z) = \sum_{r \in 2m\mathbb{Z}+\ell} q^{\frac{r^2}{4m}} y^r. \quad (2.19) $$

This is the result which will be reproduced below, and generalized to include a non-trivial torsion, from a completely different approach starting from the generating functions of D4-D2-D0 black holes degeneracies in $\mathcal{N} = 2$ compactifications.

# 3 Refined BPS index and modularity

## 3.1 D4-D2-D0 black holes in $\mathcal{N} = 2$ setup

Let us consider type IIA string theory compactified on a generic compact CY threefold $\mathfrak{Z}$ with SU(3) holonomy group. At low energies it is described by $\mathcal{N} = 2$ supergravity coupled to $h_{1,1}(\mathfrak{Z}) = b_2(\mathfrak{Z})$ vector multiplets and $h_{2,1}(\mathfrak{Z}) + 1$ hypermultiplets. The $\frac{1}{2}$-BPS states in this theory are labelled by electro-magnetic charge $\gamma = (p^0, p^a, q_a, q_0)$ with $a = 1, \dots, b_2$ whose entries correspond to D6, D4, D2 and D0-brane charges, respectively, and at large coupling are realized as supersymmetric black holes. They are counted (with sign) by BPS indices $\Omega^{(2|2)}(\gamma)$ which are known to coincide with the generalized Donaldson-Thomas (DT) invariants of the CY threefold. In fact, below we will deal mostly with their refined version

$$ \Omega(\gamma, y) = \mathrm{Tr}_{\mathcal{H}'_{\gamma}}(-y)^{2J_3}, \quad (3.1) $$

which reduces to $\Omega^{(2|2)}(\gamma)$ at $y = 1$. Here $J_3$ is a Cartan generator in the massive little group in 3+1 dimensions, $\mathcal{H}'_{\gamma}$ is the Hilbert space of states graded by the charge $\gamma$ with the center of mass degrees of freedom excluded, and $y$ is a refinement parameter. In particular, we will be interested in the modular properties of the generating functions of the refined indices.

While in string theory on $K3 \times T^2$ the modular symmetry can be trivially identified with large diffeomorphisms of the torus, one may wonder where it comes from for type IIA on a generic CY. It can be revealed by compactifying this theory on a circle. Indeed, the resulting theory has two dual formulations: it can be viewed either as M-theory on $\mathfrak{Z} \times T^2$ or, after applying T-duality along the circle, as type IIB string theory on $\mathfrak{Z} \times S^1$. In both formulations the modular symmetry is evident<fnref n="5" /> and must be realized as an isometry of the moduli space $M_{3d}$ in three dimensions [31]. Given that the BPS states in four dimensions

<footnote n="4">⁴In [3, eq. (1.7)] this equation was given with a different coefficient: the denominator $8\pi i$ appeared under square root. However, it must follow from applying eq. (7.4) with $k = 3/2$ to the function given in eq. (9.5) in that paper. Collecting all coefficients, one does find $1/(8\pi i)$, as we wrote in (2.18).</footnote>

<footnote n="5">⁵We note that the SL(2, $\mathbb{Z}$) modular group revealed by this construction is universal to all type II compactifications and it is distinct from the electric-magnetic duality group in the heterotic frame which appears in the case of $\mathcal{N} = 4$ compactifications.</footnote>
induce instanton corrections weighted by $\Omega^{(2|2)}(\gamma)$ to the metric on $M_{3d}$, this modular isometry constraint imposes non-trivial restrictions on the BPS indices.

To proceed further we need to restrict to the vanishing D6-brane charge $p^0$. The reason is that SL(2, $\mathbb{Z}$) mixes D6-branes wrapped on $\mathfrak{Z} \times S^1$ with KK-instantons (or in the T-dual picture, D5 and NS5-branes both wrapped on $\mathfrak{Z}$). Whereas the exact description of D-instantons is well-known by now [31–33], the understanding of NS5-brane instantons remains incomplete (see [34–36]), which makes it difficult to draw precise conclusions for the modular properties of BPS indices with non-vanishing $p^0$.

Thus, we consider BPS states with the charge $\gamma = (0, p^a, q_a, q_0)$ satisfying the following quantization conditions [34]:

$$p^a \in \mathbb{Z}, \quad q_a \in \mathbb{Z} + \frac{1}{2} \kappa_{abc} p^b p^c, \quad q_0 \in \mathbb{Z} - \frac{1}{24} c_{2,a} p^a. \qquad (3.2)$$

Here $c_{2,a}$ are components of the second Chern class of $\mathfrak{Z}$ and $\kappa_{abc}$ are the intersection numbers on $\Lambda = H_4(\mathfrak{Z}, \mathbb{Z})$. Furthermore, the divisor $\mathcal{D} = p^a\gamma_a$, where $\gamma_a$ is a basis of $\Lambda$, wrapped by D4-brane must be ample, i.e. belong to the Kähler cone defined, in terms of a convenient notation $(lkp) = \kappa_{abc}l^a k^b p^c$, by

$$p^3 > 0, \quad (rp^2) > 0, \quad k_a p^a > 0, \qquad (3.3)$$

for all divisor classes $r^a\gamma_a \in H_4(\mathfrak{Z}, \mathbb{Z})$ with $r^a > 0$, and curve classes $k_a\gamma^a \in H_2(\mathfrak{Z}, \mathbb{Z})$ with $k_a > 0$. Under these conditions, the charge $p^a$ induces a quadratic form $\kappa_{ab} = \kappa_{abc}p^c$ of signature $(1, b_2 - 1)$ on the lattice $\Lambda$. This quadratic form allows to embed $\Lambda$ into $\Lambda^* = H_2(\mathfrak{Z}, \mathbb{Z})$, but the map $\epsilon^a \mapsto \kappa_{ab}\epsilon^b$ is in general not surjective, the quotient $\Lambda^*/\Lambda$ being a finite group of order $|\det \kappa_{ab}|$.

As in $\mathcal{N} = 4$ string theory, the BPS indices carry dependence on CY moduli $z^a$ due to the existence of bound states and the wall-crossing phenomenon [37]. But while in $\mathcal{N} = 4$ there are only bound states with two constituents [27], in the $\mathcal{N} = 2$ setup the number of constituents can be arbitrary. Given that the modular group acts on $z^a$ and thus can map from one chamber of the moduli space $M$ to another, the complicated wall-crossing pattern makes it difficult to expect any simple modular properties from the BPS indices considered at arbitrary point in $M$.

This problem is solved by considering the BPS indices evaluated at the large volume attractor point $z^a = z^a_\infty(\gamma)$,

$$z^a_\infty(\gamma) = \lim_{\lambda \to \infty} (-\kappa^{ab} q_b + i\lambda p^a). \qquad (3.4)$$

Such indices $\Omega^{(2|2)}_*(\gamma) \equiv \Omega^{(2|2)}(\gamma; z^a_\infty(\gamma))$ as well as their refined version possess a set of important properties:

* *Spectral flow symmetry.* They are invariant under spectral flow transformations acting on the D2 and D0 charges via

$$q_a \mapsto q_a - \kappa_{ab} \epsilon^b, \quad q_0 \mapsto q_0 - \epsilon^a q_a + \frac{1}{2} \kappa_{ab} \epsilon^a \epsilon^b \qquad (3.5)$$
with $\epsilon^a \in \Lambda$. These transformations leave invariant the combination

$$ \hat{q}_0 = q_0 - \frac{1}{2} \kappa^{ab} q_a q_b, \qquad (3.6) $$

where $\kappa^{ab}$ is the inverse of $\kappa_{ab}$, and allow a decomposition of the D2-brane charge into the spectral flow parameter $\epsilon$ and the residue class $\mu \in \Lambda^*/\Lambda$

$$ q_a = \kappa_{ab} \epsilon^b + \mu_a + \frac{1}{2} \kappa_{ab} p^b, \quad \epsilon^a \in \mathbb{Z}. \qquad (3.7) $$

As a result, due to the spectral flow symmetry, the BPS indices evaluated at (3.4) depend only on $\hat{q}_0$, $p^a$ and $\mu_a$ so that we can write (in the presence of refinement)

$$ \Omega_{\star}(\gamma, y) = \Omega_{p,\mu}(\hat{q}_0, y). \qquad (3.8) $$

* **Bogomolov bound.** The invariant charge $\hat{q}_0$ (3.6) is bounded from above because DT invariants are known to vanish for $\hat{q}_0 > \hat{q}_0^{\max} = \frac{1}{24}\chi(D) = \frac{1}{24}(p^3 + c_{2,a}p^a)$.

* **Relation to single-centered black holes.** The index $\Omega_{p,\mu}(\hat{q}_0, y)$ is known to be closely related to the one counting single-centered black holes. Although they do not coincide [38], the difference between these two indices is only due to the so-called scaling solutions, i.e. multi-centered black holes whose constituents can become arbitrarily close to each other and are allowed to exist in the attractor chamber. An important feature of these scaling solutions is that they comprise of at least 3 centers [39, 40].

These properties allow to define a natural generating function

$$ h_{p,\mu}^{\text{ref}}(\tau, z) = \sum_{\hat{q}_0 \le \hat{q}_0^{\max}} \frac{\bar{\Omega}_{p,\mu}(\hat{q}_0, y)}{y - y^{-1}} q^{-\hat{q}_0}, \qquad (3.9) $$

where we represented the refinement parameter as $y = e^{2\pi i z}$ and introduced rational invariants which differ from the integer valued ones only for non-primitive charges,

$$ \bar{\Omega}(\gamma, y) = \sum_{d|\gamma} \frac{y - y^{-1}}{d(y^d - y^{-d})} \Omega(\gamma/d, y^d). \qquad (3.10) $$

In the refined case, the rational invariants appeared first in [14] where they were shown to have simplified wall-crossing properties. It is crucial to use them in the generating function for the latter to possess nice modular properties, and we will see that they are also important for agreement with the results presented in the previous section.

In [11], on the basis of the unrefined construction resulting from the analysis of the three-dimensional moduli space $M_{3d}$ [5], it was argued that the generating functions (3.9) of refined BPS indices transform under modular transformations

$$ \tau \to \frac{a\tau + b}{c\tau + d}, \quad z \to \frac{z}{c\tau + d}, \quad \begin{pmatrix} a & b \\ c & d \end{pmatrix} \in \text{SL}(2, \mathbb{Z}) \qquad (3.11) $$
as vector valued (higher depth) mock Jacobi forms<fnref n="6" /> of weight $w_{\text{ref}} = -\frac{1}{2}b_2$ and index $m_{\text{ref}}(p) = -\left(\frac{1}{6}p^3 + \frac{1}{12}c_{2,a}p^a\right)$. Their precise transformations can be found in appendix B. This result implies that there is canonical way to construct a non-holomorphic modular completion $\hat{h}_{p,\mu}^{\text{ref}}$ which transforms as a true Jacobi form of the same weight and index, and the main result of [11] was a formula for such completion expressing it as a series in $h_{p_i,\mu_i}^{\text{ref}}$ with $\sum_i p_i^a = p^a$. We will be mainly interested in the holomorphic anomaly equation satisfied by $\hat{h}_{p,\mu}^{\text{ref}}$ which was also derived in [11] and takes the following form

$$ \partial_{\bar{\tau}} \hat{h}_{p,\mu}^{\text{ref}}(\tau, z) = \sum_{n=2}^{\infty} \sum_{\sum_{i=1}^{n} \check{\gamma}_i = \check{\gamma}} \mathcal{J}_n^{\text{ref}}(\{\check{\gamma}_i\}, \tau_2, y) e^{\pi i \tau Q_n(\{\check{\gamma}_i\})} \prod_{i=1}^{n} \hat{h}_{p_i, \mu_i}^{\text{ref}}(\tau, z), \quad (3.12) $$

where $\check{\gamma} = (p^a, q_a = \mu_a + \frac{1}{2}\kappa_{ab}p^b)$, $\check{\gamma}_i = (p_i^a, q_{i,a})$, the electric charges $q_{i,a}$ are decomposed as in (3.7) with the quadratic form $\kappa_{i,ab} = \kappa_{abc}p_i^c$, and

$$ Q_n(\{\check{\gamma}_i\}) = \kappa^{ab} q_a q_b - \sum_{i=1}^{n} \kappa_i^{ab} q_{i,a} q_{i,b}. \quad (3.13) $$

Each term in (3.12) has the form of the product of the completions corresponding to charges $p_i^a$, multiplied by a theta series determined by the quadratic form $Q_n$ and the kernel $\mathcal{J}_n^{\text{ref}}$. It is important that due to the restrictions on the divisors $\mathcal{D}_i = p_i^a \gamma_a$, all $\kappa_{i,ab}$ are of Lorentzian signature so that $Q_n$ has rank $(n-1)b_2$ and signature $((n-1)(b_2-1), n-1)$.

Of course, all non-trivialities are hidden in the kernels $\mathcal{J}_n^{\text{ref}}$. They are expressed through the so called generalized error functions [41, 42], but we will not need their explicit form in this work and refer an interested reader to [11]. The only fact which is relevant for us is that they have a zero of order $n-1$ at $y=1$, i.e.

$$ \lim_{y \to 1} [(y - y^{-1})^{1-n} \mathcal{J}_n^{\text{ref}}(\{\check{\gamma}_i\}, \tau_2, y)] = \mathcal{J}_n(\{\check{\gamma}_i\}, \tau_2) \quad (3.14) $$

is finite and well defined. In particular, one can show that

$$ \mathcal{J}_2(\{\check{\gamma}_1, \check{\gamma}_2\}, \tau_2) = \frac{(-1)^{\gamma_{12}} \sqrt{(pp_1p_2)}}{8\pi i (2\tau_2)^{3/2}} e^{-\frac{2\pi\tau_2\gamma_{12}^2}{(pp_1p_2)}}, \quad (3.15) $$

where

$$ \gamma_{12} = q_{1,a}p_2^a - q_{2,a}p_1^a \quad (3.16) $$

is the Dirac product on the charge lattice (for vanishing D6-brane charge). Taking into account the presence of the factor $(y - y^{-1})^{-1}$ in the definition of the generating functions (3.9), the property (3.14) ensures that the holomorphic anomaly equation (3.12) has a well defined unrefined limit $y \to 1$. Provided the generating functions of *unrefined* BPS indices are defined by

$$ h_{p,\mu}(\tau) = \lim_{z \to 0} [(y - y^{-1}) h_{p,\mu}^{\text{ref}}(\tau, z)] = \sum_{\hat{q}_0 \le \hat{q}_0^{\text{max}}} \bar{\Omega}_{p,\mu}^{(2|2)}(\hat{q}_0) q^{-\hat{q}_0}, \quad (3.17) $$

<footnote n="6">⁶More precisely, if the divisor $\mathcal{D}$ is a sum of $n$ *irreducible* divisors, then $h_{p,\mu}^{\text{ref}}$ is a vector valued mock Jacobi form of depth $n-1$. In particular, this means that for $\mathcal{D}$ *irreducible* the generating function is a Jacobi form and for $n=2$ it is the standard mock Jacobi form.</footnote>
their completions $\hat{h}_{p,\mu}$ satisfy a holomorphic anomaly equation similar to (3.12) with $\hat{h}_{p,\mu}^{\text{ref}}$ and $\mathcal{J}_n^{\text{ref}}$ replaced by $\hat{h}_{p,\mu}$ and $\mathcal{J}_n$, respectively.

Our goal is to extend the results just described to more general compactifications which include in particular CY threefolds with a reduced holonomy group like $K3 \times T^2$. One immediately notices some similarities in the (mock) modular behavior of the generating functions defined in this and the previous sections. However, a closer inspection reveals important differences:

* While the anomaly equations (2.18) and (3.12) both imply mock modularity of the holomorphic generating functions, the r.h.s. of the former is only quadratic in BPS indices, whereas in the latter one sums over all possible decompositions of the charge into any number of constituents with the only condition of $\mathcal{D}_i$ being ample.

* In the case of $\mathfrak{Z} = K3 \times T^2$, the electric charge lattice is larger than the second homology lattice $H_2(\mathfrak{Z}, \mathbb{Z})$ and its signature is not Lorentzian.

In the next subsections we show how these differences can be incorporated into a general framework allowing to establish a precise correspondence with the well known results in $\mathcal{N} = 4$ string compactifications.

## 3.2 Helicity supertraces and refined index

The differences delineated above between the $\mathcal{N} = 2$ and $\mathcal{N} = 4$ cases are not too surprising in light of the fact that we are trying to compare theories with different amount of supersymmetry. Furthermore, it is important to note that the BPS indices in the two theories are genuinely different quantities, irrespective of whether they count BPS states with the same or different number of conserved supersymmetries. These indices, similar to the Witten index, perform a weighted count (with signs) of the short and intermediate multiplets in the corresponding supersymmetric theories and are precisely defined in terms of helicity supertraces [18],

$$B_{2K}(\mathcal{R}) = \text{Tr}_{\mathcal{R}} [(-1)^{2J_3} J_3^{2K}], \quad (3.18)$$

where $\mathcal{R}$ is a representation of the supersymmetry algebra. The insertion of each power of $J_3$ in the trace soaks up 2 fermionic zero modes. Each fermionic zero mode corresponds to a broken supercharge and all of them should be soaked up to get a non-vanishing result. A $\frac{1}{r}$-BPS state breaks $4\mathcal{N}(1 - \frac{1}{r})$ supercharges resulting in the same number of zero modes. Hence, the first helicity supertrace to which a multiplet of $\frac{1}{r}$-BPS states in a 4d theory with $\mathcal{N}$ extended supersymmetry can contribute non-trivially is $B_{2K}$ with

$$K = \frac{\mathcal{N}}{r}(r-1). \quad (3.19)$$

Hence, the index $\Omega^{(2|2)}(\gamma)$ counting $\frac{1}{2}$-BPS states in $\mathcal{N} = 2$ theories is encoded in $B_2$, whereas the indices $\Omega^{(4|2)}(\gamma)$ and $\Omega^{(4|4)}(\gamma)$ in $\mathcal{N} = 4$ can be obtained from $B_4$ and $B_6$, respectively. In order to extract an index from a helicity supertrace, one should factor out
the center of mass contribution equal to the helicity supertrace of the corresponding BPS multiplet,<fnref n="7" />

$$B_{2K}^{\text{cm}}(j) = B_{2K}(\mathcal{R}_{j,2K}) = (-1)^{2j+K} 2^{-2K} (2K)!(2j+1), \quad (3.20)$$

where $\mathcal{R}_{j,2K}$ denotes the supersymmetry multiplet constructed by acting on a spin $j$ ground state with $2K$ oscillators. Hence we can write down indices in $\mathcal{N} = 2, 4$ theories as

$$\Omega^{(2|2)}(\gamma) = \frac{B_2(\mathcal{H}_{\gamma,j}^{N=2})}{B_2^{\text{cm}}(j)}, \quad \Omega^{(4|2)}(\gamma) = \frac{B_4(\mathcal{H}_{\gamma,j}^{N=4})}{B_4^{\text{cm}}(j)}, \quad \Omega^{(4|4)}(\gamma) = \frac{B_6(\mathcal{H}_{\gamma,j}^{N=4})}{B_6^{\text{cm}}(j)}, \quad (3.21)$$

where $\mathcal{H}_{\gamma,j} = \mathcal{H}'_{\gamma} \otimes \mathcal{R}_{j,2K}$. Here we have suppressed the suffix $2K$ on $\mathcal{H}_{\gamma,j}$ as it is purely determined by the charge $\gamma$ and the total number of supersymmetries, and instead indicated explicitly the latter.

At this juncture, we make the following significant observation. All of the different helicity supertraces $B_{2K}$ can be obtained from a single helicity generating function [18]

$$B(\mathcal{R}, y) = \text{Tr}_{\mathcal{R}}(-y)^{2J_3} \quad (3.22)$$

as

$$B_{2K}(\mathcal{R}) = \left(\frac{1}{2} y \partial_y\right)^{2K} B(\mathcal{R}, y)|_{y=1}. \quad (3.23)$$

One immediately recognizes this generating function to be reminiscent of the refined BPS index $\Omega(\gamma, y)$ introduced in (3.1). Indeed, to obtain the latter, one needs only to factor out again the center of mass contribution

$$\Omega(\gamma, y) = \frac{B(\mathcal{H}_{\gamma,j}, y)}{B^{\text{cm}}(j, y)}. \quad (3.24)$$

Since, by definition, in the unrefined limit, the refined index reduces to the $\frac{1}{2}$-BPS index of $\mathcal{N} = 2$ theory, $\Omega(\gamma, 1) = \Omega^{(2|2)}(\gamma)$, the center of mass contribution must be given by the helicity generating function evaluated on an $\mathcal{N} = 2$ short multiplet which results in

$$B^{\text{cm}}(j, y) \equiv B(\mathcal{R}_{j,2}, y) = (-1)^{2j+1} \frac{y^{2j+1} - y^{-2j-1}}{y - y^{-1}} \frac{(y-1)^2}{y}. \quad (3.25)$$

It is easy to check that, setting $y = 1$ in (3.24), ones does reproduce the first relation in (3.21) because in $\mathcal{N} = 2$ theory the helicity generating function behaves near $y = 1$ as $B(\mathcal{H}_{\gamma,j}^{N=2}, y) \sim (y-1)^2$.

Importantly, the relation (3.24) holds as a perfectly sensible relation beyond $\mathcal{N} = 2$. Thus, the refined index can be defined in a theory with any number of supersymmetries through its relation to the helicity generating function and the only information about its $\mathcal{N} = 2$ origin is contained in its normalization factor (3.25). It can also be related to

<footnote n="7">⁷For $\frac{1}{2}$-BPS states in $\mathcal{N} = 2$ theory this corresponds to the contribution of a half-hypermultiplet, which is consistent with the fact that the contribution of a single half-hypermultiplet to the BPS index $\Omega(\gamma)$ is equal to one [14].</footnote>
the indices counting $\frac{1}{r}$-BPS multiplets in theories with $\mathcal{N}$ extended supersymmetry with generic $\mathcal{N}$ and $r$, which we define by generalizing (3.21)

$$ \Omega^{(\mathcal{N}|r)}(\gamma) = \frac{B_{2K}(\mathcal{H}_{\gamma,j}^{\mathcal{N}})}{B_{2K}^{\text{cm}}(j)}, \qquad (3.26) $$

where $K$ is determined by $\mathcal{N}$ and $r$ by (3.19). To get such a relation, one should note that $B(\mathcal{R}_{j,2K}, y) \sim (y-1)^{2K}$ near $y=1$. This fact together with the relation (3.23) ensures that $B_{2K}$ is the first non-vanishing helicity supertrace for such multiplets. By combining (3.23)-(3.25), one can then express the index (3.26) through the refined BPS index as

$$ \Omega^{(\mathcal{N}|r)}(\gamma) = \frac{(-1)^{K-1}}{(2K-2)!} \partial_y^{2K-2} \Omega(\gamma, y)|_{y=1}. \qquad (3.27) $$

In particular, for $(\mathcal{N}|r) = (4|2)$ and $(4|4)$ corresponding to $K=2$ and $3$ respectively, this provides a precise relation between the BPS indices in $\mathcal{N}=4$ theory and the refined BPS index introduced in the $\mathcal{N}=2$ context. More generally, eq. (3.27) encodes the formula for extracting BPS indices in a general theory with extended supersymmetry from a single refined index.

## 3.3 Proposal

Given that one can write down a refined BPS index in any theory with extended supersymmetry, the next natural step is to generalize the results about modularity of its generating functions, presented in section 3.1, to string compactifications with $\mathcal{N} > 2$. In particular, we assume that in all these theories one can still construct the generating functions $h_{p,\mu}^{\text{ref}}$ (3.9) of (rational) refined indices evaluated at the large volume attractor point and that they behave under modular transformations as vector valued (higher depth) mock Jacobi forms. To write however a generalization of the holomorphic anomaly equation satisfied by their completions requires understanding of several issues.

The first new feature appearing for $\mathcal{N} > 2$ is that the charge lattice is larger than the homology lattice of the CY and includes NS charges appearing due to the existence of non-trivial one-cycles. The full charge vector can be represented as $\gamma = (p^I, q_I) = (p^0, p^A, q_A, q_0)$ where $A$ runs over $b_2 + 2b_1$ values and as before we will restrict to the vanishing D6-brane charge $p^0 = 0$.

The crucial role in the construction of section 3.1 was played by the quadratic form $\kappa_{ab} = \kappa_{abc}p^c$ determined by the intersection numbers. In theories with $\mathcal{N} > 2$ there is a natural generalization of this object which can be read off from the classical prepotential governing the couplings of vector multiplets in the effective action at the two-derivative level. The prepotential has a cubic form$^8$

$$ F^{\text{cl}}(X) = -\frac{\kappa_{ABC} X^A X^B X^C}{6X^0}, \qquad (3.28) $$

<footnote>$^8$The prepotential can also have contributions quadratic in $X^I$, but they can be removed by a symplectic transformation at the expense of making charges rational [34]. This is the origin of the rational shifts in (3.2).</footnote>
and hence defines a tensor<fnref n="9" /> $\kappa_{ABC}$, which can be seen as an extension of the intersection numbers. It defines the natural quadratic form $\kappa_{AB} = \kappa_{ABC}p^C$ which appears in the spectral flow transformations (3.5) [44]. Hence, one may expect it to replace $\kappa_{ab}$ also in the definition of the quadratic form $Q_n$ (3.13) entering the holomorphic anomaly equation for refined indices.

This replacement has important implications. First, it changes the rank of the quadratic form and hence the modular weight of various theta series appearing as building blocks in the construction of the completion. On the other hand, the weight of $h_{p,\mu}^{\text{ref}}$ was tuned to compensate the weight of these theta series. Thus, one can expect that now it will be given by

$$w_{\text{ref}} = -\frac{1}{2} \text{rank}(\kappa_{AB}). \qquad (3.29)$$

In the $N = 2$ case the rank was always maximal due to the ampleness condition on the divisor. It turns out that for $N > 2$ this condition should be relaxed and replaced by a weaker one that the divisor is *effective*, i.e. $p^A \ge 0$. In particular, as we will see in the next section, for $\frac{1}{2}$-BPS states in $N = 4$ the corresponding divisor is never ample. As a result, the rank can be less than $b_2 + 2b_1$ and the weight (3.29) starts depending on the choice of the magnetic charge vector $p^A$.

If the rank is not maximal, the quadratic form is not invertible so that we should clarify the meaning of the expressions involving its inverse, like the one for the invariant charge (3.6). It turns out that in this case the electric charge lattice is reduced: the charges associated with the degenerate directions of the quadratic form get frozen. More precisely, if $\{\lambda_s^A\}$ is the set of eigenvectors of $\kappa_{AB}$ with zero eigenvalue, i.e. $\kappa_{AB}\lambda_s^B = 0$, then the charges must satisfy

$$\lambda_s^A q_A = 0. \qquad (3.30)$$

In fact, it is easy to see that this condition is necessary for theta series to converge. Moreover, it was noticed to hold in the case of non-compact CYs [11], and in appendix C we show that it also follows from the attractor equations. As a result, the relevant charge lattice which one sums over in theta series is

$$\Lambda_p = \left\{ q_A \in \mathbb{Z} + \frac{1}{2} \kappa_{AB} p^B : \lambda_s^A q_A = 0 \right\}. \qquad (3.31)$$

After the reduction to $\Lambda_p$ the quadratic form becomes non-degenerate and hence invertible. It is convenient to introduce the embedding of its inverse into $\mathbb{R}^{b_2+2b_1}$ which we denote by $\kappa^{AB}$. It can be defined by the following conditions: i) $\text{rank}(\kappa^{AB}) = \text{rank}(\kappa_{AB})$, ii) $\kappa^{AC}\kappa_{CB} = \delta_B^A - \sum_{s,t} e^{st}\lambda_s^A\lambda_{t,B}$ where $e^{st}$ is the inverse of $e_{st} = \lambda_s^A\lambda_{t,A}$. Then a proper generalization from the $N = 2$ case involves a replacement $\kappa^{ab}q_a q_b \to \kappa^{AB}q_A q_B$ where the charges are supposed to satisfy (3.30).

Another new feature is that the signature of the quadratic form $\kappa_{AB}$, even after the restriction to $\Lambda_p$, is not necessarily Lorentzian, i.e. it can be $(n_+, n_-)$ with $n_+ > 1$. This fact drastically affects the construction of $\hat{h}_{p,\mu}^{\text{ref}}$ because the naive extension of the formula

<footnote n="9">⁹This tensor is invariant under U-duality group in five-dimensions and determines the classical entropy of 5d black holes [43].</footnote>
from [11] to the larger lattice with the quadratic form $\kappa_{AB}$ would lead to a divergent expression. A way to cure this problem is to change the kernels of theta series like $\mathcal{J}_n^{\text{ref}}$ in (3.12). In this paper we do not provide explicit expressions for the new kernels and simply assume that they exist. The only additional assumption which will be used here is that, as soon as the quadratic form $Q_n$ has $n-1$ negative eigenvalues, the kernels are given by those found in [11].

Summarizing, we formulate the following

**Conjecture 1** The generating functions $h_{p,\mu}^{\text{ref}}$ of refined BPS indices defined in (3.9) with

$$ \hat{q}_0 = q_0 - \frac{1}{2} \kappa^{AB} q_A q_B \le \hat{q}_0^{\text{max}} = \frac{1}{24} (p^3 + c_{2,a} p^a), \qquad (3.32) $$

transform as vector valued (higher depth) Jacobi forms of weight (3.29) and index<fnref n="10" /> $m_{\text{ref}}(p) = -\left(\frac{1}{6}p^3 + \frac{1}{12}c_{2,a}p^a\right) - N$ where $p^3 = \kappa_{ABC}p^A p^B p^C$ and $N = b_2 + 2b_1 - \text{rank}(\kappa_{AB})$. Their modular completions $\hat{h}_{p,\mu}^{\text{ref}}$ satisfy the holomorphic anomaly equation (3.12) where $\check{\gamma} = (p^A, q_A = \mu_A + \frac{1}{2}\kappa_{AB}p^B)$, $\check{\gamma}_i = (p_i^A, q_{i,A})$, the magnetic charges $p^A, p_i^A$ are all non-negative, the electric charges are decomposed as

$$ q_{i,A} = \kappa_{i,AB} \left( \epsilon^B + \frac{1}{2} p^B \right) + \mu_A, \quad \epsilon^A \in \mathbb{Z}, \quad \lambda_s^A \epsilon_A = \lambda_s^A \mu_A = 0, \quad \kappa_{i,AB} = \kappa_{ABC} p_i^C, \qquad (3.33) $$

and

$$ Q_n(\{\check{\gamma}_i\}) = \kappa^{AB} q_A q_B - \sum_{i=1}^{n} \kappa_i^{AB} q_{i,A} q_{i,B}. \qquad (3.34) $$

Finally, the kernels $\mathcal{J}_n^{\text{ref}}$ are supposed to have a zero of order $n-1$ at $y=1$ and in the case of $Q_n$ with $n-1$ negative eigenvalues to coincide with the ones found in the $\mathcal{N}=2$ case.

## 3.4 The unrefined limit

Let us now show how the above conjecture can be used to extract modular properties of the generating functions of the unrefined BPS indices. The key fact is the relation (3.27). Applying it to (3.9), one can obtain a relation between the generating functions of refined and unrefined indices, generalizing (3.17) valid in the $\mathcal{N}=2$ case,

$$ h_{p,\mu}^{(\mathcal{N}|r)}(\tau) = \sum_{\hat{q}_0 \le \hat{q}_0^{\text{max}}} \bar{\Omega}_{p,\mu}^{(\mathcal{N}|r)}(\hat{q}_0) q^{-\hat{q}_0} = \frac{2i(2\pi)^{3-2K}}{(2K-2)!} \partial_z^{2K-2} (z h_{p,\mu}^{\text{ref}}(\tau, z))|_{z=0}, \qquad (3.35) $$

where as usual $K$ is determined by (3.19) and $\bar{\Omega}_{p,\mu}^{(\mathcal{N}|r)}$ is a linear combination of the unrefined indices

$$ \bar{\Omega}^{(\mathcal{N}|r)}(\gamma) = \sum_{d|\gamma} d^{2K-4} \Omega^{(\mathcal{N}|r)}(\gamma/d) \qquad (3.36) $$

evaluated at the large volume attractor point. This combination follows directly from (3.10) after applying the derivative operator. It is worth to note that for $\mathcal{N} > 2$, one has $K \ge 2$

<footnote n="10">¹⁰The shift by $N$ was noticed in [11] in the context of non-compact CY threefolds.</footnote>
so that, in contrast to the $\mathcal{N} = 2$ case, the indices (3.36) are not rational, although still different from $\Omega^{(\mathcal{N}|r)}(\gamma)$ for non-primitive charges.

The relation (3.35) allows to read off the modular weight of $h_{p,\mu}^{(\mathcal{N}|r)}$ from that of $h_{p,\mu}^{\text{ref}}$. Indeed, since $z$ is an elliptic variable, i.e. transforms as a modular form of weight $-1$, this relation implies that the generating function $h_{p,\mu}^{(\mathcal{N}|r)}$ is a vector valued (mock) modular form of weight

$$w = 2K - 3 + w_{\text{ref.}} \qquad (3.37)$$

Given (3.29), this agrees with the formula (1.1) given in the Introduction.

The mock nature of $h_{p,\mu}^{(\mathcal{N}|r)}$ is characterized by the holomorphic anomaly equation for its completion (if it is non-trivial), which should also be obtained as the limit $y \to 1$ of (3.12). Before taking the limit, it is useful to rewrite this equation in a slightly different form

$$(y - y^{-1}) \partial_{\tau} \hat{h}_{p,\mu}^{\text{ref}}(\tau, z) = q^{\frac{1}{2}} \kappa^{AB} q_A q_B \sum_{q_0} \sum_{n=2}^{\infty} \sum_{\sum_{i=1}^{n} \gamma_i = \gamma} \frac{\mathcal{J}_n^{\text{ref}}(\{\tilde{\gamma}_i\}, \tau_2, y)}{(y - y^{-1})^{n-1}} \prod_{i=1}^{n} (\bar{\Omega}(\gamma_i, y) q^{-q_{i,0}}), \qquad (3.38)$$

where we simply substituted the definition of the generating functions on the r.h.s. and used the spectral flow invariance of the refined BPS indices. The reason for this rewriting is that the charges $\gamma_i$ that differ only by D0-brane charge $q_{i,0}$ may correspond to states preserving different number of supersymmetries. If this is the case, the behavior of the corresponding indices $\bar{\Omega}(\gamma_i, y)$ in the unrefined limit will be different and hence they will contribute differently to the anomaly equation in this limit.

Now it is clear how to proceed: one should apply the derivative operator from (3.35) to both sides of (3.38) and take the unrefined limit. To this end, it is crucial to take into account that the coefficients $(y - y^{-1})^{1-n} \mathcal{J}_n^{\text{ref}}$ are assumed to be finite in the limit reducing to $\mathcal{J}_n$ (3.14), while the refined BPS indices develop a zero of certain order. More precisely, in a theory with $\mathcal{N}$ extended supersymmetry they behave as $\sim z^{\mathcal{N}-2}$ if the charge corresponds to a $\frac{1}{2}$-BPS state and for other BPS states they vanish even faster. Thus, to get a non-vanishing contribution, all powers of $z$ must be canceled by the derivative operator. However, the number of derivatives satisfies

$$2K - 2 = 2\mathcal{N} - 2 - \frac{2\mathcal{N}}{r} \le n(\mathcal{N} - 2), \quad n \ge 2, \qquad (3.39)$$

with equality reached (for $\mathcal{N} > 2$) only for $n = 2$ and $r = \mathcal{N}$. This simple inequality immediately implies several important consequences:

* The holomorphic anomaly equation can be non-trivial, and hence generating functions be mock modular, only for $\frac{1}{\mathcal{N}}$-BPS states.

* Only $\frac{1}{2}$-BPS states can contribute to the r.h.s. of the holomorphic anomaly equation.

* For $\mathcal{N} > 2$ only the contribution of $\frac{1}{2}$-BPS states with $n = 2$ survives the unrefined limit.
Thus, for $\mathcal{N} > 2$ the only non-trivial holomorphic anomaly equation takes the following form

$$ \partial_{\tau} \hat{h}_{p,\mu}^{(\mathcal{N}|\mathcal{N})}(\tau) = q^{\frac{1}{2}} \kappa^{AB} q_A q_B \sum_{q_0} \sum_{\gamma_1+\gamma_2=\gamma} \mathcal{J}_2(\{\check{\gamma}_1, \check{\gamma}_2\}, \tau_2) \prod_{i=1}^{2} (\bar{\Omega}^{(\mathcal{N}|2)}(\gamma_i) q^{-q_{i,0}}). \quad (3.40) $$

All other generating functions (3.35) must be vector valued modular forms with respect to the full SL(2, $\mathbb{Z}$) duality group.

In the next section we verify these predictions for $\mathcal{N} = 4$ against the known results explained in section 2 and extract a new result concerning modularity of $\frac{1}{4}$-BPS states with a non-trivial torsion.

# 4 Modularity of immortal dyons from refinement

Let us now apply the formalism of the previous section to the compactification of type II string theory on the CY threefold $\mathfrak{Y} = K3 \times T^2$ which preserves $\mathcal{N} = 4$ supersymmetry in four dimensions. This CY is characterized by the following data

$$ b_1 = 2, \quad b_2 = 23, \quad c_{2,a} p^a = 24 p^b, \quad (4.1) $$

where the index $b$ corresponds to the divisor $\gamma_b = [K3]$. Thus, the indices $A, B, \dots$ run over $b_2 + 2b_1 = 27$ values $A \in \{b, \alpha\} = \{b, 1, \dots, 26\}$, and the non-vanishing components of the symmetric tensor $\kappa_{ABC}$ are given by

$$ \kappa_{b\alpha\beta} = \eta_{\alpha\beta} = \begin{pmatrix} I_{1,1}^{\oplus 5} & 0 \\ 0 & -C_{16} \end{pmatrix}. \quad (4.2) $$

The most general charge vector which we consider takes the following form in the heterotic frame (cf. (2.14))

$$ \gamma = \begin{pmatrix} q_0, & -p^b, & q_\alpha \\ q_b, & 0, & \eta_{\alpha\beta} p^b \end{pmatrix}. \quad (4.3) $$

For this charge, the T-duality invariants (2.6) are found to be

$$ n = \frac{1}{2} q^2 - p^b q_0, \quad m = \frac{1}{2} p^2, \quad \ell = p^\alpha q_\alpha - p^b q_b, \quad (4.4) $$

where $q^2 = \eta^{\alpha\beta} q_\alpha q_\beta$ and $p^2 = \eta_{\alpha\beta} p^\alpha p^\beta$, and one has $p^3 = 6mp^b$.

To proceed with the analysis, we need to further specify the charge vector so that it describes either a half- or a quarter-BPS state.

## 4.1 Half-BPS states

As was recalled in section 2, $\frac{1}{2}$-BPS states are distinguished by the condition that the vectors given by the first and second lines of the charge (4.3) are parallel. There are two possibilities to satisfy this condition.
First, if $p^b > 0$, then all charges in the second line must vanish. To simplify the analysis, we restrict ourselves to the case $p^b = 1$, which ensures the primitivity of the charge and will be enough for our purposes. Thus, we consider

$$ \gamma_1 = \begin{pmatrix} q_0, & -1, & q_\alpha \\ 0, & 0, & 0 \end{pmatrix}. \qquad (4.5) $$

In this case the quadratic form $\kappa_{AB} = \kappa_{ABC}p^C$ is

$$ \kappa_{AB} = \begin{pmatrix} 0 & 0 \\ 0 & \eta_{\alpha\beta} \end{pmatrix}. \qquad (4.6) $$

It is degenerate and has rank equal to 26. Note that the existence of a degenerate direction in the charge lattice implies the vanishing of $q_b$, consistently with the $\frac{1}{2}$-BPS condition. The non-degenerate part of the quadratic form is $\eta_{\alpha\beta}$ and it is unimodular. This fact implies that there is no the residual flux $\mu$, and the generating function $h_{p_0}^{(4|2)}(\tau)$ of $\frac{1}{2}$-BPS states, where $p_0 = (1, 0, \dots, 0)$ is the magnetic charge, is a modular scalar. Comparing (3.32) with (4.4), one concludes that

$$ \hat{q}_0 = -n \le \hat{q}_0^{\max} = 1. \qquad (4.7) $$

Thus, the generating function can be explicitly written as

$$ h_{p_0}^{(4|2)}(\tau) = \sum_{n=-1}^{\infty} \Omega^{(4|2)}(n) q^n \qquad (4.8) $$

and coincides with (2.8). Furthermore, the formula (3.37) and the analysis of the holomorphic anomaly done in the previous section imply that it is a modular form of weight $w = 2 \cdot 2 - 3 - 26/2 = -12$, with a trivial multiplier system as can be checked from (B.2) specialized to $p^\alpha = \mu = 0$. Since the space of cusp modular forms (i.e. those which have only positive Fourier coefficients) of weight 12 is one-dimensional and generated by $\eta(\tau)^{24}$ [3], it follows that $h_{p_0}^{(4|2)}(\tau) \sim \eta(\tau)^{-24}$, consistently with (2.9). Of course, the precise proportionality coefficient cannot be fixed from the analysis based only on modularity.

The second possibility to get a $\frac{1}{2}$-BPS state is to take $p^b = 0$ and other components in the two lines proportional to each other, i.e.

$$ \gamma_2 = \begin{pmatrix} \frac{\epsilon}{d_Q} q_b, & 0, & \frac{\epsilon}{d_Q} \eta_{\alpha\beta} p^\beta \\ q_b, & 0, & \eta_{\alpha\beta} p^\beta \end{pmatrix}, \quad \epsilon \in \mathbb{Z}, \quad d_Q = \gcd(q_b, \{p^\alpha\}). \qquad (4.9) $$

In this case the charge $q_0$ is not independent, but fixed in terms of other charges. This implies that it is impossible to construct a generating function as in (3.35). Nevertheless, as we now demonstrate, the formalism of the previous section works even in such trivial situation.

For the charge (4.9), the quadratic form reads as

$$ \kappa_{AB} = \begin{pmatrix} 0 & \eta_{\alpha\beta} p^\beta \\ \eta_{\alpha\beta} p^\beta & 0 \end{pmatrix}. \qquad (4.10) $$
It has rank equal to 2, which corresponds to 2 integers, $q_b$ and $\epsilon$, labelling independent electric charges in (4.9). Therefore, according to (3.37), the generating function corresponding to the magnetic charge $(0, p^\alpha)$ must be a modular form of weight $w = 2 \cdot 2 - 3 - 2/2 = 0$, which implies that the generating function is a constant!

On the other hand, what the fixation of $q_0$ really means is that, due to the $\frac{1}{2}$-BPS condition, in the generating function (3.35) only one term survives. To find this term, note that the matrix $\kappa^{AB}$ defined below (3.31) is given by

$$ \kappa^{AB} = \frac{1}{p^2} \begin{pmatrix} 0 & p^\alpha \\ p^\alpha & 0 \end{pmatrix}. \qquad (4.11) $$

Substituting it into (3.32) together with the constraints on $q_0$ and $q_\alpha$ implied by (4.9), it is easy to show that $\hat{q}_0$ vanishes. Thus, consistently with the above conclusion based on modularity, the generating function reduces to a constant term.

## 4.2 Quarter-BPS states: holomorphic anomaly

The indices counting $\frac{1}{4}$-BPS states in $N = 4$ theory are moduli dependent due to the formation and decay of bound states across lines of marginal stability in the moduli space. However, being evaluated at the attractor point, they coincide with the indices counting only single-centered black holes because the only difference might arise due to scaling solutions, but being composed of at least three constituents they do not contribute to BPS indices in $N = 4$ theory [27]. Therefore, it is natural to expect that the indices $\Omega_{p,\mu}^{(4|4)}(\hat{q}_0)$ coincide with the ones captured by the function $\psi_m^F$, which appears in the decomposition (2.17) and also counts the immortal dyons. As was reviewed in section 2.2, $\psi_m^F$ is a mock Jacobi form with the completion $\hat{\psi}_m^F$ satisfying the holomorphic anomaly equation (2.18). This nicely fits with the result of the previous section that the generating function $h_{p,\mu}^{(4|4)}$ is also mock modular. Below we demonstrate that the holomorphic anomaly equation (3.40) satisfied by its completion can be used to derive the equation (2.18) for $\hat{\psi}_m^F$ as well as its generalization for $I(\gamma) > 1$.

To achieve this goal, let us make all ingredients of (3.40) explicit. We restrict our consideration to the charges (4.3) with $p^b = 1$ and $p^2 > 0$. The first condition, as in the previous subsection, guarantees the primitivity of the charge, while the second ensures the existence of a solution to the attractor equations. For such charge the quadratic form is non-degenerate and is given with its inverse by

$$ \kappa_{AB} = \begin{pmatrix} 0 & \eta_{\alpha\beta} p^\beta \\ \eta_{\alpha\beta} p^\beta & \eta_{\alpha\beta} \end{pmatrix}, \qquad \kappa^{AB} = \frac{1}{p^2} \begin{pmatrix} -1 & p^\alpha \\ p^\alpha & p^2 \eta^{\alpha\beta} - p^\alpha p^\beta \end{pmatrix}. \qquad (4.12) $$

This implies the following spectral flow decomposition of the electric charges

$$ \begin{aligned} q_b &= \eta_{\alpha\beta} \epsilon^\alpha p^\beta + \mu_b + m, \\ q_\alpha &= (\epsilon^b + 1) \eta_{\alpha\beta} p^\beta + \eta_{\alpha\beta} \epsilon^\beta + \mu_\alpha, \end{aligned} \qquad (4.13) $$

Since $|\det \kappa_{AB}| = p^2 = 2m$, the residual flux $\mu$ takes $2m$ non-equivalent values which can be represented by $\mu_b = 0, \dots, 2m - 1$ and vanishing $\mu_\alpha$. Accepting this choice and
substituting the decomposition into (4.4), one finds

$$ \ell = m - \mu_b + 2m\epsilon^b \qquad (4.14) $$

so that this T-duality invariant changes under spectral flow by $2m$.

According to (3.40), the non-vanishing contributions to the anomaly equation arise only from splits of the charge $\gamma = \gamma_1 + \gamma_2$ where $\gamma_1$ and $\gamma_2$ are both $\frac{1}{2}$-BPS charges. It is easy to see that this is possible only if one of them belongs to the class (4.5) and the other to (4.9). Thus, the charges are restricted to satisfy

$$ \begin{pmatrix} q_{1,0}, & -1, & q_{1,\alpha} \\ 0, & 0, & 0 \end{pmatrix} + \begin{pmatrix} \frac{\epsilon}{I(\gamma)} & q_{2,\beta}, & 0, \\ q_{2,\beta}, & 0, & \eta_{\alpha\beta} p^{\beta} \end{pmatrix} = \begin{pmatrix} q_0, & -1, & \eta_{\alpha\beta} p^{\beta} \\ \mu_{\beta} + m, & 0, & \eta_{\alpha\beta} p^{\beta} \end{pmatrix}. \qquad (4.15) $$

Here we took into account that $d_Q$ defined in (4.9) coincides with the torsion invariant $I(\gamma)$ (2.7) of the full charge, which due to (4.14) can also be written as

$$ I(\gamma) = \gcd(\ell, \{p^{\alpha}\}). \qquad (4.16) $$

The constraint (4.15) fixes all charges of the constituents in terms of the full charge and one parameter $\epsilon$. This means that the lattice one sums over on the r.h.s. of the anomaly equation is one-dimensional! It is immediate to check that the quadratic form (3.34) depends on the free parameter as $Q_2 = -\frac{2m}{I(\gamma)^2} \epsilon^2 + O(\epsilon)$ and thus has signature $(0, 1)$. As a result, according to our assumption, the function $J_2$ can be replaced by the simple exponential function (3.15) found in [11]. Taking into account that

$$ (pp_1p_2) = 2m, \qquad \gamma_{12} = \ell - \frac{2m\epsilon}{I(\gamma)}, \qquad \kappa^{AB}q_Aq_B = 2m - \frac{\ell^2}{2m}, \qquad (4.17) $$

where we used (4.14) with $\epsilon^b = 0$, and parametrizing the residue flux as $\mu(\ell) = (m - \ell, 0, \dots, 0)$, the anomaly equation (3.40) takes the following explicit form$^{11}$

$$ \tau_2^{3/2} \partial_{\tau} \hat{h}_{p, \mu(\ell)}^{(4|4)}(\tau) = \frac{(-1)^{\ell} \sqrt{m}}{8\pi i} \sum_{\epsilon \in \mathbb{Z}} \left( \sum_{\hat{q}_{1,0} \le 1} \bar{\Omega}^{(4|2)}(\gamma_1) q^{-\hat{q}_{1,0}} \right) \bar{\Omega}^{(4|2)}(\gamma_2) \bar{q}^{\frac{1}{4m} \left( \frac{2m\epsilon}{I(\gamma)} - \ell \right)^2}. \qquad (4.18) $$

As follows from (4.8), the sum over $\hat{q}_{1,0}$ gives the factor $\eta(\tau)^{-24}$. To deal with the sum over $\epsilon$, we decompose it into two sums by representing $\epsilon = s - I(\gamma)r$ where $r \in \mathbb{Z}$ and $s = 0, \dots, I(\gamma) - 1$. Then we note that by a duality transformation the charge $\gamma_2$ can be brought to the form

$$ \gamma_2' = \begin{pmatrix} 0, & 0, & 0 \\ \frac{d_s}{I(\gamma)}(2m - \ell), & 0, & \frac{d_s}{I(\gamma)}\eta_{\alpha\beta}p^{\beta} \end{pmatrix}, \qquad d_s = \gcd(s, I(\gamma)). \qquad (4.19) $$

In this form the charge has only one non-vanishing T-duality invariant $m' = \frac{d_s^2}{I(\gamma)^2} m$. As a result, the invariance under U-duality and the relation (3.36) allow to express the BPS index $\bar{\Omega}^{(4|2)}(\gamma_2)$ in terms of the coefficients of (4.8)

$$ \bar{\Omega}^{(4|2)}(\gamma_2) = \sum_{d|d_s} \Omega^{(4|2)}(m'/d^2). \qquad (4.20) $$

<footnote>$^{11}$Note the factor of 2 coming from the symmetry $\gamma_1 \leftrightarrow \gamma_2$.</footnote>
Finally, the sum over $r$ can be evaluated explicitly giving rise to the theta function (2.19) at $z = 0$. Thus, the holomorphic anomaly equation becomes

$$ \tau_2^{3/2} \partial_{\tau} \hat{h}_{p,\mu(\ell)}^{(4|4)}(\tau) = \frac{(-1)^{\ell} \sqrt{m}}{8\pi i \eta(\tau)^{24}} \sum_{s=0}^{I(\gamma)-1} \overline{\theta_{m,\ell-\frac{2ms}{I(\gamma)}}(\tau,0)} \sum_{d|d_s} \Omega^{(4|2)} \left( \frac{d_s^2}{d^2} \frac{m}{I(\gamma)^2} \right). \quad (4.21) $$

To bring the resulting equation to the same form as (2.18), one needs to construct a Jacobi form out of the modular vector. Comparing the modular transformations of $\hat{h}_{p,\mu(\ell)}^{(4|4)}$ and the theta series $\theta_{m,\ell}(\tau, z)$, one observes that their multiplier systems, (B.3) and (B.4), cancel each other up to a factor produced by $(-1)^{\ell}$. In other words, the following function transforms as a mock Jacobi form

$$ \psi_p(\tau, z) = \sum_{\ell=-m}^{m-1} (-1)^{\ell} h_{p,\mu(\ell)}^{(4|4)}(\tau) \theta_{m,\ell}(\tau, z) = \sum_{n \ge -1} \sum_{\ell \in \mathbb{Z}} \Omega_{p,\mu(\ell)}^{(4|4)} \left(-\frac{\Delta}{4m}\right) q^n (-y)^{\ell}, \quad (4.22) $$

where we expressed the invariant charge in terms of duality invariants

$$ \hat{q}_0 = -n + \frac{\ell^2}{4m} = -\frac{\Delta}{4m} \quad (4.23) $$

and took into account that $\hat{q}_0^{\max} = \frac{m}{4} + 1$. Given that the modular weight of $h_{p,\mu}^{(4|4)}$, as follows from (3.37), is equal to $w = 2 \cdot 3 - 3 - 27/2 = -\frac{21}{2}$, the function (4.22) has weight $-10$ and index $m$, which perfectly agrees with the properties of the function $\psi_m^F$ defined in section 2.2. Thus, we expect that in the case $I(\gamma) = 1$ these two functions can be identified. Furthermore, setting $I(\gamma) = 1$ in (4.21) and rewriting it in terms of $\psi_p$, it is immediate to see that one recovers the holomorphic anomaly equation (2.18).

It is important to note that, as can be seen from (4.16), the torsion invariant depends on $\ell$, the variable one sums over in the definition (4.22). Therefore, setting $I(\gamma) = 1$, we assume that this constraint holds for all $\ell = -m, \dots, m-1$. This is equivalent to the simpler condition that $d_p = \text{gcd}\{p^\alpha\} = 1$. Once this condition holds, the anomaly equation (4.21) reduces to the well known equation (2.18).

On the other hand, if we do not impose the condition $d_p = 1$ in (4.21), it provides a generalization of the anomaly equation which includes contributions of charges with a non-trivial torsion. In the rest of this section we derive a simplified form of the resulting anomaly equation and show its consistency with the formula (2.13).

To this end, we rewrite (4.21) in terms of $\psi_p$ and perform some manipulations with the finite sums. First, we note that $d' = I(\gamma)d/d_s$ divides both $d_p$ and $\ell$, while $I(\gamma)/d' = d_s/d$ divides $s$. This allows to trade the sum over $d$ for the sum over $d'$ and exchange the order of summation so that this sum appears the first. By changing the variables as $\ell = d'k$ and $s = \frac{I(\ell)}{d'}c$, one obtains

$$ \tau_2^{3/2} \partial_{\tau} \hat{\psi}_p(\tau, z) = \frac{\sqrt{m}}{8\pi i \eta(\tau)^{24}} \sum_{d'|d_p} \Omega^{(4|2)} \left( \frac{m}{d'^2} \right) \sum_{k=0}^{\frac{2m}{d'}-1} \theta_{m,d'k}(\tau, z) \sum_{c=0}^{d'-1} \overline{\theta_{m,d'k-\frac{2mc}{d'}}(\tau, 0)}. \quad (4.24) $$
Next, we manipulate with the sum of theta series as follows (we drop the prime on d to avoid cluttering)

$$
\begin{align}
& \sum_{k=0}^{\frac{2m}{d}-1} \theta_{m,dk}(\tau, z) \sum_{c=0}^{d-1} \overline{\theta_{m,dk-\frac{2mc}{d}}(\tau, 0)} \nonumber \\
&= \sum_{k=0}^{\frac{2m}{d}-1} \sum_{r \in 2m\mathbb{Z}+dk} q^{\frac{r^2}{4m}} y^r \sum_{c=0}^{d-1} \sum_{r' \in 2m(\mathbb{Z}-\frac{c}{d})+dk} \overline{q^{\frac{r'^2}{4m}}} \nonumber \\
&= \sum_{\ell=0}^{\frac{2m}{d^2}-1} \sum_{s=0}^{d-1} \sum_{r \in 2m(\mathbb{Z}+\frac{s}{d})+d\ell} q^{\frac{r^2}{4m}} y^r \sum_{r' \in \frac{2m}{d}\mathbb{Z}+d\ell} \overline{q^{\frac{r'^2}{4m}}} \nonumber \\
&= \sum_{\ell=0}^{\frac{2m}{d^2}-1} \overline{\theta_{\frac{m}{d^2},\ell}(\tau, 0)} \sum_{r \in \frac{2m}{d}\mathbb{Z}+d\ell} q^{\frac{r^2}{4m}} y^r = \sum_{\ell=0}^{\frac{2m}{d^2}-1} \overline{\theta_{\frac{m}{d^2},\ell}(\tau, 0)} \theta_{\frac{m}{d^2},\ell}(\tau, dz) \tag{4.25}
\end{align}
$$

where at the second step we decomposed $k = \ell + \frac{2ms}{d^2}$. As a result, the anomaly (4.24) for $d_p > 1$ can be expressed through the anomaly for $d_p = 1$: using the function $\mathcal{A}_m(\tau, z)$ defined in (2.18) as the r.h.s. of the holomorphic anomaly equation for trivial torsion, the general anomaly equation takes the form

$$
\tau_2^{3/2} \partial_{\bar{\tau}} \hat{\psi}_p(\tau, z) = \sum_{d|d_p} d \mathcal{A}_{m/d^2}(\tau, dz). \qquad (4.26)
$$

Let us now check the consistency of this anomaly with the formula (2.13) which ex-
presses the degeneracies for $I > 1$ through those for $I = 1$. Using the identification

$$
\Omega_{p,\mu(\ell)}^{(4|4)} \left( -\frac{\Delta}{4m} \right) = \Omega_{I,\star}^{(4|4)}(n,m,\ell), \qquad (4.27)
$$

where *I* is given by (4.16), and substituting (2.13), the mock Jacobi form (4.22) can be
rewritten as

$$
\begin{align}
\psi_p(\tau, z) &= \sum_{n \ge -1} \sum_{\ell \in \mathbb{Z}} \sum_{d|(\ell, d_p)} d \Omega_{1,\star}^{(4|4)} \left( n, \frac{m}{d^2}, \frac{\ell}{d} \right) q^n (-y)^\ell \nonumber \\
&= \sum_{d|d_p} d \sum_{n \ge -1} \sum_{\ell \in d\mathbb{Z}} \Omega_{1,\star}^{(4|4)} \left( n, \frac{m}{d^2}, \frac{\ell}{d} \right) q^n (-y)^\ell \tag{4.28} \\
&= \sum_{d|d_p} d \psi_{m/d^2}^F (\tau, dz). \nonumber
\end{align}
$$

It is clear that this result implies the holomorphic anomaly equation for $\hat{\psi}_p$ which coincides
with the one in (4.26) derived from the formalism based on the refinement.

It is worth emphasizing that the function $\psi_p$ for $d_p > 1$ comprises contributions of
charges with different values of the torsion invariant: the sum over $\ell$ allows us to get all $I$
dividing $d_p$. In this sense $\psi_p$ is very different from the function obtained by expanding the
generating function $Z_I^{(4|4)}$ with a fixed torsion. This difference is the reason why the former
is a mock Jacobi form for the full SL(2, $\mathbb{Z}$) group, whereas the latter transforms properly only under the congruence subgroup $\Gamma^0(I)$. This is a generic feature of our construction in that it automatically produces functions which transform as (mock) modular or Jacobi forms under the full SL(2, $\mathbb{Z}$). It tells us how charges with different torsion should be combined together in order to form objects with nice modular properties. In particular, we expect that generalizing our results for $p^b > 1$, even more sophisticated combinations of BPS indices can be turned into SL(2, $\mathbb{Z}$) modular functions.

# 5 Discussion

In this paper we established a relation between the results encoding modular properties of the generating functions of D4-D2-D0 black holes in $N = 2$ string compactifications, and their refined version, with the corresponding results in compactifications with $N > 2$ extended supersymmetry. Key to this relation is the observation that the refined BPS index $\Omega(\gamma, y)$ coincides with a properly normalized helicity generating function, so that all BPS indices $\Omega^{(N|r)}(\gamma)$ counting $\frac{1}{r}$-BPS states in a theory with $N$ supersymmetries can be obtained from $\Omega(\gamma, y)$ by taking an appropriate number of derivatives with respect to the refinement parameter $y$ and consequently setting it to $y = 1$ (see (3.27)). This allows to extract information about the modular properties of generating functions of $\Omega^{(N|r)}(\gamma)$ from the corresponding generating functions of $\Omega(\gamma, y)$ by providing a direct link between them, and also between the holomorphic anomaly equations satisfied by their completions. In particular, assuming the holomorphic anomaly equation for $\hat{h}_{p,\mu}^{\text{ref}}(\tau, z)$ to have a universal form independent of the number $N$ of extended supersymmetries, one finds easily that in an $N > 2$ theory the unrefined limit of the holomorphic anomaly can be non-trivial only for $r = N$, in which case it receives contributions only from two $\frac{1}{2}$-BPS states.

Next, we tested the predictions of this refined construction approach against known results on counting BPS states in $N = 4$ string theory on $K3 \times T^2$, and found perfect agreement for both half- and quarter-BPS states. More precisely, the generating function for half-BPS states was shown to be uniquely determined by the modular properties predicted for it by the refined counting, whereas for quarter-BPS states this approach accurately reproduced the holomorphic anomaly equation of [3] satisfied by the completion of the generating function of immortal dyons. Finally, we also derived a generalization (4.26) of this equation which comprises contributions of BPS dyons with non-trivial torsion $I(\gamma) > 1$ and demonstrated its consistency with the formula of [26] expressing $\Omega_I^{(4)[4]}$ through the degeneracies for $I = 1$.

In order to appreciate the difference between BPS state counting in $N = 2$ and $N > 2$ theories, it useful to recall that for the latter there exists a description of BPS degeneracies via generating functions that transform as modular objects under the U-duality group of the theory. Furthermore, mock modularity arises when one restricts oneself to counting only a specific class of BPS states such as single centred or immortal black holes. There is no analogous description in the $N = 2$ case. The generating functions obtained in our approach are not invariant under the full U-duality group, as can be seen from the fact
that they require vanishing of the D6-brane charge. Instead, they preserve only a subgroup of the T-duality group and transform generically as mock modular forms under $SL(2, \mathbb{Z})$.

This is where our approach comes into its own. Due to its universality, it naturally produces generating functions which turn out to be modular or mock modular with respect to the full $SL(2, \mathbb{Z})$ group, irrespective of the number $N$ of supersymmetries. In contrast, the naive extension of the counting of $\frac{1}{4}$-BPS states to non-trivial torsion $I > 1$, based on duality invariant generating functions, leads to modular forms under a smaller congruence group $\Gamma^0(I)$ [26]. The modularity under $SL(2, \mathbb{Z})$ is achieved due to a clever combination of contributions with different torsion. It is the formalism explained above that ensures the right combination, which otherwise would have been difficult to arrive at by plain guesswork.

There are natural avenues for extending the results reported here. Firstly, in the $N = 4$ case we imposed a restriction on the charge counting D4-branes wrapped on $K3$, $p^b \le 1$. Although this is enough to reproduce the known counting functions, it would be interesting to relax this restriction. One may expect that the generating functions with $p^b > 1$ provide new examples of non-trivial modular combinations of BPS indices, which might even lead to new interesting mathematical constructions of (vector valued) modular forms.

Secondly, this approach should be tested in other cases where there are known results on counting BPS states. One such possibility is to consider the CHL orbifolds [45, 46] (see [47–49] for the current state of the art of these models). Another option is given by compactification of type II string theory on $T^6$ leading to $N = 8$ supersymmetry, where a plethora of rigorous results (see e.g. [50–53]) furnishes a rich test-ground for the predictions of our approach.

Finally, we have left an important gap in our construction. Namely, due to the non-standard signature of the quadratic form $\kappa_{AB}$ appearing in compactifications with $N > 2$ extended supersymmetry, we did not determine the explicit form of the functions $J_n^{\text{ref}}$ entering the holomorphic anomaly equation in the refined case. This explicit form is not required to get the unrefined limit for $N = 4$, and it is likely that the same is still true for $N = 8$. However, this gap should be filled in order, in particular, to confirm a few mild assumptions we made about $J_n^{\text{ref}}$. This problem also represents an interesting mathematical challenge with the promise of generating new insights into the theory of indefinite theta series, to which string theory has already made important contributions.

## Acknowledgments

The authors are grateful to Gabriel Cardoso, Finn Larsen, Sameer Murthy and Boris Pioline for valuable discussions and correspondence. SN is supported by UIDB/04459/2020.

## A Dualities and charges

In this appendix we describe the interpretation of the charge vector (2.3), defined originally in the heterotic frame, in other frames which can be related to the heterotic one by a chain of duality transformations. Denoting $n$-dimensional cycles of the compactifications manifold
by $X_n$, we will use the following abbreviations:

KK/$X_1$ — momentum state along $X_1$;

F1/$X_1$ — fundamental string wrapped on $X_1$;

Dp/$X_p$ — Dp-brane wrapped on $X_p$;

M2/$X_2$ — M2-brane wrapped on $X_2$;

M5/$X_5$ — M5-brane wrapped on $X_5$;

NS5/$X_5$ — NS5-brane wrapped on $X_5$;

KKM$\to X_1$ — Kaluza-Klein monopole localized in $X_1$;

$(E_9 \oplus E_8)_{e/m}$ — electric or magnetic charges with respect to the gauge fields of the ten-dimensional heterotic theory.

In the heterotic frame, the compactification manifold is $T^6$ which we decompose as $T^3 \times \tilde{T}^3$. We denote one-dimensional cycles lying inside $T^3$ and $\tilde{T}^3$ by $S_r^1$ and $\tilde{S}_r^1$ with $r = 1, 2, 3$, respectively, and five-dimensional cycles by $T_r^5$ and $\tilde{T}_r^5$ such that $T_r^5 \times S_r = \tilde{T}_r^5 \times \tilde{S}_r^1 = T^6$. Then the charge components have the following interpretation

$$ \gamma = \begin{pmatrix} \text{KK}/S_1^1, & \text{1F}/S_1^1, & \dots, & \text{KK}/\tilde{S}_1^1, & \text{1F}/\tilde{S}_1^1, & \dots, & (E_8 \oplus E_8)_e \\ \text{NS5}/T_1^5, & \text{KKM} \to S_1^1, & \dots, & \text{NS5}/\tilde{T}_1^5, & \text{KKM} \to \tilde{T}_1^5, & \dots, & (E_8 \oplus E_8)_m \end{pmatrix}, \quad (A.1) $$

where dots denote similar entries with $r = 2, 3$. The same theory can be viewed as M-theory compactified on $K3 \times T^3$. From this point of view, the charge components are now interpreted as

$$ \gamma = \begin{pmatrix} \text{KK}/S_1^1, & \text{M5/K3} \times S_1^1, & \dots, & \text{M2}/\gamma^i \\ \text{M2}/S_2^1 \times S_3^1, & \text{KKM} \to S_1^1, & \dots, & \text{M5}/\gamma^i \times T^3 \end{pmatrix}, \quad (A.2) $$

where $\gamma^i$, $i = 1, \dots, 22$, are 2-cycles of $K3$. Let us now do reduction along $S_1^1$ to the type IIA string theory on $K3 \times T^2$. Then the charge becomes

$$ \gamma = \begin{pmatrix} \text{D0}, & \text{D4/K3}, & \text{KK}/S_2^1, \text{NS5/K3} \times S_2^1, \text{KK}/S_3^1, \text{NS5/K3} \times S_3^1, & \text{D2}/\gamma^i \\ \text{D2}/T^2, & \text{D6/K3} \times T^2, & \text{F1}/S_3^1, & \text{KKM} \to S_1^1, & \text{F1}/S_2^1, & \text{KKM} \to S_3^1, & \text{D4}/\gamma^i \times T^2 \end{pmatrix}. \quad (A.3) $$

This is precisely the charge vector (2.14) where it is written in terms of notations introduced in the beginning of section 2.1. The minus sign in front of $p^b$ originates in the symplectic transformation relating the type IIA and the heterotic frames [54].

It is instructive also to establish connection with D5-D1-KK system widely used in [3] and other studies of string theory on $K3 \times T^2$. To this end, let us return to the M-theory picture represented by the charge (A.2) and reduce it instead along $S_3^1$. This gives another type IIA formulation compactified on $K3 \times \tilde{T}^2$ with $\tilde{T}^2 = S_1^1 \times S_2^1$ and the corresponding charge is

$$ \gamma = \begin{pmatrix} \text{KK}/S_1^1, \text{NS5/K3} \times S_1^1, \text{KK}/S_2^1, \text{NS5/K3} \times S_2^1, & \text{D0}, & \text{D4/K3}, & \text{D2}/\gamma^i \\ \text{F1}/S_2^1, & \text{KKM} \to S_1^1, & \text{F1}/S_1^1, & \text{KKM} \to S_2^1, & \text{D2}/\tilde{T}^2, & \text{D6/K3} \times \tilde{T}^2, & \text{D4}/\gamma^i \times \tilde{T}^2 \end{pmatrix}. \quad (A.4) $$

Finally, we apply T-duality along $S_2^1$ which maps to the type IIB frame and leads to the following interpretation of the charge vector

$$ \gamma = \begin{pmatrix} \text{KK}/S_1^1, & \text{KKM} \to S_2^1, & \text{F1}/S_2^1, & \text{NS5/K3} \times S_2^1, & \text{D1}/S_2^1, & \text{D5/K3} \times S_2^1, & \text{D3}/\gamma^i \times S_2^1 \\ \text{KK}/S_2^1, & \text{KKM} \to S_1^1, & \text{F1}/S_1^1, & \text{NS5/K3} \times S_1^1, & \text{D1}/S_1^1, & \text{D5/K3} \times S_1^1, & \text{D4}/\gamma^i \times S_1^1 \end{pmatrix}. \quad (A.5) $$
Comparing (A.5) with (A.3), one observes that switching on KK momentum localized in $S_2^1$ and D1, D5-brane charges associated to $S_1^1$, as in [3], corresponds to having non-vanishing $p^\mu$ and $p^2$ in (2.14), which were precisely our conditions on the charge of a $\frac{1}{4}$-BPS state.

It may also be useful to note that this chain of dualities maps D1 and D5 charges to NS charges in (A.3). If one wishes to map them to D-brane charges, one can perform before the last step a mirror symmetry on K3, which effectively reduces to T-duality on one of its 2-cycles, say $\gamma^1$. This intermediate step would result in exchanging the 5th and 6th columns in (A.5) with two columns in the last entry corresponding to $\gamma^1$ and its dual cycle $\gamma^2$ in the sense that $\gamma^1 \cap \gamma^2 = 1$.

## B Modular transformations

In this appendix we collect transformation properties of various modular objects appearing in the main text.

First of all, let us recall the definition of a vector valued Jacobi form of weight $w$ and index $m$ [55]. This is a finite set of functions $\phi_\mu(\tau, z)$ with $\tau \in \mathbb{H}$, $z \in \mathbb{C}$ labelled by $\mu$ such that

$$ \phi_{\mu}(\tau, z + k\tau + \ell) = e^{-2\pi i m(k^2\tau + 2kz)} \phi_{\mu}(\tau, z), \\ \phi_{\mu}\left(\frac{a\tau + b}{c\tau + d}, \frac{z}{c\tau + d}\right) = (c\tau + d)^w e^{\frac{2\pi i mcz^2}{c\tau + d}} \sum_{\nu} M_{\mu\nu}(\rho) \phi_{\nu}(\tau, z), \qquad (B.1) $$

where $\rho = (a \ b \ c \ d) \in \text{SL}(2, \mathbb{Z})$ and we allowed for a non-trivial multiplier system $M_{\mu\nu}(\rho)$. Similarly, the transformations of a vector valued modular form $\phi_\mu(\tau)$ can be obtained from (B.1) by setting $z = m = 0$ and thus they are completely specified by weight $w$ and multiplier system $M_{\mu\nu}(\rho)$. Since $M_{\mu\nu}(\rho)$ must furnish a representation of the group and $\text{SL}(2, \mathbb{Z})$ is generated by two transformations, $T = (\frac{1}{0} \ \frac{1}{1})$ and $S = (\frac{0}{1} \ \frac{-1}{0})$, to define the multiplier system, it is enough to specify it for $\rho = T$ and $S$. Thus, below to characterize the modular behaviour of an object, we will provide $w$, $M_{\mu\nu}(T)$, $M_{\mu\nu}(S)$ and, if necessary, $m$.

* The completions $\hat{h}_{p,\mu}^{\text{ref}}(\tau, z)$ of the generating functions of refined BPS indices are vector valued Jacobi forms of weight $w_{\text{ref}}$, index $m_{\text{ref}}(p)$ and the multiplier system

$$ M_{\mu\nu}(T) = \delta_{\mu\nu} e^{\pi i (\frac{1}{12} c_{2,a} p^a + (\mu + \frac{1}{2} p)^2)}, \\ M_{\mu\nu}(S) = \frac{(-i)^{w_{\text{ref}}+1}}{\sqrt{|\Lambda^*|/\Lambda|}} e^{-2\pi i (\frac{1}{4} p^3 + \frac{1}{8} c_{2,a} p^a)} e^{-2\pi i \mu \cdot \nu}, \qquad (B.2) $$

where $\mu \cdot \nu = \kappa^{AB}\mu_A\nu_B$ is determined by the quadratic form of the non-degenerate part of the lattice of electric charges, which can be defined as $\Lambda = \{\epsilon^A \in \mathbb{Z} : \lambda_s^A \epsilon_A = 0\}$. In the $\mathcal{N} = 2$ case, $\Lambda = H_4(\mathbb{Z}, \mathbb{Z})$ and the quadratic form coincides with $\kappa_{ab}$.

* The completions $\hat{h}_{p,\mu}^{(\mathcal{N}|r)}(\tau)$ of the generating functions of unrefined BPS indices are vector valued modular forms of weight (3.37) and the same multiplier system as in (B.2). Let us make it explicit for $(\mathcal{N}|r) = (4|4)$ specified by the charge (4.3) with
$p^b = 1$. In this case, the quadratic form is given in (4.12), $p^3 = 6m$, $c_{2,a}p^a = 24$, $w_{\text{ref}} = -27/2$ and $\mu = \mu(\ell) = (m - \ell, 0, \dots, 0)$. Substituting these data into (B.2), one obtains

$$M_{\mu(k)\mu(\ell)}(T) = \delta_{k\ell} e^{-\frac{\pi i}{2m} \ell^2}, \qquad M_{\mu(k)\mu(\ell)}(S) = \frac{(-1)^{\ell+k}}{\sqrt{-2mi}} e^{\frac{\pi i}{m} k\ell}. \qquad (B.3)$$

* The theta series $\theta_{m,\ell}(\tau, z)$ (2.19) is a vector valued Jacobi form of weight 1/2, index $m$ and the multiplier system

$$M_{k\ell}(T) = \delta_{k\ell} e^{\frac{\pi i}{2m} \ell^2}, \qquad M_{k\ell}(S) = \frac{e^{-\frac{\pi i}{m} k\ell}}{\sqrt{2mi}}. \qquad (B.4)$$

## C Attractor equations and electric charges

In this appendix we analyze the attractor equations in the large volume limit and will be particularly interested in the case where the quadratic form defined by the classical part of the prepotential is degenerate. The attractor equations are the equations of motion of the low-energy effective action restricted to BPS black hole near-horizon backgrounds [56]. They allow to fix the values of scalar fields at the black hole horizon in terms of charges and can easily be formulated in terms of the prepotential $F(X)$ as

$$\mathrm{Im} X^I = p^I, \qquad \mathrm{Im} \partial_{X^I} F = q_I. \qquad (C.1)$$

The full quantum prepotential can be formally written in a perturbative world-sheet genus expansion with order $g$ term captured in terms of a genus-$g$ topological string amplitude

$$F(X) = \sum_{g=0}^{\infty} g_{\text{top}}^{2g-2} F_g(z), \qquad (C.2)$$

where $g_{\text{top}} = 1/X^0$ and $z^A = X^A/X^0$. In the large volume limit $t^A = \mathrm{Im} z^A \gg 1$, the leading term in the prepotential is holomorphic and has a universal form

$$F_0(z) = -\frac{1}{6} \kappa_{ABC} z^A z^B z^C + O(e^{-z}), \qquad (C.3)$$

where the exponentially suppressed contributions correspond to worldsheet instantons. Sometimes, the prepotential also contains contributions quadratic and linear in $z^A$, but they can be removed by a symplectic transformation (see footnote 8). In contrast, the first subleading term $F_1$ satisfies a holomorphic anomaly equation. Its solution can be found explicitly and in the large volume limit it asymptotes to a linear term (see e.g. [57])

$$F_1(z) \rightarrow a_A z^A + O(e^{-z}), \qquad (C.4)$$

where $a_A$ are real and depend on the second Chern class of the underlying CY. The higher $F_g$ are exponentially suppressed in $t^A$ and so are their derivatives with respect to $z^A$. Due to this, the generic prepotential in the large volume limit reduces to

$$F^{\text{lv}}(X) = -\kappa_{ABC} \frac{X^A X^B X^C}{6X^0} + a_A \frac{X^A}{X_0}. \qquad (C.5)$$
Let us now turn to the attractor equations. To ensure the large volume limit, we choose the electro-magnetic charge to be

$$ \gamma = \left( 0, \lambda p^A, \lambda q_A, \lambda^3 \hat{q}_0 + \frac{\lambda}{2} \kappa^{AB} q_A q_B \right), \qquad (C.6) $$

where we set D6-brane charge to zero, as everywhere in the paper, and take the parameter $\lambda$ to be large. In the case of degenerate $\kappa_{AB} = \kappa_{ABCP} p^C$, the inverse $\kappa^{AB}$ is defined as below (3.31). The first attractor equation in (C.1) is solved by

$$ X^0 \in \mathbb{R}, \quad X^A = \phi^A + i\lambda p^A, \quad \phi^A \in \mathbb{R}. \qquad (C.7) $$

Substituting this solution into the second set of equations, one finds

$$ q_A \approx -\frac{1}{2\lambda X^0} \operatorname{Im}(\kappa_{ABC} X^B X^C - 2a_A) = -\frac{1}{X^0} \kappa_{AB} \phi^B, \qquad (C.8) $$

$$ \begin{aligned} \hat{q}_0 & \approx \frac{1}{6\lambda^3(X^0)^2} \operatorname{Im}(\kappa_{ABC} X^A X^B X^C - 6a_A X^A) - \frac{1}{2\lambda^2} \kappa^{AB} q_A q_B \\ & = -\frac{1}{6\lambda^2(X^0)^2} (\lambda^2 p^3 + 6a_A p^A). \end{aligned} \qquad (C.9) $$

As a result, the attractor equations are solved by

$$ \begin{aligned} X^0 &= \left( \frac{p^3 + 6\lambda^{-2}a_A p^A}{-6\hat{q}_0} \right)^{1/2}, & (C.10) \\ X^A &= -X^0 \kappa^{AB} q_B + i\lambda p^A. \end{aligned} $$

In particular, for $p^3 > 0$, $X^0 \sim \text{const}$ and one reproduces the large volume attractor point (3.4) for the moduli $z^A = X^A/X^0$ up to a redefinition of the scaling parameter and replacement $\kappa^{ab} \to \kappa^{AB}$. On the other hand, if $p^3 = 0$, while the solution is still non-degenerate due to taking into account the one-loop correction $a_A$, the scaling is different leading to $X^0 \sim \lambda^{-1}$. However, the solution for the moduli $z^A$ is still consistent with (3.4) upon redefinition $\lambda^2 \to \lambda$.<fnref n="12" />

Most importantly, the attractor equation (C.8) shows that if the quadratic form $\kappa_{AB}$ is degenerate, a solution exists only if the electric charges satisfy certain constraints. Namely, if $\lambda_s^A$ is a set of vectors such that $\kappa_{AB} \lambda_s^B = 0$, then the existence of solution requires

$$ \lambda_s^A q_A = 0. \qquad (C.11) $$

If this is the case, eq. (C.10) with $\kappa^{AB}$ defined as below (3.31) provides the corresponding solution.

**Open Access.** This article is distributed under the terms of the Creative Commons Attribution License (CC-BY 4.0), which permits any use, distribution and reproduction in any medium, provided the original author(s) and source are credited.

<footnote n="12">¹²Alternatively, in this case one can choose to scale $\hat{q}_0$ in (C.6) as $\lambda$, which would result in $X^0 \sim \text{const}$ and $z^A$ given in (3.4).</footnote>
References

[1] S. Zwegers, *Mock theta functions*, Ph.D. dissertation, Utrecht University, Utrecht The Netherlands (2002).

[2] D. Zagier, *Ramanujan's mock theta functions and their applications (after Zwegers and Ono-Bringmann)*, *Astérisque* **326** (2009).

[3] A. Dabholkar, S. Murthy and D. Zagier, *Quantum black holes, wall crossing, and mock modular forms*, arXiv:1208.4074 [insPIRE].

[4] S. Alexandrov, S. Banerjee, J. Manschot and B. Pioline, *Multiple D3-instantons and mock modular forms I*, Commun. Math. Phys. **353** (2017) 379 [arXiv:1605.05945] [insPIRE].

[5] S. Alexandrov and B. Pioline, *Black holes and higher depth mock modular forms*, Commun. Math. Phys. **374** (2019) 549 [arXiv:1808.08479] [insPIRE].

[6] C. Vafa and E. Witten, *A strong coupling test of S duality*, Nucl. Phys. B **431** (1994) 3 [hep-th/9408074] [insPIRE].

[7] A. Dabholkar, P. Putrov and E. Witten, *Duality and mock modularity*, SciPost Phys. **9** (2020) 072 [arXiv:2004.14387] [insPIRE].

[8] G. Korpas and J. Manschot, *Donaldson-Witten theory and indefinite theta functions*, JHEP **11** (2017) 083 [arXiv:1707.06235] [insPIRE].

[9] G. Korpas, J. Manschot, G.W. Moore and I. Nidaiev, *Mocking the u-plane integral*, arXiv:1910.13410 [insPIRE].

[10] M.C.N. Cheng and J.F.R. Duncan, *On Rademacher sums, the largest Mathieu group, and the holographic modularity of Moonshine*, Commun. Num. Theor. Phys. **6** (2012) 697 [arXiv:1110.3859] [insPIRE].

[11] S. Alexandrov, J. Manschot and B. Pioline, *S-duality and refined BPS indices*, Commun. Math. Phys. **380** (2020) 755 [arXiv:1910.03098] [insPIRE].

[12] M. Kontsevich and Y. Soibelman, *Stability structures, motivic Donaldson-Thomas invariants and cluster transformations*, arXiv:0811.2435 [insPIRE].

[13] T. Dimofte and S. Gukov, *Refined, motivic, and quantum*, Lett. Math. Phys. **91** (2010) 1 [arXiv:0904.1420] [insPIRE].

[14] J. Manschot, B. Pioline and A. Sen, *Wall crossing from Boltzmann black hole halos*, JHEP **07** (2011) 059 [arXiv:1011.1258] [insPIRE].

[15] S. Alexandrov, *Vafa-Witten invariants from modular anomaly*, Commun. Num. Theor. Phys. **15** (2021) 149 [arXiv:2005.03680] [insPIRE].

[16] S. Alexandrov, *Rank N Vafa-Witten invariants, modularity and blow-up*, arXiv:2006.10074 [insPIRE].

[17] R. Dijkgraaf, E.P. Verlinde and H.L. Verlinde, *Counting dyons in $N = 4$ string theory*, Nucl. Phys. B **484** (1997) 543 [hep-th/9607026] [insPIRE].

[18] E. Kiritsis, *Introduction to nonperturbative string theory*, AIP Conf. Proc. **419** (1998) 265 [hep-th/9708130] [insPIRE].

[19] C.M. Hull and P.K. Townsend, *Unity of superstring dualities*, Nucl. Phys. B **438** (1995) 109 [hep-th/9410167] [insPIRE].
[20] A. Dabholkar, D. Gaiotto and S. Nampuri, Comments on the spectrum of CHL dyons, JHEP 01 (2008) 023 [hep-th/0702150] [INSPIRE].

[21] S. Banerjee and A. Sen, Duality orbits, dyon spectrum and gauge theory limit of heterotic string theory on $T^6$, JHEP 03 (2008) 022 [arXiv:0712.0043] [INSPIRE].

[22] S. Banerjee and A. Sen, S-duality action on discrete T-duality invariants, JHEP 04 (2008) 012 [arXiv:0801.0149] [INSPIRE].

[23] A. Dabholkar and J.A. Harvey, Nonrenormalization of the superstring tension, Phys. Rev. Lett. 63 (1989) 478 [INSPIRE].

[24] D. Shih, A. Strominger and X. Yin, Recounting Dyons in $N = 4$ string theory, JHEP 10 (2006) 087 [hep-th/0505094] [INSPIRE].

[25] D. Gaiotto, A. Strominger and X. Yin, New connections between 4D and 5-D black holes, JHEP 02 (2006) 024 [hep-th/0503217] [INSPIRE].

[26] A. Dabholkar, J. Gomes and S. Murthy, Counting all dyons in $N = 4$ string theory, JHEP 05 (2011) 059 [arXiv:0803.2692] [INSPIRE].

[27] A. Dabholkar, M. Guica, S. Murthy and S. Nampuri, No entropy enigmas for $N = 4$ dyons, JHEP 06 (2010) 007 [arXiv:0903.2481] [INSPIRE].

[28] A. Sen, Walls of marginal stability and Dyon spectrum in $N = 4$ supersymmetric string theories, JHEP 05 (2007) 039 [hep-th/0702141] [INSPIRE].

[29] M.C.N. Cheng and E. Verlinde, Dying dyons don't count, JHEP 09 (2007) 070 [arXiv:0706.2363] [INSPIRE].

[30] A. Dabholkar, F. Denef, G.W. Moore and B. Pioline, Precision counting of small black holes, JHEP 10 (2005) 096 [hep-th/0507014] [INSPIRE].

[31] S. Alexandrov, B. Pioline, F. Saueressig and S. Vandoren, D-instantons and twistors, JHEP 03 (2009) 044 [arXiv:0812.4219] [INSPIRE].

[32] S. Alexandrov, D-instantons and twistors: Some exact results, J. Phys. A 42 (2009) 335402 [arXiv:0902.2761] [INSPIRE].

[33] S. Alexandrov, Twistor approach to string compactifications: a review, Phys. Rept. 522 (2013) 1 [arXiv:1111.2892] [INSPIRE].

[34] S. Alexandrov, D. Persson and B. Pioline, Fivebrane instantons, topological wave functions and hypermultiplet moduli spaces, JHEP 03 (2011) 111 [arXiv:1010.5792] [INSPIRE].

[35] S. Alexandrov and S. Banerjee, Fivebrane instantons in Calabi-Yau compactifications, Phys. Rev. D 90 (2014) 041902 [arXiv:1403.1265] [INSPIRE].

[36] S. Alexandrov and S. Banerjee, Dualities and fivebrane instantons, JHEP 11 (2014) 040 [arXiv:1405.0291] [INSPIRE].

[37] F. Denef, Supergravity flows and D-brane stability, JHEP 08 (2000) 050 [hep-th/0005049] [INSPIRE].

[38] S. Alexandrov and B. Pioline, Attractor flow trees, BPS indices and quivers, Adv. Theor. Math. Phys. 23 (2019) 627 [arXiv:1804.06928] [INSPIRE].

[39] F. Denef and G.W. Moore, Split states, entropy enigmas, holes and halos, JHEP 11 (2011) 129 [hep-th/0702146] [INSPIRE].
[40] I. Bena, M. Berkooz, J. de Boer, S. El-Showk and D. Van den Bleeken, Scaling BPS solutions and pure-Higgs states, JHEP 11 (2012) 171 [arXiv:1205.5023] [INSPIRE].

[41] S. Alexandrov, S. Banerjee, J. Manschot and B. Pioline, Indefinite theta series and generalized error functions, Selecta Math. 24 (2018) 3927 [arXiv:1606.05495] [INSPIRE].

[42] C. Nazaroglu, r-tuple error functions and indefinite theta series of higher-depth, Commun. Num. Theor. Phys. 12 (2018) 581 [arXiv:1609.01224] [INSPIRE].

[43] M. Cvetič and C.M. Hull, Black holes and U duality, Nucl. Phys. B 480 (1996) 296 [hep-th/9606193] [INSPIRE].

[44] P. Kraus and F. Larsen, Partition functions and elliptic genera from supergravity, JHEP 01 (2007) 002 [hep-th/0607138] [INSPIRE].

[45] S. Chaudhuri, G. Hockney and J.D. Lykken, Maximally supersymmetric string theories in $D < 10$, Phys. Rev. Lett. 75 (1995) 2264 [hep-th/9505054] [INSPIRE].

[46] A. Dabholkar and D. Gaiotto, Spectrum of CHL dyons from genus-two partition function, JHEP 12 (2007) 087 [hep-th/0612011] [INSPIRE].

[47] G. Bossard, C. Cosnier-Horeau and B. Pioline, Exact effective interactions and 1/4-BPS dyons in heterotic CHL orbifolds, SciPost Phys. 7 (2019) 028 [arXiv:1806.03330] [INSPIRE].

[48] F. Fischbach, A. Klemm and C. Nega, Lost chapters in CHL black holes: untwisted quarter-BPS dyons in the $\mathbb{Z}_2$ model, arXiv:2005.07712 [INSPIRE].

[49] G.L. Cardoso, S. Nampuri and M. Rosselló, Arithmetic of decay walls through continued fractions: a new exact dyon counting solution in $N = 4$ CHL models, arXiv:2007.10302 [INSPIRE].

[50] D. Shih, A. Strominger and X. Yin, Counting dyons in $N = 8$ string theory, JHEP 06 (2006) 037 [hep-th/0506151] [INSPIRE].

[51] B. Pioline, BPS black hole degeneracies and minimal automorphic representations, JHEP 08 (2005) 071 [hep-th/0506228] [INSPIRE].

[52] A. Sen, $N = 8$ dyon partition function and walls of marginal stability, JHEP 07 (2008) 118 [arXiv:0803.1014] [INSPIRE].

[53] A. Sen, U-duality invariant dyon spectrum in type-II on $T^6$, JHEP 08 (2008) 037 [arXiv:0804.0651] [INSPIRE].

[54] A. Ceresole, R. D'Auria, S. Ferrara and A. Van Proeyen, Duality transformations in supersymmetric Yang-Mills theories coupled to supergravity, Nucl. Phys. B 444 (1995) 92 [hep-th/9502072] [INSPIRE].

[55] M. Eichler and D. Zagier, The theory of Jacobi forms, Progress in Mathematics volume 55, Birkhäuser, Boston Inc., U.S.A. (1985).

[56] S. Ferrara, R. Kallosh and A. Strominger, $N = 2$ extremal black holes, Phys. Rev. D 52 (1995) 5412 [hep-th/9508072] [INSPIRE].

[57] M.-x. Huang, S. Katz and A. Klemm, Topological string on elliptic CY 3-folds and the ring of Jacobi forms, JHEP 10 (2015) 125 [arXiv:1501.04891] [INSPIRE].