Modular invariance and entanglement entropy

We study the Renyi and entanglement entropies for free 2d CFT's at finite temperature and finite size, with emphasis on their properties under modular transformations of the torus. We address the issue of summing over fermion spin structures in the replica trick, and show that the relation between entanglement and thermal entropy determines two different ways to perform this sum in the limits of small and large interval. Both answers are modular covariant, rather than invariant. Our results are compared with those for a free boson at unit radius in the two limits and complete agreement is found, supporting the view that entanglement respects Bose-Fermi duality. We extend our computations to multiple free Dirac fermions having correlated spin structures, dual to free bosons on the Spin(2d) weight lattice.


Introduction
Entanglement entropy [1,2,3] has become a powerful diagnostic tool for a variety of phenomena in quantum theory (see for example Refs. [4,5,6]. Very important progress in our understanding of entanglement arose from the proposal [7] of holographic entanglement entropy, which has beautifully linked the study of entanglement to gravity and thermodynamics (for example, the recent work of Ref. [8]).
To define entanglement we break up the degrees of freedom into two disjoint sets A and B. The density matrix of the full system is taken to be ρ. Define the reduced density matrix in the region A as ρ A = tr B ρ, obtained by tracing out the degrees of freedom in region B. Then the entanglement entropy is defined as: A more general quantity called the Rényi entropy is often studied. This is defined as: where n is a positive integer. Besides being a diagnostic on its own, the Rényi entropy can sometimes be used as a trick to compute the entanglement entropy. This happens when S n can be unambiguously continued to arbitrary real values of n. Then it is easily verified that the limit lim n→1 S n = S E . The advantage of focusing on Rényi entropy is that it can often be computed using the replica trick [9,10,11,12]. For this, one constructs "twist fields" and computes their correlation functions using relatively standard procedures in CFT. The twist correlators determine a quantity called the "replica partition function" Z n , in terms of which the Rényi entropy is: Entanglement and Rényi entropies have been computed for a wide variety of quantum field theories but they tend to have the problem that either (i) they are very universal, depending on limited information about the QFT (in which case they are not a very useful diagostic), or (ii) they are extremely hard to compute. In class (i) one has conformal field theories at finite temperature or in a finite space, with a single entangling interval, for which the entanglement entropy depends only on the central charge. However when the temperature and spatial size are both finite, there is a finite space with multiple entangling intervals, the same theories do not exhibit such a level of universality and therefore this situation is more interesting. The case of multiple intervals at zero temperature was investigated in Refs. [13,14,15,16]. At finite temperature and finite size (i.e., on a Euclidean torus), only a few explicit computations exist and these apply to free field theories of bosons or fermions. The results for the Rényi entropy are found to depend sensitively on the spectrum of operator dimensions and not just the central charge. To date, explicit computations have been carried out only for the free Dirac fermion [17,18] and a pair of free scalar fields [19,20,21]. There are also some general results about the universal thermal correction in generic 2d CFT's [22,23].
Once we are on the torus (defined by the inverse temperature β and the system size L), the issue of modular invariance naturally arises. Early computations including those in [17,18], obtained the Rényi entropy for free Dirac fermions in a fixed spin structure (which could be any of (−, −), (+, −), (−, +) but not (+, +)). The computation made use of local Bose-Fermi equivalence to construct the twist field and compute its correlators, then manually restricted the bosonic sum to obtain a fixed fermion spin structure. The results are not modular-invariant and therefore do not respect Bose-Fermi duality. This brings into question whether Rényi and entanglement entropies are properties of a QFT independent of its presentation, or depend on the specific fields used to define the QFT.
This point is discussed in Ref. [16] 1 which makes a strong case that entanglement should depend only on the theory rather than on its presentation. The consistent definition of a CFT incorporates modular invariance as a fundamental property and this provides a 1 We thank Shiraz Minwalla for bringing this work to our attention.
Motivated by this viewpoint we revisit the previous computation of Rényi entropy for free fermions, performed using the replica trick, and examine whether a modular-invariant replica partition function Z n exists satisfying all the desired properties. In order to achieve modular invariance one needs to perform a sum over spin structures (i.e. over anti-periodic and periodic boundary conditions in both the spatial and thermal directions) [24].
The replica trick involves extending the original theory to an n-fold copy and performing a twist-field computation on this copy. The presence of fermion spin structures introduces, quite literally, a new twist on the problem -one has to decide whether the spin structures are correlated or uncorrelated across replicas. To get some physical input into which one is correct, we appeal to the universal relation between entanglement and thermal entropy first noted in Ref. [17]. We find a perhaps surprising result: for free fermions, this relation holds only if we choose two different ways of summing in two different limits: for a small entangling region one must consider uncorrelated spin structures, while for a large one (close to the size of the entire space) one has to completely correlate spin structures across replicas. The correct formula for a general size of the entangling region must interpolate between these two extremes, and we speculate at the end about how this could come about.
It is known that for large intervals, the replica trick requires a correlation between states on different replicas, as was originally evident from the work of [22]. In a beautiful series of works, this relation has been developed further and a formal proof been provided for the entanglement-thermal entropy relation [26,20]). Our computation can be seen as a verification of these ideas in the specific context of fermion spin structures. In Ref. [21] the proof has been explicitly verified for the free-boson partition function. We confirm that our result agrees with that of the above reference in the special case of radius R = 1 (in units where α ′ = 2), where the free boson is known to be equivalent to a free Dirac fermion.
This provides strong evidence, for the first time, that Bose-Fermi duality is respected by entanglement entropy on the torus.
Both the ways of summing over spin structures that we use lead to a replica partition function that is modular covariant rather than invariant. Under modular transformations of the torus, it transforms into itself with a prefactor. As a result the Rényi and entanglement entropies acquire an additive contribution upon modular transformations. We will show that the replica partition function can be rendered completely invariant by absorbing a certain power of τ 2 that depends only on the central charge and number of replicas (here τ is the modular parameter of the torus) into its definition. In this way the Rényi entropy and entanglement entropy on a torus become modular invariant. We verify that the Rényi entropy for a compact free boson at radius R, originally attempted in [19] and recently corrected in Ref. [21], is also modular covariant and can be rendered invariant in the same way.
Next we turn our attention to more general free 2d CFT's. The CFT of two Dirac fermions with correlated spin structures is equivalent to a pair of bosons compactified at radius R = √ 2 (this is the self-dual value under T-duality). We compute the Rényi entropies for this theory for small and large intervals and find (after multiplying by the appropriate prefactor) modular-invariant answers that satisfy the thermal entropy relation.
This is then repeated for theories of multiple correlated Dirac fermions. These are CFT's of arbitrarily large central charge d that are not direct sums of simpler CFT's. The bosonic duals are given by multiple free bosons compactified on the weight lattice of Spin(2d) with a specific background B-field [27]. We use the weight-lattice structure to construct a twist field, and compute its two-point function. Incorporating the sum over spin structures in the two relevant limits provides the replica partition function in these limits and confirms the arguments made above. We conclude with some observations and speculations about future directions.

Free Dirac fermion and modular invariance
Consider a CFT whose partition function on a rectangular torus of spatial size L and Euclidean time extent β is Z 1 (L, β). As mentioned above, the Rényi entropy S n associated to a spatial region A running from 0 to ℓ is defined as: where ρ A is the density matrix obtained by tracing out the degrees of freedom outside A. This can be evaluated using the replica trick, which we briefly summarise here. One extends the original torus to an n-fold cover with branch cuts along spatial intervals from 0 to ℓ. This can equivalently be thought of as a single copy of the original torus with the insertion of "twist fields" labelled σ k at the endpoints of the entangling interval. Here k ranges from − n−1 2 to n−1 2 in integral steps. The job of the twist fields is to introduce a phase factor e 2πik n on the free fermion field, which we denote D(z), as it goes around the twist field: and the opposite phase on the anti-holomorphic conjugate fermion: The twist fields can be shown to satisfy k ∆ k = c 24 n − 1 n in any CFT, where c is the central charge.
One can then show that [9,12] tr ρ n A = n−1 2 It is convenient to think of the product of un-normalised correlators as defining the "replica partition function" where Z 1 is the ordinary partition function of the theory (without insertions), and we use · · · to denote un-normalised correlators. It follows that: from which the Rényi entropies are easily obtained.
Consider a Dirac fermion with a single entangling interval of length ℓ. This theory consists of two Majorana fermions with correlated spin structures. Labelling the holomorphic parts of the Majorana fermions as ψ 1 , ψ 2 we make the Dirac fermion D(z) = ψ 1 (z)+iψ 2 (z).
The local operators of dimension ( 1 2 , 1 2 ) arising from this are: D(z)D(z), D † (z)D(z), D(z)D † (z), D † (z)D † (z). This theory has the modular-invariant partition function: For future use we define: where the subscript 1 refers to the ordinary partition function (this will later be replaced by n for the nth replica partition function). This is the ordinary partition function for m Dirac fermions with correlated spin structures. In this notation the single Dirac fermion has ordinary partition function Z 1 [1].
For the replica partition function of the same theory, the following result 2 was obtained in Ref. [17]: In their conventions, L = 1 and ℓ is denoted by L.
Here ∆ k = k 2 2n 2 , ν = 2, 3, 4 is a fixed spin-structure on the torus corresponding to boundary conditions (+, −), (−, −), (−, +) respectively 3 , and τ = i β L . For the (+, +) spin-structure the result would formally be the same but with ν = 1. Subsequently the above results were re-derived in Ref. [18], where it was observed that the 2-point function in the (+, +) spin structure is divergent due to the vanishing of θ 1 (0|τ ). Importantly, the entanglement entropy following from the computations in Refs. [17,18] satisfies the relation proposed in Ref. [17], based on holography, relating its small and large-interval limits to the thermal entropy of the same system.
Despite meeting all the other physical requirements, the above result raises a puzzle.
As emphasised in Ref. [16], entanglement entropy should be a feature of a definite quantum field theory and independent of the presentation of that theory. If so, in a theory where Bose-Fermi correspondence holds, one should obtain the same result in both bosonic and fermionic formulations. A free fermion with a single spin structure is not dual to the theory of free bosons, rather it is the modular-invariant free fermion partition function (and correlation functions) that can be compared with those of the boson theory. In this spirit, we propose that Rényi entropy be computed by performing a sum over all four spin structures in the replica partition function Z n , and dividing by a corresponding quantity in the absence of replicas. In principle there is more than one way to do this, and this point will be central to our discussion.
Let us review the calculation of [17] for the Dirac fermon theory. To compute the correlators of fermionic twist fields on the torus in this theory, these operators are first identified with (non-local) operators in a free boson theory using the fact that a Dirac fermion is equivalent to a free compact boson of radius R = 1 (in our conventions α ′ = 2, so T-duality acts by R → 2 R and R = √ 2 is the self-dual radius). At a general radius R, the free compact boson has vertex operators labelled by integers (e, m): (2.12) 3 The first entry labels the spatial boundary condition and the second, the boundary condition in Euclidean time.
The OPE's between the chiral parts of the vertex operators are given by: For the special value R = 1, the compact boson is equivalent to a Dirac fermion. The fermion field has (∆,∆) = ( 1 2 , 1 2 ) and is given, in bosonic language, by O 1,0 . In Ref. [17] the fermionic twist fields are identified as: Since the winding number m for these operators is not an integer, they are not included in the set of local operators of the theory. This is expected, since twist operators are mutually non-local with the physical fields of the theory. One has the OPE's: as desired. Now we only need to compute: For this we use the general result (see for example Ref. [28]): With (e, m) = (0, 2k n ) and R = 1, this reduces to: An important point to emphasise here is that in this approach one has to use free bosons to represent fermionic twist fields. These do not introduce a phase on the boson, instead they shift the free boson φ appearing in ψ = e iφ by sending φ → φ+ 2πk n which is the k/n'th multiple of its natural period 2π (because R = 1). Correspondingly one hasφ →φ − 2πk n (here φ,φ are the holomorphic and anti-holomorphic parts of the scalar field respectively).
The bosonic representation is used only as a tool to obtain the correlators of the fermion twist fields.
At this point, we need to decide how to take the product over replicas. The most straightforward way would be to just take the product of the above result over all k. In this way the spin structures are summed over before we carry out replication. Hence the spin structure on one replica of the torus is uncorrelated with that on any other, leading to what we call the "uncorrelated replica partition function" Z u n : There is another way that one can take the product. First isolate the contribution to Eq. (2.18) corresponding to a given spin structure ν ∈ 1, 2, 3, 4. This simply corresponds to picking out the function θ ν . Next, take the product of this term over all replicas and finally sum over spin structures. In this way the spin structure on each replica of the torus is the same. We call this the "correlated replica partition function" Z c n : Notice that the two types of replica partition functions coincide at n = 1: which is the ordinary modular-invariant partition function of a Dirac fermion (the contribution from ν = 1 actually vanishes in this case). We also observe that as ℓ → 0 (and generic n), the two types of partition function are quite different: The second factors in the two cases are the ordinary partition functions of n Dirac fermions with, respectively, uncorrelated and correlated spin structures [27].
Corresponding to two possible replica partitions, we can define two Rényi entropies: The denominators are the same because, as we pointed out earlier, the two types of partition functions coincide at n = 1.
Clearly we would like to know which one of these (if any) is the correct Rényi entropy of the modular-invariant free Dirac fermion theory. Before addressing this question, which turns out to be quite subtle, let us establish a few properties of the two quantities Z u n and Z c n . First of all, they can be compared to the non-modular-invariant result of Ref. [17] for the replica partition function: and the corresponding Rényi entropy: This makes sense only for the spin structures 2, 3, 4, since Z and Eq. (2.20). This transformation exchanges the two cycles of the torus. We also have a branch cut along the horizontal axis, which under this transformation becomes a branch cut along the vertical axis. Thus the transformation acts as β ↔ L and ℓ → iℓ, where we have used the identification τ = iτ 2 = i β L and z = ℓ L . This permits us to use: with the usual dictionary: From the first term, which is common to both expressions, we get a corresponding factor: which cancels the previous one, as well as a factor: Thus at the end, one has: We see that even after summing over spin structures, the replica partition functions are not exactly modular invariant -there is a multiplicative pre-factor. This factor vanishes at n = 1, so Z 1 is indeed modular invariant as it must be. Interestingly the power of this factor is equal to c 6 n − 1 n , an expression that appears frequently in the context of Rényi entropy. As we will see below in more generality, for every CFT of central charge c for which Z n is known, the same result holds with: Using any such replica partition function, one would find a Rényi entropy S n that transforms as: Hence even the entanglement entropy would shift by an additive term.
We can modify the prescription for computing the replica partition functions (in both uncorrelated and correlated cases) by multiplying them by an overall factor that renders them modular invariant. This is done as follows (importantly the factor is independent of We have put in a dependence on c, the central charge, which is equal to 1 in the present example. Our conjecture is that the replica partition function for every CFT, after multiplication by the above factor, is modular invariant.
Returning now to the Dirac fermion, the two Rényi entropies, defined as: It follows that the entanglement entropies obtained by taking n → 1 in the above will also be modular invariant.
In the following subsection we address the question of which one of S u n , S c n is the correct Rényi entropy of the theory. From now on, we will not be very careful to insert the prefactor above or to distinguish between modular covariant and modular invariant expressions at each stage, since this insertion is ℓ-independent and can always be carried out at the end.

Relation to thermodynamic entropy
In Ref. [17], the result Eq. (2.24) was used to provide evidence for the conjecture, based on holography, that the entanglement entropy satisfies: where S is the thermodynamic entropy of the theory: We will use this as a guide to determine which of our modular-invariant definitions of the replica partition function, Z u n or Z c n , is correct. As emphasised in Refs. [22,26], we can simply use the low-temperature expansion for this purpose. Note that the overall factor that we removed from the replica partition function to render it modular-invariant is independent of the interval size ℓ and therefore drops out of Eq. (3.1).
Consider now the small-ℓ behaviour of the candidate Rényi entropies. From Eq. (2. 22) we see that in this limit, Z u n → (Z 1 ) n but Z c n → (Z 1 ) n (upto an overall power of ℓ). It is a physical requirement that for small intervals (equivalent to a very large spatial size L) the replica partition function should indeed tend to (Z 1 ) n times the given power of ℓ. On this criterion, the correct Rényi entropy for small ℓ should be S u n and not S c n . Next consider the large interval limit, ℓ → L. In this case, it has been predicted on general grounds [22,26] that the replica partition function should tend to Z 1 (nτ ), i.e. the ordinary partition function on a torus with n times the original modular parameter, apart from the same power of ℓ as in the ℓ → 0 case. Moreover it has been shown that this behaviour (together with the correct ℓ → 0 behaviour) ensures that Eq. (3.1) holds. Let us subject our Z u n and Z c n to this test. We start with the latter. From Eq. (2.20) one sees that: We may now apply an identity involving θ-functions after fractional shifts [29]: This is easily derived using the product representation of θ-functions. It is important that the above relation is true for the three spin structures ν = 2, 3, 4 with no relative factors.
The fourth spin structure ν = 1 does not matter because we have to put z = 0 in the above equation, and θ 1 (0|τ ) = 0. Using the above relation, we find: Thus we see that for a large interval, Z c n becomes equal to Z 1 (nτ ) upto the standard power of ℓ, as desired. However, if we repeat the analysis for Z u n then this is not the case. With this function we would find cross-terms between θ-functions of different spin structures, for which an identity like Eq. (3.4) does not hold. We thus have clear evidence that as ℓ → L, the correct replica partition function should be Z c n and not Z u n . Hence we are led to propose that the correct modular-invariant partition function for the free Dirac fermion theory is Z u n at small ℓ and Z c n at large ℓ. Let us now verify that this proposal precisely satisfies Eq. (3.1). We have: Thus our proposal satisfies the relation to thermodynamic entropy. Notably, the final steps work out just as in the general proof of Ref. [26] (see their Eq.(11)) but here we have used explicit θ-function identities to obtain them. The fact that spin structures are uncorrelated/correlated for small/large intervals is a nice mathematical verification, in a special class of models, of the general principles put forward in Refs. [22,26]. The key conclusion for us is that neither S u n nor S c n can be the correct Rényi entropy for all values of ℓ. This naturally raises the question of what is the general answer that interpolates between these two limits, a point to which we will return at the end.

Compact bosons
The replica trick can be applied for free bosons as well. Recall that the partition function for a single free boson at radius R is: where in the second line we have specialised to real q = e −πτ 2 .
For the replica partition function, one considers twist fields T k with k = 0, 1, · · · , n − 1 satisfying: and one has: An important part of the computation of this quantity was carried out in Ref. [19] for a pair of free bosons compactified on a square torus of size R. The result is the product of a quantum and a classical part. It is rather implicit, involving integrals of products of fractional powers of θ-functions which appear in the construction of cut differentials on the torus. Unfortunately the classical part of their answer, which carries all the R-dependence, is not invariant under R → α ′ R so it does not satisfy T-duality. In Ref. [21] this classical part has been corrected and takes a different form that possesses manifest T-duality.
Accordingly we will analyse the replica partition function obtained in the latter reference and compare it with our proposal regarding modular invariance. We adapt it to our notation, which includes setting α ′ = 2, and to the case of a single free boson. The latter just involves taking the square root of their answer, which is particularly simple since it is presented as a perfect square. We write the answer as a product of four factors: Only the last two factors, which form the classical part of the answer, depend on the compactification radius R. T-duality invariance is already manifest at this stage. Here, Here W 1 1 and W 2 2 are integrals of the cut differentials over the different periods of the torus: The answer Eq. (4.4) is normalised such that Z 1 is indeed the usual partition function of the theory. To check this, observe that for n = 1, k = 0 one has W 1 1 = 1, W 2 2 = −iτ 2 . Hence: Agreement with Eq. (4.1) is immediate.
We would now like to investigate the modular transformation of Eq. (4.4). To this end, we note the following results: The first and third of these are well-known, while the second was shown in Eq.(B.41) of Ref. [19] (unlike the very subtle issue of the q-expansion of W 2 2 , this result is straightforward to derive). From the above, it follows that under a modular transformation, Following this with a multi-variable Poisson resummation as in Ref. [21], we find that: Thus the product transforms as: Putting everything together, we find that: Thus, it will become modular invariant upon multiplying by the factor given in our proposal in Eq. (2.33).

The general expression for Rényi entropy Eq. (4.4) is rather complicated and it has
proved difficult to extract explicit results from it. However, in Ref. [21] the limits as ℓ → 0 and ℓ → L have been extracted and the results correspond (upto the usual powers of ℓ) to (Z 1 (τ )) n and Z 1 (nτ ) respectively, where by Z 1 we mean the expression in Eq. (4.1). This of course depends on R, and for R = 1 it coincides with the free Dirac fermion partition function. It follows from this and our previous analysis that our fermion replica partition function, in the regimes where we know it (small and large ℓ) coincides precisely with that of the boson theory at R = 1. It is amusing that the boson theory "knows" about the switchover from uncorrelated to correlated replicas within the single, though complicated, function in Eq. (4.4). We expect there to be a similar fermion partition function that interpolates between the small and large-ℓ regimes. It should somehow involve an admixture of correlated/uncorrelated replicas, as we discuss in the last section.

Other free-fermion CFT's
It is interesting to try and extend the previous calculation to free-field CFT's that are not direct sums of the Dirac CFT. Recall that in the above calculation we had to use both the fermionic formulation of the Dirac CFT (to identify the right free field to replicate) and also the bosonic formulation (to identify the twist field and compute its correlation function).
For multiple Dirac fermions with correlated spin structures, the partition function is not simply a power of the single-Dirac partition function 4 . Correspondingly, the bosonic dual is not made up of copies of the R = 1 free boson. Indeed in bosonic language it is not the product of any number of independent bosons but rather a set of bosons compactified on the weight lattice of the algebra Spin(2d) with a specific background B-field turned on [27].
We start with the relatively simple case of Spin(4)∼ SU(2)× SU(2) and then go on to a general Spin(2d) lattice. Calculation of the Rényi entropy will again require use of both the fermion and boson descriptions of the theory. In each case, the twist field must be constructed using lattice vertex operators and their correlation functions computed in the theory of lattice bosons. We will again find answers for the replica partition function at small and large ℓ and verify their modular properties.

Two correlated Dirac fermions
The theory of two Dirac fermions with correlated spin structures has the ordinary partition function [27]: We would like to find its replica partition function. Let us examine the fundamental fields and physical operators in this theory. We have two Dirac fermions that, following the notation of Ref. [28], we call D 1 (z) and D 2 (z). By definition they possess hermitian conjugates D † i (z), i = 1, 2, that are also holomorphic. Combining with their anti-holomorphic counterparts, we have 16 physical operators of dimension ( 1 2 , 1 2 ), namely: where i.j run independently over 1, 2 (had the spin structures of D 1 , D 2 been uncorrelated we would only have had the subset with i = j). This c = 2 theory can be bosonised into two compact bosons φ 1 , φ 2 that are orthogonal to each other and compactified at the self-dual radius, which in our conventions is R = √ 2. Thus their periodicity is: If we denote the two left-moving bosons as φ i (z) and the right-moving ones asφ i (z), then the allowed vertex operators in this theory are: where the indices j, k are independently summed over 1, 2. In terms of these bosons, the free Dirac fields are represented as: In order to compute the replica partition function we need to find the twist fields which satisfy Eq. (2.2). On inspecting Eq. (5.5), we see that the monodromy induced by the twist field is: Thus it must leave the boson φ 2 inert, while it shifts φ 1 by a fraction k n of its period: We see that the twist field is: In other words, it corresponds to O Remarkably this is the same operator that plays the role of the twist field in the c = 1 theory of a single Dirac fermion -however, in the present case it is evaluated at R = √ 2 rather than R = 1. Due to the change of radius, it has conformal dimension ∆ 0, 2k n = k 2 n 2 , which is twice that in the single-Dirac case. This ensures that k ∆ k = c 24 n − 1 n with c = 2, as required. To calculate its correlator we may use Eq. (2.17) and make the appropriate change in radius, to get: The last line follows by the change of variables: The n i can be all integers or all half-integers. Moreover, the sum of all the n i is constrained to be even. Upon implementing these two facts, the sum in Eq. (5.10) splits into four parts, one corresponding to each spin structure. In this way we recover the last line of Eq. (5.10).
We now have to take the product over replicas. As before, we can do this after or before summing over spin structures. The results are then: We again propose that the first result gives the correct Rényi entropy as ℓ → 0 while the second one is correct when ℓ → L.
As emphasised at the beginning of this section, the above partition functions do not directly follow from the single Dirac case. The reason is that one needs a bosonic dual theory in order to write the twist field. For two Dirac fermions with correlated spin structures, the bosonic dual is two copies of the R = √ 2 compact boson. Interestingly the twist field that we found was not symmetric in the two bosons, depending only on one of them. We will see below that this pattern repeats for multiple correlated fermions, dual to bosons on Spin(2d) weight lattices.
It is straightforward to demonstrate that under modular transformations the above replica partition functions satisfy: is modular invariant, which agrees with our conjecture below Eq. (2.33) at c = 2.

Multiple correlated fermions and lattice bosons
For d ≥ 3, the theory of d free Dirac fermions with correlated spin structures is dual to a specific compactification of d free bosons on a target-space torus: The ordinary partition function is well-known and has been derived directly within the free fermion representation as well as from the free boson picture [27]. It corresponds to in terms of the definition in Eq. (2.8). We would like to construct the replica partition functions for these theories. As in the previous examples, this will be possible only by using features of both the fermionic and bosonic descriptions together.
The first step in doing this is to identify the ( 1 2 , 1 2 ) operators in terms of the bosons. As in the case of two Dirac fermions, we have the operators: where p, q = 1, 2, · · · d. In the free boson theory, let Λ R be the root lattice and Λ W be the dual weight lattice. Then the vertex operators are: where w i ,w i ∈ Λ W and w i −w i ∈ Λ R . Elements of the weight lattice can be parametrised as: where v i ,v i are integers and g ij is the inverse of g ij which is the half the Cartan matrix of Spin(2d). For the difference to lie in the root lattice, we must require that 1 The 2-point function of scalar fields is: Hence the conformal dimension of the above operators is (∆ w i ,∆wi) = 1 2 (g ij w i w j , g ijw iwj ).
Thus to reconstruct the fermion operators, we must look for pairs of points of unit length in the weight lattice that differ by an element of the root lattice. If α i are the d simple roots of Spin(2d) and λ i are the fundamental weights then: One also has the dual relation: which will be important in what follows. Here p, q label the individual components of each vector, and the sum is over the vectors (not components).
For the conformal dimensions, we have: Therefore to find operators of dimension ( 1 2 , 1 2 ) we must look for sets of integers v i for which: From Eq. (5.21) it follows that: hence the possible v i are given by: For the anti-holomorphic part we start by picking it independently from the same set: v (q) i = ( α i ) q . However, we need to ensure that 1 This is guaranteed by the fact that which is indeed in the root lattice. We conclude that the fermion operators are given in bosonic language by: We can now look for the twist field, an operator σ k satisfying Eq. (2.2). This induces a monodromy: corresponding to a shift: This in turn will be induced by a shift φ i → φ i + 2πζ is a constant vector satisfying: for all p. Recalling that the last weight of Spin(2d) is λ (d) = ( 1 2 , 1 2 , · · · , 1 2 ), we easily find that the shift is given by: n (0, 0, · · · , 0, 1) (5.31) Thus the twist field only acts on the last scalar φ d . Indeed, it takes the form: where one must keep in mind that ζ (k)i = g ij ζ (k) j . To check that this is correct, compute the OPE with D p (z) to find: The crucial test of our twist field is whether it has the desired conformal dimension. We have: Using g dd = 2λ (d) · λ (d) = d 2 we get ∆ k = dk 2 2n 2 from which it follows that: as desired.
It remains to calculate the two-point function of each σ k and thereby the replica partition function. Recall that the ordinary partition function for these theories is: where, as usual, w 2 = g ij w i w j and similarly forw 2 . The equivalence between the first and second lines of the above equation is the statement of Bose-Fermi equivalence between lattice bosons and multiple fermions with correlated spin structures. To demonstrate this, one starts with the observation that for Spin(2d), Λ W = Λ R ⊕ Λ V ⊕ Λ S ⊕ Λ C where Λ V,S,C are the lattices obtained by shifting Λ R by a fundamental weight in the vector, spinor and conjugate spinor representations respectively. Now we split a generic vector w ∈ Λ W into two classes: those that lie is Λ R ∪ Λ V and those in Λ S ∪ Λ C . In the former set we can write w i = √ 2 p n p ( λ i ) p for arbitrary integers n p , while in the latter set where n p are again arbitrary integers. We similarly writew i = √ 2 p m p ( λ i ) p andw i = √ 2 p (m p + 1 2 )( λ i ) p in the two respective cases. Finally, the restriction w −w ∈ Λ R is implemented by inserting a projection operator that causes both w andw to lie in Λ R or in Λ V (in the first set) or both to lie in Λ S or in Λ C (in the second set). In this way we end up with the four Jacobi θ-functions θ ν (0|τ ), ν = 1, 2, 3, 4, of which θ 1 vanishes for familiar reasons.
For the un-normalised two-point function of twist fields, we find instead: It follows that:

Conclusions
The principle of modular invariance has been consistently useful in understanding conformal field theory. Here we have applied it to the study of Rényi entropies of free Dirac fermions and found that one can define more than one modular-invariant replica partition function. Our proposal is that the uncorrelated version, taking the product over replicas performed after the sum over spin structures, defines the correct Rényi/entanglement entropy as ℓ → 0 while the correlated version, taking the product over replicas before summing over spin structures, defines the correct entropies as ℓ → L. We verified that in this way the holographically predicted relation to thermal entropy of Ref. [17] is satisfied. An ℓ-independent prefactor was introduced to render the replica partition function completely invariant rather than covariant under modular transformations. Comparing with results in the literature for free compact bosons, we showed that Bose-Fermi duality holds in the small and large-interval regimes.
It is clearly of importance to obtain the correct modular-invariant replica partition function at arbitrary values of ℓ. For a generic positive integer n one can write a variety of partition functions as follows. Consider the set S = {k 1 , k 2 , · · · , k n } where k i = − n−1 2 +i−1. Suppose that for a fixed value k i and a fixed spin structure ν, we have a replica partition function Z (ν) n (k i ). Partition S into subsets S 1 , S 2 , · · · having m j elements of S in the jth set. Now we can define the replica partition function: Clearly the fermion spin structures are correlated within each subset S j but uncorrelated across different subsets. It is straightforward to verify that each of these is modular covariant, with a prefactor that can be eliminated as in Eq. (2.33). A particular case is when each subset S j contains a single element k j . In this case we find the uncorrelated replica partition function Z u n which we have argued is the correct one as ℓ → 0. Another particular case arises when there is a single subset, the entire set S. In this case one finds the correlated replica partition function Z c n which is correct as ℓ → L. All other cases lie somewhere in between. Therefore we conjecture that the full replica partition function of the free Dirac fermion is a linear combination (with ℓ-dependent coefficients) over all partitions: The physical intuition is that as the branch cut of length ℓ expands from 0 to L, the degree of correlation among replicas steadily increases. The coefficients a must be such that only the terms corresponding to Z u n , Z c n contribute at ℓ = 0, L respectively. It will be interesting to pursue this direction and try to determine the coefficients.
This discussion strongly suggests that the modular-invariant replica partition function for free fermions is a very complicated quantity (in striking contrast to the one for a single spin-structure, which is relatively simple and very explicit for all ℓ). From this point of view it is encouraging that the free boson result of Ref. [21] is also very complicated! After all, the two are supposed to be equal on putting R = 1 in the latter.
A possible application of the above ideas is to understand entanglement in more general conformal field theories, which at finite temperature and finite size remains largely an open problem. All the techniques used so far have been based on free field theory. In this context, it may be mentioned that minimal models and other CFT's do have freefield representations with a screening charge [30] and their modular-invariant partition functions and correlators are quite well-known. It may be possible to determine replica partition functions for these theories, or at least their limiting behaviours for small and large intervals, using a combination of the free field representation and several physical principles including the relation to thermal entropy and the requirement of modular invariance.