\section{#1}\setcounter{equation}{0}}
\newcommand{\subsectiono}[1]{\subsection{#1}\setcounter{equation}{0}}

\def{\hbox{ 1\kern-.8mm l}}{{\hbox{ 1\kern-.8mm l}}}
\def{\hbox{ 0\kern-1.5mm 0}}{{\hbox{ 0\kern-1.5mm 0}}}

\def{\wh a}{{\widehat a}}
\def{\wh b}{{\widehat b}}
\def{\wh c}{{\widehat c}}
\def{\wh d}{{\widehat d}}

\renewcommand{\theequation}{\thesection.\arabic{equation}}

\begin{document}

\baselineskip 24pt

\begin{center}
{\Large \bf
Generalities of Quarter BPS Dyon Partition Function and
Dyons of Torsion Two}

\end{center}

\vskip .6cm
\medskip

\vspace*{4.0ex}

\baselineskip=18pt

\centerline{\large \rm  Shamik Banerjee,  Ashoke Sen
and Yogesh K. Srivastava}

\vspace*{4.0ex}

\centerline{\large \it Harish-Chandra Research Institute}

\centerline{\large \it  Chhatnag Road, Jhusi,
Allahabad 211019, INDIA}

\vspace*{1.0ex}
\centerline{E-mail:  bshamik, sen, yogesh@mri.ernet.in}

\vspace*{5.0ex}

\centerline{\bf Abstract} \bigskip

We propose a general set of constraints on the partition function
of quarter BPS dyons in any ${\cal N}=4$ supersymmetric string theory
by drawing insight from known examples, and study the consequences
of this proposal. The  main ingredients of our analysis are
duality symmetries, wall crossing formula and black hole
entropy. We use our analysis to
constrain the dyon partition function for two hitherto unknown
cases -- the partition function of dyons of torsion
two (\i.e. gcd($Q\wedge P$)=2) in heterotic
string theory on $T^6$ and the partition function of dyons carrying
untwisted sector electric charge in ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL model.
With the help of these constraints we propose a candidate for
the partition function of dyons of torsion two in
heterotic string theory on $T^6$. This leads to a novel wall
crossing formula for decay of quarter BPS dyons into half BPS
dyons with non-primitive charge vectors. In an appropriate
limit the proposed formula reproduces the known result
for the spectrum of torsion two dyons in gauge theory.

\vfill \eject

\baselineskip=18pt

\tableofcontents

\sectiono{Introduction and summary} \label{s1}

The partition function of quarter BPS dyons is now known in
a variety of ${\cal N}=4$ supersymmetric string
theories\cite{9607026,0412287,0505094,
0506249,0508174,0510147,0602254,
0603066,0605210,0607155,0609109,0612011,0702141,
0702150,0705.1433,0705.3874,0706.2363,0708.1270}.
Generalization of these results to a class of ${\cal N}=2$ supersymmetric
string theories have also been proposed\cite{0711.1971}.
Our goal in this paper is to draw
insight from these known results to postulate the general structure
of dyon partition function for any class of quarter BPS dyons
in any ${\cal N}=4$ supersymmetric string
theory.

The results of our analysis can be summarized as
follows.
\begin{enumerate}
\item {\bf Definition of the partition function:}
Let $(Q,P)$ denote the electric and magnetic charges carried
by a dyon, and $Q^2$, $P^2$ and $Q\cdot P$ be the T-duality
invariant quadratic forms constructed from these
charges.\footnote{Irrespective of what description we are using,
we shall denote by S-duality transformation the symmetry that acts
on the complex scalar belonging to the gravity multiplet. In heterotic
string compactification this would correspond to the axion-dilaton
modulus. On the other hand T-duality will denote the symmetry that
acts on the matter multiplet scalars. In the heterotic description
these scalars arise from the components of the metric, anti-symmetric
tensor fields and gauge fields along the compact directions.}
In order to define the dyon partition function we first need
to identify a suitable infinite
subset ${\cal B}$ of dyons in the theory with the
property that if we have two pairs of charges $(Q,P)\in{\cal B}$
and $(Q',P')\in{\cal B}$
with $Q^2=Q^{\prime2}$, $P^2=P^{\prime2}$ and $Q\cdot P
=Q'\cdot P'$, then they must be related by a
T-duality transformation. Furthermore given a pair of charge vectors
$(Q,P)\in{\cal B}$, all other pairs of
charge vectors related to it by
T-duality should be elements of the set ${\cal B}$.
We shall generate such a set ${\cal B}$ by beginning with a family
${\cal A}$ of charge vectors $(Q,P)$ labelled by three integers
such that $Q^2$, $P^2$ and $Q\cdot P$ are independent linear
functions of these three integers, and then define ${\cal B}$ to be
the set of all $(Q,P)$ which are in the T-duality orbit of
the set ${\cal A}$.
We denote by $d(Q,P)$ the degeneracy, -- or more
precisely an index measuring the number of bosonic supermultiplets
minus  the
number of fermionic supermultiplets -- of quarter BPS
dyons of charge $(Q,P)$.
Since $d(Q,P)$
should be invariant under
a T-duality transformation,  for $(Q,P)\in{\cal B}$
it should depend on $(Q,P)$ only
via the T-duality invariant combinations $Q^2$, $P^2$ and
$Q\cdot P$:
\begin{equation} \label{ei1}
d(Q,P) = f(Q^2, P^2, Q\cdot P)\, .
\end{equation}
Note that for \refb{ei1} to hold it is necessary to choose ${\cal B}$ in
the way we have described. In particular if ${\cal B}$
had contained two elements with same
$Q^2$, $P^2$ and $Q\cdot P$ but not related by a T-duality
transformation, then $d(Q,P)$ can be different for these two
elements and \refb{ei1} will not hold. Even when
${\cal B}$ is chosen according to the prescription given
above, eq.\refb{ei1} cannot be strictly correct since $d(Q,P)$
could depend on the asymptotic moduli besides the charges and one
can construct more general T-duality invariants using these
moduli and the charges. Indeed,
even though the index is not expected to change under
a continuous change in the moduli, it could jump across the walls
of marginal stability giving $d(Q,P)$ a dependence on the moduli.
The reason that we can still write eq.\refb{ei1}
is that
it is possible to label the
different domains bounded by the walls of marginal stability
by a set of discrete parameters $\vec c$ such
that T-duality transformation does not change the
parameters $\vec c$\cite{0702141,0708.1270,0801.0149}.
Physically, if a domain is bounded by $n$ walls of marginal
stability, with the $i$th wall associated with the decay
$(Q,P)\to (\alpha_i Q+\beta_i P, \gamma_i Q+\delta_i P)
+ ((1-\alpha_i) Q-\beta_i P, -\gamma_i Q+(1-\delta_i) P)$,
then $\vec c$ is the collection of the numbers $\{(\alpha_i,
\beta_i,\gamma_i,\delta_i); \, 1\le i\le n\}$.
Due to T-duality invariance of
$\vec c$,
$d(Q,P)$ inside a given domain labelled by
$\vec c$ will be invariant under a T-duality transformation on
the charges only and will have
the form \refb{ei1}. For different $\vec c$ the function $f$
will be different, \i.e.\ $f$ has a hidden $\vec c$
dependence. We now define the dyon partition function associated
with the set ${\cal B}$ to be\footnote{For ${\cal N}=4$
supersymmetric ${\hbox{ Z\kern-1.6mm Z}}_N$
orbifolds reviewed in \cite{0708.1270}
the function $\check\Phi$ is related to
the function $\widetilde\Phi$ of \cite{0708.1270} by the relation
$\check\Phi(\check\rho,\check\sigma,\check v) = \widetilde\Phi(\widetilde\rho,\widetilde\sigma,\widetilde v)$ with
$(\widetilde\rho,\widetilde\sigma,\widetilde v)=(\check\sigma/N, N\check\rho, \check v)$.}
\begin{equation}\label{ei2}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)}
\equiv \sum_{Q^2, P^2, Q\cdot P}\,
(-1)^{Q\cdot P+1}\, f(Q^2,P^2, Q\cdot P)
e^{i\pi (\check\sigma Q^2 + \check\rho P^2
+ 2 \check v Q\cdot P)}\, ,
\end{equation}
where the sum runs over all the distinct triplets
$(Q^2,P^2,Q\cdot P)$ which are present in the set ${\cal B}$. This
relation can be inverted as
\begin{equation} \label{ei3}
f(Q^2,P^2, Q\cdot P)
\propto (-1)^{Q\cdot P+1} \int_{\cal C}
 d\check\rho
d\check\sigma  d\check v \,
e^{-i\pi (\check\sigma Q^2 + \check\rho P^2
+ 2 \check v Q\cdot P)} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, ,
\end{equation}
where ${\cal C}$ denotes an appropriate three dimensional subspace
of the complex $(\check\rho,\check\sigma,\check v)$ space. Along the `contour'
${\cal C}$ the imaginary parts of $\check\rho$, $\check\sigma$ and $\check v$ are fixed at
values where the sum in \refb{ei2}
converges, and the real parts of $\check\rho$, $\check\sigma$ and $\check v$ vary over
an appropriate unit cell determined by the quantization laws of
$Q^2$, $P^2$ and $Q\cdot P$ inside the set ${\cal B}$.

In all known cases the function $f$ in different domains $\vec c$
is given by \refb{ei3} with identical integrand, but the
integration contour ${\cal C}$ depends on the choice of $\vec c$.
Put another way, the same function $1/\check\Phi(\check\rho,\check\sigma,\check v)$ admits
different Fourier expansion in different regions in the complex
$(\check\rho,\check\sigma,\check v)$ space, since a Fourier expansion that is
convergent in one region may not be convergent in another
region. The coefficients of expansion in these different regions in
the complex $(\check\rho,\check\sigma,\check v)$ plane may then be regarded as
the index $f(Q^2,P^2, Q\cdot P)$ in different domains
in the asymptotic moduli space labelled by $\vec c$.
We shall assume that {\it this result holds for all sets of dyons
in all ${\cal N}=4$ string theories.}

\item {\bf Consequences of S-duality symmetry:}
We now consider the effect of an S-duality transformation
on the set ${\cal B}$. A generic S-duality transformation will take
an element of ${\cal B}$ to outside ${\cal B}$, -- we denote by
$H$ the subgroup of the S-duality group that leaves ${\cal B}$
invariant. This is the subgroup relevant for constraining the dyon
partition function associated with the set ${\cal B}$. Since a
generic element of $H$ takes us from one domain bounded by walls
of marginal stability to another such domain,
it relates the function $f$ for one choice of $\vec c$ to the function
$f$ for another choice of $\vec c$.
However since we have assumed that
the dyon partition function $1/\check\Phi$ is independent
of the domain label $\vec c$, we can use invariance under $H$
to constrain the form of $\check\Phi$.  In particular one finds that
an S-duality symmetry of the form $(Q,P)\to (aQ+bP,cQ+dP)$
with $\pmatrix{a & b\cr c & d}\in H$ gives the following constraint
on $\check\Phi$:
\begin{equation} \label{ei4}
\check\Phi(\check\rho,\check\sigma,\check v) = \check\Phi(d^2 \check\rho+ b^2 \check\sigma + 2 bd \check v,
c^2 \check\rho + a^2 \check\sigma + 2 ac \check v,cd \check\rho+ ab \check\sigma + (ad+bc) \check v)\, .
\end{equation}
Defining
\begin{equation} \label{ei5}
\check\Omega=\pmatrix{\check\rho & \check v\cr \check v & \check\sigma} \, ,
\end{equation}
we can express \refb{ei4} as
\begin{equation} \label{ei6}
\check\Phi((A\check\Omega+B)(C\check\Omega +D)^{-1})
= (\det(C\check\Omega +D))^k \, \check\Phi(\Omega)\, ,
\end{equation}
where
\begin{equation} \label{ei7}
\pmatrix{A & B\cr C & D}
=  \pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}\, ,
\end{equation}
and $k$ is as yet undermined since $\det(C\Omega+D)=1$.

Besides this symmetry, quantization of $Q^2$, $P^2$
and $Q\cdot P$ within the set ${\cal B}$
also gives rise to some translational
symmetries of $\check\Phi$ of the form
$\check\Phi(\check\rho,\check\sigma,\check v)=\check\Phi(\check\rho+a_1,\check\sigma+a_2,\check v+a_3)$
with $a_1$, $a_2$, $a_3$ taking values in an appropriate set.
These can also be expressed as \refb{ei6} with
\begin{equation} \label{ei8}
\pmatrix{A & B\cr C & D} = \pmatrix{1 & 0 & a_1 & a_3\cr
0 & 1 & a_3 & a_2\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}\, .
\end{equation}

\item {\bf Wall crossing formula:} Given that the indices in
different domains in the moduli space are given by different choices of
the 3-dimensional
integration contour in the $(\check\rho,\check\sigma,\check v)$ space,
the jump in the index as we cross a
wall of marginal stability
must be given by the residue of the integrand at
the pole(s) encountered while deforming one contour to another.
The walls across which the index jumps are the ones associated
with decays
into a pair of half-BPS states.\footnote{For
a certain class of dyons kinematics allows decay into a
pair of quarter BPS states or a half BPS and a quarter BPS states
on a codimension 1 subspace
of the moduli space. These correspond to decays of the form
$(Q,P)\to (\alpha Q+\beta P, \gamma Q+\delta P) +
((1-\alpha) Q-\beta P, -\gamma Q+(1-\delta)P)$ with some of
the $\alpha,\beta,\gamma,\delta$ fractional so that we can have
$0<(\alpha\delta -\beta\gamma)<1$ and $0\le ((1-\alpha)(1-\delta)
-\beta\gamma <1$\cite{0707.3035,0707.1563}.
However a naive counting
of the number of fermion zero modes on a half BPS - quarter BPS
and quarter BPS - quarter BPS
combination suggests that there are additional fermion zero modes
besides the ones associated with the broken supersymmetry
generators. This
makes the index associated with
such a configuration vanish.
Although a rigorous analysis of this system is
lacking at present, we shall proceed with the assumption that the
result is valid so that
such decays do not change the index.
Otherwise the dyon partition function will have additional poles
associated with the jump in the index across these additional walls
of marginal stability.
We wish to thank F.~Denef for a discussion
on this point. \label{foot1}}
We can label the decay products as\cite{0702141}
\begin{equation}\label{eff1}
(Q,P) \to (a_0d_0 Q - a_0b_0 P, c_0d_0 Q - c_0b_0 P) +
(-b_0c_0 Q + a_0b_0 P, - c_0d_0 Q + a_0d_0 P)\, , \end{equation}
where $a_0$, $b_0$, $c_0$ and $d_0$ are normalized so that $a_0 d_0
- b_0 c_0=1$. In a generic situation
$a_0$, $b_0$, $c_0$ and $d_0$ are not necessarily integers but are
constrained by the fact that
the final charges satisfy the charge quantization laws.
In all known examples there is a specific
correlation between a wall corresponding to a given decay and the
location of the pole of the integrand that the contour crosses as we
cross the wall in the moduli space. The location of the pole
associated with the decay \refb{eff1} is given by:
\begin{equation} \label{eff2}
\check\rho c_0d_0 + \check\sigma a_0b_0 + \check v (a_0d_0 + b_0c_0) = 0\, .
\end{equation}
We shall
assume that {\it this formula continues to hold in all cases.} This
then relates the jump in the index across a given wall of
marginal stability
to the residue of the partition function at a specific pole. An
explicit
choice of moduli dependent
contour that satisfies this requirement can be
found by generalizing the result of Cheng
and Verlinde\cite{0706.2363} to generic quarter BPS
dyons in generic ${\cal N}=4$ supersymmetric
string theories:
\begin{eqnarray}\displaystyle \label{echoiceint}
\Im(\check\rho) &=& \Lambda \, \left({|\tau|^2\over \tau_2} +
{Q_R^2 \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}\right)\, ,
\nonumber \\
\Im(\check\sigma) &=& \Lambda \, \left({1\over \tau_2} +
{P_R^2 \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}\right)\, ,
\nonumber \\
\Im(\check v) &=& -\Lambda \, \left({\tau_1\over \tau_2} +
{Q_R\cdot P_R \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}
\right)\, ,
\end{eqnarray}
where $\Lambda$ is a large positive number, $\Im(z)$ denotes
the imaginary part of $z$,
\begin{equation} \label{edefcrint}
Q_R^2 = Q^T (M+L)Q, \quad P_R^2=P^T (M+L)P, \quad
Q_R\cdot P_R = Q^T(M+L)P\, ,
\end{equation}
$\tau\equiv \tau_1+i\tau_2$ denotes the asymptotic value
of the axion-dilaton moduli which
belong to the gravity multiplet and $M$ is the
asymptotic value of the symmetric matrix
valued moduli field of the matter multiplet
satisfying $MLM^T=L$.
The choice \refb{echoiceint}
of course is not unique since we can deform the contour
without changing the result for the index as long as we do not
cross a pole of the partition function.

Independent of the above analysis,
the change in the index across a wall of marginal
stability can be computed using the wall crossing
formula\cite{0005049,0010222,0101135,0206072,
0304094,0702141,0702146}. This
tells us that
as we cross a wall of marginal stability
associated with the decay $(Q,P)\to (Q_1,P_1)+(Q_2,P_2)$,
the index
jumps by an amount\footnote{Eq.\refb{eff3} holds only if the
dyons $(Q_1,P_1)$ and $(Q_2,P_2)$ are primitive. As will be
discussed later, this formula gets modified for non-primitive decay.}
\begin{equation} \label{eff3}
(-1)^{Q_1\cdot P_2 - Q_2 \cdot P_1+1} \,
(Q_1\cdot P_2 - Q_2 \cdot P_1) \,
d_h(Q_1,P_1) d_h(Q_2, P_2)\,
\end{equation}
up to a sign,
where $d_h(Q,P)$ denotes the index of half-BPS states carrying
charge $(Q,P)$.  For the decay described in
\refb{eff1} the relevant half-BPS indices
are of the form $d_h(a_0 M_0, c_0 M_0)$ and
$d_h( b_0 N_0, d_0 N_0)$ where $M_0\equiv d_0 Q - b_0 P$ and
$N_0\equiv -c_0 Q + a_0 P$. T-duality invariance implies that
-- modulo some subtleties discussed below eqs.\refb{ex5} --
the dependence of
$d_h(a_0 M_0, c_0 M_0)$ and
$d_h( b_0 N_0, d_0 N_0)$ on $M_0$ and $N_0$
must come via the combinations
$M_0^2$ and $N_0^2$ respectively.
We now define
\begin{equation} \label{eff3.5}
\phi_e(\tau;a_0, c_0) \equiv \sum_{M_0^2} e^{\pi i\tau M_0^2}
d_h(a_0 M_0, c_0 M_0), \quad
\phi_m(\tau;b_0, d_0) \equiv \sum_{N_0^2} e^{\pi i\tau N_0^2}
d_h( b_0 N_0, d_0 N_0)\, ,
\end{equation}
where the sums are over the sets of $(M_0^2, N_0^2)$ values which
arise in the possible decays of the dyons in the
set ${\cal B}$ via \refb{eff1}. Then
\refb{eff3} agrees with the residue of the partition function at the
pole \refb{eff2} if we assume that $\check\Phi$ has
a double zero at \refb{eff2} where it
behaves as
\begin{eqnarray}\displaystyle \label{eff4}
\check\Phi(\check\rho,\check\sigma,\check v) &\propto&
\check v^{\prime 2}\, \phi_e(\check\sigma' ;a_0, c_0) \,
\phi_m(\check\rho'; b_0, d_0)\, ,  \qquad
\check v'\equiv \check\rho c_0d_0 + \check\sigma a_0b_0 + \check v (a_0d_0 + b_0c_0),
\nonumber \\ &&
\check\sigma'\equiv  c_0^2\check\rho + a_0^2
\check\sigma  + 2 a_0c_0 \check v, \quad \check\rho' \equiv
d_0^2\check\rho + b_0^2 \check\sigma
+ 2 b_0d_0 \check v\, .
\end{eqnarray}
Since for any given system the allowed values
of $(a_0,b_0,c_0,d_0)$ can be found from charge quantization laws,
\refb{eff4} gives us information about the locations of the zeroes
on $\check\Phi$ and its behaviour at these zeroes in terms of the spectrum
of half-BPS states in the theory.

\item {\bf Additional modular symmetries:}
Often the partition functions associated with $d_h(Q,P)$ have
modular properties, {\it e.g.} the function $\phi_m(\tau;a_0,c_0)$
could  transform as a modular form under $\tau\to(\alpha\tau+\beta)
/(\gamma\tau+\delta)$
and $\phi_e(\tau;b_0,d_0)$
could transform as a modular form under
$\tau\to (p\tau+q)/(r\tau+s)$ with $\pmatrix{\alpha&\beta\cr \gamma
&\delta}$ and $\pmatrix{p & q\cr r & s}$ belonging to
certain subgroups
of $SL(2,{\hbox{ Z\kern-1.6mm Z}})$.  Some of these may be accidental symmetries,
but some could be consequences of exact symmetries of the
full partition function $\check\Phi(\check\rho,\check\sigma,\check v)^{-1}$. Using
\refb{eff4} one finds
 that those which can be lifted to exact symmetries of
$\check\Phi$ can be represented as symplectic transformations of
the form \refb{ei6} with $\pmatrix{A & B\cr C & D}$ given by
\begin{equation} \label{eff7}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}^{-1}
\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}
\end{equation}
and
\begin{equation} \label{eff8}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}^{-1}
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}
\end{equation}
respectively.
These represent additional
symmetries of $\check\Phi$ besides the ones associated with S-duality
invariance and charge quantization laws.
Furthermore the constant $k$ appearing in \refb{ei6} is
given by the weight of $\phi_e$ and $\phi_m$ minus 2.

It is these additional symmetries which make the symmetry group
of $\check\Phi$ a non-trivial subgroup of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$.
The
S-duality transformations \refb{ei7} and the translation symmetries
\refb{ei8} are both associated with $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices
$\pmatrix{A & B\cr C & D}$ with $C=0$. In contrast the
trnsformations \refb{eff7}, \refb{eff8} typically have $C\ne 0$.

Since we do not {\it a priori} know which part of the modular
symmetries of $\phi_e$ and $\phi_m$ survive as symmetries of
$\check\Phi$, this does not give a foolproof method for identifying
symmetries of $\check\Phi$. However often by combining information
from the behaviour of $\check\Phi$ around different zeroes one can make
a clever guess.

\item {\bf Black hole entropy:}
Additional constraints may be found be requiring that
in the limit of large charges the index reproduces correctly the
black hole entropy.\footnote{Here we are implicitly assuming that
when the effect of interactions are
taken into account, only index worth of states
remain as BPS states so that the black hole entropy can be
compared to the logarithm of the index.}
In particular, by requiring that we reproduce the
black hole entropy $\pi\sqrt{Q^2P^2-(Q\cdot P)^2}$ that arises in
the supergravity approximation one finds that $\check\Phi$ is required
to have a zero
at\cite{9607026,0412287,0510147,0605210,0708.1270}
\begin{equation} \label{ebb11}
\check\rho \check\sigma - \check v^2 + \check v=0\, .
\end{equation}
In order to find the behaviour of $\check\Phi$ near this zero one needs to
calculate the first non-leading correction to the black hole
entropy and compare this with the first non-leading correction to
the formula for the index. In general the former requires the
knowledge of the complete set of four derivative terms in the effective
action, but in all known examples one can reproduce the answer for
the index just by taking into account
the effect of the Gauss-Bonnet term in the action.
If we assume that this continues to hold in general then by matching
the first non-leading corrections on both sides one can relate the
behaviour of $\check\Phi$ near \refb{ebb11}
to the coefficient of the Gauss-Bonnet
term. The result is
\begin{equation} \label{ebb2}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^k\,
\{ v^2 \, g(\rho)\, g(\sigma) +  {\cal O}(v^4)\}\, ,
\end{equation}
where
\begin{equation} \label{ebb3}
\rho = {\check\rho \check\sigma - \check v^2\over \check\sigma}, \quad
\sigma = {\check\rho \check\sigma - (\check v-1)^2\over \check\sigma}, \quad
v= {\check\rho \check\sigma - \check v^2+\check v\over \check\sigma}\, ,
\end{equation}
and $g(\tau)$ is a modular form of weight $k+2$ of the S-duality
group, related to the Gauss-Bonnet term
\begin{equation} \label{ebb4}
 \int d^4 x\, \sqrt{-\det g} \,
 \phi(a,S)\,
\left\{ R_{\mu\nu\rho\sigma} R^{\mu\nu\rho\sigma}
- 4 R_{\mu\nu} R^{\mu\nu}
+ R^2
\right\} \, ,
\end{equation}
via the relation
\begin{equation} \label{ebb5}
\phi(a,S) = - {1\over 64\pi^2} \, \left( (k+2) \ln S
+ \ln g(a+iS) + \ln g(-a+iS)\right)
+\hbox{constant}\, .
\end{equation}
Here $\tau=a+iS$ is the axion-dilaton modulus.

\end{enumerate}

In
\S\ref{s3}
we apply the considerations
described above to several examples.
These include known examples involving unit torsion dyons
in heteroric string theory on $T^6$ and CHL orbifolds and also
some unknown cases like dyons of torsion 2 in heterotic string
theory on $T^6$
(\i.e.\ dyons for which
gcd($Q\wedge P$)=2\cite{0702150})
and dyons carrying untwisted sector charges
in ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL orbifold\cite{9505054,9506048}.
In the latter cases we
determine the constraints imposed by the S-duality invariance
and wall crossing formul\ae\ and also try to use the known
modular properties of half-BPS states to guess the symmetry
group of the quarter BPS dyon partition function.

In \S\ref{sprop} we propose a formula for the dyon partitions
function of  torsion two dyons in heterotic string theory on $T^6$.
The formula for the partition function when $Q$ and $P$ are
both primitive but $(Q\pm P)$ are twice primitive vectors is
\begin{eqnarray}\displaystyle \label{etor2}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)} &=& {1\over 8} \Bigg[
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v)} +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v)} +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{1\over 4})} \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{1\over 4})}
 +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v+{1\over 2})} \nonumber \\
&& +
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v+{1\over 2})}  +
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{3\over 4})} +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{3\over 4})}\Bigg]
\nonumber \\
&&  +
{2\over \Phi_{10}(\check\rho+\check\sigma+2\check v,
\check\rho+\check\sigma-2\check v,\check\sigma-\check\rho)}
\end{eqnarray}
where $\Phi_{10}$ is the weight 10
Igusa cusp form of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ describing the inverse
partition function of torsion one dyons. The sum of the first eight
terms on the right hand side of \refb{etor2}
coincides with the partition function of unit torsion dyons
subject to the constraints that $Q^2+P^2\pm 2Q\cdot P$ are
multiples of 8; the last term is a new addition.
We show that \refb{etor2} satisfies all the required
consistency conditions. First of all it has the required S-duality
invariance. It also satisfies the wall crossing formul\ae\ at all
the walls of marginal stability at which the original dyon decays
into a pair of primitive dyons.
It satisfies the constraint \refb{ebb2} coming from the requirement
that the statistical entropy and the black hole entropy agrees
up to the first non-leading order in inverse powers of charges.
Furthermore by taking an appropriate
limit of this formula we can reproduce the known results for
torsion two dyons in gauge
theories\cite{9804174,9907090,0005275,0609055,appear}.

In the case of torsion two dyons with $Q$, $P$ both
primitive,  the vectors $Q\pm P$ are not primitive, but
$(Q\pm P)/2$ are
primitive vectors\cite{0801.0149}.
As a result for the decay into
\begin{equation} \label{eq1p1}
(Q_1,P_1) = (Q-P,0), \qquad (Q_2,P_2) = (P,P)\, ,
\end{equation}
the charge vector $(Q_1,P_1)$ is not primitive. Computing the
jump in the index from \refb{etor2} we find that in this case
the change in the index across this wall of marginal stability is
given by
\begin{equation} \label{efh7int}
\Delta d(Q,P) = (-1)^{Q_1\cdot P_2 - Q_2\cdot P_1 + 1}
(Q_1\cdot P_2 - Q_2\cdot P_1)\,
\left\{d_h\left(Q_1,P_1\right) +
d_h\left({1\over 2} Q_1,{1\over 2} P_1\right) \right\}
\, d_h\left(Q_2,P_2\right) \, .
\end{equation}
This differs from the formula \refb{eff3}. A similar modification of
the wall crossing formula for decays into non-primitive states in
${\cal N}=2$ supersymmetric string theories has been suggested in
\cite{0702146}.

There are two more classes of dyons of torsion two, -- one where
$Q$ is primitive and $P$ is twice a primitive vector and the other
where $P$ is primitive and $Q$ is twice a primitive vector. The
partition functions for these dyons can be recovered from the
one given above by S-duality transformations $(Q,P)\to (Q, P-Q)$
and $(Q,P)\to (Q-P, P)$ respectively\cite{0801.0149}. This amount
to making replacements
$(\check\rho,\check\sigma,\check v)\to(\check\rho,\check\sigma+\check\rho+2\check v,\check v+\check\rho)$ and
$(\check\rho,\check\sigma,\check v)\to(\check\rho+\check\sigma+2\check v,\check\sigma,\check v+\check\sigma)$
respectively in eq.\refb{etor2}.

Our analysis can also be used to predict the form of the partition
function of dyons of higher torsion. These results will be presented
in a forthcoming publication\cite{rforth}.

Although we have presented most of our analysis as a way of
extracting information about the partition function of quarter
BPS states from known spectrum of half-BPS states, we could
also use it in the reverse direction.
In the final section \S\ref{sapp} we provide some examples in
the context of ${\hbox{ Z\kern-1.6mm Z}}_N$ orbifold models
where the knowledge of the
quarter BPS partition function can be used to compute the
spectrum of a certain class of half-BPS states.

\sectiono{The dyon partition function}
\label{s2}

Let us consider a particular ${\cal N}=4$ supersymmetric string
theory in four dimensions with a total of $r$ U(1) gauge fields
including the six graviphotons.
The electric and magnetic charges in this theory are represented
by $r$ dimensional vectors $Q$ and $P$, and there is a T-duality
invariant metric $L$ of signature $(6,r-6)$ that can be used to
define the inner product of the charges.
Let us consider an (infinite) set ${\cal B}$ of dyon charge vectors
$(Q,P)$ with the property that
if two different members of the set have the same values
of $Q^2\equiv Q^T L Q$, $P^2\equiv P^T L P$ and
$Q\cdot P\equiv Q^T L P$ then there must exist a
T-duality transformation that relates the two
members.
In other words
if there are  T-duality invariants other than $Q^2$, $P^2$ and
$Q\cdot P$ then for all members of the set ${\cal B}$ with a given
set of values of $(Q^2, P^2, Q\cdot P)$
these other T-duality invariants
must have the same values.
We shall generate such a set ${\cal B}$ by
beginning with a family ${\cal A}$ of charge vectors
$(Q,P)$ labelled by three integers such that the
triplet
$(Q^2,P^2,Q\cdot P)$ are independent linear functions of these
three integers, and then
define ${\cal B}$ to be the set of all $(Q,P)$ which are in the
T-duality orbit of the set ${\cal A}$. Such a set ${\cal B}$ automatically
satisfies the restriction mentioned above since given two elements
of ${\cal B}$ with the same values of $(Q^2,P^2,Q\cdot P)$, each will be
related by a T-duality transformation to the unique element
of ${\cal A}$ with these values of $(Q^2,P^2,Q\cdot P)$.
An example of such a set ${\cal A}$ can be found in eqs.\refb{ess3},
\refb{ess4}.

Our object of interest is the index $d(Q,P)$, measuring the number
of bosonic supermultiplets minus the number of fermionic supermultiplets
of quarter BPS dyons
carrying charges $(Q,P)\in {\cal B}$.
Typically the index, besides depending on $(Q,P)$,
also depends of the domain in which
the asymptotic moduli lie.
These domains are bounded by walls of marginal stability associated
with decays of the form $(Q,P)\to
(\alpha Q + \beta P, \gamma Q+\delta P) +
((1-\alpha) Q - \beta P, -\gamma Q+(1-\delta) P)$ for
appropriate values of $(\alpha,\beta,\gamma,\delta)$ associated
with the quantization
conditions\cite{0707.1563,0707.3035,0710.4533}.
For fixed values of the other moduli these walls describe circles
or straight lines in the axion-dilaton moduli space labelled
by the complex parameter $\tau$\cite{0702141,0707.1563}.
We denote by
$\vec c$ the collection of $(\alpha_i, \beta_i, \gamma_i,\delta_i)$
bordering a particular domain in the moduli space; inside any such
domain the  index remains unchanged.
It has been shown in \cite{0702141} that
the parameters $\vec c$ labelling a
domain remain invariant under a simultaneous T-duality
transformation on the charges and the moduli. Since $d(Q,P)$ must
be invariant under simultaneous T-duality transformation on the
charges and the moduli, we can conclude that for a given
$\vec c$  the index $d(Q,P)$ for $(Q,P)\in{\cal B}$
will be a function only of the
T-duality invariants $(Q^2,P^2,Q\cdot P)$. We shall express this
as
$f(Q^2, P^2, Q\cdot P, \vec c)$.

Let us now introduce the partition function
\begin{equation} \label{e1}
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}
\equiv \sum_{Q^2, P^2, Q\cdot P}\,
(-1)^{Q\cdot P+1}\, f(Q^2,P^2, Q\cdot P; \vec c_0)
e^{i\pi (\check\sigma Q^2 + \check\rho P^2
+ 2 \check v Q\cdot P)}\, .
\end{equation}
where $\vec c_0$ denotes some specific domain in the moduli
space bounded by a set of walls of marginal stability.
The sum runs over allowed values of $Q^2$, $P^2$ and $Q\cdot P$
for the dyons belonging to the set ${\cal B}$.
The factor of $(-1)^{Q\cdot P+1}$ has
been included for convenience.
$\check\Phi$ so defined is expected to be a periodic
function of $\check\rho$, $\check\sigma$ and $\check v$, with the
periods depending on the
quantization condition on $P^2$, $Q^2$ and $Q\cdot P$.
Let the periods be $T_1$, $T_2$ and $T_3$ respectively
-- these represent inverses of the quanta of $P^2/2$, $Q^2/2$
and $Q\cdot P$ belonging to the set ${\cal B}$.
The sum given in \refb{e1} is typically not convergent
for real values of $\check\rho$, $\check\sigma$ and $\check v$. However
often it may be made convergent by treating $\check\rho$,
$\check\sigma$ and $\check v$ as complex variables and working
in appropriate domain in the complex plane.
We shall assume that this can be done.
We may now invert \refb{e1} as
\begin{eqnarray}\displaystyle \label{e2}
f(Q^2,P^2, Q\cdot P; \vec c_0)
&=& {(-1)^{Q\cdot P+1}\over T_1 T_2 T_3}
\int_{i M_1-T_1/2}^{iM_1+T_1/2} d\check\rho
\int_{iM_2-T_2/2}^{i M_2+T_2/2} d\check\sigma
\int_{i M_3-T_3/2}^{i M_3+T_3/2} d\check v \, \nonumber \\
&& \qquad \qquad
e^{-i\pi (\check\sigma Q^2 + \check\rho P^2
+ 2 \check v Q\cdot P)} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, ,
\end{eqnarray}
provided the imaginary parts $M_1$, $M_2$ and $M_3$ of
$\check\rho$, $\check\sigma$ and $\check v$ are fixed in a region where the
original sum \refb{e1} is convergent.

During the above discussion we have implicitly assumed that
the quantization laws of $Q^2$, $P^2$ and $Q\cdot P$ are
uncorrelated so that $\check\Phi(\check\rho,\check\sigma,\check v)$ is separately invariant under
$\check\rho\to\check\rho+T_1$, $\check\sigma\to\check\sigma+T_2$ and $\check v\to \check v+T_3$.
In general we can have more complicated periods which involve
simultaneous shifts of $\check\rho$, $\check\sigma$ and $\check v$. In this case the
integration in \refb{e2} needs to be carried out over an
appropriate unit cell in the $(\Re(\check\rho),\Re(\check\sigma),\Re(\check v))$ space
and the factor of $T_1T_2T_3$ in the denominator will be
replaced by the volume of the unit cell.

\sectiono{Consequences of S-duality symmetry} \label{sdual}

Let us now assume that the theory has S-duality symmetries
of the form
\begin{equation} \label{e3}
Q\to Q'' = a Q + b P, \qquad P\to P''=c Q + d P\, ,
\end{equation}
for appropriate choice of $(a,b,c,d)$. Under this transformation
\begin{equation} \label{e3.5}
Q^{\prime\prime 2} = a^2 Q^2 + b^2 P^2 + 2 ab Q\cdot P,
\quad P^{\prime\prime 2} = c^2 Q^2 + d^2 P^2 + 2 cd Q\cdot P,
\quad Q''\cdot P'' = ac  Q^2 + bd  P^2 + (ad+bc) Q\cdot P\, .
\end{equation}
A generic S-duality transformation acting on an arbitrary
element of ${\cal B}$
will give rise to $(Q'',P'')$ outside the set ${\cal B}$ for which
the index formula is given by the function $f$.
We shall restrict ourselves
to a subset of S-duality transformations which takes an element
of the set ${\cal B}$ to another element of the set ${\cal B}$.
For such transformations, the S-duality
invariance of the theory tells us that
\begin{equation} \label{e4}
f(Q^{\prime\prime 2}, P^{\prime\prime 2}, Q''\cdot P'', \vec c\,''_0)
= f(Q^2, P^2, Q\cdot P, \vec c_0)\, ,
\end{equation}
where $\vec c\,''_0$ denotes the collection
$\{(\alpha_i'', \beta_i'', \gamma_i'',\delta_i'')\}$ of domain walls
related to the set
$\{(\alpha_i, \beta_i, \gamma_i,\delta_i)\}$ associated
with $\vec c_0$ by the relation\cite{0702141,0801.0149}
\begin{equation} \label{e5}
\pmatrix{ \alpha_i'' & \beta_i''\cr  \gamma_i'' & \delta_i''}
= \pmatrix{a & b\cr c & d} \pmatrix{ \alpha_i & \beta_i
\cr  \gamma_i & \delta_i} \pmatrix{a & b\cr c & d}^{-1}\, .
\end{equation}
Physically the domain corresponding to $\vec c\,''_0$ represents
the image of the one corresponding to $\vec c_0$ under
simultaneous S-duality transformation on the charges and the
moduli.
Making a change of variables
\begin{equation} \label{e6}
\check\rho = d^2 \check\rho'' + b^2 \check\sigma'' + 2 bd \check v'',
\quad \check\sigma = c^2 \check\rho'' + a^2 \check\sigma'' + 2 ac \check v'',
\quad \check v = cd \check\rho'' + ab \check\sigma'' + (ad+bc) \check v''\, ,
\end{equation}
in \refb{e2} and using the fact that
\begin{eqnarray}\displaystyle \label{efacts}
&& (-1)^{Q\cdot P} = (-1)^{Q''\cdot
P''}, \quad \check\sigma Q^2 +\check\rho P^2 + 2 \check v Q\cdot P
=  \check\sigma'' Q^{\prime\prime 2} +\check\rho'' P^{\prime\prime 2}
+ 2 \check v'' Q''\cdot P'', \nonumber \\ && \qquad
d\check\rho\wedge d\check\sigma\wedge d\check v = d\check\rho''\wedge d\check\sigma''\wedge d\check v''\, ,
\end{eqnarray}
under an S-duality transformation,
we can express \refb{e4} as
\begin{equation} \label{e7}
f(Q^{\prime\prime 2}, P^{\prime\prime 2}, Q''\cdot P'', \vec c\,''_0)
= {(-1)^{Q''\cdot P''+1}\over T_1 T_2 T_3}\,
\int_{\cal C} \, d\check\rho''
d\check\sigma''  d\check v'' \,
e^{-i\pi (\check\sigma'' Q^{\prime\prime 2} + \check\rho'' P^{\prime\prime 2}
+ 2 \check v'' Q''\cdot P'')} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, ,
\end{equation}
where ${\cal C}$ is the image of the original region of integration
\refb{e2} in the complex $(\check\rho'', \check\sigma'', \check v'')$ plane:
\begin{eqnarray}\displaystyle \label{econtour}
&& \Im(\check\rho'') = a^2 M_1 + b^2 M_2 - 2 ab M_3, \quad
\Im(\check\sigma'') = c^2 M_1 + d^2 M_2 - 2 cd M_3, \nonumber \\
&&
\Im (\check v'') = - ac M_1 - bd M_2 + (ad + bc) M_3\, .
\end{eqnarray}

We would like to get some constraint on the function $\check\Phi$
by comparing \refb{e2} with \refb{e7}. For this we note that
we can replace $(Q,P)$ by $(Q'', P'')$ and
$(\check\rho,\check\sigma, \check v)$ by $(\check\rho'', \check\sigma'', \check v'')$ everywhere
in \refb{e2} since they are dummy variables. This gives
\begin{eqnarray}\displaystyle \label{e8}
f(Q^{\prime\prime 2},P^{\prime\prime 2},
Q''\cdot P''; \vec c_0)
&=& {(-1)^{Q''\cdot P''+1}\over T_1 T_2 T_3}
\int_{iM_1-T_1/2}^{iM_1+T_1/2} d\check\rho''
\int_{iM_2-T_2/2}^{iM_2+T_2/2} d\check\sigma''
\int_{iM_3-T_3/2}^{iM_3+T_3/2} d\check v'' \,
 \nonumber \\ &&  \qquad \qquad \qquad
e^{-i\pi (\check\sigma'' Q^{\prime\prime 2} + \check\rho'' P^{\prime\prime 2}
+ 2 \check v'' Q''\cdot P'')}
{1\over \check\Phi(\check\rho'', \check\sigma'', \check v'')}\, .
\end{eqnarray}
Since
in general $\vec c_0$ and $\vec c\,''_0$ describe different
domains, we cannot compare \refb{e7} and
\refb{e8} to constrain the
form of $\check\Phi$ without any further input.\footnote{The only
exceptions are those S-duality transformations which leave the
domain $\vec c_0$ unchanged\cite{0702141}.}
However the dyon spectrum in
a variety of ${\cal N}=4$ supersymmetric string theories displays
the feature that the spectrum in two different domains
$\vec c\,''_0$ and $\vec c_0$ are both given as integrals with the
same integrand, but for $\vec c\,''_0$
the integration over $(\check\rho'',\check\sigma'',
\check v'')$ is carried out over a different subspace
 than the one given
in \refb{e8}.  In particular if $\vec c\, ''_0$ is related to
$\vec c_0$ by an S-duality transformation then this subspace is
given by the integration region ${\cal C}$ given in \refb{econtour}.
We shall assume that this feature continues to
hold in the general situation. In that case the effect of
replacing
$\vec c_0$ by $\vec c\, ''_0$ in eq.\refb{e8} is
to replace the integration contour
by ${\cal C}$ on the right hand side:
\begin{equation} \label{e9}
f(Q^{\prime\prime 2},P^{\prime\prime 2},
Q''\cdot P''; \vec c\,''_0)
= {(-1)^{Q''\cdot P''+1}\over T_1 T_2 T_3} \int_{\cal C} d\check\rho''
d\check\sigma'' d\check v'' \,
e^{-i\pi (\check\sigma'' Q^{\prime\prime 2} + \check\rho'' P^{\prime\prime 2}
+ 2 \check v'' Q''\cdot P'')} \,
{1\over \check\Phi(\check\rho'', \check\sigma'', \check v'')}\, .
\end{equation}
Comparing \refb{e9} and \refb{e7} we get
\begin{equation} \label{e10}
\check\Phi(\check\rho, \check\sigma, \check v)= \check\Phi(\check\rho'', \check\sigma'', \check v'') \, .
\end{equation}

For future reference we shall rewrite the transformation laws
\refb{e6} in a suggestive form. We define
\begin{equation} \label{e11}
\check\Omega = \pmatrix{\check\rho & \check v\cr \check v & \check\sigma}\, .
\end{equation}
Then the transformations \refb{e6} may be written as
\begin{equation} \label{e12}
\check\Omega = (A\check\Omega'' + B) (C\check\Omega'' + D)^{-1}
\, ,
\end{equation}
where $A$, $B$, $C$ and $D$ are $2\times 2$ matrices, given by
\begin{equation} \label{e13}
\pmatrix{A & B\cr C & D} = \pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}\, .
\end{equation}
Eq.\refb{e10} now gives (after replacing the dummy variable
$\check\Omega''$ by $\check\Omega$ on both sides),
\begin{equation} \label{espec}
\check\Phi((A\check\Omega + B) (C\check\Omega + D)^{-1})
= \det(C\check\Omega + D)^k \check\Phi(\check\Omega)\, ,
\end{equation}
for $A$, $B$, $C$, $D$ given in \refb{e13}.
Here $k$ is an arbitrary number. Since $\det(C\Omega +D)=1$,
we cannot yet ascertain the value of $k$.

To this we can also append the translational symmetries of
$\check\Phi$:
\begin{equation} \label{e14}
\check\Phi(\check\rho, \check\sigma, \check v) =
\check\Phi(\check\rho+a_1, \check\sigma+a_2, \check v+a_3)\, ,
\end{equation}
where $a_i$'s are integer multiples of the $T_i$'s. It is
convenient, although not necessary, to work with appropriately
rescaled $Q$ and/or $P$ so that the
$T_i$'s and hence the
$a_i$'s are integers.
This symmetry can also be rewritten as \refb{espec} with the choice
\begin{equation} \label{e15}
\pmatrix{A & B\cr C & D} = \pmatrix{1 & 0 & a_1 & a_3\cr
0 & 1 & a_3 & a_2\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}\, .
\end{equation}
Again since $\det(C\check\Omega+D)=1$ the choice of $k$ is
arbitrary.

The alert reader would have noticed that although we have expressed
the consequences of S-duality invariance and charge quantization
conditions as symmetries of the function
$\check\Phi$ under a symplectic transformation,
the symplectic transformations arising this way are
trivial, --  for all the transformations arising this way the matrix
$C$ vanishes and hence the transformations act linearly on the
variables $\check\rho$, $\check\sigma$ and $\check v$. In order to show that
the function $\check\Phi$ has non-trivial modular properties we need
to find symmetries of $\check\Phi$ which have non-vanishing $C$.
This will also determine the weight of $\check\Phi$ under the modular
transformation. To get a hint about any possible
additional symmetries of $\check\Phi$ we need
to make use of the wall crossing formula for the dyon spectrum
of ${\cal N}=4$ supersymmetric string theories.
This will be the subject of discussion in \S\ref{swall}.

\sectiono{Constraints from wall crossing} \label{swall}

As has already been discussed, the index associated with the
quarter BPS
dyon spectrum in ${\cal N}=4$ supersymmetric string theories can
undergo discontinuous jumps across walls of marginal stability.
{\it A priori} the formula for the dyon
spectrum in different domains labelled by the vector $\vec c$
could be completely different.
However the study of dyon spectrum in a variety
of ${\cal N}=4$ supersymmetric string theories shows that
in different domains the index continues to be given by
an expression similar to
\refb{e2}, the only difference being that the choice of the
3 real dimensional subspace (contour) over
which we carry out the integration
in the complex $(\check\rho,\check\sigma, \check v)$ plane is different in
different domains. As a result the difference between the indices
in two different domains is given by the sum of residues
of the integrand at the poles we encounter while deforming the
contour associated with one domain to the contour associated with
another domain.
As a special example of this we can consider the decay
$(Q,P)\to (Q,0)+ (0,P)$.
In all known examples change in the index across this wall
of marginal stability is
accounted for by the residue of a double
pole of the integrand at $\check v=0$, \i.e.
as we cross this particular wall of marginal stability
in the moduli space, the integration contour crosses the pole at
$\check v=0$. Since the change in the index as we cross a given wall
can be found using the wall crossing
formula\cite{0005049,0010222,0101135,0206072,
0304094,0702141,0702146}, this provides
information on the residue of the integrand at the $\check v=0$ pole.

There are many other possible
decays of a quarter BPS state into a pair of
half BPS states.
All such decays may be parametrized as\cite{0702141}
\begin{equation} \label{ede1}
(Q,P) \to (a_0d_0 Q - a_0b_0 P, c_0d_0 Q - c_0b_0 P) +
(-b_0c_0 Q + a_0b_0 P, - c_0d_0 Q + a_0d_0 P)\, , \quad a_0
d_0 - b_0c_0 =1\, .
\end{equation}
$a_0$, $b_0$,
$c_0$, $d_0$ are not necessarily all integers, but must be
such that the charges carried by the decay products belong to
the charge lattice. One can try
to use the wall crossing formul\ae\ associated with these
decays to further constrain the form of $\check\Phi$.
For unit torsion states in heterotic string theory on $T^6$, $a_0$,
$b_0$,
$c_0$ and $d_0$ are integers and the decay given in \refb{ede1} is
related to the decay $(Q,P)\to (Q,0)+(0,P)$ via an S-duality
transformation $\pmatrix{a_0 & b_0\cr c_0 & d_0}$.
Thus the change in the index across the wall
is controlled by the residue of the partition function at
a new pole that is
related to the $\check v=0$ pole by the S-duality transformation
\refb{e6}. This gives the location of the pole to be at
\begin{equation} \label{epole1}
\check\rho c_0d_0 + \check\sigma a_0b_0 + \check v (a_0d_0 + b_0c_0) = 0\, .
\end{equation}
As long as $\check\Phi$ is manifestly S-duality invariant, \i.e.\
satisfies \refb{e13}, \refb{espec}, the residues at these poles will
automatically satisfy the wall crossing formula. Thus they do not
provide any new information. However
in a generic situation new walls may appear,  labelled by
fractional values of $a_0,b_0,c_0,d_0$. Also
the S-duality group is smaller. As a result not all
the walls can be related to each other by S-duality transformation.
It is tempting to speculate that the jump across
any wall of marginal stability associated with the decay
\refb{ede1} is described by the residue of the partition function
at the pole at \refb{epole1}. We shall proceed with this
assumption -- this will be one of our key
postulates.\footnote{Of course the translation symmetries
\refb{e14} allow us to shift a pole at \refb{epole1} to other
equivalent locations. Our postulate asserts that the contribution comes
from poles which can be brought to \refb{epole1} using the
translation symmetries \refb{e14}.  In that case we can choose the
unit cell over which we carry out the
integration  in \refb{e2} in such a way that only the pole at
\refb{epole1} contributes to the jump in the index across
the wall at \refb{ede1}.
A possible
exception to this will be discussed in the paragraphs
above eq.\refb{esx1}
where we address some subtle issues.}

Before we proceed we shall show that this postulate is internally
consistent, \i.e.\ it is possible to choose ${\cal C}$ at different points
in the moduli space consistent with this postulate. For this we
generalize the contour prescription of \cite{0706.2363}, assuming
that it holds for all ${\cal N}=4$ supersymmetric string theories. Let
$\tau=\tau_1+i\tau_2$ be the axion-dilaton moduli, $M$ be the
usual $r\times r$ symmetric
matrix valued moduli satisfying $MLM^T=L$, and
\begin{equation} \label{edefcr}
Q_R^2 \equiv Q^T (M+L)Q, \quad P_R^2\equiv
P^T (M+L)P, \quad
Q_R\cdot P_R \equiv Q^T(M+L)P\, .
\end{equation}
Then at the point $(\tau,M)$ in the space of asymptotic moduli
we choose ${\cal C}$ to be
\begin{eqnarray}\displaystyle \label{echoice}
\Im(\check\rho) &=& \Lambda \, \left({|\tau|^2\over \tau_2} +
{Q_R^2 \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}\right)\, ,
\nonumber \\
\Im(\check\sigma) &=& \Lambda \, \left({1\over \tau_2} +
{P_R^2 \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}\right)\, ,
\nonumber \\
\Im(\check v) &=& -\Lambda \, \left({\tau_1\over \tau_2} +
{Q_R\cdot P_R \over \sqrt{Q_R^2 P_R^2 - (Q_R\cdot P_R)^2}}
\right)\, ,
\end{eqnarray}
where $\Lambda$ is a large positive number. Then on ${\cal C}$
\begin{eqnarray}\displaystyle \label{emar1}
&&\Im( c_0d_0\check\rho + a_0 b_0 \check\sigma +(a_0d_0+b_0c_0)\check v)
\nonumber \\
&=&{c_0 d_0 \over \tau_2}\, \Lambda\, \left\{
\left(\tau_2+{E\over 2 c_0 d_0}\right)^2 +\left(
\tau_1 - {a_0d_0+b_0c_0\over 2c_0d_0}\right)^2 - \left(1
+{E^2\over 4c_0^2d_0^2}\right)\right\}\, ,
\end{eqnarray}
where
\begin{equation} \label{emar2}
E={c_0 d_0 Q_R^2 +a_0b_0 P_R^2 - (a_0d_0+b_0c_0)Q_R\cdot P_R
\over \sqrt{Q_R^2P_R^2-(Q_R\cdot P_R)^2}}\, .
\end{equation}
As shown in \cite{0702141}, the right hand side of \refb{emar1}
vanishes on the wall of marginal stability associated with the
decay  given in \refb{ede1}. Thus it follows from \refb{emar1} that
as we cross this wall of marginal stability, the contour
\refb{echoice} crosses the pole at \refb{epole1} in accordance with
our postulate.

This postulate allows us to identify the
possible poles of the partition function besides those related
to the $\check v=0$ pole by the S-duality transformation
\refb{e6}, -- they occur at
\refb{epole1} for those values of
$a_0$, $b_0$, $c_0$ and $d_0$ for which
the decay \refb{ede1} is consistent
with the charge quantization laws.
One can also get information about the residues at these poles
since they are given by the jumps in the index.
This jump can be expressed
using the wall crossing
formula\cite{0005049,0010222,0101135,0206072,
0304094,0702141,0702146}
that tells us that
as we cross a wall of marginal stability
associated with the decay $(Q,P)\to (Q_1,P_1)+(Q_2,P_2)$ the index
jumps by an amount
\begin{equation} \label{ex1}
(-1)^{Q_1\cdot P_2 - Q_2 \cdot P_1+1}
\, (Q_1\cdot P_2 - Q_2 \cdot P_1)\,
d_h(Q_1,P_1) d_h(Q_2, P_2)\,
\end{equation}
up to a sign,
where $d_h(Q,P)$ denotes the index measuring the number
of bosonic minus the number of fermionic half BPS
supermultiplets carrying
charges $(Q,P)$. Thus this relates the residues at
the poles of the integrand to the indices of half BPS states.

We shall now study the consequence of \refb{ex1}
on the residue at the pole \refb{epole1}.
First let us consider the special case associated with
the decay
$(Q,P)\to (Q,0)+ (0,P)$. In this case the jump in the index
is given by
\begin{equation} \label{ex2}
(-1)^{Q\cdot P+1} \, Q\cdot P \, d_e(Q) \, d_m(P)\, ,
\end{equation}
where $d_e(Q)= d_h(Q,0)$ is the index of purely electrically
charged states and $d_m(P)=d_h(0,P)$ is the index of purely
magnetically charged state. This jump is to be
accounted for by the residue of a
pole of the integrand at $\check v=0$.
The result \refb{ex2} is reproduced
if near $\check v=0$, $\check\Phi$ behaves as
\begin{equation} \label{ex3}
\check\Phi(\check\rho, \check\sigma, \check v)^{-1} \propto \{
\phi_m(\check\rho)^{-1}\,  \phi_e(\check\sigma)^{-1} \check v^{-2} + {\cal O}(\check v^0)\}\, ,
\end{equation}
where $1/\phi_m(\check\rho)$ and $1/\phi_e(\check\sigma)$ denote respectively
the partition functions of purely
magnetic and purely
electric states:
\begin{equation} \label{ex4}
d_m(P) = {1\over T_1}\,
\int_{iM_1-T_1/2}^{iM_1+T_1/2}
d\check\rho\, e^{-i\pi P^2\check\rho} {1\over \phi_m(\check\rho)}\, ,
\qquad
d_e(Q) = {1\over T_2}\,
\int_{iM_2-T_2/2}^{iM_2+T_2/2} d\check\sigma\, e^{-i\pi Q^2\check\sigma} {1\over
\phi_e(\check\sigma)}\, .
\end{equation}
Substituting \refb{ex4} into the integrand in \refb{e2} and
picking up the residue from the pole at $\check v=0$ we get the change
in the index to be
\begin{equation} \label{ex5}
(-1)^{Q\cdot P+1} \, Q\cdot P \, d_e(Q) \, d_m(P)\, ,
\end{equation}
in agreement with \refb{ex2}, provided we choose the constant of
proportionality in \refb{ex3} appropriately. Note that the
$Q\cdot P$ factor comes from the $\check v$ derivative of the
exponential factor in \refb{e2} arising due to the double pole
of $\check\Phi^{-1}$ at $\check v=0$.

In writing \refb{ex3}, \refb{ex4} we have implicitly
assumed that the
allowed values of $Q^2$ and $P^2$ inside the set ${\cal B}$
are independent
of each other,
\i.e.\ the possible values that $Q^2$ can take for a given $P^2$ is
independent of $P^2$ and vice versa.
If this is not so then instead of having a
single product the right hand side of \refb{ex3} will contain
a sum of products. For example if in the set ${\cal B}$, $Q^2/2$ and
$P^2/2$ are correlated so that $Q^2/2$ is odd (even) when $P^2/2$
is odd (even) then the coeffcient of $\check v^{-2}$ in the expression
for $\check\Phi^{-1}$ will contain two terms,
-- the product of the partition function with odd $Q^2/2$ electric
states with that of odd $P^2/2$ magnetic states and the product
of the partition function of even $Q^2/2$ electric states with that of
even $P^2/2$ magnetic states.

There is one more assumption that has gone into writing
\refb{ex3}, \refb{ex4}. We have assumed that given two pairs
of charge vectors $(Q,P)$ and $(\widehat Q,\widehat P)$ in ${\cal B}$,
if $Q^2
= \widehat Q^{2}$ then $Q$ and $\widehat Q$ are related
by a T-duality transformation. Otherwise $d_e(Q)$ will not
be  a function of $Q^2$ and one cannot define an electric partition
function via eq.\refb{ex4}. A similar restriction applies to
the magnetic charges as well. Now since  the set ${\cal B}$
has been chosen such that if the triplets $(Q^2,P^2,Q\cdot P)$ are
identical for two charge vectors then they must be related by
T-duality transformation, if two different $Q$'s with same
$Q^2$ are not related by T-duality then they must come from
triplets with different values of $P^2$ and/or $Q\cdot P$. In other
words the different T-duality orbits for a given $Q^2$
must be correlated with $P^2$ and/or
$Q\cdot P$. If the correlation is with $P^2$ then we follow the
procedure described in the previous paragraph, {\it e.g.}
if one set of $Q$'s arise from even $P^2/2$ and another set
of $Q$'s arise from odd $P^2/2$, we define two separate electric
partition function for these two different sets of $Q$'s and
identify the coefficient of $\check v^{-2}$ in the partition
function $\check\Phi^{-1}$ as a sum of terms.
If on the other hand the correlation is with $Q\cdot P$ then the
procedure is more complicated. We first project onto different
$Q\cdot P$ sectors by adding to $\check\Phi^{-1}$ other terms obtained
by appropriate shifts of $\check v$, so that the subset of states
which contribute to the new partition function now has a
unique $Q$ for a given $Q^2$ up to T-duality transformations.
The singularities of this new partition functions near $\check v=0$ will now
be described by equation of the type \refb{ex3}, \refb{ex4}. For
example if one set of $Q$'s come from odd $Q\cdot P$ and the
second set of $Q$'s come from even
$Q\cdot P$, then we can consider the quarter BPS partition functions
${1\over 2}\{
\check\Phi^{-1}(\check\rho,\check\sigma,\check v) \pm \check\Phi^{-1}(\check\rho, \check\sigma, \check v+{1\over 2})\}$.
These pick up even $Q\cdot P$ and odd $Q\cdot P$ states
respectively, and hence the contribution to these partition
functions will come from charge vectors $(Q,P)$ with the property
that for a given $Q^2$, there will be a unique $Q$ up to a
T-duality transformation. Thus the behaviour of these
combinations will now be controlled by equations of the type
given in \refb{ex3}, \refb{ex4}.
Conversely, for the original set ${\cal B}$ the
jump in the index associated with the decay $(Q,P)\to (Q,0)+(0,P)$
is now controlled by the zeroes of $\check\Phi(\check\rho,\check\sigma,\check v)$ at
$\check v=0$ and also at $\check v = 1/2$.
Similar considerations apply
when the same $P^2$ in the set ${\cal B}$ comes from more than
one $P$'s which are not related by T-duality.

Often both the subtleties mentioned above can be avoided by a
judicious choice of the set ${\cal B}$. In fact in all the explicit
examples we shall study in \S\ref{s3}, we shall be able to avoid
these subtleties.

We now return to the general case associated with the decay
described in \refb{ede1}.
Since
here
\begin{equation} \label{esx1}
(Q_1,P_1)=(a_0d_0 Q - a_0b_0 P, c_0d_0 Q - c_0b_0 P),
\qquad (Q_2,P_2)=
(-b_0c_0 Q + a_0b_0 P, - c_0d_0 Q + a_0d_0 P)\, ,
\end{equation}
we have
\begin{equation} \label{esx2}
Q_1\cdot P_2 - Q_2 \cdot P_1 = - Q^2 c_0d_0 - P^2 a_0b_0
+ Q\cdot P
(a_0d_0 + b_0c_0)\, .
\end{equation}
Let us now make a change of variables
\begin{equation} \label{esx3}
\check\rho' = d_0^2\check\rho + b_0^2 \check\sigma + 2 b_0d_0 \check v,
\qquad \check\sigma' = c_0^2\check\rho + a_0^2
\check\sigma  + 2 a_0c_0 \check v, \qquad
\check v'=c_0d_0\check\rho + a_0b_0\check\sigma +(a_0d_0+b_0c_0) \check v\, ,
\end{equation}
and define
\begin{equation} \label{esx4}
Q' = d_0 Q - b_0 P, \qquad P' = - c_0 Q + a_0 P\, .
\end{equation}
Under this change of variables
\begin{equation} \label{ejacob}
d\check\rho\wedge d\check\sigma\wedge d\check v = d\check\rho'\wedge d\check\sigma'\wedge d\check v'\, ,
\end{equation}
\begin{equation} \label{esx5}
Q_1\cdot P_2 - Q_2 \cdot P_1 = Q'\cdot P'\, ,
\end{equation}
\begin{equation} \label{esx5.5}
(Q_1,P_1) = (a_0Q', c_0Q'), \qquad (Q_2,P_2) = (b_0 P', d_0P')\, ,
\end{equation}
and
\begin{equation} \label{esx6}
{1\over 2} \check\rho P^2 + {1\over 2} \check\sigma Q^2 + \check v Q\cdot P
= {1\over 2} \check\rho' P^{\prime 2} +
{1\over 2} \check\sigma' Q^{\prime 2} + \check v' Q'\cdot P'\, .
\end{equation}
Thus the jump in the index given in \refb{ex1} can be expressed as
\begin{equation} \label{esx7}
(-1)^{Q'\cdot P'+1} \, Q'\cdot P'\,
d_h(a_0Q', c_0Q') d_h(b_0P',d_0P')
\, .
\end{equation}
Furthermore in these variables the pole at \refb{epole1} is at
$\check v'=0$. Thus we can identify \refb{esx7}
with the residue of the
integrand from $\check v'=0$. Using \refb{ejacob}, \refb{esx6} the latter
may be expressed as
\begin{equation} \label{esplit}
(-1)^{Q\cdot P+1} \int d\check\rho' d\check\sigma' d \check v' e^{i\pi
(\check\rho' P^{\prime 2} +
\check\sigma' Q^{\prime 2} + 2\check v' Q'\cdot P') } \, {1\over \check\Phi(\check\rho,\check\sigma,\check v)}
\, ,
\end{equation}
where the integration contour is around $\check v'=0$. We now note that
this result can be reproduced if we assume that
near the pole
\refb{epole1} the
partition function behaves as\footnote{This formula
suffers from the same type of subtleties described below
eq.\refb{ex5} with $(Q,P)$ replaced by $(Q',P')$  and
$(\check\rho,\check\sigma,\check v)$ replaced by $(\check\rho',\check\sigma',\check v')$.}
\begin{equation} \label{ebe1}
{\check\Phi(\check\rho,\check\sigma,\check v)^{-1}}
\propto \,
\{ {\phi_e(\check\sigma';a_0,c_0)^{-1}} {\phi_m(\check\rho';b_0,d_0)^{-1}}
\check v^{\prime -2} + {\cal O}(\check v^{\prime 0})\}\, ,
\end{equation}
where $1/\phi_{e,m}(\tau;k,l)$  denote
the partition functions of half BPS dyons in the set ${\cal B}$
such that
\begin{eqnarray}\displaystyle \label{ebb1}
d_h(a_0 Q', c_0 Q') &=& {1\over T}\,
\int_{iM-T/2}^{ i M+T/2} d\tau\, e^{-i\pi Q^{\prime 2}\tau}
{1\over \phi_e(\tau;a_0,c_0)}, \nonumber \\
d_h(b_0 P', d_0 P') &=& {1\over T'}\,
\int_{iM-T'/2}^{i M+T'/2} d\tau\, e^{-i\pi P^{\prime 2}\tau}
{1\over \phi_m(\tau;b_0,d_0)}\, .
\end{eqnarray}
The integration over $\tau$ run parallel to the real axis over unit
period with the imaginary part fixed at some large positive value
$M$.
Substituting \refb{ebe1} into \refb{esplit} and
picking up the residue from the pole at $\check v'=0$ we get the change
in the index to be
\begin{equation} \label{bb2}
(-1)^{Q'\cdot P'+1} \, Q'\cdot P' \, d_h(a_0Q', c_0Q')
d_h(b_0P',d_0P')\, ,
\end{equation}
in agreement with \refb{esx7}.

To summarize, \refb{epole1} gives us the locations of the
zeroes of $\check\Phi$, whereas
eq.\refb{ex3} and more generally
\refb{ebe1} give us information about the behaviour of
$\check\Phi$ near this zero.
We shall now show that these results suggest additional symmetries
of $\check\Phi$ of the type described in \refb{espec}.
Typically
in any theory the partition functions of half BPS
states have modular properties. Let us for definiteness
consider the decay $(Q,P)\to (Q,0)+(0,P)$.
In this case the functions
$\phi_m(\check\rho)$ and $\phi_e(\check\sigma)$ transform as modular forms
of a subgroup of $SL(2,{\hbox{ Z\kern-1.6mm Z}})$
since they arise from quantization of a fundamental
string or a dual magnetic string. These relations
take the form
\begin{equation} \label{ey1}
\phi_m((\alpha \check\rho + \beta) (\gamma\check\rho +\delta)^{-1})
= (\gamma\check\rho +\delta)^{k+2} \phi_m(\check\rho), \qquad
\phi_e((p\check\sigma + q)(r\check\sigma + s)^{-1}) = (r\check\sigma + s)^{k+2}
\phi_e(\check\sigma)\, ,
\end{equation}
where $k$ is an integer specific to the theory under study,
and $\pmatrix{\alpha & \beta\cr \gamma & \delta}$ and
$\pmatrix{p & q\cr r & s}$ belong to appropriate subgroups
of $SL(2,{\hbox{ Z\kern-1.6mm Z}})$. Given that $\phi_m$ and $\phi_e$ have these
symmetries, we conclude from \refb{ex3} that near $\check v=0$,
$\check\Phi$ also has some additional symmetries.
Even though there is no guarantee that these will be symmetries
of the full quarter BPS
partition function, one could hope that some part
of these do lift to symmetries of the partition function and hence
of $\check\Phi$.
Those which do
can be represented by symplectic transformations
of the type \refb{espec} with
\begin{equation} \label{ez1}
\pmatrix{A & B\cr C & D} = \pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{A & B\cr C & D} = \pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}\, .
\end{equation}
The first transformation generates
\begin{equation} \label{ez2}
\check\rho \to {\alpha \check\rho+\beta \over \gamma\check\rho +\delta}, \quad
\check\sigma \to \check\sigma- {\gamma\check v^2 \over \gamma\check\rho +\delta}, \quad \check v \to {\check v
\over \gamma\check\rho +\delta}\, ,
\end{equation}
while the second transformation generates
\begin{equation} \label{ez3}
\check\rho \to \check\rho - {r\check v^2 \over r\check\sigma + s}, \quad
\check\sigma \to {p\check\sigma + q\over r\check\sigma + s}, \quad \check v\to {\check v\over
r\check\sigma + s}\, .
\end{equation}
Both transformations leave the $\check v=0$ surface invariant.
Furthermore
applying these transformations on \refb{espec} and using
\refb{ex3} near $\check v=0$
we generate the
transformation laws \refb{ey1}.

The symplectic transformations given in \refb{ez1}, if present,
give us
the additional symmetries required to have $\check\Phi$ transform
as a modular form under a non-trivial  subgroup
of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$. We can use this to determine the subgroup
of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ under which we expect $\check\Phi$ to transform as a
modular form and also the weight $k$ of the modular form.
However since we do not know {\it a priori} which part of the
symmetry groups of $\phi_e$ and $\phi_m$ will lift to the symmetries
of $\check\Phi$, this is not a fool proof method. Nevertheless these can
serve as guidelines for making an educated guess.

The behaviour of $\check\Phi$ near the other zeroes given in \refb{epole1}
could provide us with additional information. If the zero of
$\check\Phi$ at
\refb{epole1} is related to the one at $\check v=0$ by an S-duality
transformation then this information is not new.
Since S-duality transformation acts by multiplying the
matrix $\pmatrix{a_0 & b_0\cr c_0 & d_0}$ associated with a
wall from the left\cite{0702141}, this
means that if $\pmatrix{a_0 & b_0\cr c_0
& d_0}$ itself is an S-duality transformation  then we do not
get a new information. To this we must also add the information
that multiplying
$\pmatrix{a_0 & b_0\cr c_0
& d_0}$ from
the right
by $\pmatrix{\lambda & 0 \cr 0 & \lambda^{-1}}$
for any $\lambda$ or by $\pmatrix{0 & 1\cr -1 & 0}$
does not change the wall\cite{0702141}. However in many cases
even after imposing these equivalence relations one finds
inequivalent walls.\footnote{For example in ${\hbox{ Z\kern-1.6mm Z}}_6$ CHL
model with S-duality group $\Gamma_1(6)$
the wall corresponding to the matrix
$\pmatrix{1 & 1\cr 2 & 3}$ is not equivalent to the wall
corresponding to $\pmatrix{1 & 0\cr 0 & 1}$.
We shall discuss this example in some detail in
\S\ref{sapp}.\label{ff1}}
In such cases
the associated zero of $\check\Phi$
cannot be related to the zero at $\check v=0$ by an S-duality
transformation, and we get new
information.\footnote{Typically the
number of such additional zeroes is a finite number, providing us with
a finite set of additional information.}
Let $\pmatrix{a_0 & b_0\cr c_0 & d_0}$ be the matrix associated
with such a decay. If the corresponding partition functions
$\phi_m(\tau;b_0, d_0)$ and $\phi_e(\tau; a_0, c_0)$
have modular groups containing matrices
of the form $\pmatrix{\alpha_1 & \beta_1\cr \gamma_1 & \delta_1}$
and $\pmatrix{p_1 & q_1 \cr r_1 & s_1}$ respectively, then they may
be regarded as symplectic transformations generated by the matrices
\begin{equation} \label{egensp}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}^{-1}
\pmatrix{\alpha_1 & 0 & \beta_1 & 0\cr
0 & 1 & 0 & 0\cr \gamma_1 & 0 & \delta_1 & 0\cr
0 & 0 & 0 & 1}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}
\end{equation}
and
\begin{equation} \label{esecond}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}^{-1}
\pmatrix{1 & 0 & 0 & 0\cr
0 & p_1 & 0 & q_1\cr 0 & 0 & 1 & 0\cr
0 & r_1 & 0 & s_1}
\pmatrix{d_0 & b_0 &0&0 \cr c_0 & a_0 &0&0\cr
0&0& a_0 & -c_0\cr 0&0& -b_0 & d_0}
\end{equation}
respectively, acting on the original variables $(\check\rho,\check\sigma,\check v)$.
Again we could hope that a part of this symmetry is a symmetry of
$\check\Phi$.

We shall illustrate these by several examples in \S\ref{s3}.

\sectiono{Black hole entropy} \label{sblack}

Another set of constraints may be derived by requiring that the
formula for the index of quarter BPS states match the entropy
of the black hole carrying the same charges in the limit when the
charges are large. The consequences of this constraint have been
analyzed in detail in the
past\cite{9607026,0412287,0510147,0605210} and reviewed in
\cite{0708.1270}. Hence our discussion will be
limited to a review of the salient features.

In the approximation where we keep the supergravity part of
the action containing only the two derivative terms,
the black hole entropy is given by
\begin{equation} \label{eblack1}
\pi\sqrt{Q^2 P^2 - (Q\cdot P)^2}\, .
\end{equation}
In all known cases this result is reproduced by the asymptotic
behaviour of \refb{e2} for large charges. Furthermore the
leading asymptotic behaviour comes from the residue of the
partition function at the pole
at\cite{9607026,0412287,0510147,0605210, 0708.1270}
\begin{equation} \label{eblack2}
\check\rho \check\sigma - \check v^2 + \check v=0\, ,
\end{equation}
up to translations of $\check\rho$, $\check\sigma$ and $\check v$ by their periods.
We shall assume that this result continues to hold in the general
case. Thus $\check\Phi(\check\rho,\check\sigma,\check v)$ must have a zero at \refb{eblack2}.
In order to find the behaviour of $\check\Phi$ near this zero one needs to
know the first non-leading correction to the leading formula
\refb{eblack1} for the black hole entropy.
{\it A priori} these corrections depend
on the complete set of
four derivative terms in the quantum effective
action of the theory and are difficult to calculate.
However in all known examples one finds that the entropy
calculated just by including the Gauss-Bonnet term in the
effective action reproduces correctly the first non-leading
correction to the statistical entropy. If we assume that this
result continues to hold for a general theory then we can
use this to determine the behaviour of $\check\Phi$ near
\refb{eblack2} in terms of
the coefficient of the Gauss-Bonnet term in the effective action.

Since this procedure has been extensively studied in
\cite{9607026,0412287,0510147,0605210} and
reviewed in \cite{0708.1270}, we shall only quote the result.
Typically the Gauss Bonnet term in the Lagrangian has the
form
\begin{equation} \label{eblack3}
 \int d^4 x\, \sqrt{-\det g} \,
 \phi(a,S)\,
\left\{ R_{\mu\nu\rho\sigma} R^{\mu\nu\rho\sigma}
- 4 R_{\mu\nu} R^{\mu\nu}
+ R^2
\right\} \, ,
\end{equation}
where $\tau=a+iS$ is the axion-dilaton modulus and the function
$\phi(a,S)$ has the form
\begin{equation} \label{eblack4}
\phi(a,S) = - {1\over 64\pi^2} \, \left( (k+2) \ln S
+ \ln g(a+iS) + \ln g(-a+iS)\right)
+\hbox{constant}\, .
\end{equation}
Here $k$ is the same integer that appeared
in \refb{espec} and $g(\tau)$ transforms as a modular
form of weight $k+2$ under the S-duality group. In a given theory
$g(\tau)$ can be calculated in string perturbation
theory\cite{9610237,9708062}.
To the first non-leading order in the inverse power of charges,
the effect of this term is to change the black hole entropy
to\cite{0708.1270}
\begin{equation} \label{eblack5}
S_{BH} = \pi \, \sqrt{Q^2 P^2 - (Q\cdot P)^2}
+64\, \pi^2\, \phi\left({Q\cdot P\over P^2},
{\sqrt{Q^2 P^2 - (Q\cdot P)^2}\over P^2}  \right)
+\cdots\,
\end{equation}
The analysis of
\cite{9607026,0412287,0510147,0605210, 0708.1270}
shows that this behaviour can be reproduced
if we assume that near the zero at \refb{eblack2}
\begin{equation} \label{eblack6}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^k\,
\{ v^2 \, g(\rho)\, g(\sigma) +  {\cal O}(v^4)\}\, ,
\end{equation}
where
\begin{equation} \label{eblack7}
\rho = {\check\rho \check\sigma - \check v^2\over \check\sigma}, \quad
\sigma = {\check\rho \check\sigma - (\check v-1)^2\over \check\sigma}, \quad
v= {\check\rho \check\sigma - \check v^2+\check v\over \check\sigma}\, .
\end{equation}
If we assume that eq.\refb{eblack6} holds in general, then it
gives us information about the behaviour of $\check\Phi(\check\rho,\check\sigma,\check v)$
near the zero at \refb{eblack2}. On the other hand if we can determine
$\check\Phi$ from other considerations then the validity of \refb{eblack6}
would provide further evidence for the postulate that in ${\cal N}=4$
supersymmetric string theories the Gauss-Bonnet term gives the
complete correction to black hole entropy to first non-leading order.

\sectiono{Examples} \label{s3}

\renewcommand{\theequation}
{\thesubsection.\arabic{equation}}

In this section we shall describe several applications of the
general procedure described in \S\ref{s2}. Some of them will
involve known cases and will provide a test for our procedure,
while others will be new examples where we shall
derive a set of constraints on
certain dyon partition functions which
have not yet been computed from first principles.

\subsectiono{Dyons with unit torsion
in heterotic string theory on $T^6$} \label{s3.1}

We consider a dyon of charge $(Q,P)$ in the heterotic string theory
on $T^6$. $Q$ and $P$ take values in the
Narain lattice $\Lambda$\cite{narain,nsw}.
Let $S^1$ and $\widetilde S^1$ be two circles of $T^6$, each labelled
by a coordinate with period $2\pi$  and let us denote
by $n',\widetilde n$ the momenta along $S^1$ and $\widetilde S^1$,
by $-w',-\widetilde w$ the  fundamental string winding numbers along
$S^1$ and $\widetilde S^1$, by $N',\widetilde N$ the Kaluza-Klein monopole
charges associated with $S^1$ and $\widetilde S^1$, and by $-W',-\widetilde W$
the H-monopole charges associated with $S^1$ and
$\widetilde S^1$\cite{0708.1270}. Then
in the four dimensional subspace consisting of charge vectors
\begin{equation} \label{ess1}
Q = \pmatrix{\widetilde n\cr n'\cr \widetilde w\cr w'}, \qquad
P = \pmatrix{\widetilde W\cr W'\cr \widetilde N\cr N'}\, ,
\end{equation}
the metric $L$ takes the form
\begin{equation} \label{ess2}
L = \pmatrix{ 0 & I_2\cr I_2 & 0}\, ,
\end{equation}
where $I_2$ denotes $2\times 2$ identity matrix. In this subspace
we consider a three parameter family of charge vectors $(Q,P)$ with
\begin{equation} \label{ess3}
Q=\pmatrix{0 \cr m\cr 0 \cr -1}\, , \qquad P =
\pmatrix{K \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This has
\begin{equation} \label{ess4}
Q^2 = - 2 m, \quad P^2 = 2 K, \quad Q\cdot P = -J\, .
\end{equation}
We shall identify this set of charge vectors as the set
${\cal A}$.
As required, $Q^2$, $P^2$ and $Q\cdot P$ are independent linear
functions of $m$, $K$ and $J$ so that
for a pair of distinct values of $(m,K,J)$ we get a
pair of distinct values of $(Q^2, P^2, Q\cdot P)$.
All the charge vectors in this family
have unit torsion, \i.e.\ if we express the charges as linear combinations
$\sum Q_i e_i$ and $\sum P_i e_i$ of primitive basis elements
$e_i$ of the lattice $\Lambda$, then the torsion
\begin{equation} \label{et1}
r(Q,P) \equiv \hbox{gcd}\{Q_i P_j - Q_j P_i\}\, ,
\end{equation}
is equal to 1. In this case it is known that $Q^2$,
$P^2$ and $Q\cdot P$
are the complete set of T-duality invariants\cite{0712.0043},
\i.e. beginning with a pair $(Q,P)$ with unit torsion we can reach
any other pair with unit torsion and same values of $Q^2$, $P^2$
and $Q\cdot P$ via a T-duality transformation. Since the set ${\cal A}$
contains all integer triplets $(Q^2/2, P^2/2, Q\cdot P)$ we conclude
that
the set ${\cal B}$ is the set of all $(Q,P)$ with unit torsion.
The corresponding partition function is
known\cite{9607026} -- it is the inverse of the
weight ten Igusa cusp
form $\Phi_{10}$ of the full $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ group.

We shall now examine how $\Phi_{10}$ satisfies the various
constraints derived in the previous sections. First of all
note that
since S-duality transformation does not change the torsion $r$, the
full $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ group is a symmetry of this set. Furthermore
in this set $Q^2/2$, $P^2/2$ and $Q\cdot P$ are all quantized in
integer units. Thus the partition function is invariant under
translation of $\check\rho$, $\check\sigma$ and $\check v$ by arbitrary integer units.
These correspond to symplectic transformations of the form
\begin{eqnarray}\displaystyle \label{ecorr}
&& \pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}, \quad \hbox{and} \quad
\pmatrix{1 & 0 & a_1 & a_3\cr
0 & 1 & a_3 & a_2\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}
\nonumber \\ &&
\pmatrix{a & b\cr c & d}\in SL(2,{\hbox{ Z\kern-1.6mm Z}}), \quad a_1,a_2,a_3\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{eqnarray}
Clearly each of these transformations belong to
$Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ and is a symmetry of $\Phi_{10}$.

Next we turn to the constraints from the
wall crossing formula.
In this case all the walls are related by S-duality transformation to
the wall corresponding to the decay $(Q,P)\to (Q,0)+(0,P)$.
So it is sufficient to study the consequences of
the wall crossing formula at this wall.
Clearly $Q^2$ and $P^2$ given in \refb{ess4} are uncorrelated.
Furthermore in heterotic string theory on $T^6$ all $Q$'s with
a given $Q^2$ are related by $T$-duality transformation\cite{wall}.
The same is true for $P$. Thus the subtleties mentioned below
eq.\refb{ex5} are absent, and
the behaviour of
$\check\Phi(\check\rho,\check\sigma,\check v)$ near $\check v=0$ is expected to be
given by \refb{ex3}. In this case
both the electric and the magnetic half-BPS partition functions
are given by $\eta(\tau)^{-24}$
where $\eta$ denotes the Dedekind function. Thus we have,
as a consequence of the wall crossing formula,
\begin{equation} \label{et2a}
\check\Phi(\check\rho,\check\sigma,\check v) \propto \{ \check v^2 \, (\eta(\check\rho))^{24}\,  (\eta(\check\sigma))^{24}
+{\cal O}(\check v^4)\}\,.
\end{equation}
$\eta(\tau)^{24}$ transforms as a modular form of weight 12
under an $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ transformation. {}From eqs.\refb{ez1}
it follows that these $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ transformations
may be regarded as the
following symplectic transformations of $\check\rho$, $\check\sigma$, $\check v$
\begin{eqnarray}\displaystyle \label{ecorr2}
&&\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}\nonumber \\ &&
\pmatrix{\alpha & \beta\cr \gamma & \delta}\in SL(2,{\hbox{ Z\kern-1.6mm Z}}),
\quad \pmatrix{p & q\cr r & s}\in SL(2,{\hbox{ Z\kern-1.6mm Z}})\, .
\end{eqnarray}
Furthermore $\check\Phi$ should have weight $12-2=10$.

Let us now compare these with the known
properties of $\Phi_{10}$. $\Phi_{10}(\check\rho,\check\sigma,\check v)$ is indeed
known to have the factorization property \refb{et2a}.
Furthermore since $\Phi_{10}$ transforms as a modular form of weight
10 under the full $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ group, and since \refb{ecorr2}
are $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices, they represent symmetries of
$\Phi_{10}$. Thus we see that in this case the full set of
symmetries of $\phi_m$ and $\phi_e$ lift to symmetries of
$\check\Phi$.
It is worth noting that the matrices given in
\refb{ecorr} and \refb{ecorr2} generate the full $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ group.
Thus in this case by assuming that the full modular
groups of $\phi_e$ and
$\phi_m$ lift to symmetries of the partition function we could
determine the symmetries of the partition function.

Finally let us consider the constraints coming from the
knowledge of black hole entropy. In this
case the function $g(\tau)$ appearing in \refb{eblack4} is given by
$\eta(\tau)^{24}$.  Thus \refb{eblack6} takes the
fom
\begin{equation} \label{eblack6a}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^{10}\,
\{ v^2 \, \eta(\rho)^{24}\,
\eta(\sigma)^{24} +  {\cal O}(v^4)\}\, ,
\end{equation}
where $(\check\rho,\check\sigma,\check v)$ and $(\rho,\sigma,v)$ are related via
eq.\refb{eblack7}.
The Siegel modular form $\Phi_{10}(\check\rho,\check\sigma,\check v)$
satisfies these properties. In fact since \refb{eblack7}
represents an $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ transformation, the property
\refb{eblack6a} of $\check\Phi(\check\rho, \check\sigma,\check v)$ follows from the
factorization property \refb{et2a}. This however will not be
the case in a more generic situation.

\subsectiono{Dyons with unit torsion and even $Q^2/2$
in heterotic  on $T^6$} \label{s3.2}

We now consider again heterotic string theory on $T^6$, but
choose the set ${\cal A}$ to be collection of $(Q,P)$ of the form:
\begin{equation} \label{ess3a}
Q=\pmatrix{0 \cr 2m\cr 0 \cr -1}\, , \qquad P =
\pmatrix{K \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This has
\begin{equation} \label{ess4a}
Q^2 = - 4 m, \quad P^2 = 2 K, \quad Q\cdot P = -J\, .
\end{equation}
We note that all the
charge vectors have $Q^2/2$ even. Since $Q^2$
is T-duality invariant, any other charge vector which can be
obtained from this one by a T-duality transformation has
$Q^2/2$ even. Thus the set ${\cal B}$ now consists of charge vectors
which have even $Q^2/2$ and arbitrary integer values of
$P^2/2$ and $Q\cdot P$.
Since this set ${\cal B}$ is a subset of charges for which the
spectrum was analyzed in \S\ref{s3.1} we do not expect to derive
any new results. Nevertheless we have chosen this example
as this will serve as a useful guide to our analysis in later
sections.

We first note that
the quantization conditions of $Q^2$, $P^2$
and $Q\cdot P$ imply the following periods of the partition
function:
\begin{equation} \label{ess6}
(\check\rho,\check\sigma,\check v)\to (\check\rho+a_1, \check\sigma+a_2, \check v+a_3), \quad
a_1 \in {\hbox{ Z\kern-1.6mm Z}}, \quad a_2 \in {1\over 2}{\hbox{ Z\kern-1.6mm Z}}, \quad a_3
\in {\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
The period along $\check\sigma$ is not an integer. We can
remedy this by
defining
\begin{equation} \label{ess7}
Q_s = Q/2\, , \qquad \check\sigma_s = 4\check\sigma, \qquad \check v_s = 2\check v\, .
\end{equation}
so that $Q_s^2/2$ and $Q_s\cdot P$
are now quantized in half integer units. The periods
$(\widetilde a_1,\widetilde a_2,\widetilde a_3)$ of the variables
$(\check\rho,\check\sigma_s,\check v_s)$ conjugate to $(P_s^2/2,Q_s^2/2,Q_s\cdot P_s)$
are now integers, given by,
\begin{equation} \label{ess7a}
\widetilde a_1 \in {\hbox{ Z\kern-1.6mm Z}}, \quad \widetilde a_2 \in 2{\hbox{ Z\kern-1.6mm Z}}, \quad \widetilde a_3 \in 2
{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
The dyon partition function in this case can be easily calculated
from the one for \S\ref{s3.1} by taking into account the
evenness of $Q^2/2$. This
amounts
to adding to the original partition function another term where
$\check\sigma$ is shifted by $1/2$. Thus we have
\begin{equation} \label{eus1}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)} = {1\over 2}
\, \left( {1\over \Phi_{10}(\check\rho, \check\sigma,
\check v)}
+ {1\over \Phi_{10}(\check\rho, \check\sigma+{1\over 2},
\check v)}\right)\, ,
\end{equation}
or, in terms of the rescaled variables,
\begin{equation} \label{est5}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)} ={1\over 2}
\left( {1\over \Phi_{10}(\check\rho, {1\over 4}\check\sigma_s, {1\over 2}\check v_s)}
+ {1\over \Phi_{10}(\check\rho, {1\over 4}\check\sigma_s+{1\over 2},
{1\over 2}\check v_s)}\right)\, .
\end{equation}
Let us determine the symmetries of this partition function. For
this it will be useful to work in terms of the original
unscaled variables
$(\check\rho, \check\sigma,\check v)$ and at the
end go back to the rescaled variables.
The first term on the right hand side of \refb{eus1}
has the usual $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ symmetries acting
on the variables $(\check\rho, \check\sigma,
\check v)$. However not all of these are symmetries of the second
term. Given an $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrix
$\pmatrix{a_1 & b_1 & c_1 & d_1\cr
a_2 & b_2 & c_2 & d_2\cr
a_3 & b_3 & c_3 & d_3\cr
a_4 & b_4 & c_4 & d_4}$, it is a symmetry of the
second term provided its action on
$(\check\rho, \check\sigma,
\check v)$ can be regarded as an $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ action
$\pmatrix{a_1' & b_1' & c_1' & d_1'\cr
a_2' & b_2' & c_2' & d_2'\cr
a_3' & b_3' & c_3' & d_3'\cr
a_4' & b_4' & c_4' & d_4'}$
on
$(\check\rho, \check\sigma+{1\over 2},
\check v)$ followed by a translation on $\check\sigma$ by
1/2. Since a translation of $\check\sigma$ by 1/2 can be
regarded as a symplectic transformation with the matrix
$\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 1/2\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}$, the above condition takes the form:
\begin{equation} \label{eresid}
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 1/2\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}
\pmatrix{a_1 & b_1 & c_1 & d_1\cr
a_2 & b_2 & c_2 & d_2\cr
a_3 & b_3 & c_3 & d_3\cr
a_4 & b_4 & c_4 & d_4}
= \pmatrix{a_1' & b_1' & c_1' & d_1'\cr
a_2' & b_2' & c_2' & d_2'\cr
a_3' & b_3' & c_3' & d_3'\cr
a_4' & b_4' & c_4' & d_4'}
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 1/2\cr
0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}\, .
\end{equation}
This gives
\begin{equation} \label{eresid2}
\pmatrix{a_1' & b_1'
& c_1' & d_1'\cr
a_2' & b_2' & c_2' & d_2'\cr
a_3' & b_3' & c_3' & d_3'\cr
a_4' & b_4' & c_4' & d_4'}
=\pmatrix{a_1 & b_1 & c_1 & d_1 - {1\over 2}b_1\cr
a_2+{1\over 2} a_4 & b_2+{1\over 2} b_4
& c_2+{1\over 2} c_4 & d_2+{1\over 2} (d_4-b_2) -{1\over 4} b_4\cr
a_3 & b_3 & c_3 & d_3-{1\over 2} b_3\cr
a_4 & b_4 & c_4 & d_4-{1\over 2} b_4}\, .
\end{equation}
The coefficients $a_i$, $b_i$, $c_i$ and $d_i$ are integers.
Requiring that there exist integer $a_i'$, $b_i'$, $c_i'$ and
$d_i'$ satisfying the above constraints we get further conditions
on $a_i$, $b_i$, $c_i$ and $d_i$. These take the following form:
\begin{equation} \label{eresid3}
a_4, b_4, c_4, b_1,
b_3\in 2{\hbox{ Z\kern-1.6mm Z}}, \quad  b_4 - 2(d_4 - b_2) \in 4{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
On the other hand the requirement that the original matrix
$\pmatrix{a_1 & b_1 & c_1 & d_1\cr
a_2 & b_2 & c_2 & d_2\cr
a_3 & b_3 & c_3 & d_3\cr
a_4 & b_4 & c_4 & d_4}$ is symplectic, together with the
first set of conditions given in \refb{eresid3}, can be used to
show that $b_2$ and $d_4$
are both odd. As a result $(b_2-d_4)$ is even, and hence
$b_4$ must be a multiple of 4 in order to satisfy \refb{eresid3}.
Thus we have
\begin{equation} \label{eresid4}
a_4 = 2 \widehat a_4, \quad b_4 = 4\widehat b_4, \quad
c_4 = 2 \widehat c_4, \quad b_1 = 2 \widehat b_1, \quad
b_3 = 2\widehat b_3, \quad \widehat a_4, \widehat b_4, \widehat c_4, \widehat b_1,
\widehat b_3\in {\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This determines the subgroup of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ which leaves the
individual terms in \refb{eus1} invariant. To this we must add the
additional element corresponding to
$\check\sigma \to \check\sigma+{1\over 2}$ which exchanges the two terms
in \refb{eus1}. This corresponds to the symplectic transformation
\begin{equation} \label{eresid5}
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 1/2\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}\, .
\end{equation}
The full symmetry group is then generated by the matrices:
\begin{equation} \label{eresid6}
\pmatrix{a_1 & 2\widehat b_1 & c_1 & d_1\cr
a_2 & b_2 & c_2 & d_2\cr
a_3 & 2\widehat b_3 & c_3 & d_3\cr
2\widehat a_4 & 4\widehat b_4 & 2\widehat c_4 & d_4} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 1/2\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}\, .
\end{equation}
We can easily determine how these transformations
act on the rescaled variables $(\check\rho,\check\sigma_s,\check v_s)$.
This is done with the help of conjugation by the
symplectic matrix
\begin{equation} \label{econj1}
\pmatrix{1 & 0 & 0 & 0\cr 0 & 2 & 0 & 0\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1/2}\,
\end{equation}
relating $(\check\rho,\check\sigma,\check v)$ to $(\check\rho,\check\sigma_s,\check v_s)$.
This converts the generators given in \refb{eresid6} to
\begin{equation} \label{econj2}
\pmatrix{a_1 & \widehat b_1 & c_1 & 2d_1\cr
2a_2 & b_2 & 2c_2 & 4d_2\cr
a_3 & \widehat b_3 & c_3 & 2d_3\cr
\widehat a_4 & \widehat b_4 & \widehat c_4 & d_4} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 2\cr 0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}\, .
\end{equation}
We now note that all the matrices appearing in \refb{econj2}
have the form
\begin{equation} \label{econj3}
\pmatrix{* & * & * & 0\cr 0 & * & 0 & 0\cr * & * & * & 0\cr
* & * & * & *} \quad \hbox{mod 2}\, ,
\end{equation}
with $*$ denoting an arbitrary integer subject to the condition
that \refb{econj3} describes a symplectic matrix. Furthetmore the
set of matrices \refb{econj3} are closed under matrix multiplication.
Thus the
group generated by the matrices \refb{econj2} is
contained in the group $\check G$ consisting of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$
matrices of the form \refb{econj3}. It is in fact easy to show that
the group generated by the matrices \refb{econj2} is the whole
of $\check G$, \i.e.\ any element of $\check G$ given in
\refb{econj3} can be written as a product
of the elements given in \refb{econj2}.

We shall now set aside this result for a while and study the implications
of S-duality symmetry and the wall crossing formula on the partition
function. The eventual goal is to test the conclusions drawn from the
general arguments along the lines of  \S\ref{sdual} and \S\ref{swall}
against the known results for $\check\Phi$ given above.
It follows from \refb{e3.5} and \refb{ess4a}
that in order that an S-duality
transformation generated by $\pmatrix{a & b\cr c & d}$ takes an
arbitrary element of the set ${\cal B}$ to another element of the
set ${\cal B}$ we must have $b$ even. Thus S-duality transformations
which preserve the set ${\cal B}$ take the form:
\begin{equation} \label{ess5}
Q\to Q'' = a Q + b P, \quad P\to P''=cQ + d P, \quad
a,c,d\in{\hbox{ Z\kern-1.6mm Z}}, \quad b\in 2{\hbox{ Z\kern-1.6mm Z}}, \quad ad-bc=1\, .
\end{equation}
On the original variables $(\check\rho,\check\sigma,\check v)$ the associated transformation
can be represented by the symplectic matrix \refb{e13}. After
conjugation by the matrix \refb{econj1}
we get the symplectic
matrix acting on the rescaled variables $(\check\rho,\check\sigma_s,\check v_s)$:
\begin{equation} \label{esympaa}
\pmatrix{d & \widetilde b &0&0 \cr \widetilde c & a &0&0\cr
0&0& a & -\widetilde c\cr 0&0& -\widetilde b & d}\,, \quad a,\widetilde b\equiv b/2,
d\in{\hbox{ Z\kern-1.6mm Z}}, \quad \widetilde c\equiv 2c\in
2{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This clearly has the form given in \refb{econj3}. Also the
periodicities along the $(\check\rho,\check\sigma_s,\check v_s)$ directions, as given in
\refb{ess7a}, are represented by the symplectic transformation
\begin{equation} \label{esya1}
\pmatrix{1 & 0 & \widetilde a_1 & \widetilde a_3\cr 0 & 1 & \widetilde
a_3 & \widetilde a_2\cr
0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}, \qquad \widetilde a_1\in{\hbox{ Z\kern-1.6mm Z}},
\quad \widetilde a_2, \widetilde a_3 \in 2{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
These also are of the form given in \refb{econj3}.

Next we turn to the information obtained from the wall
crossing relations.  Consider first the wall associated with
decay $(Q,P)\to (Q,0) + (0, P)$, -- this controls the
behaviour of $\check\Phi$ near $\check v=0$ via eq.\refb{ex3}.
Since $Q^2=-4m$ and $P^2=2K$ can vary
independently inside
the set ${\cal A}$, and since any
two charge vectors of the same norm
can be related by a T-duality transformation\cite{wall},
there is no subtlety of the type described below
\refb{ex5}.
The inverse of the magnetic
partition function $\phi_m$ entering \refb{ex3} is the same as
the one that appeared in \refb{et2a}:
\begin{equation} \label{est1}
\phi_m(\check\rho) = (\eta(\check\rho))^{24}\, .
\end{equation}
The electric partition function gets modified from the
corresponding expression given in \refb{et2a}
due to
the fact that we are only including even
$Q^2/2$ states. As a result the partition function now
becomes ${1\over 2}
\left(\eta(\check\sigma)^{-24} +
\eta\left(\check\sigma+{1\over 2}\right)^{-24}\right)$.
Replacing $\check\sigma$ by $\check\sigma_s/4$
we get
\begin{equation} \label{est2}
\phi_e(\check\sigma)^{-1} = {1\over 2}\left(\eta\left({\check\sigma_s\over 4}
\right)\right)^{-24} + {1\over 2}
\left(\eta\left({\check\sigma_s\over 4}+{1\over 2}\right)\right)^{-24}\, .
\end{equation}
This leads to the following behaviour of $\check\Phi$ near
$\check v_s=0$:
\begin{equation} \label{efactor1}
\check\Phi(\check\rho,\check\sigma,\check v) \propto \left[
\check v_s^2 \, \eta(\check\rho)^{24} \, \left\{
\left(\eta\left({\check\sigma_s\over 4}
\right)\right)^{-24} +
\left(\eta\left({\check\sigma_s\over 4}+{1\over 2}\right)\right)^{-24}
\right\}^{-1} + {\cal O}(\check v_s^4)
\right]
\end{equation}
$\check\Phi$ given in \refb{est5} can be shown to satisfy this property.

$\phi_m(\check\rho)$ given in
\refb{est1} transforms  as a modular form of weight 12 under
\begin{equation} \label{est1.5}
\check\rho\to {\alpha \check\rho +\beta\over \gamma\check\rho + \delta},
\qquad \pmatrix{\alpha &\beta \cr\gamma & \delta}
\in SL(2,{\hbox{ Z\kern-1.6mm Z}})\, .
\end{equation}
On the other hand
$\phi_e(\check\sigma)$ given in \refb{est2} can be shown to
transform as a modular form of weight
12 under
\begin{equation} \label{est3}
\check\sigma_s \to {p\check\sigma_s + q\over r\check\sigma_s + s}, \quad \pmatrix{ p & q\cr r & s}
\in\Gamma^0(2)\, ,
\end{equation}
\i.e. $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices with $q$ even.
\refb{est1.5} and \refb{est3} can be represented as symplectic
transformations of $(\check\rho,\check\sigma_s,\check v_s)$ generated by the
$Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices
\begin{equation} \label{es1a}
\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}\, , \quad  q\in 2 {\hbox{ Z\kern-1.6mm Z}}, \quad
\alpha,\beta,\gamma,\delta,p,r,s\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
We now note that these transformations fall in the class given in
\refb{econj3}. Thus in this case
the modular symmetries of the half-BPS
partition function associated with pole at $\check v=0$ are lifted to
symmetries of the full partition function.

In this case there is one additional wall which is not related to the
wall considered above by the $\Gamma^0(2)$ S-duality
transformation \refb{ess5} acting on the original variables.
This corresponds to the decay  $(Q,P)\to (Q-P, 0) +(P,P)$.
Comparing this with \refb{ede1} we see that here
\begin{equation} \label{esv1}
\pmatrix{a_0 & b_0\cr c_0 & d_0} = \pmatrix{1 & 1\cr
0 & 1}\, .
\end{equation}
Following \refb{esx3}, \refb{esx4} and the relationship
\refb{ess7} between the original variables and the rescaled variables
we have
\begin{equation} \label{esv2}
\check\rho' = \check\rho + {1\over 4}\check\sigma_s +\check v_s, \quad \check\sigma' = {1\over 4}{\check\sigma_s},
\quad
\check v' = {1\over 2} \check v_s +{1\over 4} \check\sigma_s\, ,
\end{equation}
\begin{equation} \label{esv3}
Q' = Q-P, \quad P' = P\, .
\end{equation}
Thus the pole
of the partition function is at $\check v_s + {1\over 2}\check\sigma_s=0$.
Furthermore
since from the relations \refb{ess4a} we see that the allowed
values of $(Q-P)^2/2=J+K-2m$ and
$P^2/2=K$ are uncorrelated and can take
arbitrary integer values,
it follows from \refb{ebe1} that
at this zero $\check\Phi$ goes as
\begin{equation} \label{esv4}
\check\Phi(\check\rho,\check\sigma_s,\check v_s) \propto (2\check v_s +\check\sigma_s)^2 \, \phi_m\left(\check\rho
+{1\over 4}\check\sigma_s+\check v_s;{1}, 1\right) \,
\phi_e\left({1\over 4}\check\sigma_s; 1,0\right) +
{\cal O}\left((2\check v_s+\check\sigma_s)^4\right)\, .
\end{equation}
$\phi_m(\tau; {1}, 1)$ denotes the partition
function of half-BPS
states carrying charges $(P,  P)$,
with $\tau$ being conjugate to the variable
$P^{\prime 2}/2=P^2/2$. Thus
we have $\phi_m(\tau; {1}, 1)=(\eta(\tau))^{24}$. On the
other hand $(\phi_e(\tau;1,0))^{-1}$ is the partition function of half
BPS states carrying charges $(Q',0)=(Q-P, 0)$
 with $\tau$ being conjugate to $Q^{\prime 2}/2
= (Q-P)^2/2$. Since $(Q-P)^2/2=(-2m+K+J)$ can take arbitrary
integer values, the corresponding
partition function is also given by
$\eta(\tau)^{-24}$.
Thus
we have near $(\check\sigma_s+2\check v_s)=0$
\begin{equation} \label{efactor2}
\check\Phi(\check\rho,\check\sigma_s,\check v_s) \propto \left\{ (2\check v_s+\check\sigma_s)^2 \eta\left(
\check\rho + {1\over 4} \check\sigma_s +\check v_s\right)^{24}
\eta\left({\check\sigma_s\over 4}\right)^{24}
+ {\cal O}((2\check v_s+\check\sigma_s)^4)
\right\}
\end{equation}
$\check\Phi$ given in \refb{est5} can be shown to satisfy this property.

$\phi_m(\tau;{1}, 1)$ transforms as a modular
form of weight 12 under
$\tau\to (\alpha_1\tau +\beta_1)/(\gamma_1\tau+\delta_1)$ with
$\alpha_1,\beta_1,\gamma_1, \delta_1\in {\hbox{ Z\kern-1.6mm Z}}$, $\alpha_1\delta_1
-\beta_1\gamma_1=1$. On the other hand $\phi_e(\tau;1,0)$ transforms
as a modular form of weight 12 under
$\tau\to (p_1\tau+q_1)/(r_1\tau+s_1)$
with $p_1,q_1,r_1,s_1\in{\hbox{ Z\kern-1.6mm Z}}$,
$p_1s_1 -q_1r_1=1$.
Using \refb{egensp}, \refb{esecond} and \refb{econj1}
we see that the the action of these transformations
on the variables $(\check\rho,\check\sigma_s,\check v_s)$ may be represented by the
symplectic matrices
\begin{eqnarray}\displaystyle \label{esv6}
&& \pmatrix{\alpha_1 & (\alpha_1-1)/2 & \beta_1 & 0\cr
0 & 1 & 0 & 0\cr \gamma_1 & \gamma_1/2 & \delta_1 & 0\cr
\gamma_1/2 & \gamma_1/4 & (\delta_1 -1)/2 & 1}, \quad
\pmatrix{1 & (1 - p_1)/2 & q_1  & -2q_1  \cr
0 & p_1 & -2q_1  & 4q_1\cr  0 & 0 & 1 & 0\cr 0 & r_1/4
& (1-s_1)/2 & s_1}\,  . \nonumber \\
\end{eqnarray}
By comparing with the matrices given in \refb{econj3} we see
however that the transformations \refb{esv6} generates symmetries
of the full partition function only after we impose the additional
constraints
\begin{equation} \label{esksk1}
r_1, \gamma_1\in 4{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
Thus here we encounter a case where only a subset of
the symmetries of the partition function near a pole is lifted to
a full symmetry of the partition function. By examining the details
carefully one discovers that in this case the
pole comes from the first term
in \refb{est5}. Whereas this term displays the full symmetry
given in \refb{esv6}, requiring that the other term also transforms
covariantly under this symmetry generates the additional
restrictions given in \refb{esksk1}.

Finally we turn to the constraint from black hole entropy. As in
\S\ref{s3.1}, in this case we have $g(\tau)=\eta(\tau)^{24}$
in \refb{eblack4}.  Thus \refb{eblack6} takes the
form
\begin{equation} \label{eblack6b}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^{10}\,
\{ v^2 \, \eta(\rho)^{24}\,
\eta(\sigma)^{24} +  {\cal O}(v^4)\}\, ,
\end{equation}
where  $(\check\rho,\check\sigma,\check v)$ and $(\rho,\sigma,v)$ are related via
\refb{eblack7}.
$\check\Phi(\check\rho,\check\sigma,\check v)$ given in \refb{eus1} can be shown to satisfy this
property. In fact the relevent pole of $\check\Phi^{-1}$ comes from the first
term on the right hand side of \refb{eus1}. The location of
the zeroes of $\Phi_{10}$ are given in \refb{eapl5a},
and it follows from this
that the second term does not have a pole at
$v=0$.

\subsectiono{Dyons of torsion 2 in heterotic string theory
on $T^6$}
\label{s3.4}

We consider again heterotic string theory on $T^6$ and take the
set ${\cal A}$ to consist of charge vectors of the form
\begin{equation} \label{esa1}
Q=\pmatrix{1 \cr 2m+1\cr 1 \cr 1}\, , \qquad P =
\pmatrix{2K+1 \cr 2J+1 \cr 1\cr -1}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This has
\begin{equation} \label{esa2}
Q^2 = 4(m+1), \quad P^2 = 4(K-J), \quad Q\cdot P = 2(K+J-m+1)\, .
\end{equation}
Furthermore gcd$\{Q_i P_j - Q_j P_i\}$=2. Thus we have a
family of charge vectors with torsion
2.  It was shown in \cite{0712.0043,0801.0149} that for $r=2$
there are three T-duality
orbits for given $(Q^2, P^2, Q\cdot P)$ -- in the first
$Q$ is twice a primitive lattice vector, in the second $P$ is
twice a primitive lattice vector and in the third both $Q$ and $P$
are primitive but $Q\pm P$ are twice primitive lattice vectors.
The dyon charges given in \refb{esa1} are clearly of the third
kind.
In the notation of \cite{0801.0149} the
discrete T-duality invariants of
these charges are $(r_1=1, r_2=1, r_3=2, u_1=1)$.
Note that as we vary $m$, $J$ and $K$, $Q^2/2$ and $P^2/2$ take
all possible even values and $Q\cdot P$ takes all possible
values subject to the restriction that $Q\pm P$ are
twice primitive lattice vectors. The latter condition requires
$Q\cdot P$ to be even and
$Q\cdot P -{1\over 2}Q^2 - {1\over 2}P^2$ to be a multiple
of four. It now follows from the result of
\cite{0712.0043,0801.0149} that the T-duality
orbit ${\cal B}$ of the set ${\cal A}$ consists of all the pairs
$(Q,P)$ with $(r_1=1, r_2=1, r_3=2, u_1=1)$ and
even values of $Q^2/2$, $P^2/2$.

Since $Q^2/2$, $P^2/2$ and $Q\cdot P$ are all
even and $Q^2 + P^2 + 2Q\cdot P$ is a multiple of 8,
it is natural to introduce  new charge vectors and variables
\begin{equation} \label{escale2}
Q_s\equiv Q/2, \quad P_s \equiv P/2, \quad \check\rho_s\equiv
4\check\rho, \quad
\check\sigma_s \equiv 4\check\sigma, \quad \check v_s\equiv 4\check v\, ,
\end{equation}
so that we have
\begin{equation} \label{esa3}
{1\over 2}Q_s^2 = {1\over 2}
(m+1), \quad {1\over 2} P_s^2 = {1\over 2}
(K-J), \quad Q_s\cdot P_s
= {1\over 2} (K+J-m+1)\, ,
\end{equation}
quantized in half integer units subject to the constraint that
\begin{equation} \label{econstr}
{1\over 2}Q_s^2 + {1\over 2} P_s^2 +  Q_s\cdot P_s
= K + 1\, ,
\end{equation}
is an integer.
Since $(\check\rho_s,\check\sigma_s,\check v_s)$ are conjugate to
$(P_s^2/2, Q_s^2/2, Q_s\cdot P_s)$,
the partition function \refb{e1} will be periodic under
\begin{equation} \label{eper}
(\check\rho_s, \check\sigma_s, \check v_s) \to (\check\rho_s+2, \check\sigma_s, \check v_s), \,
(\check\rho_s, \check\sigma_s+2, \check v_s), \, (\check\rho_s, \check\sigma_s, \check v_s+2),
\, (\check\rho_s+1, \check\sigma_s+1, \check v_s+1)\, .
\end{equation}
The group generated by these transformations
can be collectively represented by symplectic matrices
of the form
\begin{equation} \label{ecollect}
\pmatrix{1 & 0 & \widetilde a_1 & \widetilde a_3\cr
0 & 1 & \widetilde a_3 & \widetilde a_2\cr 0 & 0 & 1 & 0
\cr 0 & 0 & 0 & 1}, \quad
\widetilde a_1, \widetilde a_2, \widetilde a_3\in{\hbox{ Z\kern-1.6mm Z}}, \quad
\widetilde a_1+\widetilde a_2, \widetilde a_2+\widetilde a_3, \widetilde a_1+\widetilde a_3\in 2{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{equation}
acting on the variables $(\check\rho_s,\check\sigma_s,\check v_s)$.
For future reference we note that
the change of variables from $(\check\rho,\check\sigma,\check v)$ to $(\check\rho_s,\check\sigma_s,\check v_s)$
can be regarded as a symplectic transformation of the form
\begin{equation} \label{esym1}
\pmatrix{2 & 0 & 0 & 0 \cr  0 & 2 & 0 & 0\cr 0 & 0 & 1/2 & 0\cr
0 & 0 & 0 & 1/2}\, .
\end{equation}

We now need to determine the subgroup of the S-duality
group that leaves the set ${\cal B}$ invariant. If we did not
have the restriction that $Q^2/2$ and $P^2/2$ are even, then this
subgroup would consist of $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices of the
form $\pmatrix{a & b\cr c & d}$ subject to the restriction
$a+b\in 2{\hbox{ Z\kern-1.6mm Z}}+1$ and $c+d\in 2{\hbox{ Z\kern-1.6mm Z}}+1$\cite{0801.0149}, --
these conditions
guarantee  that
the new charge vectors $(Q'',P'')$ are each primitive and
hence have the same set of discrete
T-duality invariants
$(r_1=1, r_2=1, r_3=2, u_1=1)$.
 We shall now
argue that the same subgroup also leaves the set ${\cal B}$ invariant.
For this we need to note that if we begin with a $(Q,P)$ for which
$Q^2/2$, $P^2/2$ and $Q\cdot P$ are all even then their
S-duality transforms given in
\refb{e3.5} will automatically have the same properties.
Thus requiring the transformed
pair $(Q'',P'')$ to have even $Q^{\prime\prime2}/2$ and
$P^{\prime\prime2}/2$, as is required for $(Q'', P'')$ to
belong to the set ${\cal B}$,
does not put any additional restriction on the S-duality
transformations. Since both $Q$ and $P$ are
scaled by the same amount to get the rescaled charges
$Q_s$ and $P_s$, the S-duality group action on $(Q_s, P_s)$
is identical to that on $(Q,P)$ and hence its action on
$(\check\rho_s,\check\sigma_s,\check v_s)$ is identical to that on $(\check\rho,\check\sigma,\check v)$.
Using \refb{e13} we see that
the  representations of these symmetries as symplectic matrices
are given by
\begin{equation} \label{ete2s}
\pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}, \qquad a,b,c,d\in{\hbox{ Z\kern-1.6mm Z}}, \quad ad-bc=1,
\quad a+c\in 2{\hbox{ Z\kern-1.6mm Z}}+1, \quad b+d\in 2{\hbox{ Z\kern-1.6mm Z}}+1\, ,
\end{equation}
acting on the variables $(\check\rho,\check\sigma,\check v)$ and also on
$(\check\rho_s,\check\sigma_s,\check v_s)$.

Next we turn to the constraints from the wall crossing formula.
We begin with the wall associated with the decay $(Q,P)\to
(Q,0)+(0,P)$, --
this controls the behaviour of $\check\Phi$ at $\check v=0$.
The analysis is straightforward. We note that
both electric and magnetic partition functions involve
summing over all possible
even $Q^2/2$ and $P^2/2$ values.  An analysis
similar to the one leading to \refb{est2} give
\begin{equation} \label{ex11}
\phi_e(\check\sigma)^{-1}=
{1\over 2} \left\{   \eta\left({\check\sigma_s\over 4}\right)^{-24}
+ \eta\left({\check\sigma_s+2\over 4}\right)^{-24}
\right\} \, ,
\end{equation}
and
\begin{equation} \label{ex12}
\phi_m(\check\rho)^{-1} =
{1\over 2} \left\{   \eta\left({\check\rho_s\over 4}\right)^{-24}
+ \eta\left({\check\rho_s+2\over 4}\right)^{-24}
\right\}\, .
\end{equation}
Thus we have
\begin{equation} \label{ev=0}
\check\Phi(\check\rho,\check\sigma,\check v) \sim \left[\check v_s^2 \, \left\{   \eta\left({\check\sigma_s
\over 4}
\right)^{-24}
+ \eta\left({\check\sigma_s+2\over 4}\right)^{-24}
\right\}^{-1}
\left\{   \eta\left({\check\rho_s\over 4}\right)^{-24}
+ \eta\left({\check\rho_s+2\over 4}\right)^{-24}
\right\}^{-1} +{\cal O}(\check v_s^4)\right]\, ,
\end{equation}
near $\check v=0$.
One can easily verify that the functions $\phi_e(\check\sigma)$ and
$\phi_m(\check\rho)$
transform
as modular forms of weight 12 under the transformation
$\check\sigma_s\to (p\check\sigma_s + q) / (r\check\sigma_s + s)$ and
$\check\rho_s\to (\alpha \check\rho_s +\beta)/(\gamma\check\rho_s+\delta)$
with $\pmatrix{p & q\cr r & s}
\in \Gamma^0(2)$ and $\pmatrix{\alpha & \beta\cr \gamma &\delta}
\in \Gamma^0(2)$.
These can be regarded as symplectic transformations of the
form
\begin{eqnarray}\displaystyle \label{esut1}
&\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}, \nonumber \\
& \alpha\delta - \beta\gamma=1, \quad
ps - qr=1, \quad  p,r,s,\alpha,\gamma,\delta\in{\hbox{ Z\kern-1.6mm Z}}, \quad
q,\beta\in 2{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{eqnarray}
acting on $(\check\rho_s,\check\sigma_s,\check v_s)$.

Next we consider the wall associated with the decay
$(Q,P)\to ((Q-P)/2, (P-Q)/2) + ((Q+P)/2, (Q+P)/2) $. From
\refb{ede1} we see that the
associated matrix can be taken to be
\begin{equation} \label{ematrix}
\pmatrix{a_0 & b_0\cr c_0 & d_0} = \pmatrix{{1\over\sqrt 2} &
{1\over\sqrt 2} \cr - {1\over\sqrt 2} & {1\over\sqrt 2}}\, .
\end{equation}
According to \refb{epole1}
this controls the
behaviour of $\check\Phi(\check\rho,\check\sigma,\check v)$ near its zero at
\begin{equation} \label{emm1}
\check\rho-\check\sigma = 0\, .
\end{equation}
Following the procedure outlined in
eqs.\refb{esx3}-\refb{ebe1} we can find the coefficient of
$(\check\rho-\check\sigma)^2$ in the expression for $\check\Phi$.
One can see from \refb{esa1} that in this case
${1\over 2} ((Q+P)/2)^2$
and ${1\over 2} ((Q-P)/2)^2$ can take all possible
independent integer
values $(K+1)$ and $(m-J)$ respectively.
We find from \refb{ebb1} that the inverses of the
relevant half-BPS partition functions are:
\begin{equation} \label{emm2}
\phi_e\left(\tau;a_0,c_0\right)
=\eta(2\tau)^{24}, \quad
\phi_m\left(\tau;b_0,d_0\right)
=\eta(2\tau)^{24}\, .
\end{equation}
The factor of $2$ in the argument of $\eta$ is due to the fact that
$Q^{\prime 2}/2 = (d_0Q - b_0 P)^2/2 =
(Q-P)^2/4$ and $P^{\prime 2}/2
=(-c_0Q + a_0 P)^2/2=(Q+P)^2/4$ entering in
\refb{ebb1} are twice the usual integer
normalized combinations ${1\over 8} (Q\pm P)^2$.
This gives, from \refb{esx3}, \refb{ebe1} and \refb{escale2}
\begin{equation} \label{emm3}
\check\Phi(\check\rho,\check\sigma,\check v) \sim \left\{(\check\rho_s-\check\sigma_s)^2 \,
\eta((\check\rho_s+\check\sigma_s-2\check v_s)/4)^{24} \, \eta((\check\rho_s+\check\sigma_s+2\check v_s)/4)^{24}
+{\cal O}((\check\rho_s-\check\sigma_s)^4)\right\}\, ,
\end{equation}
near $\check\rho_s\simeq\check\sigma_s$. Since $\eta(2\tau)$ transforms covariantly
under $\tau\to (\alpha\tau+{1\over 2}\beta)/
(2\gamma\tau +\delta)$ with $\pmatrix{\alpha &\beta
\cr \gamma& \delta}\in SL(2,{\hbox{ Z\kern-1.6mm Z}})$,
both $\phi_e$ and $\phi_m$
have full $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ symmetry. Using \refb{egensp},
\refb{esecond} and \refb{esym1}
to represent them as symplectic transformations
on the variables $(\check\rho_s,\check\sigma_s,\check v_s)$ we get the following two
sets of symplectic matrices:
\begin{eqnarray}\displaystyle \label{emm4}
& {1\over 2}
\pmatrix{{\alpha_1+1} & {\alpha_1-1}
& 2{\beta_1} & 2{\beta_1}\cr
{\alpha_1-1} & {\alpha_1+1}
& 2{\beta_1} & 2{\beta_1}\cr
{\gamma_1/2} & {\gamma_1/2} &
{\delta_1+1} & {\delta_1-1} \cr
{\gamma_1/2} & {\gamma_1/2} &
{\delta_1-1} & {\delta_1+1}
} , \quad
{1\over 2}\pmatrix{{p_1+1} & {-p_1+1}
& {2q_1} & {-2q_1}\cr
{-p_1+1} & {p_1+1}
& {-2q_1} & {2q_1}\cr
{r_1/2} & {-r_1/2}  & {s_1+1}
& {-s_1+1}\cr
{-r_1/2} & {r_1/2}  & {-s_1+1}
& {s_1+1}}\, , \nonumber \\ \cr
& \alpha_1,\beta_1,\gamma_1,\delta_1,p_1, q_1, r_1, s_1\in{\hbox{ Z\kern-1.6mm Z}},
\quad \alpha_1\delta_1-\beta_1\gamma_1=p_1s_1-q_1r_1=1\, .
\end{eqnarray}

Next we turn to the wall corresponding to the decay
$(Q,P)\to (Q-P, 0) +(P, P)$. This corresponds to the
choice
\begin{equation}\label{ea0b0}
\pmatrix{a_0 & b_0\cr c_0 & d_0} = \pmatrix{1 & 1 \cr 0 & 1}\, ,
\end{equation}
and is associated with the zero of
$\check\Phi$ at
\begin{equation} \label{eabab1}
\check\sigma +\check v=0\, .
\end{equation}
Since $(Q-P)^2/8=m-J$ and $P^2/4=K-J$ can take independent
integer values,  we should be able to use \refb{ex3},
\refb{ex4}.
The behaviour of $\check\Phi$ near this zero is however somewhat
ambiguous since one of the decay products -- the state carrying
charge $(Q-P,0)$ -- is not a primitive dyon. As a result the index
associated with this state is ambiguous.\footnote{For half-BPS states
in ${\cal N}=2$ supersymmetric theories a modification of the wall
crossing formula for such non-primitive decays has been suggested
in \cite{0702146}. It is not clear {\it a priori}
how to modify it for the decays of
quarter BPS dyons in ${\cal N}=4$ supersymmetric string theories.
In \S\ref{sprop} we shall propose a formula for the partition function
of the states being studied in this section and examine it to find what the
modification should be.}
Nevertheless if we
go ahead and assume the naive index that follows from
tree level spectrum of elementary string states, we get the
following factorization behaviour of $\check\Phi$:
\begin{equation} \label{eabab2}
\check\Phi(\check\rho, \check\sigma, \check v) \, {?\atop \sim} \, \left\{ (\check\sigma_s + \check v_s)^2
\phi_e\left({\check\sigma_s\over 4};1,0\right) \,
\phi_m\left({\check\rho_s+\check\sigma_s+2\check v_s\over 4};1,1\right)
 +{\cal O}((\check\sigma_s+\check v_s)^4)\right\}\quad
\hbox{for $\check v\simeq -\check\sigma$}\, ,
\end{equation}
with
\begin{eqnarray}\displaystyle \label{eabab2.5}
\phi_e\left({\tau\over 4};1,0\right) &=&{1\over 4}
\left\{\eta(\tau/4)^{-24} + \eta((\tau+1)/4)^{-24}
+\eta((\tau+2)/4)^{-24} +\eta((\tau+3)/4)^{-24}
\right\}^{-1}, \nonumber \\
\phi_m\left({\tau\over 4};1,1\right) &=&
{1\over 2} \left\{\eta(\tau/4)^{-24}
+\eta(\tau+2)/4)^{-24}\right\}^{-1}\,  .
\end{eqnarray}
$\phi_e(\tau/4)$ has duality symmetries of the form $\tau\to
(p_2\tau+q_2)/(r_2\tau+s_2)$ with
$\pmatrix{p_2 & q_2\cr r_2 & s_2}\in
\Gamma_0(2)$. On the other hand $\phi_m(\tau/4)$ has duality
symmetries of the form $\tau\to (\alpha_2\tau+\beta_2)/
(\gamma_2\tau+\delta_2)$ with $\pmatrix{\alpha_2 & \beta_2
\cr \gamma_2 &\delta_2}\in \Gamma^0(2)$.
Using \refb{egensp},
\refb{esecond} and \refb{esym1} we find that
the modular properties in this factorized limit correspond to
the following symplectic transformations acting on
$(\check\rho_s,\check\sigma_s,\check v_s)$
\begin{eqnarray}\displaystyle \label{eabab3}
& \pmatrix{\alpha_2 & \alpha_2 -1 & \beta_2 & 0\cr
0 & 1 & 0 & 0\cr \gamma_2 & \gamma_2 & \delta_2 & 0\cr
\gamma_2  & \gamma_2  & \delta_2 -1 & 1}
\quad \hbox{and} \quad
\pmatrix{1 & 1-p_2 & q_2 & -q_2\cr 0 & p_2 & -q_2 & q_2\cr
0 & 0 & 1 & 0\cr 0 & r_2 & 1-s_2  & s_2}
\, , \nonumber \\
& \alpha_2\delta_2 - \beta_2\gamma_2=1=p_2 s_2-r_2 q_2,
\quad \alpha_2, \gamma_2, \delta_2,
p_2, q_2, s_2 \in{\hbox{ Z\kern-1.6mm Z}}, \quad
\beta_2, r_2\in 2{\hbox{ Z\kern-1.6mm Z}} \, .
\end{eqnarray}

We can now try to see if all the symplectic transformation
matrices \refb{ecollect}, \refb{ete2s}, \refb{esut1},
\refb{emm4} and \refb{eabab3},
representing possible symmetries of $\check\Phi$, fit into
some subgroup of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ defined by some
congruence condition. As it stands there does not seem to be a
simple
congruence subgroup of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$
that fits all the matrices since some of these matrices do not even
have integer entries. However if
we restrict $\gamma$ and $r$ in \refb{esut1} to be even, \i.e.\ assume
that only a $\Gamma(2)\times \Gamma(2)$ subgroup of the symmetry
group $\Gamma^0(2)\times \Gamma^0(2)$ of the $\check v\to 0$ limit
survives as a symmetry of the full partition function, and restrict
$\gamma_1$ and $r_1$ in \refb{emm4} to be multiples of 4, \i.e.\ assume
that only a $\Gamma_0(4)\times \Gamma_0(4)$ subgroup of the
$\check\rho_s\to \check\sigma_s$ limit survives as a symmetry of the full partition
function,
then there
is a simple congruence subgroup of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ into which all the
matrices fit:
\begin{equation} \label{epropose}
\pmatrix{1+u & u & v & v\cr u & 1+u & v & v\cr
w & w & 1+u & u \cr w & w & u & 1+u}\quad \hbox{mod 2}, \quad
u,v,w=0, 1\, .
\end{equation}
We speculate that this could be the symmetry group of the dyon partition
function under consideration.

Finally we turn to the constraint from black hole entropy. As in
\S\ref{s3.1}, in this case we have $g(\tau)=\eta(\tau)^{24}$
in \refb{eblack4}.  Thus \refb{eblack6} takes the
form
\begin{equation} \label{eblack6bb}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^{10}\,
\{ v^2 \, \eta(\rho)^{24}\,
\eta(\sigma)^{24} +  {\cal O}(v^4)\}\, ,
\end{equation}
where $(\rho,\sigma,v)$ and $(\check\rho,\check\sigma,\check v)$ are related via
\refb{eblack7}.

Before concluding this section we would like to note that we can
easily extend the analysis of this section to the complementary subset
of torsion 2 dyons with $Q$, $P$ primitive and $Q^2/2$ and $P^2/2$
odd. For this we consider six dimensional electric and magnetic charge
vectors with metric
\begin{equation} \label{esix1}
L=\pmatrix{ 0 & 1 & 0 & 0\cr 1 & 0 & 0 & 0\cr 0 & 0 & 0 & I_2\cr
0 & 0 & I_2 & 0}\, ,
\end{equation}
and take the set ${\cal A}$ to be the collection of charge vectors $(Q,P)$
with
\begin{equation} \label{esix2}
Q=\pmatrix{1\cr -1\cr 1 \cr 2m+1\cr 1 \cr 1}\, , \qquad P =
\pmatrix{1\cr 1\cr 2K+1 \cr 2J+1 \cr 1\cr -1}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
This has
\begin{equation} \label{esix3}
{Q^2\over 2} = 2m+1, \quad {P^2\over 2} = 2(K-J)+1,
\quad Q\cdot P = 2(K+J-m+1)\, .
\end{equation}
Thus we have $Q^2/2$ and $P^2/2$ odd and $Q\cdot P$ even.
Furthermore
we still have the constraint that
$Q^2 + P^2 + 2Q\cdot P$ is a multiple of 8. Thus with
$(\check\rho_s,\check\sigma_s,\check v_s)$ defined as in \refb{escale2}, the partition
function is antiperiodic under $(\check\rho_s,\check\sigma_s,\check v_s)\to
(\check\rho_s+2, \check v_s,\check\sigma_s), (\check\rho_s,\check\sigma_s+2,\check v_s)$ and periodic
under $(\check\rho_s,\check\sigma_s,\check v_s)\to (\check\rho_s,\check\sigma_s,\check v_s+2),
(\check\rho_s+1,\check\sigma_s+1,\check v_s+1)$. We can now repeat the analysis of this
section for this set of dyons. The results are more or less identical
except for some
relative minus signs between the terms in the curly brackets
in
eqs.\refb{ex11}-\refb{ev=0} and the second equation
in \refb{eabab2.5}.

\subsectiono{Dyons in ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL orbifold with twisted sector
electric charge} \label{s3.3}

We now consider a ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL orbifold
defined as follows\cite{9505054,9506048}.
We begin with $E_8\times E_8$
heterotic string theory on $T^4\times S^1
\times \widetilde S^1$ with $S^1$ and $\widetilde S^1$ labelled by coordinates
with period $4\pi$ and $2\pi$ respectively, and
take a quotient of the theory
by a ${\hbox{ Z\kern-1.6mm Z}}_2$ symmetry that involves $2\pi$ shift along $S^1$
together with an exchange of the two $E_8$ factors.
In the four dimensional subspace of charges
given in \refb{ess1}, now the momentum
$n'$ along $S^1$ is quantized in units of $1/2$ whereas the
Kaluza-Klein monopole charge
$N'$ along $S^1$ is quantized in units of $2$\cite{0605210}.
We shall take the set ${\cal A}$ to be
consisting of charge vectors of the form
\begin{equation} \label{ed1}
Q=\pmatrix{0 \cr m/2\cr 0 \cr -1}\, , \qquad P =
\pmatrix{K \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
For this state we have
\begin{equation} \label{ed2}
Q^2 = - m, \quad P^2 = 2 K, \quad Q\cdot P = -J\, .
\end{equation}
As usual we denote by ${\cal B}$ the set of all $(Q,P)$ which are
related to the ones given in \refb{ed2} by a T-duality transformation.
Since $Q^2/2$, $P^2/2$ and $Q\cdot P$ are quantized in units of
$1/2$, 1 and 1 respectively, $\check\Phi$ satisfies the periodicity
conditions \refb{e14} with
\begin{equation} \label{ed3}
a_1\in{\hbox{ Z\kern-1.6mm Z}}, \quad a_2\in 2{\hbox{ Z\kern-1.6mm Z}}, \quad a_3 \in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
Comparison of \refb{ed1} and \refb{ess1}
shows that the winding charge
$-w'$ along $S^1$ is
$1$ for this state. Thus it represents a twisted sector state.

Our next task is to determine the subgroup of the S-duality group
that leaves the set ${\cal B}$ invariant. In this case the full S-duality
group is $\Gamma_0(2)$, generated by matrices of the form
$\pmatrix{a & b\cr c & d}$ with $a,b,d\in{\hbox{ Z\kern-1.6mm Z}}$, $c\in 2{\hbox{ Z\kern-1.6mm Z}}$,
$ad-bc=1$. It was shown in \cite{0708.1270}
that the set ${\cal B}$ is closed
under the full S-duality group. Thus the full S-duality group must
be a symmetry of the partition function.

We now turn to the constraints from the wall crossing formula.
Consider first the wall associated with the decay $(Q,P)\to (Q,0)
+(0,P)$, --
this in fact is the only case we need to analyze since
all the
walls are related to this one by S-duality
transformation\cite{0702141}. First of all note from
\refb{ed1}, \refb{ed2} that for a given $Q^2=-m$ the charge vector
$Q\in{\cal A}$
is fixed uniquely. Thus the index of half-BPS states with charge
$(Q,0)$ can be regarded as a function of $Q^2$. On the other hand
for a given $P^2=2K$ there is a family of $P\in{\cal A}$ labelled by
$J$, but  these can be transformed to the vector corresponding to
$J=0$ by the T-duality transformation matrix\cite{0708.1270}
$\pmatrix{1 & 0 & 0 & J\cr 0 & 1 & -J & 0\cr
0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}$. Thus the index of the charge
vector $(0,P)$ can also be expressed as a function of $P^2$.
Finally we see from \refb{ed2} that the allowed values of $Q^2$
and $P^2$ are uncorrelated. Thus we can use eqs.\refb{ex3},
\refb{ex4} to extract the behaviour of $\check\Phi$ near $\check v=0$.
The electric partition function can be calculated by
examining the spectrum of twisted sector states in the heterotic
string theory\cite{0502126,0502157,0504005,0507014}.
On the other hand the magnetic partition function
can be calculated by examing the spectrum of D1-D5 system in a dual
type IIB description of the theory\cite{0708.1270}. The results are
\begin{equation} \label{ed4}
\phi_e(\check\sigma) = \eta(\check\sigma)^{8} \eta(\check\sigma/2)^{8}\, ,
\qquad \phi_m(\check\rho)  = \eta(\check\rho)^{8} \eta(2\check\rho)^{8}\, .
\end{equation}
Eq.\refb{ex3} then gives, near $\check v=0$,
\begin{equation} \label{efactor3}
\check\Phi(\check\rho,\check\sigma,\check v) \propto \left\{ \check v^2 \eta(\check\sigma)^8
\eta(\check\sigma/2)^8 \eta(\check\rho)^8\eta(2\check\rho)^8 +{\cal O}(\check v^4)\right\}\, .
\end{equation}
$\phi_e(\check\sigma)$ and $\phi_m(\check\rho)$
transform as modular forms of weight $8$ under
\begin{equation} \label{ed5}
\check\sigma\to {p\check\sigma + q\over r\check\sigma +s}, \quad p,r,s\in{\hbox{ Z\kern-1.6mm Z}}, \quad q\in 2{\hbox{ Z\kern-1.6mm Z}},
\quad ps - qr=1\, ,
\end{equation}
and
\begin{equation} \label{ed6}
\check\rho\to {\alpha \check\rho +\beta\over \gamma\check\rho+\delta}, \quad
\alpha,\beta,\delta\in {\hbox{ Z\kern-1.6mm Z}}, \quad \gamma\in 2{\hbox{ Z\kern-1.6mm Z}}, \quad
\alpha\delta - \beta\gamma=1\, .
\end{equation}
The corresponding groups are $\Gamma^0(2)$ and
$\Gamma_0(2)$ respectively. Thus from \refb{e13},
\refb{e15}, \refb{ez1}
we see that if \refb{ed5} and \refb{ed6} lift to symmetries
of the full partition function then the partition
function transforms as a modular form of weight 6 under the
$Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ transformations of the form
\begin{equation} \label{es1b}
\pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}, \quad
\pmatrix{1 & 0 & a_1 & a_3\cr
0 & 1 & a_3 & a_2\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}, \quad
\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}\, ,
\end{equation}
with
\begin{equation} \label{ed7}
\pmatrix{a & b\cr c & d}\in \Gamma_0(2), \quad
\pmatrix{\alpha & \beta\cr \gamma & \delta}
\in \Gamma_0(2), \quad \pmatrix{p & q\cr r & s} \in
\Gamma^0(2), \quad a_1, a_3\in {\hbox{ Z\kern-1.6mm Z}}, \quad a_2 \in 2{\hbox{ Z\kern-1.6mm Z}}\,.
\end{equation}
All the $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices in \refb{es1b}
subject to the constraints \refb{ed7} have the form
\begin{equation} \label{edd8}
\pmatrix{1 & * & * & *\cr 0 & 1 & * & 0\cr 0 & 0 & 1 & 0\cr
0 & * & * & 1} \quad \hbox{mod 2}\, .
\end{equation}
Furthermore the set of matrices \refb{edd8} are closed under
matrix multiplication. Thus
the group generated by the set of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$
matrices \refb{es1b} subject to the
condition \refb{ed7} is contained in the group
$\check G$ of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices \refb{edd8}.

All the symmetries listed in \refb{es1b}
are indeed symmetries of the dyon partition function of
this model proposed in \cite{0510147} and
proved in \cite{0605210}.
Furthermore near $\check v=0$ the partition function is known to
have the factorization property given in
\refb{efactor3}\cite{0702141,0705.3874,0706.2363}.
One question that one can ask is: do
the matrices given in \refb{es1b} generate the full symmetry
group of the partition function (which is known in this case)? It
turns out that the answer is no. This group does not include the
matrix
\begin{equation} \label{emiss}
\pmatrix{1 & 0 & 0 & 0\cr 0 & 1 & 0 & 0\cr 0 & -1 & 1 & 0\cr
-1 & 0 & 0 & 1}\, ,
\end{equation}
since this is not of the form given in \refb{edd8}. This
generates the transformation
\begin{equation} \label{emissym}
\check\rho \to {\check\rho\over (1 - \check v)^2 - \check\sigma\check\rho}, \quad
\check\sigma \to {\check\sigma \over (1 - \check v)^2 - \check\sigma\check\rho}, \quad
\check v \to {\check\rho \check\sigma + \check v(1 - \check v)
 \over (1 - \check v)^2 - \check\sigma\check\rho}\, ,
 \end{equation}
 and is known to be a symmetry of the partition
 function.\footnote{This
 is the symmetry refered to as $g_3(1,0)$ in \cite{0510147} in a
 different representation.}

Finally we turn to the constraints from black hole entropy.
In this case the function $g(\tau)$ is given
by\cite{9708062,0502126}:
\begin{equation} \label{egtau}
g(\tau) =
\eta(\tau)^{8}\, \eta(2\tau)^{8}\, .
\end{equation}
Thus \refb{eblack6} takes the
fom
\begin{equation} \label{eblack6c}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^{6}\,
 \{ v^2 \, \eta(\rho)^{8}\eta(2\rho)^8\,
\eta(\sigma)^{8}\eta(2\sigma)^8 +  {\cal O}(v^4)\}\, ,
\end{equation}
where $(\rho,\sigma,v)$ and $(\check\rho,\check\sigma,\check v)$ are
related via \refb{eblack7}.
The dyon partition function of the ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL model is
known to satisfy this property. In fact
historically this is the property that
was used to guess the form of the partition function\cite{0510147}.

This analysis can be easily generalized to the dyons of ${\hbox{ Z\kern-1.6mm Z}}_N$
CHL orbifolds carrying twisted sector electric charges.

\subsectiono{Dyons in ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL model
with untwisted sector
electric charge} \label{s3.5}

We again consider the ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL model introduced
in \S\ref{s3.3}, but now take the set ${\cal A}$ to consist of
dyons with charge vectors
\begin{equation} \label{ed1a}
Q=\pmatrix{0 \cr (2m+1)/2\cr 0 \cr -2}\, , \qquad P =
\pmatrix{2K+1 \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
Since $w'=-2$ for this
state, it represents an untwisted sector state.
For this state we have
\begin{equation} \label{ed2a}
Q^2 = - 2(2m+1), \quad P^2 = 2(2 K+1), \quad Q\cdot P = -2J\, .
\end{equation}
Note that $Q$ and $P$ are both primitive. Since $Q\cdot P$ is
quantized in units of 2, we shall define
\begin{equation} \label{esev1}
Q_s={Q\over \sqrt
2}, \quad P_s={P\over \sqrt 2}, \quad
\check\rho_s = 2\check\rho, \quad \check\sigma_s = 2 \check\sigma, \quad \check v_s = 2\check v\, .
\end{equation}
Thus we have
\begin{equation} \label{ef1}
Q_s^2 = -\left(2m+1\right), \quad P_s^2 = 2K+1, \quad
Q_s\cdot P_s=-J\, .
\end{equation}
Since $Q_s^2/2$ is quantized in units of 1/2, we expect the partition
function to have $\check\sigma_s$ period $2$. However except for an
overall additive factor of $1/2$, $Q_s^2/2$ is actually quantized in
integer units. Thus the partition function has the additional
property that it is odd under $\check\sigma_s\to \check\sigma_s + 1$.
Similarly since $P_s^2$ is an odd integer, the partition function
picks up a minus sign under $\check\rho_s\to\check\rho_s+1$. We shall call these
symmetries of $\check\Phi$. Finally
since  $Q_s\cdot P_s$
is quantized in
integer units,  the period in the  $\check v_s$
direction is also unity.
The corresponding symplectic transformations acting on
$(\check\rho_s,\check\sigma_s,\check v_s)$ are of the form
\begin{equation} \label{espsp1}
\pmatrix{1 & 0 & \widetilde a_1 & \widetilde a_3\cr 0 & 1 & \widetilde a_3 &
\widetilde a_2\cr
0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}\, , \quad \widetilde a_1,
\widetilde a_2, \widetilde a_3\in{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
Under this transformation the partition function picks up a
multiplier factor
of $(-1)^{\widetilde a_1+\widetilde a_2}$.

Our next task is to determine the subgroup of the S-duality group
$\Gamma_0(2)$ that leaves the set ${\cal B}$ -- defined as the
T-duality orbit of ${\cal A}$ -- invariant.
For this let us apply the S-duality transformation
$\pmatrix{a & b\cr c & d}\in\Gamma_0(2)$
on the charge vector \refb{ed1a}.
This gives
\begin{equation} \label{ef2}
Q' = aQ + bP = \pmatrix{b (2K+1)\cr (2m+1)a/2 + bJ \cr b \cr -2a},
\qquad P'=cQ + dP =\pmatrix{d (2K+1)
\cr (2m+1)c/2 + dJ \cr d \cr -2c}
\, .
\end{equation}
We need to choose $a$, $b$, $c$, $d$ such that \refb{ef2} is
inside the set ${\cal B}$, \i.e. it can be brought to the form
\refb{ed1a} after a T-duality transformation. The T-duality
transformations acting within this four dimensional subspace
are generated by matrices of the form\cite{0708.1270}:
\begin{equation} \label{ef3}
\pmatrix{n_1 & -m_1 && \cr -l_1 & k_1 && \cr && k_1 & l_1\cr
&& m_1 & n_1} \quad \hbox{and} \quad
\pmatrix{k_2 &&& -l_2\cr & k_2&l_2&\cr &m_2&n_2&\cr
-m_2&&&n_2}, \quad   \pmatrix{k_i & l_i\cr m_i & n_i}
\in \Gamma_0(2)\, .
\end{equation}
Now suppose $b$ in \refb{ef2} is even. Then we can apply a
T-duality transformation on the charge vector given in
\refb{ef2} with the matrix
\begin{equation} \label{ef4}
\pmatrix{1 && &l_0\cr &1& -l_0 &\cr
& 0 & 1 &\cr 0 &&& 1}
\pmatrix{d & -2c && \cr -b/2 & a &&\cr && a & b/2\cr
&& 2c & d}, \qquad l_0 \equiv {1\over 2} bd(2K+1)
-{c\over 2} \{ (2m+1) a + 2 b J\}\, .
\end{equation}
It is straightfoward to verify that this brings \refb{ef2}
back to the set ${\cal A}$ consisting of pairs of charge
vectors of the form given in \refb{ed1a}.
This shows that a sufficient condition for \refb{ef2} to
lie in the set ${\cal B}$ is to have $b$ even, \i.e.
$\pmatrix{a & b\cr c & d}\in\Gamma(2)$. Using
\refb{e3.5} we can also see that this condition is necessary
since acting on a pair $(Q,P)$ with $Q^2/2$ odd, $P^2/2$
odd and $Q\cdot P$ even, an S-duality transformation produces
a $(Q',P')$ with odd $Q^{\prime 2}/2$ only if $b$ is even.

Thus we identify
the subgroup $\Gamma(2)$ of the S-duality group
$\Gamma_0(2)$ as the symmetry of the set ${\cal B}$. The overall
scaling of $Q$ and $P$ does not change the symmetry group.
Thus the
quarter BPS dyon partition function associated with the set ${\cal B}$
must be invariant under the $\Gamma(2)$ S-duality symmetry.
This in turn corresponds to symplectic transformations of the
form
\begin{equation} \label{espsp3}
\pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}, \qquad ad-bc=1,\quad
a,d\in{\hbox{ Z\kern-1.6mm Z}},
\quad b,c \in 2{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{equation}
acting on $(\check\rho,\check\sigma,\check v)$ and also on $(\check\rho_s,\check\sigma_s,\check v_s)$.

Next we turn to the analysis of the constraints from
wall crossing. First consider the wall
corresponding to the decay $(Q,P)\to (Q,0)+(0,P)$, and examine
whether there are subtleties of kind mentioned below eq.\refb{ex5}
in applying eqs.\refb{ex3}, \refb{ex4}. For this we note that
here $Q^2=-2(2m+1)$ and $P^2=2(2K+1)$ are uncorrelated.
For a given $Q^2= -2(2m+1)$ there is a unique charge vector
in the list given in \refb{ed1a}. On the other hand even though for
a given $P^2=2(2K+1)$ there is an infinite family of $P$ labelled
by $J$, they are all related by the T-duality transformation
matrix $\pmatrix{1&0 & 0 &-J\cr 0 & 1 & J & 0\cr
0 & 0 & 1 & 0\cr
0 & 0 & 0 & 1}$ to the vector $\pmatrix{2K+1\cr 0\cr 1\cr 0}$.
Thus there are no subtleties of the kind mentioned below
\refb{ex5} and we have
\begin{equation} \label{espsp4}
\check\Phi(\check\rho,\check\sigma,\check v) \propto \left\{ \check v^2 \, \phi_m(\check\rho)
\phi_e(\check\sigma) +{\cal O}(\check v^4)\right\}
\quad \hbox{for $\check v\simeq 0$}\, .
\end{equation}
The magnetic partition function
is obtained from \refb{ed4} by  projection
to odd values of $P^2/2$ followed by
$\check\rho\to\check\rho_s/2$
replacement.  This
gives
\begin{equation} \label{epm1}
\phi_m(\check\rho)^{-1} = {1\over 2}
\left\{ \eta(\check\rho_s/2)^{-8} \eta(\check\rho_s)^{-8}
- \eta((\check\rho_s+1)/2)^{-8} \eta(\check\rho_s)^{-8}\right\}\, .
\end{equation}
On the other hand the electric partition function can be
calculated by analyzing the untwisted sector BPS spectrum
of the fundamental heterotic
string\cite{0502126,0502157,0504005,0507014}. After taking into
account the fact that we are
computing the partition function of odd $Q^2/2$ states
only, and the $\check\sigma\to \check\sigma_s/2$ replacement, the result is
\begin{eqnarray}\displaystyle \label{epm2}
\phi_e^{-1}(\check\sigma) &=& {1\over 2} \left( \psi_e(\check\sigma_s) - \psi_e
\left(\check\sigma_s+1\right)\right) \, , \nonumber \\
\psi_e(\check\sigma_s) &=&
8\, \eta(\check\sigma_s/2)^{-24}\, \left[{1\over 2} \left(
\vartheta_2(\check\sigma_s)^8 + \vartheta_3(\check\sigma_s)^8 + \vartheta_4(\check\sigma_s)^8\right)
- \vartheta_3(\check\sigma_s/2)^4 \vartheta_4(\check\sigma_s/2)^4
\right] \, . \nonumber \\
\end{eqnarray}
In \refb{epm2} $\psi_e$ describes the partition function
before projecting on to the odd $Q^2/2$ sector\cite{0502157}.

$\phi_m(\check\rho_s)$ given in \refb{epm1}
transforms as a modular form of weight 8 under
$\check\rho_s\to (\alpha\check\rho_s+\beta)/(\gamma\check\rho_s+\delta)$ with
$\pmatrix{\alpha &\beta\cr \gamma &\delta}\in \Gamma_0(2)$
with a multiplier $(-1)^\beta$. On the other hand
$\phi_e(\check\sigma)$ given in \refb{epm2} can be shown to transform as
a modular form of weight $8$ under
$\check\sigma_s\to (p\check\sigma_s + q)/(r \check\sigma_s +s)$
for $\pmatrix{p & q\cr r & s} \in \Gamma_0(2)$, with a
multiplier $(-1)^q$.
These duality symmetries correspond to the symplectic
transformations
\begin{eqnarray}\displaystyle \label{es1d}
&\pmatrix{\alpha & 0 & \beta & 0\cr
0 & 1 & 0 & 0\cr \gamma & 0 & \delta & 0\cr
0 & 0 & 0 & 1} \quad \hbox{and} \quad
\pmatrix{1 & 0 & 0 & 0\cr
0 & p & 0 & q\cr 0 & 0 & 1 & 0\cr
0 & r & 0 & s}\, , \nonumber \\ \cr
& \alpha\delta - \beta\gamma=1, \quad ps-qr=1, \quad
\alpha, \beta, \delta, p, q, s\in {\hbox{ Z\kern-1.6mm Z}},
\quad \gamma, r\in 2{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{eqnarray}
acting on $(\check\rho_s,\check\sigma_s,\check v_s)$.

Since for the set ${\cal B}$ the S-duality group is $\Gamma(2)$,
in this case there is another wall of marginal stability, associated
with $\pmatrix{a_0 & b_0\cr c_0 & d_0}
=\pmatrix{1 & 1\cr 0 & 1}$,
which cannot be related to the previous wall by an S-duality
transformation. This corresponds to the decay $(Q,P)\to (Q-P, 0)
+ (P,P)$ and controls the behaviour of $\check\Phi$ near $\check v+\check\sigma=0$.
As usual we first need to determine if there are any subtleties
of the type mentioned below eq.\refb{ex5}. Eq.\refb{ed1a} shows that
for a given $(Q-P)^2=4(K+J-m)$ there is an infinite family of
$(Q-P)=\pmatrix{-(2K+1)\cr (2m-2J+1)/2\cr -1\cr -2}$ labelled
by $2K$. However all of these can be related by T-duality
transformation $\pmatrix{1 & 0 & 0 & K\cr 0 & 1 & -K & 0\cr
0 & 0 & 1 &0\cr 0 & 0 & 0 & 1}$ to the vector
$\pmatrix{-1\cr (2m-2J-2K+1)/2\cr -1\cr -2}$ which is
determined completely in terms of $(Q-P)^2$. We have already
seen earlier that all choices of $P$ for a given $P^2$ are
also related by  T-duality transformations. Finally we note that
in this case $(Q-P)^2/2$ and $P^2/2$ can take independent even
and odd integer values respectively. It then follows that there
are no subtleties of the kind mentioned
below \refb{ex5}. After evaluating $\phi_e$ and $\phi_m$
by standard procedure we find that near $\check v+\check\sigma=0$ $\check\Phi$
behaves as
\begin{equation} \label{efin1}
\check\Phi(\check\rho,\check\sigma, \check v) \propto \left[
\check v_s^{\prime 2} \, \left\{ \eta(\check\rho_s'/2)^{-8}
- \eta((\check\rho_s'+1)/2)^{-8}
\right\}^{-1} \eta(\check\rho_s')^{8} \{ \psi_e(\check\sigma_s') + \psi_e(\check\sigma_s'+1) \}^{-1}
+{\cal O}(\check v_s^{\prime 4})
\right]\, ,
\end{equation}
where
\begin{equation} \label{efin2}
\check v_s'= \check v_s+\check\sigma_s, \quad \check\sigma_s' = \check\sigma_s,
\quad \check\rho_s' = \check\rho_s +\check\sigma_s+2\check v_s\, .
\end{equation}
This has duality symmetry
$\check\rho_s'\to (\alpha_1\check\rho_s'+\beta_1)/(\gamma_1\check\rho_s' +\delta_1)$  and
$\check\sigma_s'\to (p_1\check\sigma_s' + q_1)/(r_1\check\sigma_s' + s_1)$ for
$\pmatrix{\alpha_1 & \beta_1\cr \gamma_1 & \delta_1}
\in \Gamma_0(2)$
and $\pmatrix{p_1 & q_1\cr r_1 & s_1}\in \Gamma_0(2)$
with a multiplier $(-1)^{\beta_1}$.
We can express them as symplectic transformations acting on
$(\check\rho_s,\check\sigma_s,\check v_s)$ using
\refb{egensp}, \refb{esecond}. This gives
\begin{eqnarray}\displaystyle \label{efin3}
& \pmatrix{\alpha_1 & \alpha_1 -1 & \beta_1 & 0\cr
0 & 1 & 0 & 0\cr \gamma_1 & \gamma_1 & \delta_1 & 0\cr
\gamma_1 & \gamma_1
& \delta_1 -1 & 1}, \quad \hbox{and} \quad
\pmatrix{1 & 1-p_1 & q_1 & -q_1\cr 0 & p_1 & -q_1 & q_1\cr
0 & 0 & 1 & 0\cr 0 & r_1 & 1-s_1  & s_1}
\, , \nonumber \\ \cr
& \alpha_1\delta_1 - \beta_1\gamma_1=1=p_1 s_1-r_1 q_1,
\quad \alpha_1, \beta_1, \delta_1,
p_1, q_1, s_1 \in{\hbox{ Z\kern-1.6mm Z}}, \quad
\gamma_1, r_1\in 2{\hbox{ Z\kern-1.6mm Z}} \, .
\end{eqnarray}

As usual, we would like to know if there is a natural subgroup
of $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ defined by some congruence relation into which
all the $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ matrices \refb{espsp1}, \refb{espsp3},
\refb{es1d} and \refb{efin3} fit. There is indeed such a subgroup
defined as the collection of matrices of the form
\begin{equation} \label{epm3.2}
\pmatrix{1 & 0 & * & *\cr 0 & 1 & * & *\cr
0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1} \quad \hbox{mod 2}\, .
\end{equation}
It is natural to speculate that \refb{epm3.2} is the symmetry group
of the partition function under consideration.

Finally we turn to the constraint from black hole entropy. Since
we are considering ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL orbifold, the
function $g(\tau)$ appearing in the coefficient of the Gauss-Bonnet
term in the effective action is the same as the one in
\S\ref{s3.3}:
\begin{equation} \label{egtaunew}
g(\tau) =
\eta(\tau)^{8}\, \eta(2\tau)^{8}\, .
\end{equation}
Thus \refb{eblack6} takes the
fom
\begin{equation} \label{eblack6e}
\check\Phi(\check\rho, \check\sigma,\check v) \propto (2v-\rho-\sigma)^6\,
\{ v^2 \, \eta(\rho)^{8}\eta(2\rho)^8\,
\eta(\sigma)^{8}\eta(2\sigma)^8 +  {\cal O}(v^4)\}\, ,
\end{equation}
where $(\rho,\sigma,v)$ and $(\check\rho,\check\sigma,\check v)$ are related via
\refb{eblack7}.

\renewcommand{\theequation}{\thesection.\arabic{equation}}

\sectiono{A proposal for the
partition function of dyons of torsion two} \label{sprop}

In this section we shall consider the set of dyons described in
\S\ref{s3.4}, carrying charge vectors $(Q,P)$
with torsion 2, $Q$, $P$ primitive and $Q^2/2$, $P^2/2$ even,
and propose a form of the partition function that satisfies all the
constraints derived in \S\ref{s3.4}. The proposed form of
the partition function is
\begin{eqnarray}\displaystyle \label{epr1}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)} &=& {1\over 16} \Bigg[
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v)} +
{1\over \Phi_{10}(\check\rho,\check\sigma+{1\over 2},\check v)} +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma,\check v)} \nonumber \\
&& +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v)} +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{1\over 4})} \nonumber \\
&&
+
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{3\over 4},\check v+{1\over 4})} +
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{1\over 4},\check v+{1\over 4})} \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{1\over 4})}
 +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v+{1\over 2})} \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma,\check v+{1\over 2})} +
{1\over \Phi_{10}(\check\rho,\check\sigma+{1\over 2},\check v+{1\over 2})} +
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v+{1\over 2})}  \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{3\over 4})} +
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{1\over 4},\check v+{3\over 4})}
\nonumber \\
&& +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{3\over 4},\check v+{3\over 4})}  +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{3\over 4})}\Bigg]
\nonumber \\
&&  +
\Bigg[{1\over \Phi_{10}(\check\rho+\check\sigma+2\check v,
\check\rho+\check\sigma-2\check v,\check\sigma-\check\rho)} \nonumber \\
&&
+ {1\over \Phi_{10}(\check\rho+\check\sigma+2\check v+{1\over 2},
\check\rho+\check\sigma-2\check v+{1\over 2},\check\sigma-\check\rho+{1\over 2})}
\Bigg]\, .
\end{eqnarray}
The index $d(Q,P)$ is computed from this partition function using
the formula
\begin{eqnarray}\displaystyle \label{epr2}
d(Q,P)&=& {1\over 4}\, (-1)^{Q\cdot P+1} \, \int_{\cal C}
 d\check\rho_s
d\check\sigma_s  d\check v_s \,
e^{-i{\pi\over 4} (\check\sigma_s Q^2 + \check\rho_s P^2
+ 2 \check v_s Q\cdot P)} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, , \nonumber \\ && \qquad \qquad
(\check\rho_s,\check\sigma_s,\check v_s) \equiv (4\check\rho,4\check\sigma,4\check v)\, ,
\end{eqnarray}
where the contour ${\cal C}$ is defined by fixing the imaginary
parts of $\check\rho_s$, $\check\sigma_s$, $\check v_s$ to appropriate values depending on
the domain of the moduli space in which we want to compute the
index, and the real parts span the unit cell defined by the
periodicity condition
\begin{equation} \label{epr3}
(\check\rho_s, \check\sigma_s, \check v_s) \to (\check\rho_s+2, \check\sigma_s, \check v_s), \,
(\check\rho_s, \check\sigma_s+2, \check v_s), \, (\check\rho_s, \check\sigma_s, \check v_s+2),
\, (\check\rho_s+1, \check\sigma_s+1, \check v_s+1)\, .
\end{equation}
The overall
multiplicative factor of 1/4 in \refb{epr2} accounts for the
fact that the unit cell defined by eqs.\refb{epr3} has volume 4.
The factor of $1/4$ in the exponent in \refb{epr2}
accounts for the replacement of $(\check\rho,\check\sigma,\check v)$ by
$(\check\rho_s/4,\check\sigma_s/4,\check v_s/4)$ in \refb{e2}.
Note that the sixteen terms inside the first square bracket in
\refb{epr1} together gives the partition function of dyons of unit
torsion subject to the constraint that $Q^2/2$, $P^2/2$, $Q\cdot P$
are even and $Q^2+P^2-2Q\cdot P$ is a multiple of 8. The second
term is new and reflects the effect of considering states with torsion
two.

We shall now check that this formula satisfies all the constraints
derived in \S\ref{s3.4}. We begin with the
S-duality transformations.
The first term inside the first
square bracket $(\Phi_{10}(\check\rho,\check\sigma,\check v))^{-1}$ is
S-duality invariant since S-duality transformation can be
regarded as an $Sp(2,{\hbox{ Z\kern-1.6mm Z}})$ transformation on
$(\check\rho,\check\sigma,\check v)$. The
other terms inside the first square bracket have the form
$(\Phi_{10}(\check\rho+b_1,\check\sigma+b_2,\check v+b_3))^{-1}$
for appropriate choices of $(b_1,b_2,b_3)$. Since these shifts
may be
represented as symplectic transformations of $(\check\rho,\check\sigma,\check v)$,
S-duality transformation \refb{ete2s} will change this term to
$(\Phi_{10}(\check\rho+b_1'',\check\sigma+b_2'',\check v+b_3''))^{-1}$
with
\begin{eqnarray}\displaystyle \label{epr4}
&& \pmatrix{1 & 0 & b_1'' & b_3''\cr
0 & 1 & b_3'' & b_2''\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}
=\pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}^{-1} \,
\pmatrix{1 & 0 & b_1 & b_3\cr
0 & 1 & b_3 & b_2\cr 0 & 0 & 1 & 0\cr 0 & 0 & 0 & 1}
\pmatrix{d & b &0&0 \cr c & a &0&0\cr
0&0& a & -c\cr 0&0& -b & d}\, ,
\nonumber \\ &&
\qquad a,b,c,d\in{\hbox{ Z\kern-1.6mm Z}}, \quad ad-bc=1,
\quad a+c\in 2{\hbox{ Z\kern-1.6mm Z}}+1, \quad b+d\in 2{\hbox{ Z\kern-1.6mm Z}}+1\, .
\end{eqnarray}
One finds that under such a transformation the sixteen triplets
$(b_1,b_2,b_3)$ appearing in the sixteen terms inside the first
square bracket get permuted up to integer shifts which are
symmetries of $\Phi_{10}$. This proves the S-duality invariance
of the first 16 terms.

To test the S-duality invariance of the second term we
define
\begin{equation} \label{epr5}
\check\rho' = (\check\rho+\check\sigma+2\check v), \quad \check\sigma'=
(\check\rho+\check\sigma-2\check v), \quad \check v' =(\check\sigma-\check\rho)\, .
\end{equation}
It is easy to verify that the effect of S-duality transformation
\refb{ete2s} on the
$(\check\rho',\check\sigma',\check v')$ variables is represented by the symplectic
matrix
\begin{equation} \label{epr6}
\pmatrix{(a+b+c+d)/2 & (a+b-c-d)/2 &0&0 \cr(a-b+c-d)/2
 & (a-b-c+d)/2 &0&0\cr
0&0& (a-b-c+d)/2 & -(a-b+c-d)/2\cr 0&0& -(a+b-c-d)/2 &
(a+b+c+d)/2}\,.
\end{equation}
Given the conditions \refb{epr4} on $a,b,c,d$, this is an
$Sp(2,{\hbox{ Z\kern-1.6mm Z}})$
transformation. Thus the first term inside the second
square bracket in \refb{epr1},
given by $(\Phi_{10}(\check\rho',\check\sigma',\check v'))^{-1}$, is
manifestly S-duality invariant. The second term involves a
shift of $(\check\rho',\check\sigma',\check v')$ by $(1/2,1/2,1/2)$. One can easily
check that this commutes with the symplectic transformation
\refb{epr6} up to integer shifts in $(\check\rho',\check\sigma',\check v')$. Thus the second
term is also S-duality invariant.

We now turn to the wall crossing formul\ae. First consider the wall
associated with the decay $(Q,P)\to (Q,0)+(0,P)$. The jump in
the index across this wall is controlled
by the residue of the pole at $\check v=0$. In order to evaluate this residue
it will be most convenient to choose the unit cell over which
the integration \refb{epr2} is performed to be
$-1\le\Re(\check\rho_s)<1$, $-1\le\Re(\check\sigma_s)<1$ and $-{1\over 2}\le \Re(\check v_s)
<{1\over 2}$ so that the image of the
pole at $\check v_s=0$ under $(\check\rho_s,\check\sigma_s,\check v_s)\to
(\check\rho_s\pm 1,\check\sigma_s\pm 1,\check v_s\pm 1)$
is outside the unit cell, -- otherwise we would need to include the
contribution from this pole as well.
Using \refb{epr2}
we see that the change in the index across this wall is given by
\begin{equation} \label{ech1}
\Delta d(Q,P) =
{1\over 4}\, (-1)^{Q\cdot P+1} \, \int_{iM_1-1}^{iM_1+1}
d\check\rho_s \int_{iM_2-1}^{iM_2+1} d\check\sigma_s
\ointop d\check v_s
 \,
e^{-i{\pi\over 4} (\check\sigma_s Q^2 + \check\rho_s P^2
+ 2 \check v_s Q\cdot P)} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, ,
\end{equation}
where $\ointop$ denotes the contour around $\check v_s=0$ and $M_1$,
$M_2$ are large positive numbers.
Now the poles in \refb{epr1} can be found from the known
locations of the zeroes in $\Phi_{10}(x,y,z)$:
\begin{eqnarray}\displaystyle \label{eapl5a}
&& n_2 ( xy-z^2) + j z  +
n_1 y  -  m_1 x+ m_2 = 0 \nonumber \\
&& m_1,
n_1, m_2, n_2 \in {\hbox{ Z\kern-1.6mm Z}}, \quad j\in 2{\hbox{ Z\kern-1.6mm Z}}+1, \quad
m_1 n_1 + m_2 n_2 +\frac{j^2}{4} = {1\over 4}\, .
\end{eqnarray}
Using this we find that the poles in \refb{epr1} at $\check v_s=0$
can come from the first
four terms inside the first square bracket. There
is no pole at $\check v_s=0$ from the terms in the second square bracket.
The residue at the pole can be calculated by using the fact that
\begin{equation} \label{ech2}
\Phi_{10}(x,y,z) \simeq -4\pi^2\, z^2\, \eta(x)^{24}
\eta(y)^{24} + {\cal O}(z^4)\, ,
\end{equation}
near $z=0$. This gives
\begin{equation} \label{ech2.5}
\check\Phi(\check\rho,\check\sigma,\check v)
= -4\pi^2\,  \check v_s^2 \, \left\{   \eta\left({\check\sigma_s\over 4}
\right)^{-24}
+ \eta\left({\check\sigma_s+2\over 4}\right)^{-24}
\right\}^{-1}
\left\{   \eta\left({\check\rho_s\over 4}\right)^{-24}
+ \eta\left({\check\rho_s+2\over 4}\right)^{-24}
\right\}^{-1} +{\cal O}(\check v_s^4) \, .
\end{equation}
Substituting this into \refb{ech1} and using the convention that the
$\check v_s$ contour encloses the pole clockwise, we get
\begin{eqnarray}\displaystyle \label{ech3}
\Delta d(Q,P) &=&
{1\over 16}\, (-1)^{Q\cdot P+1} \, Q\cdot P\,
\int_{iM_1-1}^{iM_1+1}
d\check\rho_s \,
\left\{\eta(\check\rho_s/4)^{-24} + \eta((\check\rho_s+2)/4)^{-24}\right\}
\, e^{-i\pi \check\rho_s \, P^2/4}\, \nonumber \\ &&
\int_{iM_2-1}^{iM_2+1} d\check\sigma_s
\, \left\{\eta(\check\sigma_s/4)^{-24} + \eta((\check\sigma_s+2)/4)^{-24}\right\}
\, e^{-i\pi \check\sigma_s \, Q^2/4}
\, .
\end{eqnarray}
We now want to compare this with the general wall crossing
formula given in \refb{ex1}.
Here the relevant half-BPS partition functions are to be
computed with $Q^2$ and $P^2$ restricted to be even.
This gives
\begin{eqnarray}\displaystyle \label{ech4}
d_h(Q,0) &=& \int_{iM-1/4}^{iM+1/4}\, d\tau \,
\left\{ \eta(\tau)^{-24} + \eta\left(\tau+{1\over 2}\right)^{-24}
\right\} \,
e^{-i\pi\tau Q^2}\nonumber \\
& = &
{1\over 4} \,
\int_{4iM-1}^{4iM+1}\,
d\check\sigma_s \, \left\{\eta(\check\sigma_s/4)^{-24} + \eta((\check\sigma_s+2)/4)^{-24}\right\}
\, e^{-i\pi \check\sigma_s \, Q^2/4}, \nonumber \\
d_h(0,P) &=& \int_{iM-1/4}^{iM+1/4} \, d\tau\,
\left\{ \eta(\tau)^{-24} + \eta\left(\tau+{1\over 2}\right)^{-24}
\right\} \,
e^{-i\pi\tau P^2}\nonumber \\
&=& {1\over 4}\, \int_{4iM-1}^{4iM+1}\, d\check\rho_s\,
\left\{\eta(\check\rho_s/4)^{-24} + \eta((\check\rho_s+2)/4)^{-24}\right\}
\, e^{-i\pi \check\rho_s \, P^2/4}\, ,
\end{eqnarray}
for some large positive number $M$.
Using this we can rewrite \refb{ech3} as
\begin{equation} \label{ech5}
\Delta d(Q,P) =
(-1)^{Q\cdot P+1} \, Q\cdot P\, d_h(Q,0)\, d_h(0,P)\, ,
\end{equation}
in agreement with the wall crossing formula.

Next we consider the wall associated with the decay
$(Q,P)\to ((Q-P)/2, (P-Q)/2) + ((Q+P)/2, (Q+P)/2)$.
The associated pole of the partition function is at
$\check\rho=\check\sigma$. {}With the help of \refb{ech2}
we find that this pole
arises from the first term inside the second square
bracket  in \refb{epr1}, and near this pole
\begin{equation} \label{edh1}
\check\Phi(\check\rho,\check\sigma,\check v) = -{\pi^2\over 4}
(\check\sigma_s-\check\rho_s)^2\,
\eta((\check\rho_s+\check\sigma_s+2\check v_s)/4)\,
\eta((\check\rho_s+\check\sigma_s-2\check v_s)/4)+{\cal O}\left( (\check\sigma_s-\check\rho_s)^4\right)\, .
\end{equation}
In order to compute the change in the index as we cross this
wall, we change variables to
\begin{equation} \label{edh2}
\check\rho_s' = (\check\rho_s+\check\sigma_s+2\check v_s)/2, \quad \check\sigma_s' = (\check\rho_s+\check\sigma_s-2\check v_s)/2,
\quad \check v_s' = (\check\sigma_s-\check\rho_s)/2\, .
\end{equation}
The periodicity properties \refb{epr3} on $(\check\rho_s,\check\sigma_s,\check v_s)$
take the form
\begin{equation} \label{edh3}
(\check\rho_s',\check\sigma_s',\check v_s') \to  (\check\rho_s'+2,\check\sigma_s', \check v_s'), \,
(\check\rho_s',\check\sigma_s'+2, \check v_s'), \, (\check\rho_s',\check\sigma_s',\check v_s'+2), \,
(\check\rho_s'+1, \check\sigma_s'+1, \check v_s'+1)\, .
\end{equation}
We choose the unit cell in the $(\Re(\check\rho_s'), \Re(\check\sigma_s'), \Re(\check v_s'))$
to be $-1\le\Re(\check\rho_s')<1$, $-1\le\Re(\check\sigma_s')<1$ and
$-{1\over 2}\le \Re(\check v_s')
<{1\over 2}$.
Since the jacobian of the transformation associated with
\refb{edh2} is unity, the change in the index across the
wall is given by an expression analogous to
\refb{ech1}
\begin{equation} \label{edh4}
\Delta d(Q,P) =
{1\over 4}\, (-1)^{Q\cdot P+1} \,
\int_{iM_1'-1}^{iM_1'+1}\, d\check\rho_s'
\int_{iM_2'-1}^{iM_2'+1}\, d\check\sigma_s'
\ointop d\check v_s'
 \,
e^{-i{\pi\over 4} (\check\sigma_s' Q^{\prime 2} + \check\rho_s' P^{\prime 2}
+ 2 \check v_s' Q'\cdot P')} \,
{1\over \check\Phi(\check\rho, \check\sigma, \check v)}\, ,
\end{equation}
where
\begin{equation} \label{edh6}
Q' = {Q-P\over \sqrt 2}, \qquad P'={Q+P\over \sqrt 2}\, .
\end{equation}
Substituting \refb{edh1} into \refb{edh4} we get
\begin{eqnarray}\displaystyle \label{edh5}
\Delta d(Q,P) &=&
{1\over 4}
\, (-1)^{Q\cdot P+1} \, Q'\cdot P'\,
\int_{iM_1'-1}^{iM_1'+1}\, d\check\rho_s' \,
\eta(\check\rho_s'/2)^{-24}
\, e^{-i\pi \check\rho_s' \, P^{\prime 2}/4}\, \nonumber \\
&& \qquad
\int_{iM_2'-1}^{iM_2'+1}\, d\check\sigma_s' \, \eta(\check\sigma_s'/2)^{-24}
\, e^{-i\pi \check\sigma_s' \, Q^{\prime 2}/4}
\, .
\end{eqnarray}
On the other hand now the indices of the half-BPS decay
products carrying charges
\begin{equation} \label{edh5.5}
(Q_1,P_1) = ((Q-P)/2,(P-Q)/2), \qquad
(Q_2,P_2) = ((Q+P)/2,(Q+P)/2)\, ,
\end{equation}
are given by
\begin{equation} \label{edh7}
d_h(Q_1,P_1) = \int_{iM-1/2}^{iM+1/2}\,
d\tau (\eta(\tau))^{-24}
e^{-i\pi\tau ((Q-P)/2)^2}
= {1\over 2} \, \int_{2iM-1}^{2iM+1}\,
d\check\sigma_s' \, \eta(\check\sigma_s'/2)^{-24}
\, e^{-i\pi \check\sigma_s' \, Q^{\prime 2}/4}
\, ,
\end{equation}
and
\begin{equation} \label{edh8}
d_h(Q_2,P_2) = \int_{iM-1/2}^{iM+1/2}\,
 d\tau (\eta(\tau))^{-24}
e^{-i\pi\tau ((Q+P)/2)^2}
= {1\over 2} \, \int_{2iM-1}^{2iM+1}\,
d\check\rho_s' \, \eta(\check\rho_s'/2)^{-24}
\, e^{-i\pi \check\rho_s' \, P^{\prime 2}/4}
\, .
\end{equation}
Using these results and the identities
\begin{equation} \label{eiden}
Q_1\cdot P_2 - Q_2\cdot P_1 = Q'\cdot P', \quad
(-1)^{Q_1\cdot P_2 - Q_2\cdot P_1}
= (-1)^{(Q-P)^2/2  -P^2 + Q\cdot P} =(-1)^{Q\cdot P}\, ,
\end{equation}
we can express \refb{edh5} as
\begin{equation} \label{edh9}
\Delta d(Q,P)
= (-1)^{Q_1\cdot P_2-Q_2\cdot P_1+1}\,
(Q_1\cdot P_2-Q_2\cdot P_1) \,
d_h(Q_1,P_1)\, d_h(Q_2,P_2)\, ,
\end{equation}
in agreement with the wall crossing formula.

Next consider the decay $(Q,P)\to (Q-P,0)+(P,P)$. This is controlled
by the pole at $\check\sigma+\check v=0$. To analyze this contribution we define
\begin{equation} \label{efh1}
Q' = Q-P, \quad P'=P
\end{equation}
and
\begin{equation} \label{efh2}
\check\rho_s'=\check\rho_s+\check\sigma_s+2\check v_s, \quad \check\sigma_s' = \check\sigma_s,
\quad \check v_s'=\check v_s+\check\sigma_s\, ,
\end{equation}
so that $\check\rho_sP^2+\check\sigma_s Q^2 + 2\check v_s Q\cdot P
= \check\rho'_s P^{\prime 2} + \check\sigma_s' Q^{\prime 2} + 2\check v_s'
Q'\cdot P'$.
In terms of these variables the periods are
\begin{equation} \label{efh3}
(\check\rho_s',\check\sigma_s',\check v_s') \to (\check\rho_s'+2,\check\sigma_s',\check v_s'), \, (\check\rho_s',\check\sigma_s'+1,\check v_s'), \,
(\check\rho_s',\check\sigma_s',\check v_s'+2)\, .
\end{equation}
The behaviour of $\check\Phi$ near $\check v_s'=0$ can be found
by the usual procedure
and result is
\begin{eqnarray}\displaystyle \label{efh4}
\check\Phi(\check\rho,\check\sigma,\check v)^{-1} &=& -{1\over 4\pi^2 \check v_s^{\prime 2} }
\left\{ \eta\left({\check\rho_s'\over 4}\right)^{-24}
+ \eta\left({\check\rho_s'+2\over 4}\right)^{-24}
\right\}\nonumber \\
&& \qquad \times \left\{ \eta\left({\check\sigma_s'\over 4}\right)^{-24}
+ \eta\left({\check\sigma_s'+1\over 4}\right)^{-24} +
\eta\left({\check\sigma_s'+2\over 4}\right)^{-24}
+ \eta\left({\check\sigma_s'+3\over 4}\right)^{-24}
\right\}  \nonumber \\
&& - {1\over \pi^2 \check v_s^{\prime 2}}
\, \left\{ \eta\left({\check\rho_s'\over 4}\right)^{-24}
+ \eta\left({\check\rho_s'+2\over 4}\right)^{-24}
\right\} \, \eta(\check\sigma_s')^{-24} +{\cal O}\left( \check v_s^{\prime 0}\right)\, .
\end{eqnarray}
Note that the first set of terms represent correctly the factorization
behaviour given in \refb{eabab2}, but the second set of terms
are extra. Thus the wall crossing formula gets modified for the
decay into non-primitive states.
Using \refb{efh4} we can compute
the jump in the index across the wall
\begin{eqnarray}\displaystyle \label{efh5}
&& \Delta d(Q,P)
= {1\over 16} (-1)^{Q\cdot P+1} \, Q'\cdot P' \,
\int_{iM_1'-1}^{iM_1'+1}\,
d\check\rho_s' \left\{ \eta\left({\check\rho_s'\over 4}\right)^{-24}
+ \eta\left({\check\rho_s'+2\over 4}\right)^{-24}
\right\} e^{-i\pi\check\rho_s' P^{\prime 2}/4}\,
\nonumber \\
&&
\int_{iM_2'-1/2}^{iM_2'+1/2}\, d\check\sigma_s' \,
\left\{ \eta\left({\check\sigma_s'\over 4}\right)^{-24}
+ \eta\left({\check\sigma_s'+1\over 4}\right)^{-24} \right.\nonumber \\
&& \qquad \qquad \qquad \left. +
\eta\left({\check\sigma_s'+2\over 4}\right)^{-24}
+ \eta\left({\check\sigma_s'+3\over 4}\right)^{-24}
\right\}\,
e^{-i\pi\check\sigma_s' Q^{\prime 2}/4}\nonumber \\
&& + {1\over 4} (-1)^{Q\cdot P+1} \, Q'\cdot P' \,
\int_{iM_1'-1}^{iM_1'+1}\,
d\check\rho_s' \left\{ \eta\left({\check\rho_s'\over 4}\right)^{-24}
+ \eta\left({\check\rho_s'+2\over 4}\right)^{-24}
\right\}  \, e^{-i\pi\check\rho_s' P^{\prime 2}/4} \nonumber \\
&&
\qquad \qquad \times\,
\int_{iM_2'-1/2}^{iM_2'+1/2}\,  d\check\sigma_s'
\, \eta(\check\sigma_s')^{-24}\, e^{-i\pi\check\sigma_s' Q^{\prime 2}/4}\, .
\end{eqnarray}
Defining
\begin{equation} \label{efh6}
(Q_1,P_1) = (Q-P, 0), \quad (Q_2,P_2) = (P,P)\,,
\end{equation}
we can express \refb{efh5} as
\begin{equation} \label{efh7}
\Delta d(Q,P) = (-1)^{Q_1\cdot P_2 - Q_2\cdot P_1 + 1}
(Q_1\cdot P_2 - Q_2\cdot P_1)\,
\left\{d_h\left(Q_1,P_1\right) +
d_h\left({1\over 2} Q_1,{1\over 2} P_1\right) \right\}
\, d_h\left(Q_2,P_2\right) \, .
\end{equation}
The second term is extra compared to \refb{ex1}; it represents the
effect of non-primitivity of the final state dyons.

Finally let us turn to the analysis of the black hole entropy. For this
we need to identify the zeroes of $\check\Phi$ at $\check\rho\check\sigma-\check v^2+\check v=0$
and show that $\check\Phi$ has the behaviour given in
\refb{eblack6bb} near this pole. This is easily done using \refb{epr1}
and the
locations of the zeroes of $\Phi_{10}$ given in \refb{eapl5a}.
One finds that the only term that has a zero at the desired
location is the first term inside the first square bracket
in \refb{epr1}. Furthermore this term is
proportional to the dyon partition function
$1/\Phi_{10}(\check\rho,\check\sigma,\check v)$ of the unit torsion states discussed
in \S\ref{s3.1}. Thus this
term clearly will have the desired factorization property given in
\refb{eblack6bb}.

Our proposal for the dyon partition function can be easily
generalized to the torsion 2,
primitive $Q$, $P$ and
odd $Q^2/2$,
$P^2/2$ dyons discussed at the end of \S\ref{s3.4}.
This requires changing
the signs of appropriate terms in \refb{epr1} so that the partition
function is odd under $\check\rho \to \check\rho+{1\over 2}$ and also
under $\check\sigma\to \check\sigma+{1\over 2}$. The result is
\begin{eqnarray}\displaystyle \label{epr1odd}
{1\over \check\Phi(\check\rho,\check\sigma,\check v)} &=& {1\over 16} \Bigg[
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v)} -
{1\over \Phi_{10}(\check\rho,\check\sigma+{1\over 2},\check v)} -
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma,\check v)} \nonumber \\
&& +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v)} +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{1\over 4})} \nonumber \\
&&
-
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{3\over 4},\check v+{1\over 4})} -
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{1\over 4},\check v+{1\over 4})} \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{1\over 4})}
 +
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma+{1\over 2},\check v+{1\over 2})} \nonumber \\
&&-
{1\over \Phi_{10}(\check\rho+{1\over 2},\check\sigma,\check v+{1\over 2})} -
{1\over \Phi_{10}(\check\rho,\check\sigma+{1\over 2},\check v+{1\over 2})} +
{1\over \Phi_{10}(\check\rho,\check\sigma,\check v+{1\over 2})}  \nonumber \\
&&+
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{3\over 4},\check v+{3\over 4})} -
{1\over \Phi_{10}(\check\rho+{3\over 4},\check\sigma+{1\over 4},\check v+{3\over 4})}
\nonumber \\
&& -
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{3\over 4},\check v+{3\over 4})}  +
{1\over \Phi_{10}(\check\rho+{1\over 4},\check\sigma+{1\over 4},\check v+{3\over 4})}\Bigg]
\nonumber \\
&&  +
\Bigg[{1\over \Phi_{10}(\check\rho+\check\sigma+2\check v,
\check\rho+\check\sigma-2\check v,\check\sigma-\check\rho)} \nonumber \\
&&
- {1\over \Phi_{10}(\check\rho+\check\sigma+2\check v+{1\over 2},
\check\rho+\check\sigma-2\check v+{1\over 2},\check\sigma-\check\rho+{1\over 2})}
\Bigg]\, .
\end{eqnarray}
This together with
\refb{epr1}
 exhausts all the dyons of torsion two with $Q$, $P$ primitive
since there are no dyons of this type with $Q^2/2$ even, $P^2/2$
odd or vice versa. To see this we note that since $(Q\pm P)$ are
$2\times$
primitive vectors, $(Q\pm P)^2/2$ must be multiples of four.
Taking the sum and difference we find that
$(Q^2+P^2)/2$ and $Q\cdot P$
must be even.

Since \refb{epr1} and \refb{epr1odd} contains information about
all the torsion two dyons with primitive $(Q,P)$, the full partition
function for such dyons in obtained by taking the sum of these two
functions. This gives the result quoted in \refb{etor2}.

Given this result on torsion two dyons in string theory we can go to
appropriate gauge theory limit to extract information about torsion
two dyons in gauge theories as in \cite{0708.3715,0712.0043}.
For simplicity we shall consider
$SU(3)$ gauge theories. If we denote by $\alpha_1$ and $\alpha_2$
the two simple roots of $SU(3)$, then, since the metric $L$ reduces
to the negative of the Cartan metric of the gauge group, we have
\begin{equation} \label{egg1}
\alpha_1^2 = -2, \qquad \alpha_2^2=-2, \qquad \alpha_1\cdot
\alpha_2=1\, .
\end{equation}
Let us now consider a dyon of charge vectors $(Q,P)$ with
\begin{equation} \label{egg2}
Q=\alpha_1 - \alpha_2, \qquad P=\alpha_1+\alpha_2\, .
\end{equation}
This has torsion 2. Furthermore both $Q$ and $P$ are primitive.
Thus this falls in the class of dyons analyzed in this section. In fact,
since
\begin{equation} \label{egg3}
{Q^2 \over 2} = -3, \qquad {P^2\over 2} = -1 , \qquad
Q\cdot P=0\, ,
\end{equation}
the index of these quarter BPS dyons in gauge theory must be
contained in \refb{epr1odd}.
We shall first show that the 16 terms inside the first square bracket
in \refb{epr1odd} do not
contribute to the index of the dyons described in
\refb{egg2} in any domain in the moduli space.
For this we note that the index computed from
these terms is identical to the index of dyons of torsion 1
with appropriate constraints on $Q^2$, $P^2$ and $Q\cdot P$.
In absence of these constraints the index is
known to reproduce the index of unit torsion gauge
theory dyons correctly\cite{0708.3715},
-- these are dyons of charge
$(\alpha_1,\alpha_2)$ or ones related to it by $SL(2,{\hbox{ Z\kern-1.6mm Z}})$ S-duality
transformation:
\begin{equation} \label{egg4}
(Q,P) = (a\alpha_1+b\alpha_2, c\alpha_1+d\alpha_2), \quad
a,b,c,d\in{\hbox{ Z\kern-1.6mm Z}}, \quad ad-bc=1\, .
\end{equation}
Such dyons will always have $Q^2P^2-(Q\cdot P)^2=3$, and
hence can never give a state of the form given in \refb{egg2} which
has $Q^2P^2-(Q\cdot P)^2=12$.
This in turn shows that the 16 terms inside the first square bracket
in \refb{epr1odd} can never give a non-vanishing contribution to the
index of a gauge theory state with charge vector given in
\refb{egg2}.

Thus the only possible contribution to the index
of the dyons with charges
$(\alpha_1-\alpha_2,\alpha_1+\alpha_2)$
can come from
the two terms inside the second square bracket in \refb{epr1odd}.
In fact when
$Q^2/2$ and $P^2/2$ are odd then both
terms give equal contribution;
so we can just calculate the contribution from the first term and
multiply it by a factor of 2. Equivalently we could use \refb{etor2}
where only the first term is present with a factor of 2.
Defining
\begin{equation} \label{egg6}
\check\rho' = \check\rho+\check\sigma+2\check v, \quad \check\sigma'=\check\rho+\check\sigma -2\check v, \quad
\check v' = \check\sigma -\check\rho\, ,
\end{equation}
we can identify the relevant term in $1/\check\Phi(\check\rho,\check\sigma,\check v)$ as
$2/\Phi_{10}(\check\rho',\check\sigma',\check v')$. As usual
the contribution of this term to the index  depends on the
choice of the integration contour, which in turn is determined by
domain in the moduli space in which we want to compute the index.
Equivalently we can say that in different domains we need to
use different Fourier series expansion of
$1/\check\Phi$.
Now the index of a charge vector of the type given in
\refb{egg3} will come from a term in the expansion of $1/\check\Phi$
of the form
\begin{equation} \label{egg5}
e^{-2i\pi (\check\rho+3\check\sigma)}\, .
\end{equation}
Using \refb{egg6} this takes the form
\begin{equation} \label{egg7}
e^{-2i\pi(\check\rho'+\check\sigma'+\check v')}\, .
\end{equation}
Thus in whichever domain the Fourier
expansion of $1/\check\Phi$ contains a term of the form \refb{egg7} we
have a non-vanishing index for the dyon in \refb{egg3} with the
index being equal to $(-1)^{Q\cdot P+1}$ times
the coefficient of this term.
Since here $Q\cdot P=0$, the index is $-2$ times the coefficient
of \refb{egg7} in the Fourier
expansion of $1/\Phi_{10}(\check\rho',\check\sigma',\check v')$.
Now from the analysis of partition function of torsion one dyons
(see {\it e.g.} \cite{0708.3715})
we know that this expansion indeed
has  a term of the form \refb{egg7} for one class of choices
of contour; these are the contours for which
\begin{equation} \label{egg8}
\Im(\check\rho'), \Im(\check\sigma') >> -\Im(\check v') >> 0 \, .
\end{equation}
Using \refb{echoice}, or equivalently by an $SL(2,{\hbox{ R\kern-2.4mm R}})$
transformation of the results of \cite{0708.3715}, one can
figure out the domain in the moduli space in
which this choice of contour is the correct one.
It turns out to be the domain bounded by the walls associated with the
decays of $(Q,P)$ into
\begin{equation} \label{ewallgauge}
((Q-P)/2,(P-Q)/2) + ((Q+P)/2,(Q+P)/2), \quad (-P,P)+(P+Q,0), \quad
(Q-P,0)+(P,P)\, .
\end{equation}
In this domain
$1/\Phi_{10}$ has to be first expanded in powers of $e^{2\pi i\check\rho'}$
and $e^{2\pi i\check\sigma'}$ and then each coefficient needs to be expanded
in powers of $e^{-2\pi i\check v'}$.
\refb{egg7} is the  leading term in this
expansion  and its coefficient
is 1. As a result the
index of the dyons is $-2$. This agrees
with the results of \cite{9804174,9907090,0005275,0609055}
where it was shown that in an appropriate domain in the
moduli space dyons of torsion $r$ has index $(-1)^{r-1} r$,
since these dyonic states are obtained by tensoring the basic
supermultiplet with a state of spin $(r-1)/2$.

Using a string junction picture\cite{9712211,9804160}
ref.\cite{9804174} also showed that the dyon
considered above exists in a domain of the moduli space bounded
by three walls of marginal stability, -- one asscociated with the decay
into $(\alpha_1,\alpha_1)+(-\alpha_2,\alpha_2)$, the second
associated with the decay into $(2\alpha_1,0)
+(-\alpha_1-\alpha_2, \alpha_1+\alpha_2)$
and the third one associated
with the decay into
$(-2\alpha_2,0)+(\alpha_1+\alpha_2,\alpha_1+\alpha_2)$.
These are precisely the walls listed in \refb{ewallgauge}. Since
the gauge theory dyons cease to exist outside these walls,
the index computed in gauge theory jumps by $2$ across
these three walls of marginal stability.
Does this agree with the prediction of the proposed dyon
partition function in string theory?
We can
calculate the change in the index associated with these
decays using the standard formula \refb{ex1} for decay into primitive
dyons\cite{appear} and the
modified formula \refb{efh7} for decay into
non-primitive dyons since the proposed partition function satisfies
these relations. We find a jump in the index equal to 2 across each of these
walls
as predicted by the gauge theory results.

\sectiono{Reverse applications} \label{sapp}

In our analysis so far we have used the information on half BPS
partition function to extract information about quarter BPS
partition function. However we can turn this around. If the
quarter BPS partition function is known then we can use it to
extract information about the half-BPS partition function by
first identifying  an appropriate wall on which one of the decay
products is the half BPS state under consideration and then studying
the behaviour of the quarter BPS partition function near the
pole that controls the jump in the index at this particular wall.

As an example we can consider the ${\hbox{ Z\kern-1.6mm Z}}_2$ CHL model of
\S\ref{s3.3}. The decay $(Q,P)\to (Q,0)+(0,P)$ is controlled
by the behaviour of $\check\Phi$ near $\check v=0$. Thus if we did not know
the spectrum of magnetically charged half BPS states in this theory,
we could study the behaviour of $\check\Phi$ near $\check v=0$ to get this
information. In this case since all the other walls are related
to this one by S-duality transformation, this is the only
independent information we can get.  However for more
complicated models there can be more information.

To illustrate this we shall consider the example of the ${\hbox{ Z\kern-1.6mm Z}}_6$
CHL model\cite{9508144,9508154}
mentioned in footnote \ref{ff1}. Our set ${\cal A}$
consists of charge vectors of the form
\begin{equation} \label{eapl1}
Q=\pmatrix{0 \cr m/6\cr 0 \cr -1}\, , \qquad P =
\pmatrix{K \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{equation}
as in \refb{ed1}. We now consider the decay associated with the
matrix
\begin{equation} \label{eapl2}
\pmatrix{a_0 & b_0\cr c_0 & d_0} = \pmatrix{1 & 1\cr 2 & 3}\, .
\end{equation}
{}From \refb{ede1} we see that this corresponds to the decay
\begin{equation} \label{eapl3}
(Q,P) \to (M_0, 2M_0) + (N_0, 3N_0) \, , \quad
M_0\equiv 3Q-P, \quad N_0\equiv -2Q + P\, .
\end{equation}
The charge vectors $M_0$ and $N_0$ are not related to $Q$ or $P$
by a T-duality transformation since they correspond to charges
that are triple and double twisted respectively. Furthermore
the dyon charges $(M_0,2M_0)$ and $(N_0,3N_0)$ cannot be
related by S-duality group $\Gamma_1(6)$ to either a purely
electric or a purely magnetic state whose index is known.
On the other hand the partition function of quarter BPS states of
the type given in \refb{eapl3} is known\cite{0609109,0708.1270}.
Thus the latter can be used to extract information about the
partition function of these half BPS states.

{}From \refb{epole1} it follows that the relevant zero of
$\check\Phi$ we need to examine is at
\begin{equation} \label{eapl4}
6\check\rho + \check\sigma + 5\check v = 0\, .
\end{equation}
The zeroes of $\check\Phi$ have been classified in
\cite{0605210,0708.1270}.
For a generic ${\hbox{ Z\kern-1.6mm Z}}_N$ model $\check\Phi$ has double zeroes at
\begin{eqnarray}\displaystyle \label{eapl5}
&& n_2 ( \check\sigma \check\rho  -\check v ^2) + j\check v  +
n_1 \check\sigma  -\check\rho m_1 + m_2 = 0 \nonumber \\
&& m_1\in N{\hbox{ Z\kern-1.6mm Z}}, \quad
n_1, m_2, n_2 \in {\hbox{ Z\kern-1.6mm Z}}, \quad j\in 2{\hbox{ Z\kern-1.6mm Z}}+1, \quad
m_1 n_1 + m_2 n_2 +\frac{j^2}{4} = {1\over 4}\, .
\end{eqnarray}
For the $N=6$ model, taking
\begin{equation} \label{eapl6}
m_1 = -6, \quad n_1=1, \quad m_2 = n_2=0, \quad j = 5\, ,
\end{equation}
we see that $\check\Phi$ indeed has a zero at \refb{eapl4}. Thus by
examining the known expression for $\check\Phi$ near this zero
we can determine the half-BPS partition functions of interest.
This can be done in a straightforward manner following the
general procedure described in \cite{0605210,0708.1270}.

We note in passing that
in an arbitrary ${\hbox{ Z\kern-1.6mm Z}}_N$ model with the set ${\cal A}$ chosen as
\begin{equation} \label{eapl7}
Q=\pmatrix{0 \cr m/N\cr 0 \cr -1}\, , \qquad P =
\pmatrix{K \cr J \cr 1\cr 0}\, , \quad m, K, J\in{\hbox{ Z\kern-1.6mm Z}}\, ,
\end{equation}
the walls of marginal stability are controlled by matrices
$\pmatrix{a_0 & b_0\cr c_0 & d_0}$ subject to the
conditions\cite{0702141}
\begin{equation} \label{eapl8}
a_0d_0-b_0 c_0=1, \quad
a_0, b_0, c_0, d_0\in{\hbox{ Z\kern-1.6mm Z}}, \quad
c_0 d_0\in N{\hbox{ Z\kern-1.6mm Z}}\, .
\end{equation}
According to our hypothesis this decay will be controlled by a
double zero of $\check\Phi$ at
\begin{equation} \label{eapl9}
\check\rho c_0d_0 + \check\sigma a_0b_0 + \check v (a_0d_0 + b_0c_0) = 0\, .
\end{equation}
This corresponds to the choice
\begin{equation} \label{eapl10}
m_1 = - c_0 d_0, \quad n_1 = a_0 b_0 , \quad m_2 = n_2 =0, \quad
j = a_0d_0 + b_0c_0\, ,
\end{equation}
in eq.\refb{eapl5}.
We now see that the $m_i$'s, $n_i$'s and $j$ given in \refb{eapl10}
satisfies all the constraints mentioned in \refb{eapl5} as a
consequence of \refb{eapl8}. Thus our proposal that the
decay associated with the matrix $\pmatrix{a_0 & b_0\cr
c_0 & d_0}$ is always controlled by the zero at
\refb{eapl9} is at least consistent with the locations of the zeroes
of $\check\Phi$ for ${\hbox{ Z\kern-1.6mm Z}}_N$ orbifold models.

\medskip

\noindent {\bf Acknowledgment:} We would like to thank
Nabamita Banerjee, Miranda Cheng, Atish Dabholkar,
Justin David,
Frederik Denef, Dileep Jatkar, Suresh Nampuri and
K. Narayan for useful discussions.