Matrix ensembles with global symmetries and ’t Hooft anomalies from 2d gauge theory

The Hilbert space of a quantum system with internal global symmetry G decomposes into sectors labelled by irreducible representations of G. If the system is chaotic, the energies in each sector should separately resemble ordinary random matrix theory. We show that such “sector-wise” random matrix ensembles arise as the boundary dual of two- dimensional gravity with a G gauge field in the bulk. Within each sector, the eigenvalue density is enhanced by a nontrivial factor of the dimension of the representation, and the ground state energy is determined by the quadratic Casimir. We study the consequences of ’t Hooft anomalies in the matrix ensembles, which are incorporated by adding specific topological terms to the gauge theory action. The effect is to introduce projective representations into the decomposition of the Hilbert space. Finally, we consider ensembles with G symmetry and time reversal symmetry, and analyze a simple case of a mixed anomaly between time reversal and an internal ℤ2 symmetry.


Introduction
Two-dimensional quantum gravity arises in several different physical contexts. It serves as the simplest toy model of higher-dimensional quantum gravity, as the worldsheet description of the first-quantized string, and also as an approximation to the dynamics in the JHEP04(2020)186 throats of higher-dimensional near-extremal black holes. The most successful approach to these models exploits an old idea [1,2] which sought to model the integral over random surfaces as a continuum limit of random triangulations [3][4][5][6][7]. This relationship between double-scaled matrix integrals and 2d gravity has been studied extensively, and appears to provide a quantitative definition of the simplest universality classes of two-dimensional quantum gravity [8][9][10]. This subject is currently the focus of renewed attention due to interest in the simplest model of 2d gravity, the Jackiw-Teitelboim model [11,12], and its relation to black holes [13][14][15][16] and the SYK model [17][18][19][20][21]. In [22], it was shown that the Euclidean path integral of this theory is equal to a particular double-scaled matrix integral, and in [23][24][25][26][27][28] some generalizations were considered.
The purpose of this paper is to show how to incorporate global symmetries in this correspondence between 2d gravity and matrix integrals. In order to do so, we include dynamical gauge fields in the bulk gravity theory. One motivation for this is as a warmup for discussing higher dimensional gravity theories (which would include dynamical gauge fields in a reduction to 2d), or gravity theories with higher supersymmetry. Another motivation is to explore the effect of 't Hooft anomalies in random matrix theory. Finally, we expect that aspects of this setup (although not the exact connection to random matrix theory) will be relevant for the bulk description of SYK-like theories with global symmetry [29][30][31][32][33][34][35][36].
We will now summarize the paper.
In section 2, we give a definition of random matrix theory including some global symmetry group G that commutes with the random matrix (which we think of as a Hamiltonian). The Hilbert space breaks apart into different representations of G, and essentially, one can define separate random Hamiltonians acting in these subspaces. More precisely, we study correlation functions in the matrix ensemble of Tr e −β 1 H . . . Tr e −βnH c where H is the full Hamiltonian, including G symmetry. Each of the partition functions can be decomposed into a sum of traces over subspaces corresponding to particular representations, Tr Hr (e −βH ), with correlations Tr Hr 1 (e −β 1 H ) . . . Tr Hr n (e −βnH ) c = δ r 1 ,...,rn dim(r 1 ) n Tr e −β 1 H (r 1 ) . . . Tr e −βnH (r 1 ) c . (1.1) Here H (r i ) is the Hamiltonian acting on the different copies of the representation r i . It is drawn from an ordinary random matrix ensemble without global symmetry. The expectation value on the r.h.s. has a "genus" expansion, with coefficients determined by the loop equations [37,38] of random matrix theory. In section 3 we discuss the bulk gauge theory that will be added in order to reproduce the random matrix correlations of the form (1.1). The partition functions of Yang-Mills and BF gauge theories on general Riemann surfaces were computed in [39][40][41][42][43][44][45]. We focus on the case of topological (BF-type) gauge theories, which are insensitive to local fluctuations of the geometry. This means that for each topology, the partition function of an arbitrary 2d gravity theory coupled to the gauge theory factorizes into the partition function of the gravity theory itself, times a partition function in the BF gauge theory.
To compare to the random matrix observables (1.1), we need to study the combined gravity theory on a space with n boundaries, with particular boundary conditions related JHEP04(2020)186 Figure 1. A cartoon of the geometry that computes Z g (β 1 , r 1 ; . . . ; β n , r n ). There is a genus g surface glued to n "trumpets" associated to the insertions of Tr Hr (e −βH ) on the RMT side. The boundary conditions at the ends of the trumpets are determined by β and r.
to the values of {β i } and the representations {r i }. To match the results at a given order g in the "genus" expansion of the matrix integral, we study the gravity theory on a space of genus g. As we show using [39][40][41][42][43][44][45], the BF gauge theory partition function on this space with the appropriate boundary conditions is Z gauge g (β 1 , r 1 ; . . . ; β n , r n ) = δ r 1 ,...,rn (dim(r 1 )) n vol(G) dim(r 1 ) To get the full partition function, we multiply this by the partition function of the original 2d gravity theory without gauge fields.
In section 4, we show that (1.1) and (1.2) are compatible with each other, and that (1.2) indicates a particular relationship between the random matrix theories that describe each subspace. In particular, the sector labelled by the irreducible representation r has a density of states proportional to (dim(r)) 2 . One factor of dim(r) arises from the obvious spectral degeneracy due to the G symmetry of the system. However, the second factor of dim(r) implies that the ranks of the random matrices in the fixed representation sectors are proportional to dim(r) as well. A possible explanation of the second factor of dim(r) is that the Hilbert space carries the action of a second copy of G that commutes with the first G-symmetry but does not commute with the Hamiltonian. 1 We also find that the ground state energy in each sector is proportional to the quadratic Casimir c 2 (r). This result is clearly model dependent, but does reproduce the dependence of the ground state energy on the charge in the complex SYK model [36].
In section 5, we discuss a generalization of this calculation, which immediately suggests itself in the gauge theory language but is rarely considered in the random matrix literature. This is to consider the effect of 't Hooft anomalies in the global symmetry G on the random matrix ensemble. In the gauge theory formulation, this is achieved by including particular discrete topological terms in the bulk action. The resulting partition functions are still calculable, and can be expressed in terms of restricted classes of projective representations of the group G. We find that the dual matrix integral again factors into distinct sectors, JHEP04(2020)186 each now corresponding to a genuinely projective representation of G. These results dovetail nicely with recent discussions in the QFT literature [47][48][49] and are relevant for the complex SYK model, which exhibits a mixed anomaly between the global U(1) symmetry and charge conjugation when the number of Dirac fermions is odd [31,50].
In section 6, as a final variant, we also consider matrix ensembles with a G symmetry and time-reversal invariance. In the bulk, this corresponds to summing over non-orientable surfaces. In the case without any 't Hooft anomalies, we find that the dual matrix integral is GOE or GSE like for self-conjugate representations of G, and contains degenerate pairs of GUE blocks for pairs (r, r) with r = r. We also study an example with a mixed anomaly between an internal Z 2 symmetry and time reversal, and find two degenerate GUE-like sectors that are exchanged by the time reversal symmetry, even though both the irreps of Z 2 are self-conjugate. The interpretation is that, in the presence of the anomaly, the time-reversal operation and the Z 2 operator anti -commute, rather than commute.
In section 7 we conclude, and in appendix A we give a detailed computation of some BF theory path integrals that are used in the main text. In appendix B we discuss the details of the U(1) case as an illustrative example, and in appendix C we discus the case where the bulk gravity theory is the JT model, where simpler computations with standard Yang-Mills theory are possible.
Note added. After our analysis of the anomaly-free case was completed, we learned of the paper [51] which has partial overlap with our section 3 and gives an interesting interpretation of the partition functions in terms of matrices whose entries are functions on the group. In the final stages of our project, we also learned of the paper [52] which has overlap with a special case of our results for the partition functions of PSU(N ) gauge theories with 't Hooft anomaly.

Expectations from random matrix theory
In the original application of random matrix theory to physics, one views the random matrix as a model for a quantum Hamiltonian H, and one defines an ensemble that is "as random as possible" given the symmetries of H. For example, without imposing any symmetries at all, a good notion of "as random as possible" is to integrate over all Hermitian matrices where dH is a flat measure on the L 2 independent real components of an L × L Hermitian matrix, and V (H) is a "potential" function that determines the leading distribution of the eigenvalues, generalizing Wigner's semicircle.
In random matrix theory, the most important symmetry is the antiunitary timereversal symmetry. The presence or absence of this symmetry changes the random matrix ensemble in a fundamental way. For example, if the Hamiltonian commutes with a time reversal symmetry T satisfying T 2 = 1, then one can choose a basis in which T = K, where K is simply the complex conjugation operator. T-symmetry then implies that the components of H are real, and the relevant notion of "as random as possible" replaces the JHEP04(2020)186 integral dH over components of a Hermitian matrix with an integral dH over the independent components of a real symmetric matrix. This turns out to change the random matrix integral in rather important ways.
Ordinary unitary symmetries play a less fundamental role than time-reversal. The reason is that there is a somewhat trivial modification of "as random as possible" that incorporates unitary symmetries. To explain this, let G be a group of unitary symmetries that commutes with H. Then the Hilbert space on which H acts decomposes into a direct sum of subspaces corresponding to irreducible representations of G: Each H r consists of the states that transform under the symmetry G in representation r. Such states can be further grouped into multiplets of dimension dim(r) that transform among themselves under the action of G. So we can choose a basis for the states of the full Hilbert space as |r, a; i , where r labels the representation, a ∈ {1, . . . , dim(r)} labels the state within a given multiplet, and i labels the different multiplets. The G symmetry of the Hamiltonian H implies that r, a; i|H|r , a ; i = δ r,r δ a,a H (r) ii . (2.4) However, G symmetry gives no constraints at all on the matrix H (r) . One can therefore define a maximally random matrix ensemble with G symmetry by taking the H (r) matrices for each representation r to be independent random matrices.
To state this more precisely, we will have to introduce some notation, starting with the case with no G symmetry. In this paper, we will focus on aspects of the random matrix H that depend only on its eigenvalues λ 1 , . . . , λ L . A convenient observable of this type is the "thermal partition function" Below, we will leave the dependence on the eigenvalues {λ} implicit and use the simpler notation Z(β). We will also denote expectation values in the matrix integral (2.1) using the notation · . An interesting set of observables are the connected correlation functions (or cumulants) of a product of n partition functions. A basic fact in random matrix theory is that such observables have an asymptotic 1/L expansion of the form The summation variable g is referred to as the "genus" and in general it takes both integer and half-integer values. In the simplest hermitian matrix integral, it takes only JHEP04(2020)186 integer values. The coefficient functions Z g (β 1 . . . β n ) give the 1/L expansion of the matrix integral, and they can be computed efficiently using a set of equations known as the "loop equations." 2 There are two pieces of input data to the loop equations, and these two pieces of data specify what we mean by a matrix integral. The first piece is a discrete choice of symmetry class, in particular whether there is a time-reversal symmetry and if so whether T 2 = +1 or −1. This piece of data determines what we mean by dH in (2.1). The second piece of data is the potential V (H). In practice, it is more convenient to give an equivalent piece of data, which is the leading large L approximation to the density of eigenvalues: (2.7) One can solve for ρ 0 (x) in terms of the potential and vice versa. In the simplest ("one cut") matrix integrals, ρ 0 (x) is supported in a single interval of the real axis. Note that ρ 0 (x) is normalized so that its integral is one. The leading approximation to the total density of eigenvalues has an extra factor of L: Given these two pieces of data (the symmetry class and ρ 0 (x)), a universal recursion relation that follows from the loop equations determines all of the Z g (β 1 . . . β n ) coefficients [38]. The types of matrix integrals that are related to 2d gravity are not quite of the form (2.1). Instead, they are "double-scaled" matrix integrals. Formally, these are integrals in which the interval of support of the leading distribution of eigenvalues is the half-line x ≥ x 0 , and we relax the requirement of normalizability of ρ 0 (x). More precisely, they can be obtained as limits of ordinary matrix integrals, where we take L → ∞ and adjust the potential V (H) in such a way that pointwise where ρ 0 (x) is supported on the half-line x ≥ x 0 , and is not normalized. The parameter e S 0 is the leftover parameter, which plays a role analogous to L in ordinary matrix integrals. In particular, the double-scaling procedure commutes with the loop equations, but the expansion becomes a series in e S 0 rather than L: An important fact for this paper follows from the form of this expansion. If we take a double-scaled random matrix theory and rescale ρ 0 (x) → λρ 0 (x), then the expansion coefficients will transform as (2.11) To see this, note that both rescalings can be accomplished by shifting S 0 → S 0 + log λ. 2 The loop equations were introduced in [37] and have been streamlined significantly over time, culminating in [38]. For a review, see [53] or section 4 of [25].

JHEP04(2020)186
To state this more precisely, it is helpful to define a thermal partition function restricted to a given representation sector Z(β, r) := Tr Hr e −βH = dim(r) Tr e −βH (r) . (2.12) The trace in the final expression is over the i index in (2.4) that labels the different multiplets within the subspace H r . Independence of the H (r) matrices corresponding to different sectors implies a "diagonal" property in the representation label, One can then define a random matrix ensemble in the presence of G symmetry by saying that the expectation value on the r.h.s. is an expectation value in an ordinary random matrix ensemble with no G symmetry, as defined previously. In particular, associated to each sector r will be a function ρ (r) 0 (x) that characterizes the leading density of eigenvalues of the matrix H (r) . The expectation value on the r.h.s. will then have a genus expansion with coefficients determined by ρ (r) 0 (x) and the loop equations. In the next two sections, we will show how the structure in (2.13) arises in 2d gravity once we incorporate a bulk version of G symmetry.

Gauge theory partition functions
We would like to start with a 2d gravity theory that is dual to (or at least approximated by) a random matrix ensemble without G symmetry, and somehow modify it to make it dual to a random matrix ensemble with G symmetry. For example, we can start with the correspondence between JT gravity and a particular double-scaled matrix integral. This can be viewed as a type of disorder-averaged AdS/CFT correspondence. In AdS/CFT duality generally, the presence of a global symmetry in the boundary theory means that the bulk theory should have a gauge symmetry. So, at least tentatively, in order to describe a random matrix ensemble with G symmetry, we should include a dynamical G gauge theory in the bulk.
We will choose the bulk action to be that of the simplest 2d gauge theory, which is the topological BF theory. Boundary terms and boundary conditions will be discussed in section 3.2. The fields in this theory consist of a gauge field A with field strength F = dA + A ∧ A, and an adjoint-valued scalar field B. The action on a closed 2d manifold Σ is The integral over the field B is a Lagrange multiplier that imposes F = 0, so the path integral localizes to an integral over flat connections. In general, there is a moduli space of such connections, and the path integral computes the volume of this space, with respect to a measure that we will describe in more detail below. JHEP04(2020)186

Path integral on a closed surface
The path integral can be computed efficiently by decomposing the surface into three-holed spheres, as explained in [44]. 3 A three-holed sphere is a space with the topology of a sphere with three disks removed. To compute the path integral on such a space, we need boundary conditions for each of the S 1 boundaries. A convenient choice is to fix the holonomy U = P exp(− γ A) around each circle. Under a gauge transformation that acts nontrivially at the boundary, the holonomy transforms by conjugation, so gauge invariance implies that the path integral with fixed holonomy will be a "class function," meaning a function of U that is conjugation-invariant. On the three-holed sphere, the path integral of the BF theory is a class function of the three holonomies where the subscript indicates genus zero. One can write a simple expression for (3.2), as shown in [44]. The expression is particularly simple when expressed in the basis of characters. The characters χ r (U ) = Tr r (U ) for different representations provide a complete orthonormal basis of class functions: The result of [44] is that, in the representation basis, the three-holed sphere path integral is In particular, the result is "diagonal." To compute the path integral of the BF theory on an arbitrary orientable closed surface, one simply builds the surface up by gluing together three-holed spheres. Suppose that we have two spaces with S 1 boundaries that we want to glue together, and that the path integrals on the two spaces with fixed holonomy on the S 1 are ψ(U ) and φ(U ), respectively. Then the path integral on the connected space is The U −1 in one factor is due to the fact that if we pick a consistent orientation of the 2d surface, and cut it along an S 1 , then the opposite orientation of the S 1 will be induced on the two cut pieces.

Boundary conditions
To make contact with random matrix theory, we would like to understand what gauge theory object is dual to an insertion in the matrix integral of The Z(β, r) appearing here is a matrix integral partition function in a fixed representation sector, and was defined in (2.12). V ∈ G is a group element, and we will sometimes write it as V = e βµ , with µ a chemical potential. 4 In the bulk gauge theory, this insertion corresponds to the requirement that the 2d bulk space should have a boundary with boundary conditions determined by β and V , in a way that we will describe below. In fact, to compare the gauge theory and matrix integral formulas, it will be convenient to directly work with insertions of Z(β, r), with fixed representation r. These can be obtained by taking a weighted integral over V : This insertion can be described as another type of boundary condition in the bulk gauge theory, characterized by β and r.
We would like to compute the path integral of the gauge theory on arbitrary orientable surfaces, with boundaries of the type that correspond to insertions of Z(β, r). This path integral can be constructed using a gluing procedure. One important component in the gluing is the three-holed sphere discussed above. We will also need the path integral on a "trumpet" geometry, with the Z(β, r) boundary conditions at one end, and the gluing boundary condition at the other end. Finally, as a special case, we will also need the path integral on the disk with Z(β, r) boundary conditions on the boundary. The disk and trumpet path integrals are computed from the BF theory perspective in appendix A. We will discuss them from a related Yang-Mills perspective below. Either way, the results are For Z gauge T , the final r argument labels the representation at the gluing end of the trumpet. The trumpet path integral, together with the formula for the three-holed sphere above, can be used to give the partition function of the BF theory with Z(β, r) boundary conditions, and an arbitrary connected topology. The only fact that one needs to know is that a genus g surface with n boundaries can be decomposed into 2g + n − 2 three-holed spheres. Since the three-holed sphere is diagonal in representation (see eq. (3.2)), and the trumpet is also diagonal in representation (see eq. (3.10)), all representations will have JHEP04(2020)186 to be equal. Multiplying together the factors for n trumpets and 2g + n − 2 three-holed spheres, one finds Z gauge g (β 1 , r 1 ; . . . ; β n , r n ) = δ r 1 ,...,rn (dim(r 1 )) n vol(G) dim(r 1 ) This formula is actually the only thing we will need to know about the bulk gauge theory in order to match to random matrix theory. Plugging in g = 0 and n = 1, one finds that this formula also gives the right answer for the special case of the disk (3.9).
The rest of this section should be regarded as optional. We will describe the boundary conditions that correspond to insertions of (3.7). Because they are slightly unusual from the perspective of 2d gauge theory, we will discuss them from two different perspectives below. Detailed computations in the BF perspective are in appendix A.

Yang-Mills theory
It will be helpful to think about a generalization of the BF theory to a Yang-Mills theory with a position-dependent coupling constant e 2 (x): Here and below, we use boldface for the Yang-Mills fields, to distinguish them from the BF fields in the discussion below. After integrating out B, one gets a standard Yang-Mills theory. A simple boundary condition is the "gluing" boundary condition discussed above, where we fix the holonomy V of the gauge field around an S 1 boundary. To relate this to the dual boundary theory, we interpret V as the holonomy of a background gauge field on the boundary circle, which is to say that this V is the same as the V in the insertion introduced in (3.7). The theory (3.12) was solved in [44] for an arbitrary e 2 (x), and the answer is simple to state. In the discussion of the BF theory, we saw that the three-holed sphere is "diagonal" in the representation basis, so the partition function can be written as a single sum over representations. The effect of the e 2 (x) term is simply to add an additional weighting We will choose the function e 2 (x) to be concentrated in a narrow annular region near each true boundary (as opposed to artificial boundaries that are included in e.g. the pants decomposition), so that this weighting factor is where β j is the renormalized length of the j-th boundary. With this choice of e 2 (x), the disk and trumpet answers in (3.9) and (3.10) follow from results in [44]. The physics of this Yang-Mills setup is as follows. In the bulk of the space, we have e 2 (x) = 0, so the B field acts as a Lagrange multiplier that forces the gauge field to be JHEP04(2020)186 flat. However, in a small region near the boundary, e 2 (x) is nonzero, and the gauge field can fluctuate. This fluctuation is the off-shell "particle-on-a-group" mode that has been identified in the low-energy limit of the SYK model with global symmetry [29-31, 33-35, 59, 60]. Because the gauge field is flat everywhere in the bulk of the space, one would expect that the somewhat unusual Yang-Mills theory we just described could be understood as a boundary condition in a conventional BF theory. We turn to this next.
BF theory with a non-topological boundary The same particle-on-a-group theory that we just discussed has also been derived from pure BF theory with a particular boundary condition in [61]. Generalizing this slightly to include a chemical potential, the theory is together with the boundary condition Here u is a renormalized time coordinate along the boundary, and it runs from zero to β.
The quantity µ is a chemical potential, as we will see in a moment. Note that although the boundary conditions relate B to A u , they do not determine the value of B itself, and the fluctuations in B become the particle-on-a-group mode [61]. An important difference between these boundary conditions and the Yang-Mills ones is that (3.16) is not gauge-invariant. So, in the BF description, we restrict the gauge transformations to act trivially at the boundary. The asymptotically constant would-be gauge transformations A → gAg −1 + gdg −1 that do not vanish at the boundary become global symmetries. The corresponding Noether charge can be worked out from the action (3.15): (3.17) From this it follows that for small variations µ → µ + δµ, the change in the action is δI = −β Tr(δµ Q) , (3.18) which means that µ is indeed the chemical potential.
In appendix A, we work out the disk and trumpet formulas (3.9) and (3.10) in detail from the BF theory path integral with these boundary conditions. The fact that the answers agree with the Yang-Mills results from [44] establishes in a roundabout way that the two descriptions are equivalent. We will also give a direct (although less precise) path-integral argument for their equivalence.

Relationship between the two descriptions
In order to relate the two descriptions, it is convenient to consider the thin annulus near the boundary where the YM coupling is nonzero, and where the YM gauge field can fluctuate. Roughly, we identify the BF theory as living in the region inside the inner boundary of JHEP04(2020)186 this strip, where the gauge field is forced to be flat. The fluctuating boundary mode of the BF theory will describe the YM gauge field in the remaining part of the geometry, which is the thin annulus itself.
In relating the theories, the following detail is important. Normally in YM theory, we fix the holonomy of the gauge field at the boundary in terms of the chemical potential V = e βµ , and we quotient by gauge transformations that are nonzero on the boundary. However, an equivalent prescription is to fix A τ pointwise along the boundary, and not quotient by gauge transformations on the boundary. To relate the theories, we will take this perspective. Rather than defining the YM theory by V = e βµ , we will define it by Now, the main idea is that the BF and YM gauge fields are the same in the interior of the geometry, and in the thin annular region, they differ by a term proportional to the boundary value of the B field of the BF theory: Here x is a coordinate that goes from x = 0 (inner boundary of the thin annulus) to x = ε (outer boundary of the thin annulus). The motivation for this term linear in B is that it makes the BF boundary condition (3.16) consistent with the YM boundary condition (3.19). Substituting the above into the YM action, we find that in the thin annulus, In going to the final expression, we integrated over the radial x direction in the thin annulus, assuming that B is approximately constant in this small interval. After doing the Gaussian integral over B, this becomes which is the action for the boundary mode in the BF description. So we see that after integrating out the B field of the YM description, the fluctuations of A in the thin annulus become the fluctuations in the boundary mode of the BF description.

Comparison to random matrix theory
Now, let us try to compare the bulk gauge-theory result (3.11) to random matrix theory. As a starting point, we should remember that the BF or YM gauge theory is only part of the bulk theory. In addition, we have whatever "seed" 2d gravity theory is dual to the matrix integral without global symmetry. For example, this could be the (2, p) minimal string, or JT gravity. Then the full partition function on genus g with n boundaries characterized by {β i , r i } is

JHEP04(2020)186
Here Z grav g (β 1 . . . β n ) is the partition function of the 2d gravity theory without the bulk gauge theory included, and Z gauge g is given in (3.11). Note that this simple factorization is a result of the fact that the BF theory is topological in the bulk, and doesn't depend on the details of the metric or the bulk gravity theory.
We define a seed ρ grav 0 (x) as the leading density of eigenvalues associated to Z grav 0 : Given this function, what is the leading density of eigenvalues of the full theory in a given representation sector? Due to the exact dim(r) degeneracy in sector r, we would like to write 0 (x) to be interpreted as the leading density of distinct eigenvalues in the sector of the Hilbert space transforming in representation r, not including the degeneracy. In other words, ρ (r) 0 (x) is the leading density of eigenvalues of H (r) . Our formula for the disk (3.9) implies that Compatibility with (4.2) and (4.3) then requires that So the leading density of eigenvalues in the different sectors are all described by the same function ρ grav 0 (x), but with shifted ground state energies c 2 (r)/2, and densities (of distinct eigenvalues) rescaled by a factor proportional to dim(r). Note that this factor in the density of distinct eigenvalues combines with the exact dim(r) degeneracy to imply that the total number of eigenvalues in each sector is proportional to dim(r) 2 .
In random matrix theory, the function ρ , the prediction can actually be written in a simple way in terms of the correlation functions of the seed theory Z grav Both of the multiplicative factors on the r.h.s. have simple explanations. The factors of e −β j c 2 (r)/2 account for the shift in the ground state energy by c 2 (r)/2. The other factor involving vol(G)/ dim(r) accounts for the rescaling of ρ

JHEP04(2020)186
Finally, using (2.13) to convert from the partition function of distinct eigenvalues Tr e −βH (r) to the total partition function in each sector Z(β, r), we find This equation is precisely consistent with (4.1) and the answer for the BF theory in (3.11). This establishes that if the seed 2d gravity theory was dual to a random matrix ensemble, then after coupling to BF theory, the result will be dual to a random matrix ensemble with G symmetry.

Global symmetries with anomalies
In section 2 it was assumed that, for a quantum mechanical ensemble with G symmetry, the Hilbert space on which the Hermitian matrix H acts decomposes into a direct sum of subspaces corresponding to the irreducible representations of G. However, since states in quantum mechanics are identified projectively, the total Hilbert space is only required to furnish projective representations of G. In principle, the decomposition of the Hilbert space in (2.2) could therefore include a sum over projective representations. As we will review, replacing the sum over ordinary representations by a particular class of these projective representations can be described by saying that the theory has an 't Hooft anomaly in the realization of the G symmetry. The presence of this anomaly is a type of qualitative distinction in the realization of the G symmetry. In the AdS/CFT context (and in the study of SPT phases), an 't Hooft anomaly in the boundary description can be described in the bulk by adding discrete topological terms that assign phase weighting to nontrivial gauge bundles. In this section, we will see that after including such terms, the bulk theory remains dual to a random matrix integral, but with a particular set of projective representations appearing, indicating the 't Hooft anomaly.
We will work with the Yang-Mills description of the theory, since it is straightforward to incorporate holonomies that do not belong to the connected component of the identity in G. The coupling will still be delta-function localized on the boundary, so the theory is topological away from the boundary. In this section we restrict our attention to systems without time-reversal symmetry.

Non-trivial bundles and discrete θ terms
The partition function of a gauge theory with gauge group G on a manifold Σ involves an integral over gauge equivalence classes of connections on all principal G-bundles with base Σ. For topologically trivial Σ, the only class of G-bundle is G × Σ, but for general Σ and certain choices of G, the partition function separates into integrals over distinct topological classes of bundles. The definition of the quantum field theory requires an unambiguous rule JHEP04(2020)186 for weighting these different sectors in a manner compatible with locality and unitarity. In previous sections, we have implicitly weighted all classes of bundles uniformly. When G is a simply-connected Lie group, there are no non-trivial bundles and the point is moot. However, for generic G and Σ there exist distinct theories that differ from one another through the inclusion of discrete topological terms in the gauge theory action.
The allowed weighting factors for topological classes of G-bundles are classifiable [62,63] in any dimension, but for our purposes a more pedestrian approach is possible. Since our primary motivation is to introduce a sum over projective representations in the dual matrix ensemble, we will restrict attention to topological weighting factors that measure the obstruction to lifting a G-bundle to a G-bundle, where G is a central extension of G. Rather than providing an exhaustive treatment, we will specialize the general discussion to an interesting subclass of theories, and then illustrate the construction with a small number of representative examples.

Projective representations and central extensions
A unitary projective representation of a group G on a vector space H is a homomorphism from G to P U (H). 5 Given such a representation, one can pick a (non-unique) lift to U(H), in which case the group law is obeyed up to a system of phases: The system of phases ω : G × G → U(1) defines a 2-cocycle in the group cohomology of G.
Since the lift is non-unique, each element U(g) is only defined up to a g-dependent phase U (g) = f (g)U(g). Changing the lift sends and quotienting by this redundancy defines a class [ω] ∈ H 2 (G, U(1)). If this class is trivial, the representation can be "de-projectivized," or lifted to an honest linear representation of G, while a nontrivial class [ω] presents an obstruction to de-projectivization.
The central extension of a group G by an abelian group C is defined by a short exact where C is a subgroup of the center of G, i is the inclusion map and π : G → G is a surjective homomorphism. Central extensions of G by C can also be classified, up to isomorphism, by group cohomology. Each such extension corresponds to a class [E] ∈ H 2 (G, C). Therefore, isomorphism classes of central extensions of G by U(1) are in bijective correspondence with isomorphism classes of projective representations.
In the case where C is a proper subgroup of U(1), there are generally more group extensions of G by C than there are distinct classes of projective representations with phase systems ω contained in C. However, there is always at least one group G whose JHEP04(2020)186 linear representations contain all of the projective representations of G: the Schur covering group G S . 6 The Schur covering group is a stem 7 extension of G by the degree two group homology of G: For a finite group, H 2 (G, Z) is the same as H 2 (G, U(1)), and is also known as the Schur multiplier of G. The Schur covering group is not unique unless the group G is perfect (equal to its commutator subgroup), but all Schur covering groups for a finite group G are isoclinic. 8 In particular, this implies that if G 1 and G 2 are two Schur covering groups of a finite group G, then G 1 and G 2 have the same number of representations of each dimension. In other words, the partition functions on closed surfaces of two 2D gauge theories whose gauge groups are isoclinic will be equal to each other. When G is a compact, connected semi-simple Lie group, the analog of the Schur covering group is the universal cover G of G. In this case, G is simply connected, and the quotient π : G → G by a subgroup Γ = ker(π) of the center of G realizes G as a central extension of G by Γ. All projective representations of G can be realized as linear representations of G, and the non-trivial classes [ω] correspond to representations of G for which some element of Γ is represented non-trivially.
Below, we will focus on the case with ker(π) ∼ = Z N , with group elements 1, z, z 2 , . . . , z N −1 . Then in a given representation r of G, the generator z is equal to e 2πik /N for some k that depends on the representation r. So in general We will follow a convention and refer to the value of k as the "N -ality" of the representation r. 9

Topological actions and partition functions for finite gauge groups
For a finite gauge group G, each bundle on a closed Riemann surface Σ of genus g is completely specified by the holonomies around the non-contractible cycles in Σ, modulo overall conjugation by G. Each bundle therefore represents an element of Hom(π 1 (Σ), G)/G and a unique topological class. Since there is a unique flat connection in each class, the possible partition functions of the theory are completely determined by the relative weights assigned to each topological class of bundle: See, for example, https://groupprops.subwiki.org/wiki/Schur covering group, or §20 of the book [65].
is called a stem extension if C is also contained in the commutator subgroup of G. 8 See, for example, https://groupprops.subwiki.org/wiki/Isoclinic groups. 9 If p is coprime with N , then z p also generates ker(π). Our choice of generator z defines what we mean by N -ality of a representation of G, as well as the G-bundle with minimal topological number in the discussion that follows.

JHEP04(2020)186
The simplest choice of topological action, S(Σ, γ) = 0, weights all bundles equally and simply counts the number of G-bundles on Σ, modulo conjugation. In general, we can allow S(Σ, γ) to be multivalued, provided that the phase in (5.6) is well-defined. The possible choices of S(Σ, γ) consistent with factorization can be classified using group cohomology [62]. Each action corresponds to a class [S] ∈ H 2 (BG, U(1)), where BG is the classifying space for principal G-bundles. 10 This cohomology ring is isomorphic to the group cohomology used in the classification of projective representations, H * (BG, U(1)) = H * (G, U(1)), so that a choice of topological action also singles out a particular class of non-trivial projective representations of G. As we will see, the partition function of this theory in the representation basis can be expressed solely in terms of this particular class of projective representations. Concretely, the classifying map ρ : Σ → BG allows one to pull back cohomology ρ * : H 2 (BG, U(1)) → H 2 (Σ, U(1)). Pairing the image of [S] under this map with the fundamental homology cycle [Σ] yields a topological action which depends only on the topological class of G bundle (provided that Σ has no boundary). We would like a practical way to evaluate the action (5.7) in concrete examples. We will focus on finite groups G such that H 2 (BG, U(1)) equals Z N . In this case, the group G has N distinct classes of projective representations. We choose a Schur covering group 11 (in this case an extension of G by Z N ), and distinguish (and weight) G bundles according to whether or not they lift to G bundles. For discrete G, each bundle is topological, and is therefore completely specified by its transition functions g ij on an open cover {U i } of Σ. On each triple intersection of the open cover, the transition functions of the G bundle satisfy the cocycle condition g ij g jk g ki = 1. (5.8) Picking a lift G → G, each transition function lifts to an element in G: g ij → g ij . On a generic triple intersection, one will have A nonzero element of Z N appearing in the cocycle condition represents a possible obstruction to lifting the G bundle to a G bundle. Changing the lift of the transition functions can change the local values of the c ijk , but if the transition functions cannot be lifted in such a way so as to remove this obstruction globally, then the G-bundle does not lift to a G bundle and we expect the topological action (5.7) to be nonzero. Concretely, the assignment of an element of Z N to each triple intersection (modulo local gauge transformations and changes of lift) defines aČech 2- 10 BG is the base space of the so-called "universal bundle" EG. The topological classes of G bundles over a manifold M are classified by the homotopy classes of maps M ρ − → BG, which can be used to pull back the bundle over BG to a bundle over M . See section 2 of [62] for a discussion aimed at physicists. 11 The choice does not affect the answer since all Schur covering groups are isoclinic.

JHEP04(2020)186
Since we are assuming that H 2 (BG, U(1)) = Z N , our theories are labelled by an integer k ∈ {0, . . . , N − 1}. 12 To determine the effect of the topological term (5.7) on the partition function, we begin by grouping the G-bundles on Σ according to the value of ω: where γ ∈ Hom(π 1 (Σ), G) and Z Σ, ω denotes the partition function restricted to G-bundles on Σ with topological number ω. In order to determine Z Σ, ω , it is convenient to introduce the partition function of the gauge theory with gauge group G with no topological weighting factor, which we denote Z Σ : The final expression is the analog of (3.6) for finite groups, and it is derived the same way [44]. The irreducible representations of G are denoted by r. Because G is a Schur covering group, all representations of G, projective or not, occur in the sum. All G bundles that do not lift to G bundles can be obtained from honest G bundles using a simple trick that involves excising a small disk D from Σ [44,66]. As we have seen, specifying a G bundle for a finite group G involves specifying holonomies Since we began with an honest G-bundle, it is guaranteed that u ∈ ker π Z N . However, u may not be equal to 1 G , in which case the bundle does not lift. The value of ω ∈ Z N in (5.10) is given directly by u. Note that the U i 's and the V i 's become admissible holonomies for a G bundle if we cut out a small disk D from Σ, 14 and impose a holonomy around ∂D equal to u −1 . Therefore, an equivalent construction of G-bundles with obstruction number ω simply starts with the collection of admissable G-bundles, excises a small disk in each, and imposes the holonomy u −1 determined by ω around the excision. Since this action is performed on each G bundle, we can use the formula for the partition function of the G-theory on a Riemann surface with one boundary [44] to obtain (5.13) 12 We note that, in general, the set of possible topological terms is labelled by elements of (ker π) , the dual group of ker π, which is the group of homomorphisms from ker π into the circle group U(1). 13 The fundamental group of Σ is the free group generated by 2g elements subject to this relation. 14 Concretely, imagine the representation of Σ as a 4g-gon with the standard identification of the edges, and imagine cutting out the disk from the center of this polygon.

JHEP04(2020)186
This formula requires some explanation. First, u is the element of ker(π) Z N that is given by z ω , where z is the elementary generator of Z N . From (5.5), we therefore have where k is the N -ality, discussed near (5.5). Finally, the factor N 1−2g = (| G|/|G|) 1−2g can be interpreted as the inverse of a Z N partition function, which corrects for the fact that the G gauge theory overcounts configurations from the perspective of a G gauge theory. In particular, each of the 2g holonomies can be given N different lifts to G. Substituting (5.13) into (5.10) and using the orthogonality relation Σ is a sum over only those representations of G with "N -ality" k. Note that for k = 0, the only representations that contribute are linear representations of G, and the normalization factors are such that we recover the original Z Σ .

Connected Lie groups
When G is a connected, simply-connected Lie group, all principal G-bundles are topologically trivial and homeomorphic to G × Σ. When G is connected, but not simply-connected, non-trivial bundles exist and are in one-to-one correspondence with the elements of π 1 (G). This correspondence can be explained as follows. The universal cover G is a central extension of G by π 1 (G). Because G is simply connected, there is only one class of bundle E = G × Σ, and there is a simple procedure to construct the non-trivial G bundles from E [44,66], just as in the discrete group case. 15 Given the trivial bundle E, one cuts out a small disk D from Σ, and glues it back with a transition function u ∈ π 1 (G). This procedure defines a G bundle E u which does not lift to a G bundle. To see this, note that because π 0 (G) = 0, the bundle is trivial when restricted to D and to Σ−D. On each patch, E u therefore lifts to a G-bundle. However, the overlap of these two patches is a circle, and the transition function u : S 1 → G defines a closed path in G but not in G. The lifted transition functions are therefore not single-valued in G and E u is not homeomorphic to E.
One can alternately diagnose this obstruction using a characteristic class. Given a G-bundle E u , the transition functions on the open cover satisfy the cocycle condition on triple intersections g ij g jk g ki = 1 .
E u lifts to a G-bundle on each open patch, but the lifts of the transition functions will generically satisfy g ij g jk g ki = c ijk ∈ π 1 (G) . which depends only on the topological class of the bundle E u . When π 1 (G) = Z N , the analysis is the same as for the finite group case above. One finds Summing over ω as in (5.10), one finds again that the Z (k) Σ is a sum over representations of G with N -ality equal to k.

Manifolds with boundary and the anomaly
The characteristic classes that define the topological terms are well-defined and gauge invariant on closed manifolds: they depend only on the bundle, rather than a particular connection on the bundle. In particular, given some representative ω N of the class [ω N ] ∈ H 2 (Σ, Z N ), a variation of the connection or a gauge transformation induces a shift by a coboundary ω N → ω N + δb However, on manifolds with boundary b, ∂[Σ] ∈ Z N , and the weighting factors are not necessarily gauge-invariant or independent of the connection on the bundle. In general, the non-invariance of the "topological" term is completely controlled by the connection on the boundary. Honest gauge transformations that vanish at the boundary will not change the path integral. However, if we consider a gauge transformation that does not vanish on some S 1 boundary, and instead describes a nontrivial element of π 1 (G) as we wind around the boundary circle, then b, ∂[Σ] will be nonzero and the path integral will transform by a phase.
The boundary values of the gauge fields represent background gauge fields for the global symmetry G in the random matrix ensemble. A gauge transformation that does not vanish on the boundary represents a gauge transformation of this background gauge field. The non-invariance of the partition function under such a transformation is the definition of an 't Hooft anomaly.
With this understanding, let's now try to define the partition function with boundaries in the theory with the anomaly. The naive generalization of (5.10) to a manifold with a JHEP04(2020)186 single boundary and prescribed holonomy U ∈ G would be In this formula, one would like "Z Σ, ω (β 1 , U 1 )" to denote the partition function of the G gauge theory restricted "to the class of bundles with topological number ω and prescribed holonomy U ". As we have noted, this formal object is ill-defined, since the value of ω on a manifold with boundary is no longer an invariant. The left hand side of the equation is welldefined but not invariant under large gauge transformations that wind non-trivially around the boundary circle. These gauge transformations correspond to non-trivial elements of π 1 (G) and change the phase of the path integral in a controlled way. This phase ambiguity can be repackaged by lifting the holonomy U 1 to an elementŨ 1 of π −1 (U 1 ) ∈ G. Since there are no topologically non-trivial gauge transformations in G, once the lift of U 1 is chosen the path integral is defined unambiguously. However, different choices of the lift result in different overall phases, matching the ambiguity in the G-theory's partition function.
Having chosen a definite phase for the path integral by lifting to G, the partition functions in the fixed topological sectors can be computed by excising a disk from Σ and gluing in one with holonomy u ∈ Z N , as in section 5.1. A well-defined version of (5.22) therefore reads Again, the N −2g factor can be interpreted as the inverse of a Z N partition function on a genus g surface with one boundary.
The discussion is identical on a surface with n boundaries. One would like to compute the partition function with specified honolomy U i ∈ G on the i th boundary component. This object has phase ambiguities associated to elements of π 1 (G) acting at each boundary. These ambiguities can be repackaged by working with a G-theory and lifting the U i to elements of the covering There is an N -fold choice for each U i , and there is no canonical way to make this choice. 16 In this formulation, the dependence of the partition function on the choice of an element of π −1 (U i ) is the statement of the anomaly. The phase ambiguities match those of the G-theory: the partition function transforms the same way (by a phase related to an element of the center of G) when one performs a large gauge transformation in the G theory or when one changes the choice of lift in π −1 (U i ) in the G-theory. Following the prescription of excising a small disk in [44], we get the analog of (5.19) and (5.10) for

JHEP04(2020)186
general manifolds with boundary: The Kronecker delta ensures that we sum only over representations of N -ality k. In the case of a finite group, we would have the same formula, with vol(G) replaced by |G|.
Let's see how this formula reproduces the 't Hooft anomaly. Suppose that we transform one of the holonomies U i , by a background gauge transformation that corresponds to the elementary generator of π 1 (G). U i will just transform by conjugation, but the lift U i will be multiplied by z, the generator of ker(π). Using (5.5), we find that (5.25) will transform by a definite phase e 2πik/N which characterizes the 't Hooft anomaly. In particular, in the case k = 0, we sum over honest linear representations, and the result is just the partition function in the theory with no anomaly.

Connection to random matrix theory
The formula (5.25) (or its analog for finite groups) can be converted to the representation basis by exploiting the orthogonality of characters of G, and the projection formula (3.3) for the group G. 17 The resulting expression for Z g (β 1 , r 1 ; . . . ; β n , r n ) is identical to (3.11), except for the restriction to projective representations of fixed N -ality. The discussion of section 4 goes through as before, and we conclude that the bulk theory is dual to a random matrix ensemble with G symmetry but only projective representations of fixed N -ality.

Examples
In the rest of this section, we consider specific examples to illustrate the above general theory. In section 5.4.1, we consider the finite group G = Z 2 × Z 2 , for which there are two Schur covering groups: the dihedral group with eight elements and the quaternion group. In section 5.4.2, we consider the case with G = O(2) and G = Pin + (2). Here G is continuous, but disconnected. In section 5.4.3, we consider the case G = PSU(N ) and G = SU(N ). Here G is connected, but not simply connected, and G is its universal cover; this is the original setting in [69].
The simplest internal symmetry group capable of exhibiting an anomaly in quantum mechanics is Z 2 × Z 2 , see the second column of table 1 of [63]. Since H 2 (Z 2 × Z 2 , U(1)) = Z 2 , there are two choices for the gauge theory action and a single non-trivial class of projective representation. However, there are multiple inequivalent central extensions of Z 2 × Z 2 by 17 After projecting (5.25) to a given r using the orthogonality of the characters of G, we are only left with a dependence on dim( r). Thus the answer is independent of the choice of G, since the various possible G are isoclinic.

JHEP04(2020)186
There are four possible G's, and thus multiple elements of H 2 (Z 2 × Z 2 , Z 2 ) can correspond to the same G. Explicitly, there is Z 2 × Z 2 × Z 2 (appearing once), Z 2 × Z 4 (appearing thrice), the dihedral group D 8 (appearing thrice), and the quaternion group Q (appearing once). Of these, D 8 and Q are isoclinic Schur covering groups, while Z 2 × Z 2 × Z 2 and Z 2 × Z 4 are not stem extensions, and therefore are not Schur covering groups. 18 Since Z 2 × Z 2 is abelian, it suffices to work with the abelianization of π 1 (Σ) when enumerating bundles. Each bundle is characterized by a homomorphism H 1 (Σ, Z) → Z 2 × Z 2 , of which there are 4 2g . The simplest theory with this gauge symmetry counts the number of such bundles modulo the conjugation action, and has the partition function This expression in the "bundle basis" is of course also equal to the expression in the representation basis (3.6). The group Z 2 ×Z 2 has 4 conjugacy classes and 4 one-dimensional representations, so the partition function can also be expressed as It is possible to construct a variant of this theory that distinguishes the Z 2 ×Z 2 bundles that lift to bundles of the covering group D 8 from those that do not. 19 The corresponding action is related to the non-trivial element of H 2 (Z 2 × Z 2 , U(1)). The dihedral group has the presentation The elements {1, a 2 } are central, and D 8 /{1, a 2 } = Z 2 × Z 2 . The group D 8 has five conjugacy classes, and therefore five irreducible representations. Four of these representations are one-dimensional and restrict to representations of Z 2 × Z 2 (since a 2 is represented trivially). The fifth irreducible representation of D 8 has dimension two, and the central element a 2 is represented by −I 2×2 . This corresponds to the unique class of non-trivial projective representation of Z 2 × Z 2 . The path integral of the D 8 gauge theory on a closed surface is given by the sum over representations (3.6) We will now explicitly evaluate the partition functions of the Z 2 × Z 2 theory with the anomaly. The topological action (5.7) corresponding to the non-trivial element of H 2 (Z 2 × Z 2 , U(1)) = Z 2 evaluates to 0 if the Z 2 × Z 2 bundle lifts to a D 8 bundle, and 18 A discussion of these facts can be found here or in the lecture notes [70] by Greg Moore. 19 See appendix D of [47] for a recent discussion. As mentioned previously, the Z2 × Z2 bundles can be distinguished using either Schur covering group D8 or Q. Both groups are isoclinic and therefore have identical partition functions on closed orientable surfaces.

JHEP04(2020)186
returns 1 2 otherwise. The partition function with the anomaly therefore takes the form where ω(γ) = 0 if γ lifts to a D 8 bundle and ω(γ) = 1 otherwise. The calculation therefore reduces to counting Z 2 × Z 2 bundles with signs. The sum over Z 2 × Z 2 bundles that lift to D 8 bundles is simply related to the D 8 partition function (5.29) in the representation basis through the formula (5.13) and gives Because the kernel of the covering map D 8 → Z 2 × Z 2 contains a single non-identity element a 2 , the non-lifting bundles can all be constructed from the liftable bundles by excising a small disk and imposing the holonomy a 2 around it. According to the general formula (5.13), each D 8 representation occurring in this second sum is weighted by plus or minus one depending on whether a 2 is represented nontrivially in that representation. One easily obtains The partition function of the theory without the anomaly is the sum of (5.31) and (5.32), also known as 4 2g−1 . This is in complete agreement with (5.26). Note that the sum projects out the two-dimensional representation of D 8 which defines a genuinely projective representation of Z 2 ×Z 2 . The partition function of the theory with the anomaly, eq. (5.30), is the difference of (5.31) and (5.32), and projects onto the single genuinely projective representation: We emphasize that if one is simply counting the number of bundles, and not quotienting by conjugations, one is computing the volume of moduli space rather than the partition function. The moduli space volumes for a finite group are simply equal to |G| times the relevant partition function. It is instructive to check these results on the torus. There are 8 2 = 64 possible assignments of D 8 holonomies (u, v) to the two homology cycles of the torus. Since D 8 is nonabelian, the necessary condition uvu −1 v −1 = 1 for a D 8 bundle is not automatically satisfied, and only 40 choices of (u, v) satisfy the relation and define D 8 bundles. These 40 bundles, after accounting for conjugation, yield Z g=1 = 5 in agreement with (5.29) for g = 1. The remaining 24 pairs (u, v) satisfy uvu −1 v −1 = a 2 and are accounted for in (5.32). In the Z 2 ×Z 2 language, out of the sixteen possible assignments of Z 2 ×Z 2 holonomy (U, V ) to the two cycles of the torus, ten pairs lift to admissible D 8 holonomies, while six do not.
We now turn to the evaluation of the Z 2 × Z 2 gauge theory partition function on surfaces with boundary. In the theory without the anomaly, we need to specify a holonomy JHEP04(2020)186 U i ∈ Z 2 × Z 2 on each boundary i ∈ {1, . . . , n}. Since the discrete gauge theories are truly topological and independent of the length of the boundary curves, we can simply use the answers from [44]: Z (k=0) g (β 1 , r 1 ; . . . ; β n , r n ) = 4 2g+n−2 δ r 1 ,...,rn . (5.33) Evaluation of this partition function in the theory with the anomaly is more subtle. As discussed in section 5.2, we need to specify a holonomy U i ∈ Z 2 × Z 2 for each boundary, and also a choice of lift U i ∈ π −1 (U i ) ⊂ D 8 . Because the lifts of the non-identity elements of Z 2 × Z 2 are traceless in the two-dimensional representation of D 8 , the answer for the path integral in the theory with the anomaly should vanish unless all of the U i 's are equal to the identity.
Let's check this mechanically. Suppose that we glue a trumpet with holonomy U around the S 1 into a larger manifold. There is a choice of Wilson line V across the S 1 gluing locus, and we need to sum over this. The fact that this sum gives zero can be established using the locality argument in [25]: if we zoom in on a neighborhood of the gluing, then we will find a geometry with the topology of a cylinder S 1 × I, with holonomy U on the S 1 and Wilson line V on the interval. This same sum arises in the calculation of the torus partition function with fixed holonomy U around one of the cycles, and arbitrary holonomy v around the other.
We therefore consider the restricted holonomy sum on the torus, where U = a, and we sum over V = 1, a, b, ab. Because Z 2 × Z 2 is abelian, we will have U V U −1 V −1 = 1 for any of these four choices. To check whether the bundle lifts to D 8 , we need to check if U V U −1 V −1 = 1 using only the relations of D 8 . One can check In Z 2 × Z 2 , we have a 2 = 1, but in D 8 , it is not one, so one finds that half of the bundles lift and half do not. So the conclusion is that on the torus with holonomy on one cycle restricted to be U = a, the sum over gauge bundles weighted by the anomaly term vanishes. One can repeat this calculation for the case U = b or U = ab with the same conclusion.

O(2)
We now consider the simplest example of a continuous, but disconnected symmetry group, O(2) = U(1) Z 2 . We denote the connected component of the identity in O(2) by O(2) + , and the other connected component by O (2) − . An O(2) symmetry naturally arises in systems with a U(1) symmetry that are invariant under charge conjugation, and the possible mixed anomaly between U(1) and Z 2 has interesting consequences both in quantum mechanics and in gauge theory [47,49]. 20 By an O(2) BF gauge theory, we mean a sum over all flat O(2) bundles. There are several classes of O(2) bundle, each distinguished by a characteristic class. The first Stiefel-Whitney class ω 1 ∈ H 1 (Σ, Z 2 ) is an obstruction to orientability of the bundle. If it vanishes, the O(2) bundle defines an SO(2) bundle, or a complex line bundle. Such 20 Certain SYK models with N Dirac fermions exhibit O(2) symmetry. In the SYK context, the anomaly is present when N is odd, and it is absent if N is even [31,50].

JHEP04(2020)186
bundles are classified by their first Chern class c 1 ∈ H 2 (Σ, R) which vanishes for a flat bundle. If ω 1 = 0, then the Chern class cannot be defined for the bundle, but a mod 2 analog ω 2 ∈ H 2 (Σ, Z 2 ), the second Stiefel-Whitney class, still makes sense. Bundles with ω 1 = ω 2 = 0 can be lifted to Spin(2) bundles, and bundles with ω 2 = 0 can be lifted to Pin + (2) bundles (whether or not ω 1 is trivial). Since we are not considering matrix ensembles with time reversal symmetry, all Riemann surfaces in this section are oriented. For rank-2 vector bundles over oriented Riemann surfaces ω 1 ∪ ω 1 = 0, and so the only topological weighting factor for O(2) bundles that is consistent with factorization is ω 2 . There is thus a unique theory with anomalous O(2) symmetry [63], and it corresponds to weighting the O(2) bundles according to whether or not they admit a Pin + (2) lift. 21 The group Pin + (2) is a double cover of O(2), with the kernel of the covering map given by the center of Pin + (2): . Following the general discussion in section 5.1, we expect the O(2) symmetric quantum mechanical system with the anomaly to contain precisely these projective representations. We first consider the theory without the anomaly, where the general formulas of section 3 are valid. The partition function on a closed genus-g surface is given by the sum over all irreducible representations, as in (3.6): where the factor of 4π in this expression arises because vol(O(2)) = 4π, in a standard convention. Note that this partition function (5.36) is formally divergent, because we have infinitely many 2d irreps and no Boltzmann suppression on closed surfaces. For Riemann surfaces with boundary, the partition functions in the representation basis are given by the general expression (3.11). In the holonomy basis, we will have (2 cos mθ i )e −β i m 2 /2 . (5.37) 21 Since ω1 ∪ ω1 = 0 on oriented surfaces, ω2 is the obstruction for both Pin + (2) and Pin − (2). We could therefore also use the group Pin − (2) in the following discussion. Since Pin + (2) and Pin − (2) are isoclinic, their partition functions on closed surfaces agree and the choice does not effect the calculation of the O(2) partition functions. This is completely analogous to the choice of D8 or Q in section 5.4.1.

JHEP04(2020)186
Now, let us turn to the theory with the anomaly. As discussed above, the anomaly term is the second Stiefel-Whitney class of the O(2) bundle [48]. 22 We can compute the partition function on closed surfaces using the general method described in section 5.1. The results are Note that these expressions are also divergent. Now we combine the above two equations using (5.10) to get the formal partition function Next we consider manifolds with boundary in the theory with the anomaly. The partition function vanishes if any of the boundary holonomies belong to O(2) − , since these elements are represented by traceless elements in the projective representations. If a boundary holonomy U belongs to O(2) + , then the phase of the partition function is ambiguous and we have to specify a lift of this holonomy to Pin + (2), as discussed in section 5.2. This lift requires a choice since there are two elements U , U ∈ Pin + (2) that map to U ∈ O(2) under the covering map π : Pin + (2) → O(2). There is no canonical choice of U or U , and the partition function flips sign under the interchange. To see this explicitly, parametrize the connected component of the identity in Pin + (2) by an angle θ which has periodicity 4π. For fixed U 1 , . . . U n ∈ Pin + (2), the n-boundary partition function takes the form (5.25), which in this case is explicitly given as Changing the lift of the holonomy from U i to U i amounts to sending θ i → θ i + 2π. Since all of the m's appearing in the sum are of the form (integer + 1/2), the partition function flips sign under the shift of θ i by 2π. This is one of the defining features of the theory with the anomaly, and we see it explitly in (5.41). We can also rewrite this in the representation basis, as we explained in section 5.3. Note also the partition functions on manifolds with a boundary are convergent, as opposed to closed surfaces, because of the presence of Boltzmann suppression factors. JHEP04(2020)186

PSU(N )
The last example that we will consider is PSU(N ) gauge theory. PSU(N ) is connected but not simply connected, and can be viewed either as the quotient of SU(N ) by its center Z N , or as the quotient of U(N ) by its center. On a closed, oriented surface there is a single topological class of SU(N ) principal bundle. In order to construct a non-trivial PSU(N ) bundle from this SU(N ) bundle, one excises a disk and glues in one with holonomy u ∈ Z N . Said differently, one relaxes the SU(N ) cocycle condition on the transition functions g ij to require g ij g jk g kl ∈ Z N , since these elements are represented trivially under the projection π : SU(N ) → PSU(N ). The assignment of elements of Z N to each triple overlap on the surface defines a class  The topological term requires more care on manifolds with boundary and non-trivial holonomy (corresponding to non-trivial background fields in the quantum mechanics). The class [ω N ] is a topological invariant of the bundle because under a change of connection, the representative changes by a coboundary: On a manifold without boundary δb, [Σ] = 0 so that the invariant is independent of any choices that went into its definition. On a manifold with boundary ∂Σ, one needs to JHEP04(2020)186 specify both boundary conditions on ∂Σ, and in order to evaluate the topological term one also has to specify a representative of the cohomology class ω N . If one simply specifies a holonomy U ∈ PSU(N ) on ∂Σ, the phase of the partition function transforms under large gauge transformations that do not vanish at the boundary circle (non-trivial elements of π 1 (PSU(N )) = Z N ) where b is the 1-cocycle defined in (5.46). The explicit formulas for partition functions can be written using the methods of section 5.2.

Incorporating time-reversal symmetry and unorientable surfaces
So far, we have only discussed the gauge theory on orientable surfaces. However, one can also consider a bulk theory in which orientation-reversal is gauged. Concretely, this means that surfaces can be glued together with a reversal of orientation, and so in particular, unorientable surfaces should be allowed. Bulk theories in which orientation is gauged are expected to be related to boundary theories with time-reversal symmetry. In the context of random matrix theory, this would mean GOE-like or GSE-like matrix ensembles, see [71,72] in the "minimal string" and [25] in JT gravity. Following the strategy of the first parts of this paper, we will imagine starting with a "seed" unoriented 2d gravity theory such that Z grav (β 1 . . . β n ) agrees with the genus expansion of a GOE-like or GSE-like random matrix integral. Then we will ask what happens when we include a gauge theory for the group G.
As a first step, let's discuss the gluing rule in the gauge theory when we glue two manifolds together across a S 1 boundary with an orientation reversing twist. It is convenient to start with the ordinary gluing rule (3.5) in the holonomy basis, Reversing the orientation of one of the boundaries prior to gluing replaces U ↔ U −1 in one factor, leading to [44] dU vol(G) ψ(U )φ(U ) = r ψ(r)φ(r).
In the final expression we wrote the answer in the representation basis, using the property of the characters χ r (U −1 ) = χ r (U ). The new gluing rule is simple in the representation basis, and glues representation r to its conjugate representation r.
The other new ingredient we need to consider is the possibility of including unorientable surfaces in the path integral. These surfaces can be constructed by cutting n c holes in an orientable surface of genus g 0 , and attaching n c "crosscaps." We use g = g 0 + nc 2 to denote the genus of the surface after this operation. In order to perform this gluing in the gauge theory, one only needs to know that the wave function of the gauge theory on a crosscap in the representation basis is (see [44], section 2.4) Ψ 1 2 (r) = s r δ r,r . (6.3)

JHEP04(2020)186
The δ r,r factor indicates that unorientable surfaces only contribute to path integrals with boundary conditions that include real or pseudo-real representations of the group G. The factor s r is one if the representation is real, and minus one if the representation is pseudoreal [44]. Note that in order to add a crosscap to a space with at least one boundary, we need to add a three-holed sphere, and then glue in a crosscap on one of the new boundaries. So in the representation basis, the total factor associated to adding a crosscap will be vol(G) dim(r) s r δ r,r , (6.4) where the first factor comes from the additional three-holed sphere. Let's now try to interpret these changes to the bulk theory from the perspective of random matrix theory. Suppose first that r = r. Then (6.3) vanishes and crosscaps do not contribute, but the modified gluing rule (6.2) allows us to glue r to r. This implies that the only effect of gauging orientation-reversal in the bulk theory is to replace the δ r 1 ,...,rn in eq. (3.11) with a δ symbol that is equal to one if the representations are equal or conjugate, and zero otherwise. So in any correlation function, an insertion of Z(β, r) has the same effect as an insertion of Z(β, r). Thus Z(β, r) = Z(β, r) identically. In random matrix theory, the interpretation of this statement is that the eigenvalues in sector r remain GUE-like, but are precisely degenerate with corresponding eigenvalues in the sector r.
Next, suppose that r = r. Then crosscaps do contribute, and there are two different ways that any trumpet can be glued into a larger surface: with or without orientation reversal prior to gluing. The gauge theory does not notice the orientation reversal if r = r. Also, the weighting of the crosscap vol(G)/ dim(r) is such that (3.11) remains true on nonorientable surfaces (once we generalize g → g 0 + nc 2 where g 0 is the genus without crosscaps, and n c is the number of crosscaps). With this generalization of the genus, the random matrix prediction for GOE-like or GSE-like ensembles is also (4.7), so if the bulk theory without the gauge theory was dual to a GOE-like or GSE-like ensemble, then after coupling to gauge theory, this remains true in sectors with r = r. An interesting detail is that if r is pseudo-real and not real, then the sign associated to a crosscap will be reversed from that of the parent theory, and the statistics will be changed from GOE-like to GSE-like and vice versa. (See [73] for a proof that this sign interchanges GSE and GOE.) Both the r = r and r = r results have a simple explanation in random matrix theory. We assume a time-reversal operator T that commmutes with the full Hamiltonian H. The operator T acts on the full Hilbert space in such a way that it maps H r ↔ H r . If r is real, then T preserves H r and implies that the Hamiltonian restricted to this subspace commutes with T. So the corresponding eigenvalues should be drawn from a time-reversal-invariant ensemble (GOE-like or GSE-like). On the other hand, if r is complex, then T does not imply any time-reversal symmetry within H r . So the eigenvalues should remain GUE-like, but degenerate between H r and H r . JHEP04(2020)186

An example of a mixed anomaly including time-reversal
The inclusion of time-reversal symmetry makes new types of anomalies possible. We will illustrate this with the simplest example, where G = Z 2 . Without time reversal, there is no possible anomaly for this group. But with time-reversal, there is a mod 2 anomaly which we now discuss.
The anomaly is described in the bulk theory by a new type of topological action for the sum over Z 2 bundles, which would be trivial in a theory without orientation reversal. The term can be understood either as As we will see, the two are equal. 23 Here, w is the first Stiefel-Whitney class of the tangent bundle. It assigns one to 1-cycles along which the orientation is reversed, and zero to 1-cycles along which the orientation is not reversed. Similarly, the class w Z 2 1 assigns one to 1-cycles with nontrivial Z 2 holonomy, and zero to 1-cycles with trivial holonomy.
On an orientable 2-manifold, both expressions are equal to one and therefore trivial. For the second expression, this is obvious since orientability implies that w O(2) 1 = 0. To see that the first expression vanishes identically, recall that the cup product algebra 24 on an orientable Riemann surface is where α i and β j are the 1-cocycles dual to the standard A i and B j cycles of the Riemann surface, and γ is the 2-cocycle. This algebra implies that w 1 ∪ w 1 vanishes mod 2 for w 1 set equal to any integer combination of the α i and β j . However, on an unorientable manifold, the expressions in (6.5) are in general nontrivial. An important special case is RP 2 , for which the cup product algebra with Z 2 coefficients is Here α is dual to the 1-cycle A along which the orientation is reversed, 25 and γ is the 2-cycle. If we consider a Z 2 bundle with nontrivial holonomy along A, then we will find and therefore both expressions in (6.5) are equal to minus one. This has an important implication: it means that the sum over Z 2 bundles on RP 2 weighted by (6.5) vanishes.
The answer for the trivial Z 2 bundle is one, and the answer for the nontrivial bundle is minus one. A general unorientable surface can be constructed by starting with an orientable surface, cutting holes, and gluing in crosscaps. Associated to each crosscap is a 1-cycle that is the same thing as (−1) nc where nc is the number of crosscaps. This is related to an anomaly of a very simple kind, turning a GOE-like matrix integral with T 2 = 1 into a GSE-like one with T 2 = −1.
24 For a discussion, see section 3.2 of [74]. 25 If we view RP 2 as a disk closed off by a crosscap, then A is the cycle that goes "through" the crosscap.

JHEP04(2020)186
passes through it, along which the orientation is reversed. The sum over Z 2 bundles along this 1-cycle will vanish by the same argument as above. So we conclude that unorientable surfaces do not contribute to the path integral in the theory weighted by (6.5).
Although non-oriented surfaces do not contribute to the path integral, the theory with the weighting (6.5) does not simply reduce to the theory without orientation gauged. Gauging orientation allows the possibility to glue "trumpets" to the rest of the manifold with a reversal of orientation. In fact, locally at the point that a trumpet is glued to the rest of the manifold, there are two different Z 2 options: one can reverse the orientation, and one can act with the nontrivial Z 2 element. We need to understand the weighting of (6.5) for these four possibilities.
These four choices only affect the region near the gluing, and because the weighting factor (6.5) is local, we can study the sum over these four possibilities in a slightly simpler context, as explained in [25]. Specifically, imagine that we are gluing two trumpets together to form the double-trumpet. Then we can glue the "big ends" of the double-trumpet together to form a closed manifold. In the case where the orientation is not reversed at the gluing, this manifold is topologically a torus. Since the torus is orientable, the weighting factor is trivial, and we learn that the weighting is one, regardless of whether or not we act with Z 2 before gluing.
In the case where the orientation is reversed, gluing the "big ends" together gives a Klein bottle. The cup product algebra on the Klein bottle is as follows: Here α is dual to the 1-cycle that originally formed the boundary at the "big end" of the double trumpet, and β is dual to the 1-cycle that goes through the double trumpet from one "big end" to the other. γ is dual to the 2-cycle. For the tangent bundle, we have w O(2) 1 = β, since the orientation is reversed as we pass through the waist of the double trumpet. For the Z 2 bundle, we have where σ, τ are both either one or zero. We should sum over the two values of τ , since this corresponds to gluing with or without an action of Z 2 . But we should hold σ fixed, because this corresponds to the Z 2 holonomy at the "big end" of the trumpet, which is fixed as part of the boundary conditions. The result of the cup product is where we used σ 2 = σ. Because the answer does not depend on τ , the weighting is the same for both choices of holonomy through the double trumpet, in other words for both choices of whether we act with Z 2 before gluing together. However, we find that the weighting is one for the case where the holonomy at the "big end" is trivial, and the weighting is minus one in the other case.
Adding this together with the contributions we computed using the torus, we find that the total answer vanishes in the case where the boundary holonomy is nontrivial, and JHEP04(2020)186 the total answer is four in the case where it is trivial. The above discussion was for the double trumpet, but by locality a similar story will apply any time we glue a trumpet to any surface. In particular, the answer will vanish any time one of the trumpets has an asymptotic boundary with the nontrivial Z 2 holonomy.
Let's now give an interpretation of this in random matrix theory. We expect to find a correspondence to a matrix ensemble with a time-reversal symmetry T and a Z 2 global symmetry, generated by an operator we will refer to as Z. The Hilbert space breaks up into two sectors corresponding to the two representations of the Z 2 symmetry, H = H + ⊕ H − , where Z acts as ±1 on the two subspaces. A trumpet boundary with trivial Z 2 holonomy corresponds in the matrix integral to an insertion of Tr H (e −βH ) = Tr H + (e −βH ) + Tr H − (e −βH ), (6.12) while an insertion with nontrivial holonomy Z corresponds to an insertion of The vanishing of all gravity path integrals with nontrivial holonomy means that Tr(Ze −βH ) vanishes identically. This means that the two sectors H − and H + have precisely the same spectrum of energy eigenvalues. Note that because unorientable surfaces vanish, the statistics in either sector will be GUE-like. This pattern can be explained by saying that the Z and T operators do not commute, but instead satisfy ZT = −TZ. (6.14) The minus sign in this equation is the boundary expression of the mixed anomaly between time reversal and Z 2 . Notice that it implies that T exchanges the subspaces H ± with each other. In this situation, time reversal implies exact degeneracy between the two sectors, but doesn't place any restriction on either sector individually, so the ensemble consists of two degenerate GUE-like sectors.

Summary and discussion
In this paper, we studied two-dimensional gauge theory coupled to gravity as a dual description of certain matrix ensembles with global symmetry G. First, we studied theories without anomalies. The matrix ensemble splits into several smaller uncorrelated matrix ensembles labelled by the irreducible representations r of G. The ground state energy in each sector is proportional to c 2 (r). The density of eigenvalues in each sector is proportional to (dim r) 2 . One of these factors of dim(r) arises from the exact degeneracy due to the G symmetry. However, there is a leftover factor of dim(r), which implies that the number of copies of each irrep appearing in the spectrum is proportional to dim(r). These copies are not exactly degenerate. One can speculate that they could be related to the existence of a second action of G on the Hilbert space that commutes with the G-symmetry action but does not commute with the Hamiltonian. In other words, the second copy of G acts in the space indexed by the letter i in (2.4), but does not commute with the Hamiltonian. This

JHEP04(2020)186
is reminiscent of the paper [46] that constructed, in the setting of JT gravity coupled to matter, a gauge-invariant SL 2 algebra that does not commute with the Hamiltonian. 26 It may be important to understand this point better. Next, we studied theories with anomalies. The different sectors are now labelled by the projective representations of G. We also studied G symmetry in the presence of time reversal symmetry and concluded that self-conjugate representations correspond to GOE and GSE type blocks, whereas we get degenerate pairs of GUE blocks for representations with r = r. Finally, we studied a mixed anomaly between Z 2 and time reversal, and concluded that the Hilbert space has two sectors that are exchanged by the time reversal symmetry, and hence the matrix ensemble consists of two degenerate GUE-like sectors.
A Disk, trumpet, and double trumpet path integrals in the BF formulation In this appendix, we will compute some path integrals that are necessary for studying the BF theory on spaces with the "non-topological" type of boundary that we discussed in section 3 above. Our goal is to derive the formulas (3.9) and (3.10) for the disk and trumpet partition functions. The action is given in (3.15) supplemented with the boundary condition (3.16).

A.1 The disk
We start with the case of the disk. The path integral over B in the interior of the disk imposes the constraint F = 0, so we have to integrate over flat connections. On the disk topology, a flat connection can be written as 27 26 Juan Maldacena pointed out to us that the Hilbert space of an asymmetric top has this structure: the system has an SO(3) symmetry, but there is a second copy of SO(3) acting on the Hilbert space that does not commute with the Hamiltonian. See, for example, sections 45 and 46 of [75]. One could also consider the bound state spectrum of the Hydrogen atom and consider perturbing away from a pure 1/r potential, which breaks the symmetry generated by the Runge-Lenz vector. 27 We are suppressing a subtlety in the case of non-simply-connected groups that we will return to below.

JHEP04(2020)186
where the formal gauge transformation g is a map from the disk to the group G. In the BF theory, we require true gauge transformations to vanish at the boundary, which means that the boundary values of g cannot be changed by a gauge transformation. These boundary values are physical modes, and we need to path-integrate over them. On the boundary, (A.1) reduces to A τ = g∂ τ g −1 , and the boundary action of the BF theory (3.15) becomes (working with zero chemical potential at the moment) Here g = g(τ ) ∈ G is a function of the time coordinate along the boundary. This action is the well-known 1d sigma model that describes a particle moving on the group manifold G.
There are subtly different path integrals that one can consider with this action. The most obvious option is to integrate g(τ ) over the full space loop(G) of maps from the circle to G, with the ultralocal measure that follows from the metric The path integral with the integration measure associated to this metric is most easily obtained using canonical quantization of the particle-on-a-group theory. The energy eigenfunctions of the corresponding quantum mechanical system are the matrix elements of g in an irreducible representation r, namely ψ r,ab (g) = r, a|g|r, b , and the corresponding energies are c 2 (r)/2. Since there are dim(r) 2 such matrix elements, the degeneracy is dim(r) 2 , and one finds the partition function [76] Z ultralocal (β) = r dim(r) 2 e −βc 2 (r)/2 .
For the application to BF theory, this is not quite the right way to treat the path integral. One can see this by noting that under right-multiplication by a constant group element, g(τ ) → g(τ ) · h, the formula for A in (A.1) is unchanged. This means that the space loop(G) is a redundant description of the flat connections on the disk. Instead, we should integrate over the quotient of this space by right G actions, denoted loop(G)/G.
The appropriate measure for integrating over loop(G)/G is the one that follows from the symplectic form of the BF theory: where δ i A are small changes to the flat connection and Σ is the spacetime manifold. We are interested in evaluating this symplectic form for configurations of the type (A.1), with variations parametrized by δg. It will be helpful to have a formula for the r.h.s. of (A. 5) in the case where one of the variations is a gauge transformation, and the other variation η preserves the flatness of A:

JHEP04(2020)186
In the last step we used that dη + η ∧ A + A ∧ η = 0 in order for the variation corresponding to η to preserve the flatness of A. We can use (A.6) to compute ω(δ 1 g, δ 2 g). We set Θ equal to the gauge transformation associated to δ 1 g, which is Θ = gδ 1 g −1 , and η equal to δ 2 (gdg −1 ). Simplifying slightly, one finds which can also be written as It will be useful to compare the measure on loop(G)/G induced by this symplectic form to the meaure on loop(G) induced by the ultralocal measure (A.3). As we will see, the ratio of these measures is a measure on the group G. First, we note that the symplectic form (A.8) is right-invariant under the action of loop(G), and the ultralocal measure (A.3) is invariant under both left and right actions, so it is sufficient to compare the measures at the identity point g(τ ) = id. At the identity point, we can identify δg −1 (τ ) with an element of the Lie algebra t(τ ) ∈ g, and we can decompose this function into Fourier modes where T A are anti-Hermitian and form an orthonormal basis for the Lie algebra of G, so that Tr The set of Fourier modes parametrize the tangent space to loop(G) at the identity, and the set of nonzero Fourier modes parametrize the tangent space to loop(G)/G. So the ratio of the ultralocal and symplectic measures should be understood as a measure on the space of zero modes t A 0 . To work out the precise measure, we write out the symplectic form explicitly in terms of the coordinates t A n . More precisely, we will write it in terms of the real and imaginary parts of t A n : The corresponding measure is On the other hand, in the same coordinates the ultralocal measure is With this understanding, we can now compute the ratio where in the final equality we took the renormalized product (e.g. using zeta function regularization). The final expression in (A.14) is a measure on the Lie algebra of the group, normalized according to the metric t, s = −2α Tr(ts) , where t, s ∈ g. This metric on the Lie algebra induces a bi-invariant metric on the group, and we denote the corresponding volume as vol(G). Note that this volume depends on the normalization coefficient α. For example, vol(SU(2)) = (4α) 3 2 2π 2 . Our conclusion is that the path integral over loop(G)/G with the symplectic measure will be related to the path integral over loop(G) with the ultralocal measure according to The expression on the l.h.s. is the sum over all representations of the function Z gauge D (β, r) in (3.9). In section A.4 we will show how to get the formula for fixed representation.
We will now address a subtlety that arises in the case of non-simply connected groups. Suppose that we have a gauge field of the form (A.1). In order for this to be nonsingular everywhere in the interior of the disk, the image of the boundary of the disk under g must be a contractible path in the group G. However, for non-simply-connected groups, the integral over loop(G) or loop(G)/G includes configurations g(τ ) that do not have this property.
Such configurations can be incorporated in the BF theory by including nontrivial bundles for the bulk gauge field A. 28 On the disk topology, these bundles can be described using two patches. For example, if we use a radial coordinate r that runs between zero and one, then we can use a patch near the center P 1 = {r < 2/3} and an annular region that includes the boundary, P 2 = {1/3 < r ≤ 1}. The intersection is an annular region {1/3 < r < 2/3}, and the bundle is described by a transition function that maps this region into G. By using a transition function that winds around the desired noncontractible cycle JHEP04(2020)186 of G as the angular coordinate winds around the annulus, we can find a nonsingular flat connection that has the form (A.1) in the outer patch, with noncontractible g(τ ).
For example, in the case of G = U(1), we can take This provides a flat connection on the bundle defined by the transition function In the outer region P 2 , the gauge field is equal to (A.1) with a g that winds n times around U(1).

A.2 The trumpet
Another useful path integral is the "trumpet" path integral. This space is topologically a cylinder, but we will use the term trumpet to emphasize that the two boundaries are treated differently. In particular, at the "big end" of the trumpet, we have a non-topological boundary condition that supports the particle-on-a-group theory. The other "topological" end will always be glued onto another topological boundary, and we will work out how this gluing works later.
For the moment, we are interested in the path integral of the particle-on-a-group theory on the non-topological boundary. The analysis of this system is similar to that of the disk path integral considered above, with one important distinction: because the cylinder contains a non-contractible cycle, there exist additional non-trivial flat connections with holonomy U .
For example, if we take the periodic direction of the cylinder to be parametrized by τ , then a gauge field A = adτ (A. 20) would describe a situation with holonomy U = e −βa . A more general flat connection would be a formal gauge transformation of this one, The particle-on-a-group theory for the trumpet arises from the path integral over the boundary values of g(τ ) on the boundary at "big end" of the trumpet. To analyze this theory, it is convenient to change variables to g(τ ) = g(τ )e −aτ . Then we have simply However, note that g is no longer periodic, but instead satisfies g(β) = g(0)U , where U = e −βa . It makes sense to consider the particle-on-a-group theory with this non-periodic boundary condition and with the ultralocal measure associated to (A.3). Using the Hilbert space for the particle on the group manifold, one finds (see section A.4 below for some details on a slightly more general computation)

JHEP04(2020)186
The path integral we actually want is the one with the symplectic measure (A.5). To work this out explicitly, we start with the expression for A in (A.21). The value of g in the bulk is not meaningful since it can be changed by a true gauge transformation that vanishes on the boundary, but the values of g on the big end of the trumpet are physical. Even so, the parametrization (A.21) is slightly redundant, since multiplication g(τ ) → g(τ ) · h by a group element h that commutes with U preserves the form of A. For a generic U , the subgroup of G that commutes with U will be a maximal torus of the Lie group, which we refer to as T . This redundancy is reflected in the fact that, for a fixed a, the symplectic form (A.5) is degenerate and its zero modes span the maximal torus. To obtain a non-zero answer using the symplectic measure, we must therefore quotient the domain of integration in the path integral by the right-action of elements of T . In other words, we should integrate the boundary values of g over the space loop(G)/T .
We are interested in the path integral over loop(G)/T , with the measure that follows from the symplectic form (A.5). The induced measure on the space of g fluctuations, generalizing (A.8), is We would like to compare the measure associated to this symplectic form with the ultralocal measure. Because of right-invariance, it is enough to work out the ratio of these measures close to the identity, where we can view dg as a Lie algebra element. We decompose the Lie algebra g = g 0 ⊕ g ⊥ , where g 0 is the Lie algebra of the maximal torus T ⊂ G that contains U , and g ⊥ is the orthocomplement of T in G. Then, for the fluctuation components in g 0 , the calculation is the same as for the disk computation above. In particular, the ratio of the ultralocal and symplectic measures in the g 0 directions is a measure on the space of zero modes in g 0 itself. For the fluctuations in the g ⊥ directions, we have to do a new calculation. In general, the measure associated to a symplectic form ω = 1 2 ω ij dx i dx j is given by In the final expression, the ψ i are Grassman variables. To compute the Pfaffian of the symplectic form ω, we replace dx i → ψ i in the symplectic form and integrate exp ω over the variables ψ i . For the infinite dimensional case we are interested in, this becomes a Grassman path integral. It will be enough to consider the case of g = su(2). We will work with the basis for the Lie algebra This is a different normalization than (A.10), but as we will see below, this can be absorbed into the constant α below. We take a = ia Z Z and we want to compute the Pfaffian of JHEP04(2020)186 the symplectic form for the components corresponding to fluctuations in the X and Y Lie algebra directions, working close to the identity. To do so, we make the replacement in the symplectic form (A.24) and then evaluate the path integral over ψ X (τ ) and ψ Y (τ ). This is Here ψ denotes a derivative of ψ with respect to τ . Because we are integrating over all modes, the answer is independent of α and choosing α = 1 4 , this becomes a more-orless conventional path integral, with two Majorana fermions satisfying periodic boundary conditions in Euclidean time. The path integral can be done by performing an explicit mode decomposition, but it is evaluated most easily by quantizing the theory in a twodimensional Hilbert space, e.g.
where we inserted i(−1) F = iZ to impose periodic boundary conditions for ψ X and ψ Y . In order to generalize this computation beyond su(2), it is helpful to rewrite the answer in terms of det g ⊥ (1 − U ) where U acts on g ⊥ via the adjoint action. Continuing with our SU(2) example, we have U = e −iβa Z Z . The eigenvalues of Z, acting in the adjoint representation, are ±2. So (A. 31) This implies that for the case of su(2), we have For a general Lie algebra, we will have a copy of the su(2) calculation for each pair of Lie algebra generators that correspond to a given root. Taking the product over all such factors, one finds that (A.32) is actually the general formula. So the path integral on loop(G)/T is where Z ultralocal (β; U ) was given in (A.23). The factor in the numerator is (A.32), and the factor in the denominator arises from the integral over fluctuations in the g 0 directions, as explained before.

A.3 The double trumpet
The double trumpet is a space with the topology of the cylinder, with the non-topological boundary condition (3.16) on both ends, each supporting a particle-on-a-group mode. The path integral on this space is important, for its own sake. However, it is also useful because the double trumpet can be constructed by gluing two ordinary trumpets together along their "small ends." So comparison of the trumpet path integral and the double trumpet path integral will teach us the gluing rule for the small end of a trumpet. On the cylinder topology, a flat gauge field can be parametrized as 29 just as in (A.21). The path integral for the double trumpet involves an integral over the particle-on-a-group modes associated to both boundaries, together with an integral over the holonomy parametrized by a. The measure for all of these pieces is induced by the symplectic form (A.5).
The new component of the symplectic form that we have to evaluate is ω(δg, δa). To evaluate this, it is convenient to use (A.6) with Θ a gauge transformation corresponding to δg, namely Θ = gδg −1 . The second parameter η corresponds to the variation of a, so η = g(δa dτ )g −1 . We get Here g L and g R are the values of g on the two boundaries of the double trumpet. We can therefore write the full symplectic form as In this expression, g L and g R are functions of τ , but a is constant. As before, we would like to work out the measure induced by this symplectic form. By right-invariance, it is sufficient to work near the identity for g L and g R , so that dg −1 L = dt L and dg −1 R = dt R are Lie algebra elements. For the nonzero Fourier modes of dg −1 , the last term involving a drops out, and we find the same symplectic form as for the trumpet calculation. For the Fourier zero modes, however, the situation is different. Writing the Fourier zero modes as t 0 R and t 0 L , it is convenient to define Then the symplectic form can be written as

JHEP04(2020)186
This form appears to be degenerate, because there are linear combinations of dt + and da that are zero modes of ω. However, all this means is that our coordinates on the space of gauge fields are overcomplete. A quick way to identify a minimal set is to restrict to the set of nonzero modes of the symplectic form. A convenient restriction is to When t − ∈ g ⊥ , the term proportional to 2da in (A.38) vanishes. The part of the integral with t − in g ⊥ therefore combines with the integral with t + in g ⊥ to give the same zero mode integral that is found for the separate computation of two trumpets, as discussed in the last subsection. It remains to understand the measure for the integral over t − and a in g 0 . For these modes, the term proportional to the commutator in (A.38) vanishes. Since βda = dU U −1 , the Pfaffian of the restriction of (A.38) to these modes is just the measure associated to the Lie algebra metric (A.15), restricted to g 0 . Thus the double trumpet with no restriction on the representations on the two ends is given by Our route to this formula was somewhat involved. It seems likely that there is a quicker method, using quantization of the BF theory on the interval that stretches between the two ends of the trumpets. Indeed, the fact that the coefficients that appear in (A.43) must be integers follows immediately from that perspective.

JHEP04(2020)186
A.4 Including a chemical potential We would like to work out the formula for the trumpet or disk partition function when we include a chemical potential µ. The action for the BF theory including µ was given in (3.15), with the boundary condition in (3.16). The corresponding action for the particleon-a-group boundary mode is obtained by substituting (A.21) into the boundary action: This formula is appropriate for the disk when a = 0 and appropriate for the trumpet when a = 0. The global G symmetry for which µ is a chemical potential corresponds to left-multiplication g(τ ) → h · g(τ ). (A.45) With a generic chemical potential included, the symmetry is reduced from G to a maximal torus T . We would like to understand how the above computations of the disk and trumpet path integrals are modified by the µ term. It is convenient to rewrite the action (A.44) as So we have the ordinary particle-on-a-group action, but with a variable g that is not periodic in time, and instead satisfies g(β) = V −1 g(0)U . Here U = e −βa and V = e βµ . With respect to the ultralocal measure, this path integral can be done by quantizing the particle-on-a-group theory. The eigenfunctions of the Hamiltonian are the matrix elements of g in a given representation ψ r,ab (g) = r, a|g|r, b , and the corresponding energy eigenvalue is c 2 (r)/2. This gives

B The case of U(1) symmetry
In this appendix, we write down the partition functions on a general Riemann surface for the special case of U(1) symmetry. The motivation for this case is the complex SYK model, see [36] for recent work. Other references include [29,31]. We can take all the results directly from appendix A, but since the U(1) case is considerably simpler, and of some interest in its own right, we present it here separately, in brief. The action is given in (3.15), with boundary condition (3.16). The path integral on the disk can be reduced to a path integral over the space loop(G)/G. The space of flat connections can be parametrized as A = i dΘ, for which the symplectic form (A.5) evaluates to 2π.) We interpret the right hand side of (B.4) as a sum over the U(1) charges. The overall constant means that we renormalize e S 0 as e S 0 → e S 0 (8π 2 α) − 1 2 . We can Laplace transform this expression to obtain a density of states, which will take the general form (4.5). We emphasize that the path integral (B.4) does not have a Hilbert space interpretation, and is subtly different from the path integral of a particle-on-a-group, because the zero mode is not being integrated over.
The partition function on the trumpet geometry reduces to a path integral on loop(G)/T , but since T = G for U(1), we will get the same expression as on the right hand sides of (B.3) and (B.4). The difference is that if there is a holonomy U = e iϕ on the inner geodesic boundary of the trumpet, then βµ will be shifted to βµ − iϕ.
As an example of a gluing calculation, we discuss the partition function for a double trumpet, which was presented for a general group in section A.3. There is considerable simplification since the "maximal torus" is the entire group as g ⊥ is empty. The factor of vol(T ) and the integral over U in (A.40) are simply interpreted as integrals over the holonomy from the one end of the double trumpet to the other, and the holonomy along the waist, respectively. The result is (A.43).
For a general orientable Riemann surface, we find C AdS-JT gravity plus Yang-Mills theory in the bulk Throughout this paper we have considered either the Yang-Mills theory with a coupling constant that is delta-function peaked on the boundary, or the BF theory with a special non-topological boundary condition. Either way, the theory is topological in the bulk, and this allowed us to be agnostic as to what the gravity theory is, since the full partition function factorized between the gravity sector and the gauge sector (on a given topology). However, one could also contemplate non-topological gauge theories. A mild version of this is the standard Yang-Mills theory in the bulk, with a uniform coupling constant e 2 .

JHEP04(2020)186
In this case, in a given representation sector, the gauge theory path integral depends on the metric, but only in a very simple way [44] Z Y M g (U 1 ; . . . ; U n ) ∝ r (dim r) χ χ r (U 1 ) . . . χ r (U n ) exp −e 2 Ac 2 (r)/2 , (C.1) where A is the area of the surface. We would like to make two comments about this. First, the action of JT gravity can be written as a linear combination of the Euler characteristic, of A and of L where L is the boundary length [77,78]. So in a given representation sector, the effect of the Yang-Mills theory is just to change the coefficient of the A term. This means that JT gravity coupled to Yang-Mills (even with finite coupling) is as solvable as ordinary JT gravity.
Second, in the case where we define JT gravity with asymptotic boundaries rather than boundaries of finite length, the area A will go to infinity. In order to avoid projecting onto a single representation in (C.1), we will need to take e 2 → 0 in this limit, in such a way that e 2 A is finite. Because we are working in hyperbolic space, the area A will be proportional to the boundary length, and in fact we will find e 2 A → #(β 1 + · · · + β n ) (C. 2) where β j are the renormalized lengths of the boundary components, and # is a constant that can be absorbed into a redefinition of β. In the limit of asymptotic boundaries, then, JT gravity coupled to Yang-Mills theory reduces to the rather odd theory we studied in the main text, with e 2 concentrated in a delta function at the boundaries.
Open Access. This article is distributed under the terms of the Creative Commons Attribution License (CC-BY 4.0), which permits any use, distribution and reproduction in any medium, provided the original author(s) and source are credited.