Double-Janus Linear Sigma Models and Generalized Reciprocity for Gauss Sums

We study the supersymmetric partition function of a 2d linear $\sigma$-model whose target space is a torus with a complex structure that varies along one worldsheet direction and a K\"ahler modulus that varies along the other. This setup is inspired by the dimensional reduction of a Janus configuration of 4d $\mathcal{N}=4$ $U(1)$ Super-Yang-Mills theory compactified on a mapping torus ($T^2$ fibered over $S^1$) times a circle with an $SL(2,\mathbb{Z})$ duality wall inserted on $S^1$, but our setup has minimal supersymmetry. The partition function depends on two independent elements of $SL(2,\mathbb{Z})$, one describing the duality twist, and the other describing the geometry of the mapping torus. It is topological and can be written as a multivariate quadratic Gauss sum. By calculating the partition function in two different ways, we obtain identities relating different quadratic Gauss sums, generalizing the {\it Landsberg-Schaar} relation. These identities are a subset of a collection of identities discovered by F. Deloup. Each identity contains a phase which is an eighth root of unity, and we show how it arises as a Berry phase in the supersymmetric Janus-like configuration. Supersymmetry requires the complex structure to vary along a semicircle in the upper half-plane, as shown by Gaiotto and Witten in a related context, and that semicircle plays an important role in reproducing the correct Berry phase.

B Locality and action I at the intersection of the SL(2, Z) duality walls 44 C On the equivalence between 2 q(·) and v t M v in (6.9)

Introduction
In these notes, we study the torus partition function of a supersymmetric 2d linear σmodel with T 2 target space (a free theory) whose complex structure varies along one of the worldsheet directions (parametrized by 0 ≤ σ 1 < 1) and whose Kähler modulus varies along the other direction (parametrized by 0 ≤ σ 2 < 1). The periodic boundary conditions can be twisted both with an element in the mapping class group (MCG) of the target T 2 (we choose to do that twist along the σ 1 direction) and with a T-duality transformation (along σ 2 ). The partition function thus depends on (the conjugacy classes of) M, M ∈ SL(2, Z) that respectively describe the MCG "geometrical" element and the T-duality transformation. We represent the complex structure of the target space by τ (taking values in the upper half-plane H), which is allowed to vary as a function of σ 1 . More concretely, as we complete a loop around the first cycle of the worldsheet (by varying σ 1 from 0 to 1), the variable τ may undergo a PSL(2, Z) transformation τ → (aτ + b) / (cτ + d) , and in order to prevent a discontinuity at σ 1 = 0 we need to impose boundary conditions (connecting the fields at σ 1 = 0 to the fields at σ 1 = 1) that involve an element of the MCG of the target space, encoded by Similarly, the Kähler structure of the target space is represented by ρ = ρ 1 + iρ 2 on the upper half-plane (with ρ 2 proportional to the area of the T 2 target and ρ 1 proportional to the Kalb-Ramond flux). As σ 2 varies from 0 to 1, the variable ρ may undergo a PSL(2, Z) transformation ρ → ãρ +b cρ +d , and in order to prevent a discontinuity at σ 2 = 0 we need to impose boundary conditions (connecting the fields at σ 2 = 0 to the fields at σ 2 = 1) that involve a "T-duality wall" labeled by M = ãb cd ∈ SL(2, Z).
The motivation for considering such a setup is that it arises as a limit of a sort of "double-Janus" configuration of 4d N = 4 Super-Yang-Mills (SYM) theory. Janus configurations are 4d SYM theories with a coupling constant that varies along one direction of space. They were first introduced by Bak, Gutperle and Hirano [1] in a non-supersymmetric dilatonic deformation of AdS 5 , an exact solution to the Type IIB SUGRA equations, as a way to create a discontinuous jump in the real Yang-Mills coupling constant (which is related to the asymptotic boundary value of the dilaton according to the standard AdS/CFT dictionary) across a codimension-1 interface. A supersymmetric Janus configuration was introduced in [2], and later, the jump was "smoothed out" in [3], but still without a θ-angle. Subsequently, Gaiotto and Witten presented [4] the action of a deformation of N = 4 SYM that preserves half of the supersymmetries with a complex coupling constant τ = 4πi g 2 ym + θ 2π that varies as a function of one spatial direction, say τ (x 3 ). Janus configurations have been further explored in [5,6] and have been introduced into sphere partition functions in [7,8]. They can also be constructed for theories in other dimensions [9]. Configurations for 2d σ-models have been proposed earlier in [10] and sphere partition functions with Janus configurations have been calculated in [8,11].
Taking the gauge group to be U (n), the Gaiotto-Witten action allows us to smoothly introduce an SL(2, Z) duality twist (sometimes referred to as a "duality wall" or "S-fold" and studied in various string theory and gauge theory contexts, for example, in [12][13][14][15][16][17]) in an S 1 compactification of 4d SYM. Parameterizing S 1 by 0 ≤ x 3 < 1, the duality twist is an unconventional boundary condition that sets τ (1) = aτ (0) + b cτ (0) + d for M ∈ SL(2, Z), (1.1) together with the implied electric-magnetic duality action on the fields. We will refer to this theory as a closed Janus configuration. This setup was studied in [18] for U (1) gauge group, where the low energy limit is easily shown to be described by a Chern-Simons action with an abelian gauge group, determined (not uniquely) by a decomposition of M into T = 1 1 0 1 and S = 0 −1 1 0 generators. Furthermore, it was shown in [18] that a T-dual string theory background provides a geometrical interpretation for the quantum algebra of Wilson loops. A similar setup was also studied in [19], from the perspective of the holographic dual. Duality walls have also been studied in [20], and recently a gravitational anomaly was discovered [21] in such compactifications. The Gaiotto-Witten Janus configuration can be constructed as a limit of a compactification of the 6d (2, 0)-theory on a T 2 -fibration over R when the area of the T 2 fiber shrinks to zero. We will review this construction in Appendix A. To construct the closed Janus configuration requires us to first take the limit where the area of the T 2 fiber shrinks to zero, since otherwise the area will be discontinuous along S 1 (as we will explain in Appendix A), and so we are back to N = 4 SYM with the S-fold twist M . In the context of 3d-3d correspondence [22], this configuration is related to the 6d (2, 0) theory on an (auxiliary) 3d mapping torus studied in [23][24][25][26], where a higher-genus fiber is also considered. The setup for the present paper is derived from an abelian double-Janus configuration that is a prelude to the study of a nonabelian theory. It can be obtained as a limit of a Gaiotto-Witten Janus configuration by compactifying on a small torus and allowing its complex structure parameter to vary as a function of time. In other words, we compactify the closed 4d Janus configuration on another (auxiliary) mapping torus labeled by another SL(2, Z) element M . We are interested in the partition function Z(M, M ) which is a function of the two duality twists. Here M is the S-duality element that acts on the N = 4 SYM coupling constant, while M is the MCG element of the T 2 in the geometrical mapping torus. To preserve SUSY, it is again convenient to take the limit where the area of the T 2 fiber shrinks to zero first. Thus, we first reduce the 4d gauge theory to 2d, which for U (1) gauge group becomes a σ-model with a T 2 × R 6 target space. The R 6 factor does not play much of a role in what follows, so we ignore it. We are thus led to study "double-Janus" configurations for a linear σ-model with T 2 target space where the complex structure varies in one direction and the Kähler structure (i.e., the complexified area) varies in the other direction, with M -and M -boundary conditions respectively [where M ∈ SL(2, Z τ ) and M ∈ SL(2, Z ρ )]. We will show that Z(M, M ) is essentially a finite sum over certain roots of unity, and by calculating it in two different limits, respectively corresponding to different limits of the shape of the (physical) T 2 target, we arrive at a number-theoretic identity known as the Landsberg-Schaar identity.
The rest of this paper is organized as follows. We begin in §2 with a brief review of Quadratic Reciprocity, Gauss sums, and the Landsberg-Schaar identity. We then construct the double-Janus σ-model in the 2d bulk in §3, where we present the general constraints from supersymmetry, and various solutions. In §4 we compactify the double-Janus solution on a torus and introduce the twisted boundary conditions (with both geometrical and T-duality twists, M and M , respectively). In §5 we calculate the double-Janus partition function, including both bosonic and fermionic one-loop determinants, which cancel each other out, leaving only a number-theoretic quadratic Gauss sum. In §6 we discuss connections with abelian Chern-Simons theory partition functions and the dual "strings on mapping tori" introduced in [18] in the context of 4d closed Janus configurations. We use this dual formulation to determine the precise normalization of the partition function. In §7 we show how the basic Landsberg-Schaar relation follows with a Berry phase factor included, and in §8 we derive its multivariate generalizations, along with a comparison against known generalizations in the mathematical literature. Finally we conclude in §9.

Quadratic Reciprocity
Quadratic Reciprocity is a classic duality in elementary number theory. In order to introduce it, we first set up the context and review a few related concepts. If p is an odd prime number and q is an integer, then q is called a quadratic residue (mod p) if x 2 ≡ q (mod p) has integer solutions x. The information on solutions to this equation is packaged inside the Legendre symbol q p defined as follows: 1 if ± √ q (mod p) exist and are distinct.
The Law of Quadratic Reciprocity states that if p and q are odd primes, then It is a nontrivial statement that connects the existence of solutions to x 2 ≡ q (mod p) with the existence of solutions to the dual equation x 2 ≡ p (mod q). Quadratic Reciprocity was originally conjectured by Euler and Legendre in the late 18 th century, and then proved by Gauss in 1801. It was a catalyst for subsequent modern developments in Algebraic Number Theory, such as Artin's Reciprocity Law [27].
A Quadratic Gauss Sum is the discrete Fourier transform of the Legendre symbol: where the last equality follows from the identity p−1 b=0 e 2πiab/p = 0 for a ≡0 (mod p). It is not hard to prove that χ p (a) = a p χ p (1), so the quadratic Gauss sum is proportional to the quadratic residue. It can also be shown that χ p (1) = √ p if p ≡ 1 (mod 4) and χ p (1) = i √ p if p ≡ 3 (mod 4) (see [28]). Recent results on closed forms of some quadratic Gauss sum include [29]. Quadratic Reciprocity is then a statement about the relation between quadratic Gauss sums. For example, if both p and q are 1 (mod 4) then χ p (q)/ √ p = A convenient way to prove the Quadratic Reciprocity (2.1) is via the Landsberg-Schaar identity [30,31] The identity can easily be proved using the modular transformation properties of the Jacobi theta function ϑ (0; τ ) ≡ ∞ n=−∞ exp πiτ n 2 evaluated at zero 1 and its asymptotic behavior 1 In Riemann and Mumford's notations, ϑ(z; τ ) ≡ ϑ00(z; τ ) is denoted as θ3(z; q), where q ≡ e 2πiτ .
as the argument τ vertically approaches the real axis [32,33]. 2 In this paper, we will describe a physical system with a finite number of quantum ground states that reproduces (2.3) directly. If p and q are both even, say p = 2p and q = 2q then it is easy to see that (2.3) reduces to (This is seen by first summing the terms with n and n + 2p on the LHS and n and n + q on the RHS.) Before proceeding to the physical system, we note that for odd primes p and q, the Landsberg-Schaar identity is a slightly modified version of Quadratic Reciprocity. To see this, define which is periodic in a with period 4p, and satisfies p (a + 2p) = (−i) ap p (a) (as can easily be seen by relabeling n → n + p). In fact, it is elementary to check (by splitting the sum over n into sums over odd and even numbers) that (2.5) It then follows from Quadratic Reciprocity and the results quoted above for quadratic Gauss sums that if p = q are odd primes, Taking the complex conjugate and noting the known result −1 q = (−1) (q−1)/2 , the Landsberg-Schaar identity (2.3) follows in the form We will now construct a (p, q)-dependent quantum field theory whose partition function can be calculated in two different ways; one gives an expression proportional to χ q (p) while the other gives an expression proportional to p (−q).
In the next sections we will show how (2.7) and generalizations of it arise from studying the partition function on T 2 of supersymmetric 2d σ-models whose target space is (also) a T 2 with complex structure τ and Kähler modulus ρ that vary along the T 2 worldsheet. We will include boundary conditions with duality twists along two independent cycles of the worldsheet, acting as So that the partition function Z(M, M ) will depend on two SL(2, Z) elements The basic Landsberg-Schaar relation (2.7) will be recovered in the special case where We now present the details.
3 Double-Janus σ-models In this section we construct a 2d σ-model whose target space is a T 2 with complex structure τ and Kähler modulus ρ that vary along the worldsheet so as to preserve some amount of supersymmetry. We use the terms "worldsheet" and "target-space", borrowed from stringtheory, but we emphasize that we are dealing only with a 2d CFT. In particular, we will be working with a fixed metric where we denote the (Euclidean) worldsheet coordinates by (σ 1 , σ 2 ), and we set Dimensional reduction of the Gaiotto-Witten action [4], in the special case of a U (1) gauge group, is one way to obtain such a double-Janus Lagrangian, with both τ and ρ varying along the worldsheet. In this way we can preserve 4 supersymmetries, but we also get additional massive noncompact scalar fields. We will describe this model briefly in Appendix A, but for our purposes it will be sufficient to work with a minimally supersymmetric model which we describe in §3.1.

Minimally supersymmetric double-Janus model
Our starting point is a supersymmetric σ-model with target-space T N (later we will set N = 2). We let I, J = 1, . . . , N label target-space coordinates. The scalar fields will be denoted by X I , the left-moving fermionic fields will be denoted by Ψ I , and the rightmoving fermionic fields will be denoted by Ψ I . We combine them into (2N )-component column vectors, denoted by X, Ψ and Ψ, with transposed row-vectors denoted by X t , Ψ t , and Ψ t . We assume that X I ∼ X I +2π is a periodic field. All fields are functions of (σ 1 , σ 2 ).
The components of the target-space metric and Kalb-Ramond field will be denoted by G IJ and B IJ , respectively, and combined into the (2N ) × (2N ) matrices G and B, with This matrix will appear in the kinetic term of the scalar fields X, and we allow E to vary with (σ 1 , σ 2 ), in a predetermined way, as in a Janus configuration. E is thus a (σ 1 , σ 2 )dependent background. To preserve supersymmetry, the action requires additional "mass terms" and "background gauge field terms" and takes the general form: Σ, Σ, K, K, and W are background (2N )×(2N ) matrices with, possibly, (σ 1 , σ 2 )-dependent elements. Σ = Σ t and Σ = Σ t are symmetric matrices that define the fermionic kinetic terms, K = −K t and K = −K t are antisymmetric and enter in effective "background SO(2N ) gauge field terms", and W is an effective "mass term". The supersymmetry transformations take the form where η is an anticommuting parameter. η is real, and complex conjugation acts as 3) Note that invariance of the action under the (· · · ) operation requires B = 0, Σ = Σ, K = K and W = W t (but we will not require this except in special cases below). Invariance of the action under the SUSY transformations (3.2) requires the following relations among G, E, Σ and Σ: Then, K, K, and W are determined in terms of E, Σ, and Σ by For future reference, we list the linear equations of motion that follow from (3.1). The bosonic equations are 10) and the fermionic equations of motion are which can be simplified, using (3.7)-(3.9), to The supersymmetry constraint equations (3.4)-(3.6) simplify somewhat when G is expressed in terms of a "vielbein" V as and Then, S = S t and S = S t are symmetric matrices transforming under V → ΩV as S → ΩSΩ t and S → ΩSΩ t , while A z and A z are antisymmetric and transform like a gauge field: The constraints (3.4)-(3.5) can then be written as Next, we define the symmetric matrices Then, (3.6) can be written as 0 = SY + YS. (3.20) Thus, given V and B, we can find S and S by solving (3.17), and then (3.20) yields a constraint on V and B. We do not know the general solution G, B, S, S to (3.4)-(3.6), but below we will discuss a special class of solutions that will suffice for our needs. We restrict to N = 1 and begin with a simple class of solutions where G is diagonal and B = 0. We then apply solution generating transformations (i.e., T-duality) to obtain a wider class of solutions.

σ 1 -independent solutions
A simple way to satisfy (3.17) is to set where I is the identity matrix. Then, (3.20) becomes Y = Y, which by (3.18)-(3.19) requires 0 = ∂E + ∂E = ∂ 1 E. Thus, E, and hence G and B are functions of σ 2 only. How they vary with σ 2 is arbitrary, and any pair of G(σ 2 ) and B(σ 2 ) determines a supersymmetric action (3.1). The remaining couplings in (3.1) can then easily be calculated from (3.14) and (3.7)-(3.9): By setting S = −S = iI we similarly get a solution with couplings that are functions of σ 1 only. In this paper, however, we are more interested in solutions where G and B vary nontrivially with both σ 1 and σ 2 .

Holomorphic solutions
For the T 2 target space, another class of solutions can be obtained by requiring ρ to be constant and allowing τ to vary holomorphically with z. The setup is then an elliptic fibration, reminiscent of F-theory [36]. We can take 3 and using (3.15)-(3.16), we calculate Since ∂τ = 0, we can substitute ∂τ 1 = i∂τ 2 and ∂τ 1 = −i∂τ 2 and write Then, (3.17) has the general solution where F (z) and F (z) are arbitrary holomoprhic and antiholomorphic (symmetric) matrixvalued functions on the worldsheet. We also calculate from (3.18)- (3.19), Since, for a holomorphic τ we have ∂τ 2 = − i 2 ∂τ , which is also holomorphic, while ∂τ 2 = i 2 ∂τ is antiholomoprhic, we see that (3.23) is possible only if for some constant symmetric matrices , that satisfy Since κ and κ are nilpotent (κ 2 = κ 2 = 0), (3.25) requires κ κ = κ κ = 0 which is equivalent to Tr = Tr = 0. If we also require to be the complex conjugate of then (3.25) is satisfied provided Once we choose a 2 × 2 matrix (and its complex conjugate ) that satisfies (3.26) and (3.27), we calculate F and F from (3.24), and then we calculate S and S from (3.22). We then find Σ and Σ from (3.14).
These holomorphic solutions might be interesting to explore, but we will not discuss them further in the present paper, since our focus is the closed double-Janus solutions to be described in §3.5. We will construct these solutions by first finding solutions where E is diagonal. We will make the further assumption that S and S are constant matrices, as is the case if the worldsheet is C and we require S and S to be bounded, or if the worldsheet is T 2 with periodic boundary conditions. We also assume that S is the complex conjugate of S, and for simplicity we proceed to analyze the case N = 2, i.e., a T 2 target space.

Diagonal solutions
If S is also diagonal, we proceed as follows. We first assume without loss of generality that S 11 > 0 (since we can always rotate z by a phase to make it so). Then 0 = ∂ log G 11 S 11 + S 11 (∂ log G 11 ) says that G 11 is a function of σ 2 only. If S 22 is also real then a similar conclusion about G 22 shows that we have a special case of §3.2. If S 22 is not real, then G 22 is a function of a different linear combination of σ 1 and σ 2 . In any case, this seems to be a rather restricted system, and we will not pursue this further in this paper.
If S is not diagonal, we can assume that S 12 = S 12 > 0 (again achieved by rotating z if necessary). The off-diagonal components of from which it follows that ∂ 2 log G 11 = ∂ 2 log G 11 and similarly for G 22 . Since ∂ 2 − ∂ 2 = i∂ 1 ∂ 2 , and combined with (3.29), we find that G takes the form where we have written the metric in terms of the Kähler modulus ρ = ρ 1 + iρ 2 (with ρ 1 = 0 since B = 0) and the complex structure τ = τ 1 + iτ 2 (with τ 1 = 0 since G is diagonal), and the analysis above shows that (for S 12 > 0) τ 2 = τ 2 (σ 1 ) is a function of σ 1 only, and ρ 2 = ρ 2 (σ 2 ) is a function of σ 2 only. For the future, we denote Then, since we assume that S and S are constant, the diagonal components of (3.28) imply that either S 11 = S 22 = 0, or both τ 2 /τ 2 andρ 2 /ρ 2 are constant. We will first consider the more general case that τ 2 and ρ 2 are arbitrary functions of σ 1 and σ 2 and we therefore assume that S 11 = S 22 = 0. Although later on we will discuss the case that log τ 2 and log ρ 2 are linear functions of σ 1 and σ 2 , respectively, we will still keep the assumption S 11 = S 22 = 0, since it leads to the simpliest model. We can take S 12 = 1 without loss of generality (by rescaling z if necessary). The action (3.1) then takes the form Note that this action is real, in the sense defined below (3.3). The fermionic part of the action (3.30) can be simplified with a change of variables, but we will defer that to §5.2.

SL(2, R)-generated double-Janus solutions
The action (3.30) describes a special solution to (3.4)-(3.6) [substituted into (3.1)] where the complex structure τ = τ 1 + iτ 2 and Kähler parameter ρ 1 + iρ 2 of the T 2 target space are each allowed to vary along the imaginary axes of their respective upper half-planes. We will now apply fractional linear transformations, acting as to generate new solutions. In general, we expect an O(n, n, R) group of transformations acting on the parameters E, Σ, Σ , and converting a solution of (3.4)-(3.6) to a new solution E , Σ , Σ . This is an extension of the well-known O(n, n, R) action on σ-models with T n target space, parametrized by a Narain lattice in the isotropic (i.e., non-Janus) case. (See [37] for a review.) Such transformations are genererated by linear coordinate reparametrizations (which modify the boundary conditions since the new coordinates are still required to obey the same 2π periodicity conditions as the old ones) and T-dualities. The geometrical transformations act as and therefore where P ∈ GL(n, R) is a constant matrix. (Later, we will restrict to the case n = 2.) T-duality on all directions acts as The terms in the action (3.30) can then easily be calculated from (3.7)-(3.9). For example, after some algebra, we get For the case of T 2 target space, we can define two commuting PSL(2, R) actions. We take the target space metric to be so that the geometrical PSL(2, R) τ acts as The other group, PSL(2, R) ρ , acts as where is the antisymmetric matrix defined in (3.21), and αβ γδ ∈ SL(2, R). (3.37) Applying these transformations to the solution (3.30), we get a new solution with τ (σ 1 ) taking values on a semicircle of radius 1/2|γδ| in the upper half-plane that intersects the real axis at the points α/γ and β/δ, and similarly, ρ(σ 2 ) takes values on a semicircle of radius 1/2|γδ| that intersects the real axis at the pointsα/γ andβ/δ. This behavior of the modular parameters is similar to that derived by Gaiotto and Witten in [4] for the supersymmetric Janus configurations of N = 4 SYM. The solutions discussed above are more suitable for our needs, since for suitably chosen parameters, the semicircles will be invariant under some SL(2, Z) duality transformations. The worldsheet of such models can then be compactified on a torus, thus making σ 1 and σ 2 periodic, and the periodicities σ 1 → σ 1 + 1 and σ 2 → σ 2 + 1 are accompanied by duality twists. In the context of 4d N = 4 SYM, such a setup has been used in [18,19] to compactify the Gaiotto-Witten solution to 3d. A generic SL(2, Z) matrix with |a+d| > 2 (a hyperbolic element 4 ) preserves the semicircle of radius (a + d) 2 − 4/2|c| that intersects the real axis at We will now discuss in detail how to incorporate the duality twists, and the "interaction" between the τ and ρ twists.

Duality twists
At the end of §3.5 we obtained a model with τ varying as a function of σ 1 while taking values on a semicircle that is preserved by and with ρ varying as a function of σ 2 while taking values on another semicircle that is preserved by We will now compactify the worldsheet. To begin with, we put the theory on a noncompact rectangular worldsheet with 0 ≤ σ 1 , σ 2 < 1 .

Geometrical twist
Let us first discuss the boundary conditions relating σ 1 = 0 to σ 1 = 1. The complex structure τ of the target space T 2 depends on σ 1 , and if τ (0) = τ (1), we can insert an MCG element that acts nontrivially, but geometrically, on X. We then require τ (0) to be related to τ (1) by the element M ∈ SL(2, Z) so that The boundary conditions on the fermionic fields are For the bosonic fields, we require X(1, σ 2 ) to be related to M X(0, σ 2 ), up to a vector whose components are integer multiples of 2π: which can be thought of as a vector of "winding numbers", and being a vector of integers, it is independent of σ 2 . We can construct a vector with a simpler boundary condition by removing a constant piece from X, which satisfies the periodicity condition Note that Z is also invariant under the discrete translations that are parametrized by a vector of integers K as: In Minkowski (worldsheet) signature, the minimum energy configuration would be Z = 0 which corresponds to X = 2π(I − M ) −1 N . These are the fixed points of the action X → M X (acting on the T 2 target). Moreover, the equivalence which is required to describe a T 2 target space (instead of R 2 ), acts on N as The lattice Z 2 subject to the identification (4.8) is a finite abelian group with det(I − M ) = |a + d − 2| elements. (This abelian group played an important role in [18], where it was related to a group of symmetry operators in a related context.) We denote this group by The path integral over field configurations X (for any worldsheet signature) subject to the periodicity condition (4.3) is equivalent to a path integral over Z, subject to the boundary condition (4.6), and a sum over the finite group Ξ 0 .

T-duality twist
Now, we introduce an SL(2, Z) duality twist in the σ 2 direction. This twist acts on the ρ(σ 2 ) parameter by an element M ∈ SL(2, Z) so that resulting in an asymmetric orbifold [38]. The M -twist induces certain nontrivial boundary conditions for the fields X, Ψ and Ψ. To describe them, we denote (4.11) These fields will be used to describe the fields in the vicinity of σ 2 = 1. In the same vein, we also denote when referring to fields in the vicinity of σ 2 = 0. (Note that X 0 is identical to X, but the subscript "0" is useful for clarity when we couple X 0 to X 1 and restrict the fields to σ 2 = 0.) We use a similar subscript notation for the background fields, i.e., E 0 ≡ E, On the level of equations of motion, the boundary conditions on the bosonic fields are This is a special case of Bäcklund transformation (for Cauchy-Riemann-like equations), whereby the equations of motion for the fields at σ 2 = 1 get mapped to the integrability conditions for the fields at σ 2 = 0: which vanishes thanks to the equation of motion (3.10). The fermionic boundary conditions can be derived from the SUSY transformations (3.2), together with the boundary conditions on the background parameters (3.34)-(3.36), and they are When applied to (4.14), the SUSY variation (3.2) gives the bosonic boundary conditions (4.13), and using the fermionic equations of motion (3.12), one can easily check that the SUSY variation of (4.13) is also satisfied. In deriving (4.14) we also used the relations which mirror (3.34)-(3.36), but with integersã, . . . ,d instead of real numbersα, . . . ,δ, and we also used the identity Quantum mechanically, the boundary conditions (4.13) are introduced by inserting a "duality wall" (see for instance [39] and the supersymmetric case discussed in [40]). The T-duality wall can be thought of as the dimensional reduction of the T (U (1)) theory, 5 and in general, to incorporate the M twist into the action we have to decompose M in terms of the generators where k 1 , . . . , k r are integers. The decomposition (4.19) is not unique, but for our purposes it will be sufficient to consider the case r = 1, so we will just set (We will comment on the general case in §8.2.) The M -twist can then be inserted by adding a 1-dimensional term I and a 0-dimensional term I to the action as follows. I is defined as the integral over σ 1 at σ 2 = 0, and is a sum of bosonic and fermionic terms. The bosonic term is given by . (4.20) The first term in (4.20) implements the T k component of (4.19) while the second term couples the fields at σ 2 = 1 to the fields at σ 2 = 0 and implements theS component of M . From now own, any field with a subscript "0" or "1" will be implicitly understood to be evaluated at σ 2 = 0. The fermionic 1-dimensional action I f can be designed so that if we denote by I f the fermionic part of the bulk action I given in (3.1), then the equations of motion derived from I f + I f at σ 2 = 0 and σ 2 = 1 will be equivalent to the boundary conditions (4.14). We take the ansatz 6 , or more generally T (G), is the 3d action introduced in [41] to capture the action of S-duality in the N = 4 Super-Yang-Mills theory, and see also [20,[42][43][44][45][46] for related ideas. 6 In I f we did not include mixed chirality terms of the form Ψ where R, R, J, J, H and H are 2 × 2 antisymmetric matrices: To be compatible with (4.14), the following relations must hold: Requiring H and H to be antisymmetric [as in (4.22)], and using (4.16)-(4.17)] we get two equations for R and R: It can easily be checked that if (4.27)-(4.28) are satisfied, J and J as given by (4.23)-(4.26) are also antisymmetric.
In order to solve (4.27)-(4.28) it is convenient to change variables as follows. Since Σ and Σ are symmetric and G is symmetric and nondegenerate (as we assume), we can find matrices Y and Y so that We can also require the boundary conditions which are compatible with (4.16)-(4.17). Then, it is not hard to check that are solutions to (4.27)-(4.28). The meaning of (4.31)-(4.32) becomes clearer if we change field variables to In terms of the new variables, the kinetic terms iΨ t Σ∂Ψ and iΨ t Σ∂Ψ of (3.1) become iΨ t G∂Ψ + (· · · ) and iΨ t G∂Ψ + (· · · ), where (· · · ) are corrections to the Ψ t KΨ and Ψ t KΨ terms. In terms of the new field variables, (4.21) can be written as Thus, the coupling between Ψ 1 and Ψ 0 is given by the constant matrix . However, the disadvantage of the new variables is that formulae (3.2), (3.4)-(3.6) and (3.7)-(3.9) become more cumbersome. We also note that the total action I + I b + I f is not invariant under the SUSY transformation (3.2), but this is expected with a duality wall, and a similar problem occurs with translations. Consider, for example, an S-duality wall with ρ = i (which does not require a Janus configuration to match the field values at σ 2 = 0 to those at σ 2 = 1). In that case, the system is translationally invariant under σ 2 → σ 2 + ε, but not manifestly so, because under a translation the duality wall is moved from σ 2 = 0 to σ 2 = ε, and demonstrating invariance requires an additional duality transformation within the strip 0 < σ 2 < ε.
Finally, to complete the action we need to add a 0-dimensional term that couples the field X(0, 0) to X(1, 0). It takes the form This term is necessary to reproduce the correct equations of motion at the intersection (0, 0) of the two duality walls. Indeed, if we denote by I b the bosonic part of I from (3.1), then I b + I b + I leads to the bosonic boundary conditions (4.13). Note that X(1, 0) is related to X(0, 0) by (4.4). Without I , the variation of the action I b + I b will have an unwanted term i 2 (k − 2)δX(0, 0) t M −1 N , which would be too restrictive (leading to N = 0). Thanks to (4.4) and the identity M t M = (which follows from det M = 1), we can rewrite I as If k is odd then I b + I might not be invariant under (4.7). This is clearer after rewriting I b + I as where Z and N where defined in (4.5) and (4.4), and subscripts of Z 0 and Z 1 are defined similarly to those of X 0 and X 1 in (4.12) and (4.11). Z is invariant under the discrete shift (4.7), but the last term on the RHS of (4.36) changes by , which might be an odd multiple of iπ if k is odd. We therefore require k to be even. 7 (We will see another aspect of this requirement in §6.2.) At this point one may wonder if an additional term quadratic in N can be added to the action. This, however, will violate locality, since N can only be calculated by continuously following the value of X from σ 1 = 0 to σ 1 = 1. We will address the issue of locality in more details in Appendix B, where we will also argue that I is necessary to incorporate the discrete target space periodicity (4.7) in a local way, at least for even k.

The partition function
Thus, we have completed the construction of the action, which is given by the sum of (3.1), (4.20), (4.21) and (4.34): The model we have constructed consists of the bulk 2d action (3.1) and two duality walls inserted between σ 1 = 0 and σ 1 = 1 and between σ 2 = 0 and σ 2 = 1. The wall at σ 1 = 0 is given by nontrivial boundary conditions (4.2)-(4.3), and the wall at σ 2 = 0 is described by the 1d action I given by (4.20)-(4.21). At the intersection of the walls we have the additional 0d term I given by (4.34). This is depicted in Figure 1.
The partition function is defined as The prefactor 1/ |Ξ 0 | is necessary in order to have a properly normalized T-duality wall at σ 2 = 1. This can be argued by considering σ 2 as the time direction and realizing the Tduality wall at σ 2 = 1 as a unitary transformation on the Hilbert space. We will outline this approach in more detail in the §6, but first we will calculate Z by evaluating the one-loop determinants in the action.

Calculating the partition function
We will now calculate the partition function for the model we have constructed in §4.1- §4.2. First, it is convenient to express the bosonic 1d and 0d terms I b + I in terms of Z and N as in (4.36). The advantage is that Z satisfies linear boundary conditions (4.3) at σ 1 , unlike X whose boundary conditions include an affine term (4.4). The discrete N decouples and the partition function now takes the form where the finite abelian group Ξ 0 was defined in (4.9), and where ∆ −1 b is the result of integrating over fluctuations of Z and ∆ f is the result of integrating over Ψ and Ψ.

The bosonic one-loop determinant
Let us discuss the bosonic part first. To compute ∆ b we need a metric on the space of fluctuations, which we take to be Given a choice of vielbein V as in (3.13), we can change variables to Z ≡ V Z, which brings the metric δZ 2 into the normal form. We will now show how to calculate ∆ b for the model whose 2d bulk is obtained by acting with SL(2, R) τ × SL(2, R) ρ transformations, defined in §3.5, on the diagonal model of (3.30). Since Z, Ψ and Ψ are unaware of the periodicity of the target space T 2 , their boundary conditions do not require the transformations to be restricted to SL(2, Z), and so we can return to the diagonal model and calculate the fluctuations there.
In this way the model constructed at the end of §3.5, with τ and ρ varying along semicircles that are invariant under M and M , respectively, gets converted to a model in which τ and ρ vary along the imaginary axis. In this model, whose bulk action is given by (3.30), the boundary conditions along the σ 1 and σ 2 directions are determined by the eigenvalues of M and M , Then, (4.1) and (4.10) become and the boundary conditions (4.6) become where Z 1 and Z 2 are the components of Z, while (4.13) becomes which we can solve simply by requiring In (3.30), we can take the vielbein to be diagonal as well, so that the change of variables from Z to the normalized Z is given by The boundary conditions (5.3), (5.4) and (5.5) imply that Z is periodic in σ 1 and σ 2 . Substituting (5.6) into the bosonic part of (3.30), and integrating by parts, we get the bosonic part of the action in the form where the effective mass matrix (squared) is defined as with the eigenvalues given in terms of τ 2 (σ 1 ) and ρ 2 (σ 2 ) by The contribution of the fluctuations of Z to the partition function are now expressed in terms of the product of the eigenvalues of the operator −2∂∂ + M 2 . These take the form of sums of two 1d Schrödinger problems as follows. Define The boundary conditions (5.3) ensure that V, U 1 and U 2 are periodic. We now need to solve three separate 1d Schrödinger problems with the following periodic potentials defined on the circle parametrized by the periodic coordinate 0 ≤ x < 1: Then, µ i + ε j are the eigenvalues of the fluctuations of Z 1 , and µ i + ϑ j are the eigenvalues of the fluctuations of Z 2 (with 0 ≤ i, j < ∞). We will see below that the eigenvalues of U 1 and U 2 are the same, ε j = ϑ j , so that, formally, we can write The eigenvalues µ j , ε j = ϑ j are all positive. That the eigenvalues are nonnegative is a consequence of supersymmetry, and the fact that the σ 1 -Schrödinger problem and σ 2 -Schrödinger problem are decoupled. Thus, to show that µ j ≥ 0 we can look at the model with constant τ 2 and M = I. This model is translationally invariant in σ 1 , which we can identify as time. Because of supersymmetry, all energy states are nonnegative, and therefore all single-particle eigenvalues µ j must be nonnegative. Similarly, to argue that ε j and ϑ j are nonnegative we take ρ 2 to be constant and M = I and identify σ 2 as the time direction.
We can also argue more directly that the eigenvalues are positive, by noting that each of the potentials V, U 1 and U 2 can be written in terms of a superpotential W as 14) The Hamiltonian can then be expressed in terms of the superpotential as [47][48][49] It is now clear that the eigenvalues are nonnegative, and it is also clear that a zero eigenvalue would require a nontrivial kernel for either q or q † , but for ς and ς both nonzero, and for W given in (5.14), there are no periodic zero eigenvalues for q or q † . This 1d supersymmetry is also the reason why ε j = ϑ j . Setting , and since we have established that the kernels of both q and q † are trivial, it follows that the eigenvalues of qq † and q † q are equal, as is well-known. Thus, the double-Janus σ-model realizes a second quantized version of supersymmetric quantum mechanics.
We note that there is a special case where the three effective Schrödinger potentials are positive constants. For this we take which satisfies the boundary conditions (5.3) and leads to and the action (5.7) becomes that of two free, translationally invariant, massive bosons: with constant mass squared given in terms of the eigenvalues of the SL(2, Z) twist matrices M and M by Up to an unimportant constant, then

The fermionic one-loop determinant
To define the fermionic determinant we again need a metric on the space of fluctuations, similarly to (5.2). We choose it to be given in terms of Σ and Σ, for Ψ and Ψ, respectively. Then, using (4.29), and the vielbein, we can redefine for which the kinetic term in the bulk action is normalized. As in §5.1, we can then change variables to the diagonal model (3.30). It is convenient to use, instead of Ψ which has kinetic term i Ψ t ∂ Ψ, another set of variables 19) similarly to (5.6). These new fields are periodic in σ 1 and σ 2 and the fermionic part of (3.30) is given in terms of them by The fermionic determinant is now expressed, formally, as To calculate the determinant, we use the well known identity for the determinant of a (2N ) × (2N ) matrix given in 4 blocks of N × N matrices A, B, C, D, with C invertible, as By choosing a different representation of 2d Dirac matrices 8 we rewrite (5.21) as (5.23) The matrix in (5.21) can be written in terms of Pauli matrices as i and we got (5.23) by rotating σ1 → σ3 and σ3 → −σ1.
where m 2 2 was defined in (5.10). Following the arguments at the end of §5.1, and using (5.13), we find that For example, in the special case (5.15), we get constant and then with m 2 given by (5.17). Comparing (5.25) to (5.18), we find ∆ f = ∆ b , as expected.
We conclude that the partition function (5.1) reduces to This is essentially a quadratic Gauss sum, and we will now see how this double-Janus configuration naturally leads to the Quadratic Reciprocity.

Connections with abelian Chern-Simons theory and strings on a mapping torus
We now return to the matter of normalization of the partition function Z. In particular, we need to explain the prefactor 1/ |Ξ 0 | that appears in (4.37) and (5.26). This factor will be necessary to reproduce the Landsberg-Schaar identity in §7.4, and it can be argued by treating σ 2 and "time" and realizing the T-duality M in (4.18) as an operator on a Hilbert space of dimension |Ξ 0 |. We will argue that, up to a known phase, (5.26) can be recast as the trace of the operators representing M = ST k ∈ SL(2, Z) in a certain |Ξ 0 |-dimensional representation of SL(2, Z). We will give two equivalent constructions and physical interpretations for this representation, as a Hilbert space of ground states, one in terms of low-energy strings on a mapping-torus target space, and another in terms of an effective abelian Chern-Simons theory on T 2 . The first construction can be expressed in terms of the element in M explicitly, and it directly leads to (5.26), but the construction of matrix elements of S and T, representing S and T in SL(2, Z) respectively, will only be given up to independent (±) signs -an ambiguity that has a physical origin. The second construction relies on a particular decomposition of M as We note that this decomposition is unique if M belongs to the subgroup S, T 2 generated by S and T 2 [and isomorphic to the Hecke congruence subgroup Γ 0 (2) ⊂ SL(2, Z)], as we will assume in §8.1.
The SL(2, Z) representations that we will need belong to the subclass of representations that appear in the theory of modular tensor category 9 , i.e., the representations one obtains by studying Chern-Simons theory with a compact abelian gauge group. The physical interpretation presented in this section is partly based on results from [18]. More recently a much deeper theory related to nonabelian Chern-Simons was developed in [50,51], related to the study of the 6d (2, 0)-theory on plumbed 3-manifolds, including mapping tori, but our case is somewhat different. We will begin with a few generalities about such representations, which are defined through a quadratic form on a finite abelian group. (In general, the classification of unimodular, symmetric quadratic forms on finite abelian groups [52] is equivalent to a classification of pointed modular tensor categories, i.e., theories of "abelian anyons" in physical terminology [53,54]. For additional recent insight on abelian Chern-Simons theory and abelian anyons, see [55][56][57].)

Representations of SL(2, Z) from quadratic forms on abelian groups
In this subsection we will denote the standard SL(2, Z) generators by S and T , in order to distinguish the abstract discussion from the concrete S, T . The construction, known as the Weil representation 10 [51, 58, 60] begins with a finite abelian group A on which a quadratic form q(·) is defined. In our case the abelian group is A Ξ 0 and the complex vector space of the representation is the group algebra C[A], which we identify with the Hilbert space spanned by a basis of states of the form |v , with v ∈ A. The quadratic form q(·) is required to take values in Q/Z, i.e., q(v) is a rational number up to an undetermined integer part. Thus, the phase exp[2πiq(v)] is well-defined for every element v ∈ A. From q(·) we then construct a symmetric bilinear form 11 We assume that the abelian group A is given as a quotient of a lattice by a sublattice A = Λ/ Λ and q descends from a quadratic form q on Λ that takes integer values on Λ [so that for any basis {V i } of Λ , the associated bilinear form B is represented by a symmetric matrix with integer elements and even integers on the diagonal]. Then, the Weil representation constructed from this data is given by the action of the SL(2, Z) generators S and T on the basis vectors |v of Hilbert space as follows: where |A| is the number of elements in A and the phase φ is given by π 12 σ(q) [54,61], where σ(q) is the signature of the quadratic form (i.e., the difference between the number of positive and negative eigenvalues of the matrix representing the bilinear form B in any 9 Mathematically it is equivalent defined as a ribbon fusion category, or a braided fusion category with a spherical structure, whose modular S matrix is invertible. 10 Most generally it is defined for M p(2n), a double cover of Sp(2n), over an arbitrary local or finite field. 11 Conversely, given a bilinear form b(·, ·) (not necessarily symmetric), if a function q on A satisfies b(u, v) = q(u + v) − q(u) − q(v) + q(0), ∀ u, v ∈ A, then q is called a quadratic refinement of b(·, ·) [55][56][57].
basis {V i } of Λ ). The phase is also given by the cubic root of the Gauss-Milgram sum: [59][60][61]: In our case, there are two ways to describe q(·) on A. In the first, we decompose M ∈ SL(2, Z) into S and T generators as in (6.1), and we assume that all the powers are even, so that l i = 2v i for v i ∈ Z. We then construct the s × s symmetric matrix with {l i } along the diagonal, and (−1)'s on the (i, i + 1) and (1, s) places. For the special case s = 2 we take instead and for s = 1 we take K ≡ (l 1 − 2). We then define Λ = Z s and Λ ⊂ Λ to be the sublattice generated by the columns of K, i.e., One can show [18] that Λ/ Λ is isomorphic to Ξ 0 , and we therefore take A = Λ/ Λ , and define This quadratic form on A then defines, through (6.2), a |A|-dimensional Weil representation of SL(2, Z). We will elaborate on its physical interpretation (related to Chern-Simons theory with U (1) s gauge group) in §6.3. The expression (6.5) and the associated Weil representation (6.2) is not yet satisfactory for us, since it is not yet clear how it is related to (5.26). We would like to argue that, up to a phase, (6.5) can be written as Tr(ST k ) (corresponding to M = S T k ) in the Weil representation, but to see this we will need to recast the expressions for the matrix elements of S and T directly in terms of M . We will see that this can be achieved only up to ± signs on elements in S and T . Nevertheless, these signs drop out of the expression for Tr(ST k ). This leads us to the second way to describe q(·), which we now present.
Using it, we can define a quadratic form on Ξ 0 simply as Using q we can then define the action of S and T on the states |v in Ξ 0 as We claim that (at least for s ≤ 2) the doubled quadratic form 2 q(·) has a simple expression in terms of M : and therefore T 2 |v = e −2iφ e 2πiv t M v |v . (6.10) We will prove (6.9) in Appendix C.1 for s ≤ 2. It implies that the matrix elements of T and S can be expressed as follows (with undetermined ± signs that depend on u, v ∈ Ξ 0 , as well as other input data): (In Appendix C.2 we will show what the ± signs are in a particular example.) Fortunately, for even k = 2u, the trace Tr ST 2u is independent of the unknown ± signs in (6.11): Using (6.6), we easily check 12 that (6.12) reproduces (5.26), up to the phase e −2iuφ . In §8.2 we will also need to calculate Tr(ST 2u 1 ST 2u 2 ), and luckily again, this is independent of the ambiguous ± signs in (6.11): We will now offer a physical interpretation for (6.9).

Low-energy strings on a mapping torus
There is a simple geometrical interpretation of (6.10) in terms of the topology of (an auxiliary) mapping torus -a manifold formed by fibering T 2 over S 1 . Let θ ∈ R be a periodic coordinate on the S 1 base with periodicity 1, and let x ∈ R 2 be coordinates that will soon 12 Using N t N = 0 and M = (M t ) −1 .
parametrize a torus, after additional periodicity conditions are imposed. The mapping torus is defined as the set of points (θ, x) with identification, for a fixed M ∈ SL(2, Z), which acts as an MCG element on the fiber. In our case, a mapping torus is formed by fixing σ 2 and considering the configuration space of the fields X(σ 1 , σ 2 ) as σ 1 (which we identified as θ above) varies from 0 to 1. A ground state of the string corresponds to a point on the T 2 fiber that is invariant modulo Z 2 under the geometrical M -twist. Representing this point by This has a discrete set of rational solutions v ∈ Q 2 , and we formally define a Hilbert space H M of states with basis {|v } comprising of states |v such that Then a solution to (6.15) with the identification "v ∼ u whenever v − u ∈ Z 2 " defines an element of the coset space Λ/Z 2 , which map to a basis of the Hilbert space H M . This coset space is a finite abelian group, i.e., the cokernal of M − I, which can be identified with isometries of the mapping torus. (See [18] for more details.) It is easy to see that Λ/Z 2 is isomorphic to Ξ 0 [defined in (4.9)] and that the number of states is We need to know the action of SL(2, Z), generated by S and T , on those quantum states. It can be described as T-duality on the T 2 fiber and, as we argued in (6.9), (at least for where all the (±) signs in (6.17) and (6.18) are independent of u and v respectively, and where φ in (6.18) has been defined in §6.1 [e.g., (6.2)] and is a constant phase chosen so that (ST) 3 = S 2 equals the charge conjugation operator [which represents the −I ∈ SL(2, Z)], which acts as T k is ill-defined for odd k [unless M is such that v t M v is an even integer for all v ∈ Z 2 , which is when M ∈ Γ(2), as mentioned in Footnote 7], so to avoid extra complications we assume k ∈ 2Z. Note that the definitions (6.17) and (6.18) are independent of the representatives v and u, because for K ∈ Z 2 we have K t (M − I)u ∈ Z when (M − I)v ∈ Z 2 , and also u t (M − I)K = [(I − M )u] t M K ∈ Z. Note also that since is antisymmetric as The phase exp −kπiv t M v has a nice geometrical interpretation (analogous to the one discussed in §3.7 of [46] for M = S). The expression is the area of a triangle in R 2 with sides given by the vectors v and M −1 v. To see how this is related to T, consider a string worldsheet (i.e., an X field configuration) that interpolates between the states |0 (a string at v = 0 for say σ 2 = 0) and |v (for v = 0 and σ 2 > 0). We can realize it by constructing a section of the mapping torus with x = ζv and then letting ζ ∈ [0, 1] and θ ∈ (0, 1) be the coordinates of the worldsheet (i.e., identify θ with σ 1 , and ζ with σ 2 ). If we attach to this surface Σ the triangle with vertices 0, v, M −1 v , we obtain a surface whose boundary is the union of three loops: the loop corresponding to string state |0 , the loop corresponding to string state |v , and the loop from (0, v) to (0, M −1 v) ∼ (1, v) at constant θ = 0, which is a closed loop thanks to (6.14) and (6.15). If we now consider the scattering amplitude of an inelastic scattering process with two string states |0 going into two final string states |v and |−v : then it is calculated in string theory by a path integral over worldsheets Σ with four boundary components corresponding to the four string states |v , |−v and |0 's (wrapped twice with opposite orientation). Since the duality operation T k acts on the Kalb-Ramond field B as B → B + πkdx t ∧ dx, it multiplies the scattering amplitude by the phase The construction above shows that this phase is 4πk times the area of the triangle with vertices 0, v, M −1 v , which corresponds to a wavefunction normalization of each of the |±v states by exp kπiv t M −1 v , as required by (6.18). This explains the physical origin of the ± sign ambiguity in (6.11), since the process (6.19) requires two states for charge conservation. 13 We can now recover the partition function (5.26) by calculating Up to the phase φ, this equals (5.26) after the substitution N = (I − M )v. 13 As explained in [18], the "charges" correspond to the first homology group H1(Z) of the mapping torus, which is isomorphic to Ξ0, and |v has charge v.

Connection with U (1) s Chern-Simons theory
The quadratic Gauss sum (5.26) can also be expressed as a trace similar to (6.20), but with S and T defined as MCG representation generators acting on the Hilbert space of an abelian Chern-Simons theory placed on T 2 [18]. To see this, let us first consider Chern-Simons theory at level k cs ∈ Z with a U (1) gauge group, compactified on T 2 × R, where R is the Euclidean time direction and T 2 is a torus parametrized by periodic coordinates 0 ≤ x 1 , x 2 < 1. The action is where A is the U (1) gauge field. It is well-known [62] that the Hilbert space H U (1) of the ground states of the theory has a k cs -fold degeneracy 14 , which we will denote by |a (a = 0, . . . , k cs − 1). Let α and β be two fundamental 1-cycles of T 2 , where α corresponds to a loop at constant x 2 , with x 1 varying from 0 to 1, and β corresponds to a similar loop at constant x 1 with x 2 varying from 0 to 1. Consider the Wilson loop operators Their action on the ground states is given by the "clock" and "shift" matrices: W 1 |a = e 2πia/kcs |a , W 2 |a = |a + 1 . Up to the constant phase e −iπ/4 , this can be checked by making sure that the commutation relations S −1 W i S and T −1 W i T are as they should be (for i = 1, 2), given the geometrical interpretation of T and S as torus MCG generators. The phase e −iπ/4 is determined by requiring S T 3 = S 2 , which is the charge conjugation operator, so that we obtain a linear instead of a projective SL(2, Z) representation. It can be derived more systematically by explicitly writing the ground-state wavefunctions as a function of holonomies of the gauge fields [64,65], or by recalling the connection between the U (1) Chern-Simons theory and the 2d CFT of a free chiral boson [66]. Note that the equation for T is ill-defined for odd k cs (because it is inconsistent with |a = |a + k cs ). In that case only even powers of T are well-defined.
We now set k cs ≡ q. Up to an e πi/4 phase, the (complex conjugate of) quadratic Gauss sum appearing on the RHS of (2.3) can then be written as 14 Its ground-state degeneracy is (kcs) g on a genus-g Riemann surface instead [63].
We will see in §7.1 that, up to a phase, (6.24) is also the partition function Z that we calculated in (5.26), for M = ST q+2 . In §7.2 we will calculate the phase of the partition function in a T-dual formulation and observe that it receives a contribution from a Berry phase that depends on the details of how the complex structure varies with time. We also note that a much deeper analysis of the partition function of Chern-Simons theory on a mapping torus with SU (2) gauge group has been carried out by Jeffrey (see §4 of [67] and §4 of [68]), where the result 15 is similarly given by a trace of the action of M on the Hilbert space and yields a quadratic Gauss sum.
To move from the special case of (2.3) to the general case (5.26), we need U (1) r Chern-Simons theory on T 2 . We first recall some basic facts, and then we explain in §6.4 why it is related to (5.26). The Chern-Simons coupling constants are given by a symmetric matrix, which for r > 2 takes the tri-diagonal form with corners 16 and for r = 2 takes the form (It is conventionally called the K-matrix in condensed matter literature 17 , and is used to describe the r-component abelian fractional quantum Hall effect [72].) The Hilbert space of U (1) r Chern-Simons theory on T 2 with coupling constant matrix K has a basis of states So Λ is the sublattice of Z r that is generated by the columns of the matrix K. The coset Z r /Λ is a finite abelian group. The Hilbert space of U (1) r Chern-Simons theory on T 2 with coupling constant matrix K has a basis of states which can be identified with elements of Z r /Λ . Pick a nontrivial generator of π 1 (T 2 ), and consider the corresponding r Wilson loops acting on the Hilbert space. They form an abelian group which can be identified with Z r /Λ . Next, we define the action of SL(2, Z) on the Hilbert space, as a physical realization of (6.8). From the Chern-Simons perspective, this is the action of the MCG of T 2 . We 15 With a particular "canonical" choice of 2-framing of the mapping torus M3, i.e., the choice of a homotopy equivalence class of trivialization of of T M3 ⊕ T M3 [69], so that the theory is free of framing anomaly. 16 U (1) r Chern-Simons on more general 3-manifolds, such as plumbed 3-manifolds, has been considered in [70,71]. 17 The ground-state degeneracy of this Chern-Simons theory on a genus-g Riemann surface is | det K| g [72].
assume that K is even, i.e., all k i ∈ 2Z (i = 1, . . . , r). The generators act on states as: generalizing the previous S and T actions in U (1) Chern-Simons theory, given by (6.23). The phase φ equals πir/12 if all k i > 0, and in general it is πi/12 times the signature of K. Note that T is well-defined when K defines an even bilinear form. We will now show how the Chern-Simons picture is isomorphic to the mapping-torus picture.

Isomorphism between the Chern-Simons and mapping torus descriptions
We take the powers k 1 , . . . , k r to match the powers in one of the (non-unique) decompositions of M ∈ SL(2, Z) into S and T generators: Then, it can be shown, using elementary row and column operations, that there exist P, Q ∈ PSL(r, Z) (unimodular) so that is a unique block-diagonal matrix. In other words, M − I and K have the same Smith normal form 18 , i.e., according to (6.16) and (6.27), Λ/Z 2 is isomorphic to Z r /Λ . Now let us construct an explicit isomorphism between them. Define the (2r) × 2 matrix 18 Here we adopt the uncommon convention that on the diagonal, each lower-right element divides the element upper-left to it, opposite to that in [18].
implying that ϕ(v) ∈ Z r if (M − I)v ∈ Z 2 , so ϕ is surjective. Its injectivity is due to both P and M − I being invertible, and J t J = I. Therefore ϕ is an isomorphism between finite abelian groups ϕ : Λ/Z 2 ∼ = Z r /Λ with ϕ(v) ≡ṽ (see Appendix A in [18] by the authors of this paper for more details). We take (6.28) as the definition of the action of SL(2, Z) on the states. In the basis |v of §6.2 we define the SL(2, Z) action using the isomorphism ϕ. We conjecture that this definition is the same as formulae (6.17) and (6.18) for the T and S generators [with a suitable choice of ± signs in the matrix elements of (6.17) and (6.18)], and we prove it explicitly in the case r = 2 in Appendix C.1, with numerical evidence for the r = 3 cases in Appendix C.2.

Quadratic Reciprocity from double-Janus σ-models
The partition function of the double-Janus σ-model that we discussed in §5 reduces to a sum (5.26) over the finite abelian group Ξ 0 defined in (4.9). We will now show how, in a special case, Z reduces to the Gauss sum defined in §2, and we will follow with a discussion on the general case. We will give a Hilbert space interpretation of (5.26), with σ 2 identified as "time", and we will subsequently argue that the Landsberg-Schaar identity (2.7) can be understood by switching the role of "time" from σ 2 to σ 1 .

Quadratic Gauss sum as a special case of Z(M, M )
Taking the special case (2.8): we can identify Ξ 0 with Z q as follows. Setting x ∼ x + m + n, y ∼ y − m − n − qn.
We define z ≡ x + y, and use the freedom to choose m = −x − n to set x = 0. Then, z ∼ z − qn, and so z can be identified with an element of Z q . Setting k = 2 + 2p, we then calculate as the standard quadratic Gauss sum.

Berry phase
The Landsberg-Schaar identity (2.3) relates Gauss sum of (4p) th roots of unity to Gauss sum of q th roots of unity. The partition function Z, derived in (5.26), reproduces the latter sum, as we saw in §7.1, and this form is closely associated with a Hilbert space interpretation whereby time is identified with σ 2 . We will now show that the other side of the Landsberg-Schaar identity can be interpreted in terms of a different Hilbert space, with time identified with σ 1 . In such a Hilbert space interpretation the duality wall at σ 1 = 0 contributes a trace of M , which has to be multiplied by a Berry phase resulting from the variation of complex structure τ (which we can take to be adiabatic). 19 We will see that the phase of e πi/4 that appears in (2.3) can be reproduced by a combination of the representation of M on the low-energy Hilbert space and the Berry phase. In calculating the Berry phase, the form of the profile τ (σ 1 ) is important, and we will see that when τ (σ 1 ) takes values along a semi-circle in its upper half-plane, as in §3.5, the correct phase is reproduced.
In §3 we have chosen the radii of the σ 1 and σ 2 circles to be equal (and given by 1/2π). This was mostly to avoid a cumbersome notation, and indeed, we can easily allow the radii to be different. The partition function Z is independent of the radii, thanks to supersymmetry. We will now take the limit that the σ 2 direction is much smaller than the σ 1 circle. In this limit, we can study the Hilbert space of the problem at a fixed σ 1 , reduce to ground states, and then introduce the wall at σ 1 = 0 by inserting the operator representing M on the subspace of ground states. For 0 < σ 1 < 1, the most relevant terms in the action are given by the single-derivative terms (4.20), and we can set X 0 = X 1 , since the σ 2 circle is assumed to be small, and momentum modes along it are suppressed. Writing ξ(σ 1 ) instead of both X 0 and X 1 , we are therefore left with where the integral is over σ 1 and ξ is independent of σ 2 . We set q ≡ k − 2, and assume q > 0. ξ describes a coordinate on T 2 , and the Hilbert space of ground states can be identified with that of geometric quantization at level q (i.e., with a symplectic form q 4π Quantization on a torus at level q is one of the simplest examples of geometric quantization [74][75][76]. Our T 2 is parametrized by (ξ 1 , ξ 2 ) with 0 ≤ ξ 1 , ξ 2 < 2π. It is convenient to add the kinetic term to get the Lagrangian of a Landau problem (a particle in a uniform and constant magnetic field) on T 2 : where for G IJ we take the metric ds 2 = 1 τ 2 |τ dξ 2 − dξ 1 | 2 . The ground states of (7.3) are normalized Landau wavefunctions 20 (independent of m and the area of the T 2 ): where the Θ-function is defined as and is holomorphic in u and τ . In the low-energy limit, the kinetic term in (7.3) can be dropped, and as is well-known, we are left with the Lagrangian that describes a noncommutative T 2 with a symplectic form ω = q 2π dξ 1 ∧ dξ 2 . Defining the Berry connection in a standard way as We need to calculate the Berry phase along the path that τ takes, as σ 1 varies from 0 to 1. We parametrize the arc of the semicircle described at the end of §3.5 (see [4,18,19]) in terms of the variable ψ and parameters a and D, introduced in [4]: Defining ψ 0 and ψ 1 as the values of the phase ψ at the start and end of the arc, i.e., we calculate the phase difference as [18]: and the total Berry phase is easily calculated to be The sign of the square root is determined so that − π 2 < 1 2 (ψ 1 − ψ 0 ) < π 2 .

Modular transformations of the Landau wavefunctions
To introduce the M -duality wall, we need to examine the behavior of the wavefunction under an SL(2, Z) transformation that acts as The general SL(2, Z) transformation can be composed from the S and T generators, which act on wavefunctions as and for even q we have We note that for any q ∈ Z we have This is well-defined on the q-dimensional Hilbert space for q ∈ 2Z, since the RHS is a linear combination of the Ψ j,q 's, but for odd q ∈ Z only the square T 2 is a well-defined operator on the Hilbert space.

Recovering the Landsberg-Schaar relation
For M = ST q+2 and q = 2p we combine the two modular transformations (7.7)-(7.8) to get In this expression τ is a shorthand for τ (0) + q + 2 [since this is the value of τ after T q+2 acts on τ (0)], and Ψ l,2p on the RHS is a shorthand for Ψ l,2p ξ 2 + (q + 2)ξ 1 , −ξ 1 ; τ (0) . The RHS of (7.10) represents the wavefunction at σ 1 = 1 (not including the Berry phase yet) after the action by M . To complete the calculation of the partition function, we must multiply the RHS of (7.10) by e −I [with I given in (4.35)], take its inner product with Ψ j,2p , sum over j, and multiply by the Berry phase (7.6). Note that the role of I is to ensure periodicity in ξ 1 , ξ 2 , since the arguments in Ψ l,2p correspond to X at σ 1 = 1, while those in Ψ j,2p correspond to X at σ 1 = 0, and they can differ by N , as defined in (4.4). Moreover, since Ψ j,2p is periodic only up to a gauge transformation (in the language of the Landau problem of a particle in a uniform magnetic field), periodicity in ξ 1 , ξ 2 can only be restored by including e −I which plays the role of a gauge factor. The resulting partition function is Equating Z calculated in (5.26) with Z , we recover the (complex conjugate of the) basic Landsberg-Schaar relation (2.7).

Identities for generalizations of Gauss sums
In previous sections we saw how the Landsberg-Schaar identity ( In some cases we will be able to rewrite the sum (5.26) explicitly, which requires identifying the abelian group Ξ 0 as a direct sum of cyclic groups, and turns out to be of the form Z d 1 ⊕ Z d 2 . To achieve this we need to calculate the "Smith normal form" of the matrix I − M , i.e., to find matrices P, Q ∈ SL(2, Z) and unique integers d 1 , d 2 ∈ Z such that We will present a few examples below.

M generated by S and T 2 and M = S T 2+q
Let us assume that M can be expanded as the word We will also assume that M = S T 2+q , with q even. We recall that in SL(2, Z) there are no relations among S and T 2 , other than those that follow from inserting an even number of S 2 = −I in expressions, and therefore if M is of the form (8.1), the decomposition is unique. In fact the subgroup of SL(2, Z) freely generated by S and T 2 is isomorphic to the Hecke congruence subgroup Γ 0 (2). (See Example 3.7 of [79].) We now get an identity that equates the partition function Z given in the form (5.26) (with k = q − 2), to a partition function calculated by combining the modular transformations of the q ground-state wavefunctions and the Berry phase, as in §7.2- §7.3. The result 21 The first place where a Berry phase appears as a multiplicative factor in the partition function is in [77], where each "hedgehog" defect, a singular configuration, of a spin field in a (2 + 1)d antiferromagnet, described by an O(3) NLSM, carries a Berry phase. It is also directly related to the Wess-Zumino term [78] of the latter is The generalized identity for Gauss sums then takes the form (8.2) For example, we take s = 2 and For simplicity, we assume that v 1 , v 2 ≥ 1. Then The Smith normal form of I − M is given by [Note that the leftmost matrix on the RHS is in SL(2, Z).] An element of Ξ 0 ∼ = Z 2 /(I − M )(Z 2 ) can then be parametrized as And then we calculate so the LHS of (8.2) can be expressed as .
Setting a = v 1 , b = v 2 , and taking the complex conjugate, we find that (8.2) becomes for a, b ∈ Z, ab > 1, and q ∈ 2Z + . This is our first concrete generalization of the Landsberg-Schaar relation, whose proof we include in Appendix D. Identity (8.4) is actually a special case of a collection of generalizations of the basic Landsberg-Schaar identity derived by Krazer in 1912 [81] and other authors from then onwards, and the requirement for even q also appears there. In our case it is a requirement that appeared at the end of §4. We will discuss Krazer's and others' work in §8.3. We also note that double quadratic Gauss sums with denominators [q in (8.4)] that are powers of a prime have been evaluated in [82] in terms of the Legendre symbol.

More generalizations
We can obtain more identities by allowing M to take the more general form with u 1 , . . . , u s nonzero integers.
We recall that S and T 2 generate an index-3 congruence subgroup of SL(2, Z), called the theta subgroup 22 , and is isomorphic to the Hecke congruence subgroup Γ 0 (2) [79,80]. Inserting the M -twist in the σ 2 direction amounts to inserting r duality walls of the type (4.20), one for each S T 2u j factor (j = 1, . . . , r). The combined phase factor of modular transformations and the Berry phase, as in §7.2- §7.3, now comes out to exp( iπ 4 sr). If we repeat the analysis of §7.2 for the system with r duality walls, we get instead of (7.2), a reduced (0+1)d system that describes geometric quantization of T 2r with an action given by where K is an r × r integer coupling constant matrix given by an expression similar to (6.25)-(6.26), which for r takes the form and ξ i (i = 1, . . . , r) are coordinates on the i th T 2 factor. For r = 2, K takes the form 22 However, any subgroup S, T m with m > 2 does not have a finite index inside SL(2, Z).
The requirement that tq must be even arises as follows. The abelian group Ξ 0 defined in (4.9) turns out to be isomorphic to Z st−1 ⊕ Z 2 2 in this case, and the sum over the Z 2 2 factor produces a factor of 1 + (−1) tq 1 + (−1) sq on the LHS of (8.8a), while the RHS receives a factor of 1 + (−1) tq 1 + (−1) tp instead. We cancelled the common factor of 1 + (−1) tq by assuming tq ∈ 2Z. For t and q both odd, the relation in (8.8a) is not generally correct, for example for s = p = 2 and t = q = 1 the two sides differ by a (−) sign, and for s = 1, p = 3, t = q = 1, the LHS is 8 while the RHS is 0.

Relation to Krazer's, Jeffrey's, Deloup's, and Turaev's reciprocity formulae
Let us now briefly discuss the relationship among the identities we found in §8.1- §8.2 and a few known results in the mathematical literature spanning centuries. In the late 19 th century, a univariate formula which slightly generalizes the Landsberg-Schaar identity (2.3) was discovered independently by Cauchy, Dirichlet, and Kronecker [83]: where a, b are nonzero integers and ω ∈ Q such that ab + 2aω ∈ 2Z. Later, a version of (8.9) for multivariate Gauss sums was obtained around 1912 by A. Krazer [81,84,85]: where d is again a nonzero integer, A is a symmetric m × m matrix with integer entries, σ(A) ∈ Z is the signature of A (i.e., the difference between numbers of positive and negative eigenvalues), and either d or A is even (i.e., all diagonal entries of A are even). The r × r symmetric invertible matrix A with integer entries is determined from A by finding a unimodular matrix P such that P t AP = A ⊕ (0 m−r ), where 0 m−r is the zero matrix of size m − r. Equation (8.10) generalizes the case ω = 0 of (8.9) by replacing one of the numbers a and b in the exponents there by an integer-valued quadratic form given by A.
Note that the input to the identity is a single bilinear form A and an integer d, because A is determined by A.
In 1992, Jeffrey studied the semiclassical expansion of SU (2) Chern-Simons partition functions on Lens spaces and torus bundles [67], and discovered a generalization (which was slightly corrected by Deloup and Turaev [86]  µ∈Λ * /BΛ * e −iπ µ+ψ,rB −1 (µ+ψ) , (8.11) where Λ is a lattice of finite rank l with Λ * being its dual, ·, · is the inner product on the real vector space Λ R = Λ ⊗ Z R, ψ ∈ Λ R , r ∈ Z >0 , and B is a self-adjoint automorphism on Λ R (i.e., a bilinear form). The volume vol(Λ * ) is the absolute value of the determinant of a matrix obtained by expanding a basis of Λ * in terms of an orthonormal basis of Λ R . The symmetric bilinear form g : Λ × Λ → Z is defined by g(x, y) = x, B(y) for all x, y ∈ Λ, and σ(g) is the signature of a diagonal matrix presenting the bilinear extension Λ R × Λ R → R of g. Formula (8.11) extends Krazer's formula in that the lattice to be summed over is now arbitrary, and on both sides there are additional linear terms in ψ in the exponents, whose significance will be discussed in the next paragraph. Notice that there is still only one single bilinear form B.
In 1996, independently of Jeffrey, Deloup [87,88] geometrically generalized Krazer's formula (8.10) (as well as Jeffrey's) by essentially replacing both integers a and b in (8.9) with bilinear forms, and applied his result to calculate topological invariants of 3-manifolds, such as Witten-Reshetikhin-Turaev (WRT) invariants (i.e., Chern-Simons partition functions). For integral quadratic forms determined by two invertible, even, symmetric matrices A and B, Deloup's reciprocity theorem relates a Gauss sum with bilinear form A ⊗ B −1 to another Gauss sum with bilinear form −A −1 ⊗ B. 23 This identity appears as Theorem 3 in [87], and we do not present it here, since it would require quite a few new notations and definitions. In the context of our §8.2, A can be identified with the coupling constant matrix K (derived from M ) of abelian Chern-Simons theory, while B can be identified with a similar but independent matrix derived from M = ST 2v 1 · · · ST 2vs : We note that in a Gauss sum with a bilinear form governed by K −1 , the sum would be over the finite abelian group Z n /K(Z n ) [where K(Z n ) is the sublattice of Z n generated by the columns of K]. This abelian group is equivalent to Ξ 0 in (4.9), as shown in Appendix A of [18]. Deloup's reciprocity relation is actually more general, allowing non-even A and B by introducing arithmetic "Wu classes". For a quadratic form x t Ax (with x ∈ Z n ), a Wu class is realized by a constant vector w ∈ Z n such that x t Ax + w t x ∈ 2Z for all x ∈ Z n [87]. By adding such linear terms (also similarly in Jeffrey's), one overcomes the ambiguity in the definition of Gauss sums in (8.10) for a non-even A. In our context, this suggests a possible extension to twists M and M beyond the SL(2, Z) form given by (8.5), by inserting operators linear in the bosonic field X introduced in §3.1, which would correspond to "vertex operators", but we will not explore this possibility in the present paper.
In 1998, Turaev further generalized [83] Deloup's formula to capture an arbitrary "rational Wu class" (which means that the Gauss sums are sums of exponentials in quadratic forms on a lattice plus linear terms with rational coefficients that ensure that the exponents are well-defined up to 2πi). Overall, the place of our construction and generalization in §8.1- §8.2 is somewhere in between Krazer's/Jeffrey's formula and Deloup's theorem -for example, if we set the duality twists to be M = ST 2v 1 ST 2v 2 and M = S T 2u 1 S T 2u 2 , we get bivariate quadratic forms on both sides of the identity (8.8a); the result is a special case of Deloup's formula, but beyond Krazer's formula. In other words, our physical system is able to accommodate two independent bilinear forms, and the identities obtained in (8.4) and (8.8a) are slightly more general than Jeffrey's formula (8.11).
Recently, the corrected formula (8.11) has been extensively used in studying the categorification of WRT invariants [26,51,71,89]. It plays an essential role in the derivation ofẐ-invariants, or "homological blocks", of plumbed 3-manifolds M 3 . The topology of M 3 is encoded in its plumbing graph, hence the linking matrix of the link corresponding to the graph. The colored Jones polynomials of this link, or equivalently the WRT invariant of M 3 , is a Laurent polymonial J[q, q −1 ] in variable 24 q ≡ exp 2iπ k cs + h ∨ , which are raised to powers dictated by linking matrix elements. Formula (8.11) then basically converts J[q, q −1 ] into a linear combination of homological blocks, i.e., a summation over the lattice defined by the linking matrix, whose cokernel determines H 1 (M 3 ).
Finally, for a more comprehensive and technical historical account of the long sequence of Quadratic Reciprocity formulae up to the early 20 th century [i.e., just prior to Krazer's formula (8.10)], consult Chapter 1 of [91] or Chapter 4 of [90].

Discussion and outlook
We have constructed a supersymmetric double-Janus configuration for a 2d σ-model with T 2 target space, where all the moduli are allowed to vary along both coordinates, and we focused on a particular solution of the SUSY conditions whereby the complex structure varies along one direction and the Kähler structure varies along the other. We then placed the 2d double-Janus configuration on T 2 with periodic boundary condition that include SL(2, Z)-duality walls. We discovered a nontrivial interaction at the intersection of the duality walls, and we calculated the partition function and showed that it can be expressed as a quadratic Gauss sum. The fermionic and bosonic modes generally describe what might be called "a second quantized supersymmetric quantum mechanics", where the singleparticle energy levels are those of a 0+1d supersymmetric system with an arbitrary periodic superpotential. The fermionic and bosonic determinants cancel each other, leaving only a number-theoretic quadratic Gauss sum, which we could compute in two different ways, verifying the Landsberg-Schaar relation and obtaining generalizations. Our derivation of the 24 h ∨ is the dual Coxeter number of the gauge group of the pure Chern-Simons theory defined on M3. [92], where quantum mechanics with a toroidal phase space was also considered, although in their approach the physical time was quantized.

Landsberg-Schaar relation contains somewhat similar ingredients to a method introduced by Armitage and Rogers
Our work here is a prelude to the problem of an N = 4 Super-Yang-Mills theory with nonabelian U (n) gauge group compactified on a closed double-Janus configuration with an SL(2, Z)-duality twist. As suggested in [18], such a system can be studied by realizing it in terms of a stack of D3-branes and then mapping it to a system of weakly-coupled strings in Type-IIA on a mapping torus. That system can be compactified on another mapping torus, and the work in this paper provides the partition function of a sector of the weakly-coupled Type-IIA strings. It suggests interesting connections between number theory and partition functions with SL(2, Z)-duality walls.
We also modify the periodicity condition so that the new coordinates x 4 , x 5 are periodic with periodicity 2π. The 3-manifold in directions y, x 4 , x 5 still has an SO(2) holonomy, but dimensional reduction along x 4 , x 5 now produces a 4d gauge theory with a complex structure τ (y) that varies along a semicircle in the upper half-plane. The semicircle is the image of the imaginary axis under (A.1). The R-symmetry twist creates additional mass terms for the R-charged fields, as discovered in [4].
In the following we would like to take the further step of compactifying the y direction as well, say y ∼ y +1. This would be possible if we could find an SL(2, Z) MCG transformation acting on x 4 , x 5 that relates τ (y) to τ (y + 1). The SL(2, Z) element will then be identified with M , the S-duality twist in (1.1), and one of the eigenvalues of M has to be R 4 (1)/R 4 (0) [and the other eigenvalue will be R 4 (0)/R 4 (1)]. Note, however, that the area of the T 2 in directions x 4 , x 5 , which is (2π) 2 R 4 (y)R 5 , is not generally a periodic function of y, and so we can only compactify y after the limit R 4 , R 5 → 0 has been taken to reach the 4d SYM low-energy limit.
From the 4d SYM theory we can proceed to 2d by compactifying directions x 1 , x 2 on another T 2 and taking the low-energy limit. If the gauge group is U (1) then we obtain a σ-model with T 2 target space from the gauge fields, whose complex structure is τ (y). We can now proceed in a parallel fashion to (A.2) and replace the so far untouched 3d part of the metric with where α β γ δ ∈ SL(2, R).
In the low-energy limit, the U (1) gauge field will reduce to a 2d σ-model with T 2 target space whose complex structure varies with y and whose Kähler structure varies with t. We can then compactify t by imposing the periodicity t ∼ t + 1 together with an associated linear transformation on (x 1 , x 2 ) given by M ∈ SL(2, Z). This is possible in the limit R 1 , R 2 → 0 provided that R 1 (0)/R 1 (1) is one of the eigenvalues of M [the other eigenvalue being R 1 (1)/R 1 (0)]. We stress that the above construction is only a motivation for the σ-model that we studied in the main paper, which is a supersymmetric 2d σ-model with varying parameters.
We mentioned below (4.34) that I is necessary to incorporate the periodic identification (4.7) in a local way. Let us now explain in what sense (B.1) is a local action. For one, it is crucial that the coefficient in (4.34) is 2 − k . The key point is that X 0 and X 1 are only one set of representative functions on R 2 that represent a map to the coset T 2 R 2 /Z 2 . In order to analyze the locality of the expression, let us divide the range 0 ≤ σ 1 < 1 into n segments labeled by g = 0, . . . , n − 1 with endpoints 0 = σ 1,0 < σ 1,1 < · · · < σ 1,n−1 < σ 1,n = 1 .
In each segment [σ 1,g , σ 1,g+1 ], we define fields X 0,g (σ 1 ), with σ 1,g ≤ σ 1 ≤ σ 1,g+1 . Similarly, at σ 2 = 1 we have another sequence of vector functions {X 1,g } n g=1 . Thanks to the equivalence (4.7), there is an infinite number of ways to pick X 0,g and X 1,g in each segment, but different choices differ by a constant vector K. To incorporate that ambiguity in a local way, we allow the boundary conditions at the point were σ 1,g+1 , where one segment touches the next one, to include a shift by N g ∈ Z 2 [which plays the role of K in (4.7)]: In (B.2), we also allow a twist by an integer power ν g ∈ Z of M between the g th and (g+1) th segment. In order to comply with (4.3), we require that the net twist be M , so that: Our convention is that n ∼ 0 so that N n = N 0 . We require that the action be a sum of local expressions, and we start by replacing the first two terms in (B.1) with Next, we require local gauge invariance. The gauge transformations are labeled by n vectors K g ∈ Z 2 and act as Under this gauge transformation the action transforms as Since we assume that k ∈ 2Z, the last term is in 2πZ and we can drop it, since the path integral is over e −I . For the remaining terms, we can rearrange the sum to read where we used the identity (M ν g−1 ) t M ν g−1 = (det M ) ν g−1 = . Thus, (B.5) can be rewritten as So,Ĩ b is not gauge invariant on its own. To fix it, we can add toĨ b the term We can now check thatĨ b +Ĩ is invariant, using (B.4) to calculate and thus then we recover the action (4.36).
C On the equivalence between 2 q(·) and v t M v in (6.9) Then (half) the RHS of (6.9) is equal to .
The coupling constant matrix K is 1 × 1 and given by (2v 1 − 2) which results in the same expression. Thus, in this case q(v) equals 1 2 v t M v. For the case M = ST 2v 1 ST 2v 2 , (half) the RHS of (6.9) was calculated in (8.3) as [The relation v = (M − I) −1 N is needed to relate (8.3) to (C.1).] To calculate q(·) we note that Thus, we can define the isomorphism ϕ by and use (6.7) to calculate Comparing (C.2) to (C.1) we see that in general as stated.

C.2 Example for M with three ST # factors
Although we did not prove the equivalence of 2q(v) and v t M v (mod 1) for the case with three factors of ST # inside the decomposition of M , we here present a numerical example to support our conjecture that signs could be added by hand to the naive 25 T to satisfy (S T) 3 = S 2 . The naive T is defined as Let us consider which yields a cyclic group Ξ 0 ∼ = Z 6 with an ordered basis Here we do not calculate S according to the definition (6.17). The reason is as follows: without knowing the correct ± sign in front of each matrix element beforehand, if one were to choose all signs to be, say, +, then it is a numerical observation that almost always one would obtain a singular S where at least two rows are identical, and furthermore S 2 would not be the charge conjugation operator. Hence, we start by using the unsymmetrized 26 /naive definition: S|v ≡ 1 Then we calculate We can easily check that S 2 is the Sylvester's "shift" matrix in the canonical basis i.e., the charge conjugation sending |v to |−v , and S 4 = I. We found four solutions to ( ST) 3 = S 2 , and below is the list of phases 27 required to multiply the entire T to possibly become the refined T as in (6.18) satisfying ( ST) 3 = S 2 , along with positions on the diagonal of T where signs were flipped in each solution: • phase: e − iπ 12 , positions: 1, 2, 3, 5, 6; • phase: e iπ 12 , positions: 1, 3, 4, 5; • phase: e − iπ 4 , positions: 2, 6 ; • phase: e iπ 4 , position: 4. 26 The exponent is unsymmetrized (no symmetrization or antisymmetrization whatsoever), but S is still a symmetric matrix. 27 Up to multiplications by e 2πi 3 and e 4πi 3 , due to the three distinct ways of lifting a projective representation of SL(2, Z) to a linear representation (i.e., three distinct "linearizations"), see for example [80,94].
We see that the third sign configuration yields a phase matching φ = e −iπσ(K)/12 in T in (6.2), since the signature of the K-matrix (6.3) in this example Our final comment is that the naive T and unsymmetrized S matrices here also enable us to find the correct sign configuration on the refined T in (6.18), with a phase matching the signature of K-matrix for cases with two ST # factors in M , as expected from Appendix C.1. We also conjecture that the correct sign configuration on S in (6.11) and S in (6.17) is exactly given by S on the face value.

C.3 Concrete exercises for M with two ST # factors
The purpose of this subsection is to provide examples for Appendix C.1. Our first example is which generate Ξ 0 as Z 2 ⊕ Z 2 , the Klein 4-group 28 . Since everything is mod 1 here, we choose the ordered basis {(1/2, 1/2), (1/2, 0), (0, 1/2), (0, 0)}. Then its naive T matrix is If we were to following the customs to symmetrize the quadratic form on the exponent in (6.17) to be a quadratic refinement (a symmetric bilinear form) [53,55], then we would get a candidate "S-matrix" with symmetrized exponents e −πi(v t M u+u t M v) : However, as we have claimed in Appendix C.2, it is singular and its square is not a charge conjugation matrix. 28 Incidentally, we note that also give the same Z2 ⊕ Z2 with the same basis.
On the other hand, another candidate "S-matrix" with antisymmetrized exponents which now squared to be the identity, but one cannot achieve (S T) 3 = S 2 by flipping signs on elements in T, and the best one could possibly do is to flip the lower right entry in T so that which is fine because we are working with (mod 1) for MCG actions in (6.17) and (6.18). However, in the upcoming example we will not be so lucky with antisymmetrization, which would fail there. so its naive T matrix is The antisymmatrization proposal similar to (C.6) will yield a candidate  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1 1 , whose square and the fourth power are nothing close to a charge conjugation operator or the identity matrix. Following the unsymmetrized definition (C.4), we have the S matrix which squared to be the charge conjugation operator -the "shift" matrix in a non-canonical basis.
It is not hard to use Mathematica to find 8 solutions to ( ST) 3 = S 2 , out of 2 20 = 1, 048, 576 possible sign configurations of T's diagonal elements. Below for each solution, we list positions of entries in T whose signs are flipped, as well as the phase needs to be added by hand to convert the naive T matrix into the refined T so that ( ST) 3 = S 2 : • phase: e and e − 2iπ 3 , so we see that the second, the fifth, the sixth and the last solutions yield the correct results.
Finally, we propose the following conjecture: Conjecture For any M ∈ SL(2, Z) built from a finite number of ST # factors with any integer power #, we perform the following steps: • Compute the unsymmetrized S and the naive T à la (6.11), or à la (6.17) and (6.18); • Flip signs on T's diagonal to get T satisfying ( ST) 3 = S 2 ; • Multiply T with a necessary phase φ to satisfy ( ST) 3 = S 2 .
We claim that the resulting S and T always exist, and they give the correct sign configurations for S and T in (6.11); as well as S in (6.17) and T in (6.18). Moreover, φ equals e −iπσ(K)/12 as mentioned below (6.2) and (6.28), where K is defined by (6.3) together with (6.4).
In the following subsections, we will prove this by discussing two separate situations, in which q = 4r and q = 4r + 2, respectively, where r is an odd integer.

D.1 Analysis for q = 4r
To prove this identity (D.1) we start with the Poisson resummation in two variables: where in the exponent of the second factor on the RHS, we have ignored terms 2am 0 m 1 q, bm 2 0 , 2bn 0 n 1 q, bn 2 0 , −2m 1 n 0 q, −2m 0 n 1 q, and −2m 0 n 0 , which are proportional to either q or 1, because both m 0 and n 0 are only comparable to q at most. Then we find m n = j + m 1 (ab − 1) − n 1 a n 1 .
We need to show that with m fixed, for every n, there is always a single n = n + t such that am 2 + bn 2 − 2mn and am 2 + b(n + t) 2 − 2m(n + t) differ by an odd multiple of s, hence the pairing e πi s (am 2 +bn 2 −2mn) + e πi s (am 2 +bn 2 −2mn ) is 0. We calculate this difference am 2 + b(n + t) 2 − 2m(n + t) − am 2 + bn 2 − 2mn = bt 2 + 2bnt − 2mt, and set it to be −δs. Then we only need to show that δ can be odd for every n. We start from the quadratic equation in t: bt 2 + 2(bn − m)t + δs = 0, (D.14) with solutions t ± = −n + m ± (bn − m) 2 − bδs b . We set the discriminant ∆ to be x 2 , x ∈ Z, then it follows that (bn − m − x)(bn − m + x) = bδs.
In order to establish the pairing between n and n for all n and n , we have to require −n + y, a solution to (D.14), be exactly s = q/2 [so that the pairings are all "diagonal" in the irregular q-sided polygon on the complex plane, whose vertices are e − 2πi q (2mn−am 2 −bn 2 ) ]. So we have bn − by ± 2x = −bs ± 2x = −δ.
Since both b and s are odd, δ has to be odd, as expected. Hence, for q = 4r + 2 and odd b, both sides of (D.1) are zero.

D.2.2 The case of even b and odd a
In this case, we do not construct pairings as before, but resort to an analytic method. The first term in (D.9) expands as sπi ab 2 k 2 − 2abnk + an 2 − bk 2 + 2bjk + 2(k − j)n .
So the sum concerning n and k following (D.9) becomes lim →0 n,k∈Z e − π 2 q 2 [a(bk−n) 2 −bk 2 +2kn] e −asn 2 πi , (D. 16) where the second factor is just (−1) n . We evaluate the first factor again by converting it into a single integral via a change of variables u ≡ k √ and v ≡ n √ : , which is zero because this is an alternating Riemann sum, and the decay in the exponent is ∼ → 0, while the denominator of here goes as ∼ 1/ √ . Notice that the result here agrees with the symmetry between a and b which is manifest on the LHS of (D.1), as well as the fact that both sides vanishes for an odd b as shown in §D.2.1.

D.3 If both a and b are even
Then again the first term in (D.9) is an integer multiple of 2πi, and the remaining argument conincide with that in the previous subsection §D. 2.2.