Toric codes and quantum doubles from two-body Hamiltonians

We present a procedure to obtain the Hamiltonians of the toric code and Kitaev quantum double models as the low-energy limits of entirely two-body Hamiltonians. Our construction makes use of a new type of perturbation gadget based on error-detecting subsystem codes. The procedure is motivated by a PEPS description of the target models, and reproduces the target models' behavior using only couplings which are natural in terms of the original Hamiltonians. This allows our construction to exactly capture the symmetries of the target models.

There has been a surge of interest recently in spin lattice models because of their strange and wonderful properties. From the perspective of condensed matter physics and quantum many-body theory, they have recently led to major advances in our understanding of the nature of quantum phase transitions and topological order in two-dimentional systems. The topological properties of these models are also of interest in quantum computing and quantum error correction. A system with topological order can possess intrinsic error correction or protection capabilities. These are exploited for quantum data storage [1][2][3] or quantum information processing [4][5][6] with high error thresholds. The encoded logical operations in topological models are associated with non-trivial homology cycles on a lattice of spins. A lattice which has a non-trivial topology (such as a torus or punctured disk) can encode quantum information into its ground states which is robust to small local perturbations of the Hamiltonian.
Many models which are relatively simple (from a theoretical point of view) contain topologically ordered ground states. The toric code and its generalization to the quantum double models [7] are a significant class of exactly solvable models containing a range of different topological orders. Quantum double models of non-Abelian groups can support non-Abelian anyons, quasiparticles whose exchange statistics transcend the traditional Bose-Einstein/Fermi-Dirac dichotomy that is ubiquitous in three dimensions. Braiding such quasiparticles can be used for universal quantum computation [8][9][10][11].
However, these models (and other more general topological models [12]) consist of many-body interactions that are quite challenging to implement experimentally, as they usually involve interactions between four or more bodies. By contrast, most natural couplings are only 2-body. It is therefore of interest to find systems with only 2-body interactions which can realize topologically ordered phases.
An example of a 2-body system with a topologically-ordered ground state is the Kitaev honeycomb model [13]. This well-studied model is being pursued experimentally in a number of systems, but unfortunately it cannot be used for universal quantum computation.
Aside from explicitly finding 2-body models which reproduce a particular desired type of topological order (certainly challenging), one can use perturbative techniques to reproduce an existing many-body model as the low energy effective behaviour of a 2-body system. The perturbative gadgets approach [14][15][16][17] is the standard tool to achieve this, but it has a number of drawbacks. By tailoring the perturbation gadgets to specific classes of models, one might hope the result is a simpler construction circumventing many of these difficulties.
Here we present a new type of perturbation gadget that works by encoding the logical qudits of the target models in quantum error-detecting codes. This allows us to reproduce the properties of topological models as the low-energy effective Hamiltonians of 2-body systems. Here we concentrate specifically on the quantum double models, but we anticipate that a similar mechanism could be tailored to other classes of models (e.g. string net models [12]). Our construction is natural, in the sense that all of the interactions of our system are very closely related to the interactions of the target model, and because of this, an extensive number of symmetries of the target model are preserved exactly from the level of the physical lattice.
Unlike Kitaev's honeycomb model, our constructions are not exactly solvable. However, our results are a significant extension of Kitaev's method in that they can yield any type of topological order (i.e. different types of anyons) within the class spanned by the quantum double models, including those which are universal for quantum computation.

II. RESULTS AND METHODS
In this section we give an overview of our results and the methods we use to obtain them. To avoid obscuring the essence of our work with unnecessary technical details, we will use the toric code model as a concrete example in many places. However, we stress that our results immediately carry over to all of the cyclic (Z d ) quantum double models, and extend to the general non-Abelian quantum double models with just minor adjustments.

A. The Quantum Double Models
The quantum double models [7] are a class of spin-lattice models which exhibit topological order. They can be used as topological quantum error-correcting codes based on the algebra of the Drinfeld double D(G) of a group G. The simplest member, corresponding to the group Z 2 , is the well-studied toric code model.
For simplicity, we define the quantum double models on a square lattice (although they can be defined on any oriented graph) with qudits (d-level quantum systems) on the edges, as in Figure 1. The lattice can be embedded into any 2-dimensional orientable surface, such as a torus. The Hamiltonian for the model takes the form where v denotes a vertex of the lattice and p denotes a plaquette. In the simple case of the toric code, the vertex and plaquette operators are defined by where the form for the star of a vertex +(v) and the boundary of a plaquette (p) can be seen in Figure 1, and X e and Z e are Pauli matrices acting on the qubit located on the edge e. Since we are working on a square lattice, each of these terms are clearly 4-body. For more complicated quantum double models, the A(v) and B(p) operators take slightly different forms, but will always consist of operators acting on the star of a vertex or the boundary of a plaquette. The exact details of the quantum double construction are given in Sec. IV. When the surface in which the lattice is embedded has genus g, then the ground space of the toric code is 4 g -fold degenerate, and thus can encode 2g qubits. This particular encoding has generated so much interest because it is in some ways naturally robust to local errors [1,7,18,19]. The dimension of the codespace for a non-Abelian quantum double model is more complicated, but on a torus the the degeneracy of the ground space is equal to the total number of particle types [20,21].

Overview of Our Construction
Our main result is the construction of a wholly 2-body Hamiltonian that reproduces the quantum double Hamiltonian of Eq. (1) as its low-energy limit. Our procedure uses only qudits of the same dimension as in the target model. Furthermore, the couplings that we use have the same form as in the original model. As an example, notice how each A(v) and B(p) term from Eq. (2) consists of the tensor product of four Pauli X terms or 4 Pauli Z terms, respectively. Our construction for the toric code will involve products of only two Pauli X terms or Z terms.
Each qudit on the edges of the original model is encoded in four physical qudits, shown in Fig. 2. The 2-body interactions among these four qudits will give us an effective single-qudit degree of freedom in the low-energy limit. This gives a 4-fold increase in the number of qudits required to construct our model as compared with the target model. We will couple neighbouring encoded qudits perturbatively, and the perturbation expansion will yield the desired Hamiltonian at 4 th order. This order is related to the coordination number of the underlying lattice and the number of edges bordering each plaquette, both of which are four for a square lattice. In contrast, on a honeycomb lattice terms will arise at 3 rd and 6 th order in perturbation theory (though there would still only be a 4-fold increase in the number of physical qudits required).
We achieve these results with a blend of techniques from condensed matter physics and quantum information theory. Before sketching how we use these techniques, we briefly mention each one in turn.

Projected Entangled Pair States.
Our construction is inspired by projected entangled pair states (PEPS), a class of quantum states particularly well suited for describing the ground states of interacting quantum many-body systems [22][23][24][25][26][27]. Indeed, for the case of 1-dimensional systems this is provably the case [28]. The basic idea of these states is to use virtual pairs of entangled systems to simulate correlations. For every coupling between neighboring systems on a lattice, a maximally entangled state (of some chosen dimension) is introduced between the systems. These virtual entangled pairs are then projected down to a "physical" subspace with a dimension equal to the that of the spins in the original model. An illustrative construction is depicted in Figure 2 for the special case of a square lattice.
One would expect the kinds of models we are studying to have an efficient PEPS representations of their ground spaces because of the facts that they obey an area law, possess a spectral gap above the ground state, and contain finite correlations. In fact, the PEPS representation of the toric code ground space has been studied by Verstraete et al. [29], and a PEPS representation of general quantum double models is also known [30]. PEPS descriptions have also been developed for all of the string-net ground spaces [31,32] and the symmetries of these PEPS descriptions have been explored [30]. The quantum double models on trivalent lattices can be mapped to string net models [33], and generalisations of the quantum double models are also being interpreted as extended string net models [34]. In our construction we have an implicit PEPS representation for the quantum double models which is presumably equivalent to those already known (this is provably the case for our construction of the toric code).

Perturbation Gadgets.
The next technique that we use is that of perturbation gadgets [14][15][16][17]. Perturbation gadgets are a method for systematically reducing the complexity of a many-body coupling between a large number of quantum systems. The gadgets generally consist of introducing some ancilla qudits which act as conductors, in the sense of the conductor of an orchestra. By having a strong coupling to the conductor, n separate primary qudits can synchronize their behavior in a way which mimics an n-body coupling at low energies, but by using couplings having only a fraction of the "body-ness". By recursively applying these general constructions, one can arrive at a strictly 2-body Hamiltonian for an arbitrary n-body coupling. The cost is that this coupling only occurs at a higher order in perturbation theory.
Our construction is a new variant on the perturbation gadgets approach. The concept is very similar, but instead of beginning from the original lattice and adding ancilla qubits to break up many-body interactions, we begin by encoding the qudits of the original lattice into a 4-qudit system. These systems are then coupled via relatively weak 2-body interactions, which enable us to treat the entire model perturbatively and show that it reproduces the target model in the low-energy limit. We will refer to these 4-qudit encoded systems as "code gadgets". Apart from the intrinsic interest of a new approach, we also manage to bypass a number of pitfalls that naive application of the perturbation gadgets can encounter. In particular, the resource cost of perturbative gadget schemes scales poorly with the system complexity, and a naive application of the technique can lead to the energy gap scaling with the system size or the fidelity of the topologically ordered states [17,35]. While this can be avoided, it remains a problem with applying the method in general. Additionally, while the couplings can be reduced to FIG. 2: PEPS description on a square lattice. Each qubit (for the toric code, or qudit in general) on an edge in the original model is replaced by four qubits (or qudits in general). Qubits connected by a wavy line are in a maximally entangled state. Each blue circle represents a projection down to a single encoded qubit. The quantum states in the support of these projectors are encoded qubits, entangled with each other. The global state space contains exactly the states in the ground space of the original toric code model. With toroidal boundary conditions, the ground space is four-fold degenerate. Our construction proceeds by simulating these local projections and the entangling interactions with 2-body Hamiltonians. only 2-body, the nature of these 2-body couplings is in general vastly different from the couplings of the original model. It is plausible that by taking advantage of structure a much simpler construction could be devised that is specifically tailored to the model, using couplings that exploit this structure. This is the approach taken by Koenig [36], who showed that a simple "clock" gadget could reduce the complexity of the quantum double models to only 3-body terms. Our construction also follows a similar strategy in some sense, but uses perturbative couplings that are direct analogues of the original models' terms on simple surfaces.
The type of gadgets that we use are adapted for use with states that are ground states of local Hamiltonians and have a simple PEPS description [37]. The virtual entangled pairs of the PEPS description are promoted into real physical systems with a coupling such that their ground state is a maximally entangled state. Then the PEPS projection can be done by using strong interactions between the systems within a code gadget which energetically favors the subspace defined by the PEPS projection. When this coupling within a site is much stronger than the entangling coupling between sites, the resulting Hamiltonian at low energy approximates the desired many-body Hamiltonian, with the same ground space up to perturbative corrections. This technique was originally used [37,38] to find 2-body Hamiltonians whose ground state encodes the cluster state [39], a state which is universal for measurement-based quantum computing. Our technique is very similar, in that the target models are reproduced in an encoded manner, i.e. the 4-qudit code gadgets of our construction serve as the logical spins of the target model.

Subsystem Quantum Error Detecting Codes.
Finally, we make use of quantum error-detecting codes [40][41][42] to ensure that all of the undesirable terms in the perturbative expansion do not couple to the low-energy sector of our model. Recall that a quantum error-detecting code consists of a subspace of a larger Hilbert space, which is protected from some set of errors on the large Hilbert space. This protected subspace, the codespace, is used to store encoded logical information. The mapping between the codespace and the physical Hilbert space defines the encoded logical operators. Detectable errors move the system out of the codespace, and so can be detected by a suitable measurement.
Specifically, we use a particular type of quantum code known as a subsystem code [43,44]. Compared to stabilizer codes, subsystem codes are no more powerful in terms of the number of errors they can detect, rather, their power lies in a simplification of the recovery operations required to fix the errors. The physical Hilbert space is partitioned into distinct subsystems: the logical subsystem and a "gauge" subsystem. As in a stabilizer code [42], stabilizer operators are defined such that the logical codespace is in the mutual +1 eigenspace of these operators. If an error moves the system out of this +1 eigenspace, it can be detected by measurement of the stabilizer, and must actively be corrected. In contrast, the logical state is taken to be invariant under a transformation on the gauge system, and so any errors that occur on this gauge space are passively avoided.
The code we use on our gadget construction is designed so that any operations contributing to unwanted terms in the perturbative expansion will be detected as errors, and map the ground space to another energy eigenspace with higher energy. In this way, the code ensures that the low energy behavior of our system will remain error free, in the sense that only desirable terms (i.e. those of the target model) will remain. Errors which move the system out of the codespace need not explicitly be corrected because they will be suppressed heavily by an energy penalty for doing so. Note that the "errors" that occur in the gadget code are unrelated to errors appearing in the target model we are trying to replicate. Instead, they mix the protected low-energy sector with higher energy (unprotected) sectors, thus preventing our system from mimicking the target model perfectly.
Our models are similar in many respects to the topological subsystem codes of Bombin [45]. These models, based on the color codes [46,47] and their qudit generalizations [48], yield a subsystem code using local 2-body gauge generators. We note that the construction of [45] requires a 3-colorable lattice, whereas our method applies to any lattice for which the desired model possesses a PEPS description. Additionally, Bombin's models possess an exactly degenerate ground space while our models' ground spaces are only approximately degenerate (as in the Kitaev honeycomb model [13]), but where the degeneracy is only broken at very high order (roughly the linear size of the system). One consequence of this exact degeneracy in the Bombin model is that it is straightforward to define quantum error correction in the ground space [49] where perfect recovery operations will yield perfect recovery from correctable errors. By contrast, in our model even perfect recovery operations will yield some small error due to the splitting of the ground space. While the small error in recovery seems unavoidable in our model, it might still be the case that our model yields higher thresholds due to the substantially simpler stabilizer measurements that are required. It is an open problem to define error correction and exactly quantify the errors incurred by the splitting for our model. Aside from both of our constructions being viewed as a generalization of the honeycomb model, we are not aware of any deeper connection between them.

C. Discussion
Our results allow us to replicate in the low-energy limit the Hamiltonians of certain topological models, but a more ambitious goal is to reproduce the topological order in the ground state wavefunctions of these models, as well as in their low-lying excited states. To demonstrate that our constructions reproduce all the topological properties of the original models, we would need to show additional properties. First, we would need to show that these topological orders are stable under the kinds of perturbative corrections that our procedure introduces. There are two separate types of corrections which could threaten the stability of the topological properties of our models. The first are the very high-order corrections where perturbation terms can form non-trivial homology cycles on the surface of the model. These will occur at order 2L in perturbation theory (with L the smallest linear dimension of the surface) and split the ground space degeneracy of the encoded model. They can be heavily suppressed by increasing L or by increasing the bare energy gap of the system. The second kinds of corrections to consider are those which leave the protected ground space of our code gadgets. These allow transitions into higher energy subspaces where our encodings fail. These kinds of corrections are suppressed energetically by the energy gap. Thus, we would also need to demonstrate stability of the energy gap in the thermodynamic limit. It would also be quite interesting to compute the topological entanglement entropy in the ground state [50][51][52][53].
Like the toric code model in two dimensions [1,54,55], the topological order of Kitaev's non-Abelian quantum double model is not expected to persist at finite temperature. We expect that our models will have similar behaviour to the original quantum double model at finite temperature, and in particular, that they will suffer from the same "thermal fragility" of the topological order.
Even more ambitiously, one might hope to show that our models remain gapped even in the presence of arbitrary local perturbations, with only very small splitting of the ground state degeneracy and the degeneracy of the excited states. For topological models whose Hamiltonians consist of a sum of commuting projectors, just such a result was shown by Bravyi, Hastings and Michalakis [18,19].
Unfortunately, their techniques cannot be directly applied to our models since our Hamiltonians are not sums of commuting projectors. In fact, our models do not have frustration-free ground states either (meaning the ground states are not minimum-energy eigenstates of each term separately in the Hamiltonian) and hence other results on frustration-free systems also do not apply.
As one might expect from a perturbative construction, our effective Hamiltonian can be thought of as the target Hamiltonian plus perturbative corrections. Generically in this type of construction, the symmetries of the target model will be recovered approximately, up to these corrections. In our model, the encoded string operators of the target models will not commute with the perturbative terms in the Hamiltonian, and the corresponding ground space degeneracy will also be split. This splitting will be exponentially suppressed by the size of the lattice (as noted above), and so these symmetries will be recovered approximately as one might expect. In the quantum double models, there are also an extensive number of vertex and plaquette operators which commute with the Hamiltonian and form a quantum double algebra. It is possible to construct encoded counterparts of these operators on our model which also commute with our full Hamiltonian and form an equivalent algebra. In contrast to a generic perturbative construction, this large symmetry group is reproduced exactly by our model. This symmetry group severely constrains the arbitrarily high order terms arising from the perturbation expansion, and prevents undesirable terms from appearing. In fact, higher order terms in our effective Hamiltonian will act on the logical codespace as products of (commuting) lower order terms until the perturbative order is sufficiently high to form non-trivial loops over the lattice and break the ground space degeneracy.
As well as capturing symmetries of the target models, our construction is also natural in the sense that it is built from miniature quantum double models overlaid on each other. In the case of Abelian quantum double models (including the toric code), there is an exact correspondence between our constructions and quantum double models on simple surfaces. For these models, the ground space of our code gadget is chosen to coincide with a subspace of the quantum double ground space on a 4-qudit torus (see Sec. VI B). That is, our codespace is stabilized by the same operators as the ground space of the quantum double Hamiltonian on this torus. These stabilizers would normally be 4-body, so in order for our codespace to obtain this property from a 2-body Hamiltonian we must sacrifice the degeneracy of one of the two qudits a torus can typically encode. In addition, the perturbative bond terms we introduce can be interpreted as quantum double models on a 2-qudit sphere (see Sec. VI C). All the terms present in our model reflect the construction of the quantum double models on small surfaces. In non-Abelian models, the correspondence in the Hamiltonian is not as precise due to the distinction between left and right regular representations. However it will still be true that the ground spaces of our code gadgets will correspond to a subspace of the quantum double ground space on a 4-qudit torus, and the ground space of the perturbative bond terms will correspond to the ground space of the relevant quantum double model on a 2-qudit sphere.
Our work is inspired by the construction of Bartlett and Rudolph [37], who used encoded qubits to reproduce the cluster state as the ground state of a 2-body Hamiltonian. As with the model we present, the encoding is closely related to the PEPS description of the target state. Our work generalises this type of construction by using a subsystem code (as opposed to a subspace code). In order to reproduce the PEPS space as the ground space of a 2-body Hamiltonian, we have had to sacrifice the extra gauge degrees of freedom in our model. This would not have been possible if we had used a subspace code, where these gauge degrees of freedom are not available.
The procedure we present reproduces the quantum double Hamiltonian in the perturbative coupling limit. If we consider the opposite (strong coupling) limit in our model, the system will act as a disconnected set of maximally entangled pairs. In this limit, the lattice can be thought of as a set of disconnected quantum double models on spheres (up to the caveats noted above). There must be some phase transition(s) between these states, and the respective topologies in the two limits are suggestive of the kind of behavior studied by Gils et al. [56]. The phase transition would be between different topologies in the sense that the quantum double model would act on the entire lattice together in one limit, and at some critical coupling strength break down to act on disconnected portions of it.
A robust topologically ordered system would also have anyonic low-energy excitations which, ideally, would be similar to those of the desired quantum double model. One would need to consider the effect of the perturbative corrections in our model on these anyons and any other excitations, as for example in [57][58][59].
It would also be interesting to explicitly and rigorously show that cooling our Hamiltonians by coupling to a local bath can bring them to the ground space quickly. (Cooling to a particular ground state of the degenerate ground space is more difficult, but also quite interesting.) Because of the frustration in the model, it isn't immediately obvious that this can be achieved efficiently, i.e. in an amount of time polynomial in the size of the system. But because the low-energy effective theory is frustration-free, it certainly seems plausible that the cooling can be done efficiently.
It is noteworthy that the codes we utilise in our construction for general quantum double models are examples of extensions of the stabilizer formalism to non-Abelian groups. This has not been closely studied previously, and in that sense the quantum codes we use may be of interest in their own right.
We believe that the kind of approach we employ here to reproduce topological orders may be more generally applicable to other systems with efficient PEPS representations. Some work towards extending this treatment to the class of string net models [12] supports this belief, with some caveats, and will be presented in a future publication.
Finally, we thank Miguel Aguado, Sergey

III. EXAMPLE: THE TORIC CODE
As a simple and illustrative example of our scheme, we now demonstrate how to construct a two-body Hamiltonian for which the low-energy behavior reproduces the standard toric code Hamiltonian on a square lattice. This simple example possesses all of the key features of our general construction for the quantum double models.

A. PEPS Representation of the Toric Code
We begin our construction by replacing each qubit on the edges of the toric code lattice with four qubits, as in Fig. 2. We use the term bond to refer to the wavy lines in Fig. 2 that connect the maximally entangled pairs of physical qubits. By contrast, we use the word edge to denote the edges of the original lattice. In the PEPS description, the projection operators acting on each edge will entangle these four qubits into a single qubit. We achieve this projection in the ground space of a Hamiltonian defined on each edge e. ( This notation is a convenient visual shorthand for the tensor product of the operators acting on the given physical qubits. For each edge, the collection of 4 qubits forms our "code gadget". The Hamiltonian contains only two-body terms acting within the gadget itself. Instead of the explicit projection mechanism of the PEPS scheme to reduce the Hilbert space, our model simply supresses by energy penalty states which lie outside the desired PEPS projection. It can be shown that the projectors to the ground space of our edge Hamiltonian are equivalent to the projectors in Ref. [29] since they are equal modulo the gauge freedom in choosing the PEPS description; however, explicitly demonstrating this equivalence is tedious (though straightforward) so we omit this.
Next, we introduce entanglement across the bonds by coupling sites on different edges. Thus for each bond b, define the perturbation term chosen because it possesses a maximally entangled state as its ground state 1 . Our unpertubed Hamiltonian is summed over all edges e: and our perturbation term is summed over all bonds b: For those readers familiar with PEPS, it may seem counterintuitive to treat the bond term as small compared to the code gadget Hamiltonian (which is simulating the PEPS projection). We will see that this is in fact the correct approach to recover the target model. We introduce a coupling strength λ which is a small parameter compared to the strength of the main terms in our Hamiltonian (which we have taken to have unit norm). The full Hamiltonian describing our lattice is then given by Now we need to compute the perturbative low-energy effective Hamiltonian to leading nontrivial order in λ. We will find the exact ground space of H(e) in the next section, and then show that the perturbations λV will generate operators which reproduce an encoded toric code Hamiltonian (Eq. 1-2) at fourth order in λ.

B. Solving the Code Gadget Hamiltonians
We must first demonstrate that H(e) of an edge e has a two-dimensional degenerate ground space. We will show that this ground space is in fact the codespace of a subsystem quantum error-detecting code, which will greatly assist the perturbative analysis in the next section. Our analysis of this Hamiltonian for the toric code construction follows Bacon [61]. Because we are always working on a particular arbitrary edge (within a particular code gadget), we will suppress the label e in this section.
The code gadget Hamiltonian H (Eq. 3) posesses a number of constants of motion. That is, we can define operators that commute with each other, and with the Hamiltonian. In fact some of these operators are the stabilizers of a quantum code, so we label them S. They form a commutative group, and are generated by We can also define other joint operators to complete the algebra of our code gadget. We will call these operators gauge operators and logical operators, and denote them with appropriate subscripts. and . This choice also approximately realizes the toric code Hamiltonian in the small λ limit. The resulting Hamiltonian Eq. (7) is precisely equivalent to Kitaev's exactly solvable honeycomb model on a mosaic tiling [60]. We do not consider this possibility further since it is unclear how to generalize it to more complicated quantum double models. It is interesting to note, however, that this alternative choice results in a model with topological order in the large λ limit, in contrast to our models which become valence bond solids.
We see immediately that these operators encode two orthogonal copies of the Pauli algebra, so they define two encoded qubits. In terms of these new operators, we can rewrite the gadget Hamiltonian The protected subspace of our code, also corresponding to the ground space of the Hamiltonian, is a subspace of the +1 eigenspace of the stabilizers S X and S Z . Any single qubit error will anticommute with at least one of these, and so could be detected (though not unambiguously) by measurement of the stabilizers. This means that any single qubit error will neccesarily move the system out of its ground space, and will be suppressed by the energy penalty for doing so.
We can easily check that the logical operators X L and Z L also commute with H. However, neither X G nor Z G commutes with H. Given all these facts, H decomposes into a direct sum of four copies of L ⊗ G, each labeled by the pairs of eigenvalues (±1, ±1) of S X and S Z , and furthermore the energies in the logical space are degenerate. Thus, we only have to solve the Hamiltonian on the gauge subspace of each stabilizer eigenvalue to find the ground space.
It turns out the ground space is contained in the (+1, +1) block, and it is exactly two-fold degenerate. We provide a proof of this statement and its generalization to all the quantum double models in Appendix D. It can be shown that within this codespace the encoded computational basis states take the (unnormalised) form: Now that we have determined that the ground space encodes a qubit in an error-detecting code, we can perform the perturbative analysis to compute the low-energy effective Hamiltonian.

C. Perturbation Analysis
We now introduce the perturbative coupling of Eq. 4 between our encoded qubits on the lattice. We use the Green's function perturbation method, following Kitaev [13] (see also [62]) to calculate the leading non-trivial order in the effective Hamiltonian, defined as H eff = E 0 +Σ(E 0 ), with the unperturbed ground state energy of the lattice E 0 and Σ the self-energy. In this, we have approximated the self energy as being independent of E, for E ≈ E 0 . More details of our perturbation formalism are in Appendix A.
The key to our analysis is the fact that quantum codes map detectable errors to orthogonal states. In terms of the gadget Hamiltonians H(e), this means that any single-qubit Pauli operator anti-commutes with either (or both) of S X or S Z , and hence maps ground states to orthogonal states, since these states must lie in some block of H(e) other than the (+1, +1) block.
The consequence is that the perturbation analysis greatly simplifies. It immediately gives the result that all odd-order perturbation terms will vanish, as they will necessarily leave two code gadgets in excited states. The terms at second order only contribute an energy shift, since those that don't vanish act twice on the same qubits, hence they act proportionally to the identity. The first non-trivial terms appear at fourth order, and we can write the 4th-order effective Hamiltonian as follows: where Υ is the projector to the ground space of the unperturbed system and G 0 ( is the Green's function (resolvent) projected to vanish on ground states. The Υ will project the stabilizer and gauge degrees of freedom down to a single state, but will act identically on the logical degree of freedom. The non-trivial fourth order terms arise by constructing joint operators around a plaquette or around a vertex which leave all the code gadgets in the ground space. By expanding Eq. 13 and ignoring constant energy shifts, we can express the effective Hamiltonian to 4 th order as where v and p sum over all vertices and plaquettes, respectively. The operatorsÂ(v) andB(p) are each a sum of two terms,Â where these terms are quite cumbersome to express algebraically, so we define them pictorially in Figure 3.
Basically, these operators act on the pairs of qubits in an edge that are nearest to the center of a given plaquette or vertex. We can derive from Fig. 3 thatÂ(X, v) acts like a tensor product of logical X L operators on each of the edges surrounding v. This is not immediately obvious; we must use the fact that in the ground space X L = S X X L to exchange the action of the logical operators between pairs of qubits at a particular edge. Similarly,B(Z, p) acts like a tensor product of logical Z L operators around the plaquette p. The other operatorsÂ(Z, v) andB(X, p) act like gauge operators in a similar fashion. When these encoded gauge operators are mapped back to the ground space by Υ, they contribute only a constant energy shift, which we can ignore.
We can think of theseÂ andB operators as acting equivalently to some logical operators within the ground space. If we defineÂ then we can see that within the codespace, they are equivalent (up to muliplicative and additive constants) toÂ andB respectively. That is, We can think of the logical Hamiltonian acting within the codespace as being comprised of these operators, such that When restricted to the codespace, this is exactly the effective Hamiltonian we previously derived (again, up to multiplicative constants and energy shifts), so that H eff ∝ ΥH L Υ + const (19) Noting that the logical operatorsÂ L andB L act on the logical state exactly like the toric code vertex and plaquette terms, we can see that on the logical space, our effective Hamiltonian is the toric code Hamiltonian of Eq. 2 up to constants, as claimed. The higher order terms in the expansion for the self-energy (see Appendix A) will generally act on the logical space like products of the terms appearing in Eq. (18). Moreover, for low energies all these terms will be negative, since the perturbation term and the Green's function will both be non-positive and so each term in the expansion will be negative. All these terms in the self-energy expansion will commute, and so the ground space should remain the +1 eigenspace of the terms in Eq. (18) as desired. There will be some corrections to the excited spectrum of the effective Hamiltonian due to these higher order corrections and due to the energy dependence of the self-energy as discussed in Appendix A But as we are mainly interested in the topologically ordered ground space, this does not concern us especially. At very high order it will be possible to construct terms which run all the way around the torus. These errors will corrupt the logical state. If the linear size of the torus is N , these terms will appear at 2N th order, and will be suppressed by a factor of λ 2N .
This result allows us to take a system of only two-body couplings, and in the low energy limit reproduce the Hamiltonian of the toric code. This means we might expect to be able to use the topological properties of the toric code to protect quantum information without the requirement for experimentally problematic many-body couplings. A similar result of obtaining the toric code in a limit was observed in Kitaev's honeycomb model [13]. In contrast to our construction, this honeycomb model is exactly solvable. Although we can only solve our model perturbatively, we can generalize it relatively easily to more complicated quantum double models (and lattices other than square), as will be seen in the following sections.

IV. REVIEW OF QUANTUM DOUBLE MODELS
The quantum double models consist of coupled finite-dimensional quantum systems on the edges of a lattice, and their ground states exhibit topological order [7]. In this section, we will define the quantum double Hamiltonian that will become the target model of the perturbative two-body systems that we will work with in the subsequent sections.
As with the toric code, we will work with a square lattice for concreteness. The lattice can be embedded into any orientable 2-dimensional surface. To each edge e of the lattice we will associate an orientation, as in Figure 4. Although this orientation could be arbitrary, we chose the orientation in Figure 4 because it has the convenient feature that each vertex can be labeled with either a "+" or a "−" sign. In fact, any bipartite lattice can be partitioned in such a way.
We associate each quantum double model with a finite group G, and a local Hilbert space for each edge C |G| , with |G| the order of the group. On each edge e of the lattice, there exists a natural orthonormal basis {|g e , g ∈ G}, for these degrees of freedom. The total Hilbert space is then the tensor product of the local Hilbert spaces over all the edges.
We now define a number of operators that act on these edge degrees of freedom. For each edge e, define operators associated with left (+) and right (−) group multiplication and group projectors as follows: The operators on a single edge form an algebra defined by commutation relations Clearly, operators acting on different edges commute. We also associate a sign ± to each vertex and plaquette relative to their incident edge. This is illustrated in Figure 4. If an edge spans the vertices (v − , v + ), then the arrow along the edge points away from v − and toward v + . Plaquettes to the left of an edge when looking along its direction are labelled p − , while those to the right are labelled p + .
It is convenient to associate a particular operator with a (plaquette, edge) pair or a (vertex, edge) pair. That is, depending on the sign of the vertex or plaquette under consideration at the time (v ± or p ± ) respective to the edge under consideration, the sign of the group multiplication and projection operators can be inferred. Explicitly, we define The L operators play the role of a generalized Pauli X operator in the group element basis, insofar as they move a particular state |g through the space of elements. To make the analogy with the toric code more apparent, we can also construct some operators which act as generalized Pauli Z's for an arbitrary group algebra. Let π be a unitary irreducible representation of G. Then we can define a type of Fourier transform by where [π(g)] ij is the (i, j) th element of the representation matrix for group element g in representation π. Equivalently, we can invert this expression to obtain where the sum is over the complete set of unitarily inequivalent irreps of G and d π is the dimension of the irrep π. Although the quantum doubles are typically defined in terms of T operators, the algebra of these generalized Z operators gives the most convenient form for a particular calculation later on. Given these preliminary operators, for each vertex v we can define operators where +(v) is the set of edges incident on the vertex v (recall Figure 1). We can average these operators over the group to give the projector Given a plaquette p and a fiducial edge on its boundary that we label e 1 , we can define an operator where e i are the boundary edges taken as the plaquette is traversed clockwise starting with e 1 , and there are k total edges on the boundary of p. These operators are all orthogonal projectors, but note that this definition depends on the choice of the fiducial edge e 1 . However, if we consider the operator where 1 is the identity element of the group G, then it is easy to see that B no longer depends on the choice of this fiducial edge. For all p and all v, the B(p) operators and the A(v) commute pairwise amongst themselves and each other. Finally, the following Hamiltonian defines the quantum double model in a fashion which directly generalizes the toric code.

A. Simplifications in the Case of Cyclic Groups
It will be instructive to treat the cyclic groups Z d before moving on to the general case. For that reason, we revisit the above discussion specialized to this setting. Because each of the |G| representations of the (Abelian) groups Z d are 1-dimensional, we can relate the L and Z operators by a simple discrete Fourier transform for these groups. In cyclic groups (with d = |G|), the group multiplication operation is addition (modulo d), and so the left and right multiplication operations are equivalent. Following this, the convention for the identity element in cyclic groups is 0 as opposed to 1 for general groups. With no need for unique left and right multiplication operators, we define the cyclic L operator by The addition within the ket is performed modulo d. Note that the group action of any other element can be achieved in these models by taking powers of this (unitary) operator. We also define a set of group projection operators Following the general case, we also define a generalized Pauli Z operator. As representations of the cyclic groups are 1-dimensional, we can define a primitive Z corresponding to a representation ω where ω is a primitive d th root. Other representations of the group correspond to powers of ω, so to obtain the operators corresponding to these representations, we need only take powers of this Z operator. Thus we regard the powers of Z as being labelled by representations of Z d . If we take a discrete fourier transform on the basis |g , we obtain: where we label the Fourier basis with Greek letters (corresponding to irreps). This transformation diagonalizes the L operators: and so we can see that the Z and L operators are simply a basis change away from each other in these cyclic models, as was the case with the Pauli matrices for the toric code. As they are both unitary, we can also say In terms of the definition of the quantum double model for cyclic groups, the only changes we need make to become consistent with this simplified set of operators is to slightly redefine the associations of L and T operators with ± vertices and plaquettes, i.e.
With this in mind, the quantum double Hamiltonian is defined exactly as in the general case.

V. OUR CONSTRUCTION FOR THE CYCLIC QUANTUM DOUBLE MODELS
In this section we will show how our construction on the toric code generalizes naturally to the quantum doubles of cyclic groups. The toric code model corresponds to the quantum double of the group Z 2 ; here we extend this treatment to the quantum double of G = Z d , where |G| = d is the order of the group. This analysis could be extended to general Abelian groups. However, for simplicity, and because the fully general case is considered in the next section, we restrict our attention to cyclic groups in this section.
In order to reproduce the cyclic quantum double models, two features must be added to the simple toric code construction. To begin with, qubits at each site must be replaced by d-dimensional qudits, with appropriate generalized Pauli operators defined on them, as introduced in Sec. IV. The group multiplication operator L plays the role of the X operator in the toric code, and the newly generalized Z operator plays the role of the Pauli Z. These operators obey the commutation relation The other feature we will add to our construction at this juncture is the notion of directed edges, as discussed in Sec. IV. As in the toric code (Z 2 ) case, we will now proceed with our construction explicitly on the square lattice.

A. Code Gadgets on Lattice Edges
We use a very similar construction to the toric code to encode our qudits for cyclic quantum double models. Each logical qudit is encoded using a subsystem code constructed from 4 physical qudits ( Figure 2 shows the scheme). The d 4 -dimensional space of these edges is partitioned as where the direct sum is over eigenvalues of stabiliers S. Our codespace is in the +1 eigenspace of two stabilizer operators S L and S Z defined below. The remaining d-dimensional degrees of freedom are encoded as qudits, one of which (the gauge qudit H G ) we fix in a single state in the codespace. The other qudit is used as our logical space H L . If an error occurs, it will flip a stabilizer operator, move the code gadget out of the codespace, and incur an energy penalty. Physically, we provide the codespace with these properties as the ground space of a 2-body Hamiltonian. Before we write it, we will first introduce the gauge, logical, and stabilizer joint operators as we did for the toric code.
To avoid confusion as much as possible, we will distinguish typographically G for gauge and G for group, similarly L for logical and L for group multiplication. It is simple to verify that the operators defining each seperate degree of freedom commute with each other (i.e., stabilizers commute with gauge and logical operators, and gauge operators commute with logical operators). It can also be seen that the logical operators satisfy the desired algebra of the cyclic quantum double models: and the gauge operators satisfy an equivalent algebra: We define the Hamiltonian on a single code gadget (associated with edge e) as This equation can be represented diagrammatically as In this form, it is easy to see that each term in the Hamiltonian acts only on two qudits. Multiplication by the stabilizers (as in L G S L ) effectively moves a gauge operator from two qudits onto the opposite two. In the d = 2 case, this Hamiltonian does not directly reduce to the one quoted for the toric code earlier (Eq. (10)) because of the inclusion of the identity (k = 0) term. However this term only induces a constant energy shift, and so can be disregarded for our purposes.
We now turn to the properties of the ground space of this Hamiltonian. It is clear that this Hamiltonian commutes with the logical operators, but less obvious that its ground space possesses the other properties we require. In Appendix C, we prove the following theorem: This result, combined with the fact that our logical operators commute with the Hamiltonian, gives us a ground-space to use as an encoded logical codespace H L .

B. Coupling the Code Gadgets
The lattice is connected exactly as was the case for the toric code (Fig. 2), with qudits from neighbouring edges linked via an entangling bond. We have an unperturbed Hamiltonian for each edge qudit given as in the previous section: where the index e denotes a particular edge qudit. We then introduce the bond term: coupling the physical qudits connected by bond b. The ground state of this bond term is a maximally entangled state of dimension d between the two qudits. We are interested in reproducing the quantum double Hamiltonian in an encoded form, so to concisely state our objective, we define the encoded A and B operatorŝ with L L defined in Eq. (41) and T L = 1 d k ω k Z k L is the encoded group projection operator. We can then state main result of this section as Theorem 2.
for some constants c independent of λ and N , where N is the number of sites on the lattice.
The consequence of this theorem is our system's low energy effective Hamiltonian replicating the low-energy sector of the quantum double model (for cyclic groups at this stage).

Proof of Theorem 2.
We again follow the perturbative analysis described in Appendix A. As such, this will require evaluating terms in the perturbative expansion of the self-energy at order n: with G 0 the Green's function for the system (vanishing on ground states) and Υ is the projector to the mutual ground space of each of the code gadgets. Before we begin our the proof in earnest, it is useful to comment on the kinds of terms which will be preserved and those that will vanish in the ground space. All the operators defined for cyclic groups have some commutation relation M N = αN M for some complex α. It is then a simple result to show that for our set of stabilizers any operator which does not commute with each stabilizer will neccessarily excite a ground state to an orthogonal state. This means that an operator M with α = 1 for N any stabilizer will become a detectable error on the gadget's quantum code, and will take the gadget to an orthogonal subspace. This implies that it will vanish in our perturbative treatment, as terms arising in our effective Hamiltonian are restricted to the ground space. In this way we need only consider error-free terms (i.e. terms which commute with all stabilizers) in our effective Hamiltonian.
From this discussion, we immediately see that first order terms will vanish, as they will necessarily leave two code gadgets in excited states. The only non-vanishing second order terms will be proportional to identity. In contrast to the toric code as presented earlier, there will be non-vanishing third order terms due to the inclusion of an identity component in the perturbation term Eq. (47). However, these terms will be proportional to the second order terms, and so will be trivial. At 4 th order we find nontrivial vertex and plaquette terms which survive. To write each of these terms more explicitly, we must now distinguish between inwards directed vertices (v + ) and outward directed vertices (v − ) as well as the two kinds of plaquettes. We will label the plaquettes left (p l ) and right (p r ) depending on the orientation of the top edge. In this scheme, the effective Hamiltonian will take the form We can write each of these parts individually using the notation of Figure 5.
The κ are constants which take into account the sum of products of the Green's functions in the perturbation. They can be calculated for given d once the spectrum of H 0 has been found. They must be nonzero for each of these terms because they do not return to the ground state before the end of the perturbation, and so the Green's function will never vanish.
In terms of encoded logical, gauge and stabilizer operators, we can use a similar notation (as seen in Fig. 6) to write these terms.
We now evaluate the Υ projectors. Stabilizers S Z & S L → I in the ground space by Theorem 1, and each gauge operator will simply evaluate as a constant (expectation value) in the ground space. We can again disregard these constant terms as irrelevant energy shifts. This leaves us with: By subsitituting the definitions of the Z operators in terms of T projectors, and using the orthogonality of the characters ω, it is simple to verify that these B terms are identical to the B terms of Eq. (29). Although the ± signs associated with the vertices (and edges in general) in these definitions may not immediately seem consistent with the quantum double Hamiltonian presented earlier (30) for cyclic groups, we have the freedom to rearrange the sums over k in the Hamiltonian. When we consider that we can take k → −k whenever we like, it becomes clear that these terms are indeed identical to those appearing in the quantum double Hamiltonian. This gives the result that the effective Hamiltonian will take the form Eq. (51).
At all orders < 2L (L the smallest linear dimension of the surface into which the model is embedded) the terms in the self-energy expansion (see Appendix A) will act on the logical state like products of the 4 th order terms. These terms all commute and will not map the ground space of the quantum double model out of the +1 eigenspace of the encoded vertex and plaquette terms (62-65).

VI. OUR CONSTRUCTION FOR GENERAL QUANTUM DOUBLE MODELS
General quantum double models can have a much more complicated algebra than the simple cyclic ones studied previously (see Sec. IV). However, this class includes non-Abelian models which are able to perform universal quantum computation, and so they are of key interest in this study.

A. Code Gadget Operators
As in the previously studied Z d quantum double models, we encode each logical qudit in a code gadget consisting of four strongly coupled physical qudits (the scheme is again as in Fig. 2). For a given group G, the code gadget on each edge then has a |G|-fold degenerate ground space which we use as a logical qudit. The difference in this scheme is that the generalizations of the gauge operators and stabilizers will not commute in general, and so these degrees of freedom are not separable. This is contrary to the normal use of the terms "stabilizer" and "gauge", but we will abuse the terminology and continue to use these terms in analogy to their cyclic counterparts. The operators we define here directly generalise those used in the previous sections. The differences arise from the non-commutativity of the group multiplication operations and the fact that the irreducible representations of these general groups can be multidimensional (as opposed to the cyclic groups, which have 1-dimensional irreps). With this in mind, we can define logical and "gauge" operators on the code gadget as follows: We can also define operators to describe the "stabilizer" degrees of freedom: where here the identity group element is denoted 1. These operators are clearly defined in a very natural way with respect to the quantum double algebra. In these models, the only operators which we strictly require to stabilize (act identically within) the ground space of our edge qudits are the projectors S L and S T . Despite this, we will extend our notational abuse and continue to refer to S g L and S g T as "stabilizer operators".
The operators we have defined now constitute a minimum operator basis for the degrees of freedom of our encoded qudit. We can also define addititonal operators: The + and − subscripts on the joint operators here refer to whether these operators possess the algebra of left or right multiplication (or projection) operators, i.e.
The stabilizer operators themselves satisfy the quantum double algebra The logical operators commute with both the gauge and stabilizer operators, but in this scheme the gauge and stabilizer operators do not commute with each other.
We can also derive the Z operators corresponding to our T operators (see Sec. IV): By construction, these operators satisfy the relevant algebra for Z operators.
We have now defined operators on the code gadget corresponding to both the left regular representation and the right regular representation of the group G for the encoded gauge and logical qudits. These definitions are redundant, in that the gauge or logical state can be uniquely defined through the action of only one L operator and only one T operator (or equivalently Z operator). This gives us some freedom in the definition of the logical state. We will choose to define it through the action of L g L− and T g L+ . The action of L g L+ and T g L− will then be poorly defined in general with respect to the logical state, but we will choose the codespace such that they act appropriately within it.
In order to understand how these operators act on the logical state, it is useful at this point to explicitly identify the encoding scheme of our code gadget. We can label the state of each physical qudit within a given code gadget as follows: Here the logical and gauge states of the system are labelled by k L and k G respectively, and will transform under the the action of the logical or gauge operators. The remaining labels h define how the stabilizers S L and S G act on the system. We can directly see the action of our encoded operators on these states. For example, We chose to define the logical state k L by the action of these two operators, and as such they act on k L as might be expected. The stabilizer operators act as The action of the remaining encoded operators is not so simple. In general, these will mix the logical or gauge states with the h a or h b . However, we will construct the codespace such that within it, logical operators will act only on the logical state, and gauge operators similarly act appropriately.

B. Code Gadget Hamiltonian
Now that we have defined a set of operators we consider the Hamiltonian of a code gadget. We require that this Hamiltonian consist only of 2-body terms and possess a ground space which can be used as a codespace for our logical qudit. For this to happen, the ground space must be stabilized by S L and S T , and be exactly |G|-fold degenerate. The significance of these two stabilizers is that they are terms in the quantum double Hamiltonian defined on a small 4-qudit torus (as depicted in Fig. 7). In that sense, we are creating a code which is very similar to a miniature quantum double model. Of course, our code gadget will consist of only two-body terms, and to achieve this we must sacrifice the gauge degrees of freedom in our model.
To this end, we generalize the Hamiltonian we used for cyclic groups previously to give These two forms can be seen to be equivalent using the definitions of the Z G operators (Eq. (73)). In the latter form, it is clear that our unperturbed Hamiltonian is very closely related to the quantum double Hamiltonian (Eq. (30)). It is also clear that the logical operators will commute with the Hamiltonian (as each term is a gauge operator), and so we can expect at least the |G|-fold degeneracy of our logical qubit. The following theorem encapsulates the remaining requirements of our codespace.
Theorem 3. The Hamiltonian Eq. (79) has a |G|-fold degenerate ground space that is in the common +1 eigenspace of S L and S T .
We provide a proof of this theorem in Appendix D. This theorem places restrictions on the form of the ground space which ensure that undesirable terms in the effective Hamiltonian will couple to higher energy sectors and vanish. Now we have a suitable codespace for our logical qudit, we proceed to reproducing the target model.

C. Coupling the Code Gadgets
We place our code gadgets on the edges of the lattice and couple them using the same geometric scheme as the toric code and cyclic group cases (illustrated in Fig. 2), where each physical qudit is perturbatively coupled to a physical qudit from a neighbouring code gadget. Our uncoupled (unperturbed) Hamiltonian for each edge of the lattice is as given in Eq. (79).
As before, the subscript e refers to a particular edge (a particular code gadget). The perturbation term is generalized straightforwardly from the cyclic case to take the form: where the L or Z operator associated with a particular qudit has definite ± subscript depending on its location as follows L : FIG. 8: The 2-qudit sphere is constructed by identifying every point on the boundary of a plane. This boundary is represented by dashed red lines. The solid lines correspond to edges on the lattice, with a qudit located on each edge. The loop formed by these edges is homologically equivalent to an equator around the sphere. There exists a plaquette stabilizer for each plaquette p1 and p2 and similarly a vertex stabilizer for each vertex v1 and v2 in this quantum double model. The terms in our bond Hamiltonian are obtained by choosing one plaquette and one vertex stabilizer from these. For Abelian models the two vertex stabilizers are also equivalent, as are the two plaquette stabilizers, and so the bond Hamiltonian consists of a full generating set of the stabilizer group of the quantum double model on this surface for these groups.
e.g. an L operator in the top right hand corner of a code gadget (with the edge taken running up the page) will take the form L + . This is motivated by the definitions of v ± and p ± of the quantum double model in Sec. IV. As in the Z d models, it is clear that the coupling terms are very closely related to the quantum double Hamiltonian. In fact, these bond terms could be considered a quantum double Hamiltonian on a small (2-qudit) sphere, with the corresponding non-degenerate ground state (see Fig. 8).
Again we must define the encoded A and B operators we will reproduce in our perturbative expansion (with 1 the identity group element for general groups) The main result of this section is Theorem 4.
for constants c independent of λ and N , where N is the number of sites on the lattice. The encoded low energy behavior of the system to this order is described by the quantum double Hamiltonian Eq. (30) up to additive and multiplicative constants.
This theorem implies that our effective Hamiltonian correctly reproduces the low energy sector of the quantum double Hamiltonian for any group. Before we prove it, we make some comment on the operators that will arise in the perturbative treatment. For cyclic models, we were able to make some general arguments to exclude all unwanted operators from arising in the effective Hamiltonian. Unfortunately, no equivalent general argument has been found for the general quantum double models. For this reason, we have explicitly shown this property for the relevant operators in Appendix E. The results are an intuitive generalization of the cyclic case, in that the only non-vanishing operators will be those contributing encoded operators which act on the gauge or logical subspaces. We use these results now to calculate the non-vanishing terms in the effective Hamiltonian. Proof of Theorem 4.
We follow the perturbative treatment as used previously (see Appendix A). The results of Appendix E effectively show that no 2 nd order terms are able to survive except those proportional to identity (exactly as in the cyclic case). Similarly, all first order terms, and all non-trivial third order terms will vanish. It is clear then, that no non-trivial operators will appear below 4th order. The effective Hamiltonian at order 4 is then given by G 0 here the Green's function vanishing on ground states (taken at the unperturbed ground state energy E 0 ) and Υ again the projector to the ground space of the code gadgets. At this order we will find non-trivial terms around plaquettes and vertices consisting of products of Z or L operators. As in the Z d case, it is useful to distinguish the two different kinds of vertices and the two different kinds of plaquettes here (see Fig. 4). We have defined the lattice such that vertices can either consist of all inwardly directed edges (v + ) or all outwardly directed edges (v − ). Plaquettes can either have their top edge directed left (p l ) or right (p r ). Disregarding constant energy shifts, we can then separate terms in the Hamiltonian by vertex or plaquette type: As we did for the cyclic groups, we will write these operators pictorially to make the physical location of a particular operator obvious. For simplicity, we have neglected to draw those qudits on the outer edge of the vertex/plaquette under consideration, where these terms will act trivially. With this in mind, the individual terms in the effective Hamiltonian can be written as: (93) Here the κ's are proportionality constants arising from the pertubation treatment. For a specific model, they can readily be calculated. It should be reasonably clear that no other non-trivial 4 th order terms (or lower) than those shown above will survive (see Appendix E). The higher order terms will act in the logical space as products of the 4 th order terms, until the order is sufficiently high to form non-contractible loops over the lattice.
The most illustrative of the 4 th order terms are the plaquette Z terms. As such, we will present a brief demonstration of how these operators arise. On our plaquette, at 4th order the most general Z operator to be constructed has the form: Here we have already used the fact that Z operators with different representations will move out of the ground space, and so we have only used one representation π. From Eq. (E12, E14) we find the condition j = s = n = q for non-vanishing terms. From this, we immediately obtain the term appearing above in the effective Hamiltonian for this plaquette. Similar considerations give the other plaquette and vertex terms.
Given the operators (90-93) in their current form, it is difficult to immediately see how many of them act on the logical state. In order to study this, we must revisit the encoding scheme defined in Eq. (74) and the ground space studied in Appendix D. We will study the action of each operator on the basis particularly in the ground space where σ mn = I 11 and h = 1. From this we can examine the effect on the logical state k L in the codespace. The operators in question act on these states as follows and   I I L g In the codespace, these operators have the effective action equivalent to L g G− or L g G+ respectively. They differ from the previously defined versions, but the key is that they act only on the gauge state in this subspace. We will denote these operators L g G ′ − and L g G ′ + . In a similar way, we can look at the action of the Z-like operators: This operator acts quite similarly (identical up to conjugacy) to Z πij G+ . In the ground space, we will be able to ignore it as a constant expectation value (as the gauge state will be fixed). As such, we will denote this operator Z πij G ′ + . The second of the Z operators is a little more complicated. To this end, we must consider the exact form of the ground states: This allows us to see the action of these operators.
On the ground space, this acts not dissimilarly to Z πij G− . The gauge state becomes mixed up somewhat, but because of the particular definite gauge state we have in the code space, an operator of this form can be evaluated as a constant. This is a result of the fact that the overlap of this state (Eq. (104)) with the ground space is independent of k L (as can be easily verified). With this in mind, we will write this operator as Z πij G ′ − from now on. Given these definitions, we can now write the terms in the effective Hamiltonian in a more succinct format: We have been able to treat each code gadget in the Z terms seperately, even though in the previous definitions they shared a common index (j). The reason that we are able to separate them in this way is because in the ground space for any given j we can use Eq. (E12 -E18) to rewrite each term as an average over all values of j. This allows us to rewrite each term as a summation over different indices, which gives us their quoted form. The factor of d π appearing in the terms (105-108) then comes from the remaining sum over j. As a simplified explicit example, consider: We can disregard all the terms in the Hamiltonian which do not act on the logical subspace (as they will only introduce some constant energy shift for our purposes). We now also drop the ± subscript on logical operators, with the observation that they are consistent with the edge orientation conventions introduced in Sec. IV. With this in mind, our effective Hamiltonian reduces to: with each operator defined as in Eq. (105 -108), and the ± of the logical operators defined by the edge orientation. Using the definitions of the Z operators in terms of T operators, and the orthogonality of group characters, it is not difficult to show that these operators are indeed equivalent to those of the target quantum double Hamiltonian. This gives our Hamiltonian the form Eq. (87) as claimed.
As in the Abelian case, all orders < 2L (L the smallest linear dimension of the surface into which the model is embedded) of the self-energy expansion (see Appendix A) will act on the logical state like products of the 4 th order terms. These terms all commute and will not map the ground space of the quantum double model out of the +1 eigenspace of the encoded vertex and plaquette terms (62)(63)(64)(65). Beyond this order perturbative corrections to the self-energy will be able to form homologically non-trivial loops on the surface. These will be heavily suppressed for large L and large energy gap. approach in [13] and in general we are only interested in the leading non-constant order in the effective Hamiltonian. Given the Hamiltonian where H 0 has a subspace of degenerate eigenvectors with energy E 0 . Let Υ be the projector onto the eigenspace of the eigenvalue E 0 of H 0 . In our case we are interested in the situation where E 0 is the ground state energy of H 0 . In degenerate perturbation theory one generally aims to find an effective Hamiltonian H eff that acts on the subspace given by Υ and that has the same eigenvalues as H, in other words, an effective Hamiltonian that describes how the perturbation term V acts within the ground space of the unperturbed Hamiltonian. We use the Green's function formalism of [13] for this calculation and find the self-energy Σ(E) which is given by the perturbation expansion: At the lowest non-trivial order of perturbation theory we have The unperturbed Green's function for excited states of H 0 is denoted by such that this function vanishes in the ground space. At higher orders in perturbation theory, one would need to take into account the E dependence of the self-energy around E ≈ E 0 in order to find the effective Hamiltonian; however, as we are interested only in the lowest non-trivial order in perturbation theory throughout this paper, we do not. We can expand the self-energy order by order as follows (neglecting constant energy shifts): The Green's function G 0 is always evaluated at the unperturbed ground state energy E 0 , and will be non-positive. The product of operators obtained between between Υ's will vanish unless it remains within (or at least overlaps in some nontrivial way) the ground-space of every code gadget on the lattice. It will be simple to eliminate many operators which will vanish or act trivially on the ground space. At n th order, the self-energy will consist of a sum of terms with κ j constants. They take into account the Green's function terms appearing in the perturbative analysis. Summed over each possible ordering of the V terms which will give the same A j , κ j is the product of the (n − 1) Green's functions appearing in the n th order terms. In our case, this sum will run over the n! ways of ordering the perturbations which multiply together to give the operator A j .

Appendix B: Extension to Arbitrary Graph
It is not difficult to extend our treatment from the explicit square lattice to an arbitrary directed graph. As each edge is associated with two plaquettes on any nonintersecting 2D graph (neglecting boundaries), each edge qudit is associated with exactly 4 nearest neighbours regardless of the form of the lattice. This allows us to retain our previous definitions for edge qubit gauge and logical operators as in Sec. VI A.
If we apply a perturbation to the uncoupled edge qudits exactly as before, we will again see plaquette and vertex terms arising in the effective Hamiltonian. Of course, they may not arise at the same order in this treatment (e.g. for a hexagonal lattice plaquettes arise at 6 th and vertices arise at 3 rd order, and on a general graph plaquette boundaries and vertex stars will not be uniform in size). It is possible that this may have some undesirable effect on excited states of the effective Hamiltonian, but the higher order terms that will be able to survive the perturbation will act in the logical space as products of existing (commuting) terms until the perturbative order is high enough to form non-trivial homology cycles over the lattice. Below this order, the ground space of the effective Hamiltonian will remain within the ground space of the encoded quantum double Hamiltonian.
We can see in Fig. 9 part of a simple directed graph. If we consider the perturbation term exactly as in the general group square lattice treatment (Eq. (83)), the vertex term will take the form (up to additive and multiplicative constants) where e ← v denotes those edges which run out of the vertex v, and e → v denotes those that run towards the vertex. The exact form of the Z term is not difficult to calculate but is only sketched in this notation for clarity. In any case, the vertex Z term will evaluate as a constant in the ground space and so can be disregarded for our purposes. This leaves the products of terms for inwards directed edges and outwards directed edges. If we look back to the definitions of the quantum double model in Sec. IV, we can see that this will give a vertex term consistent with the target Hamiltonian. Similarly, as we traverse a plaquette, two kinds of terms will arise, Here the notation e → p is taken to mean the edge is on the left of the plaquette, when looking along e, and similarly e ← p has the edge on the right of p. The indices of the Z terms are here suppressed for clarity, but they can easily be restored by comparing with Eq. (110), and can be verified to be consistent with the quantum double Hamiltonian. Of course, the gauge L term will be evaluated as a constant and disregarded. This will leave us only with the desired logical operators on both plaquettes and vertices, and we will have successfully reproduced the quantum double Hamiltonian (with the caveat that the terms may arise at different order, and with different coefficients).
Appendix C: Proof of Theorem 1 Proof. We will label eigenstates of Z by group elements |h , and the corresponding eigenstates of L by (unitary, irreducible) representations |σ = 1 √ d h ω σh |h . Note that for these cyclic groups, the representations are all one dimensional. We begin by defining projectors with inverses where i ∈ {L, Z}. We can then write our Hamiltonian as If we block diagonalize with respect to both h and σ, our proof will amount to showing that the unique ground state is in the h = 0 and σ = 0 block. In group theoretic terms, this corresponds to h the identity group element and σ the trivial representation (which we wil denote now as σ = I). Our Hamiltonian within the (h, σ) block takes the form We can rewrite the k L k G and k Z k G operators as projectors on the gauge subspace onto group elements or representations: with |σ a representation state and |h a group element state. The representation states are discrete Fourier transforms of the element states. Then we have Here |0 is the group identity element and |I corresponds to the trivial representation of the group. Since H h,σ is a negative sum of projectors, all its eigenvalues are non-positive. We can then write a triangle inequality for the magnitude of least eigenvalue by taking the operator norm, H h,σ ≤ |0 0| + |I I| + |h h| + |σ σ| . (C7) We know that this inequality is saturated only if (|0 0| + |I I|) is parallel to (|h h| + |σ σ|) in their largest eigenspace. But unless (h, σ) = (0, I), these vectors are never parallel. Then we have We can now say that the ground space must have h = 0 and σ = I. Furthermore, when this is the case, we see from Eq. (C6) that the only non-vanishing eigenvectors of this block are linear combinations of |0 and |I . We find by inspection that the two independent eigenvectors are with eigenvalues This gives for the unique ground state of the gauge qudit Given that the stabilizer and gauge degrees of freedom have a unique ground state, and the fact that the Hamiltonian commutes with the logical operators, we can also say that the Hamiltonian Eq. (44) has a d-fold degenerate ground space encoding the logical state.
i.e. instead of using a representation for the gauge degree of freedom, here a single group element is used. In terms of the physical basis, the T 1 G± projectors act in the following way: where 1 is the identity group element. We are now in a position to demonstrate that the T operators explicitly project to single states in the gauge element basis:

Solving the Hamiltonian
The Hamiltonian of interest is given by Given that we now know explicitly what states each of these terms project to, we can write instead Each of these terms are pairwise orthogonal for different values of h or k L . We can then immediately block diagonalize the Hamiltonian by these two variables. As these labels will not participate overly in the calculation, we will suppress them henceforth for clarity. We can also block diagonalize by a representation and one of its indices as follows H h,k L σ,n = − m |I 11 , σ mn I 11 , σ mn | + |σ mn , I 11 σ mn , I 11 | + |σ mn , 1 σ mn , 1| + |σ mn , h σ mn , h| (D23) That projectors in each block are orthogonal to those in different blocks can be verified by examining the inner products presented in Sec. D 3.
Looking only in one block of the Hamiltonian, we can split the terms into two vectors: We can solve these subhamiltonians in each block by calculating the overlap of the two projectors (these calculations are shown in Sec. D 3: It can be shown that the eigenvalues of these subhamiltonians will then be where C is the inner product calculated above. As such, we can say that the norm of the subhamiltonians are equal, independent of m block and have value 1 + 1 √ |G| . Importantly, their length is independent of the choice of σ mn , π ij , h and k L . In terms of the full Hamiltonian and block structure, we have two vectors whose lengths are constant for a given group. We can then bound the eigenvalues of the full Hamiltonian as follows. We can use a triangle inequality argument to give We know that each individual vector has a constant length. We also know that this inequality will only be saturated when the two vectors are parallel (which will only happen when they are equal). This is also when σ = I, n = 1, and h = e. As desired, there is no dependence on k L .
Since the eigenvectors of H are non-positive, the largest magnitude eigenvalue will correspond to the ground space. The triangle inequality argument amounts to showing that the ground state must rest in the block defined by H 1,k L I,1 . By inspection, there will be 2 independent eigenvectors in this block for each value of k L (we return the h index, but the k L index remains suppressed here) |ψ ± = |I 11 , 1, 1 ± |I 11 , 1, I 11 (D33) with eigenvalues λ ± = −2 1 ± 1

|G|
Clearly |ψ + defines a |G|-fold degenerate ground space of our system. It is simple to verify that the stabilizers have the desired relations with this state g S g L |ψ + = |ψ + (D34) and thus the Hamiltonian Eq. (79) behaves as claimed.

Useful Inner Products
Here we wish to calculate inner products between states in the gauge representation basis and the gauge element basis. In general, we have In particular, the special cases we are interested can be simplified. With I the trivial representation, we have and particularly, The orthonormality of the gauge representation basis is also useful when written in the form I 11 , h, π ij , k L |σ mn , h ′ , I 11 , k ′ L = δ πσ δ σI δ i1 δ nj δ m1 δ n1 δ hh ′ δ k L k ′ L (D45)

Appendix E: Error Operations in General Quantum Double Models
In the case of cyclic quantum double models, we were able to provide a simple general argument as to why many of the terms in the effective Hamiltonian vanished. In the more general case, this kind of simple argument is no longer applicable, and so we are forced to take an exhaustive survey of the terms that may arise in the effective Hamiltonian. We aim to show that any undesired terms will vanish in the ground space.
In order to undertake this study, it is useful to note the following relations: The kinds of operators we consider will take the form: We will refer to these as "error terms" or "error operators". For each error termÊ we will calculate ΥÊΥ where Υ is the projector on to the ground state. Note that Υ = SΥ for either of the stabilizers S T or S L . First consider the error term z c : Now, because the ground state is stabilized by the projector S L , it is easy to check that it must also be stabilized by each of S g L individually. This allows us to write: This gives us the result that all errors of this type will vanish from the effective Hamiltonian unless they satisfy the conditions π = σ and j = k. It also allows us to rewrite an operator of the form z c satisfying these conditions as an average over the shared index in the ground state. This will become important when we undertake the perturbation calculations.
We can find analogous results for the other z error terms, The l error terms require slightly different treatment. Consider first l a : The first operator is now orthogonal to the projector S 1 T unless g ′ g −1 = 1. Because the ground space is stabilized by S 1 T , we can say that this vanishes unless g = g ′ . This gives: Υl a Υ = Υδ gg ′   L g i.e. error terms of the form l a will vanish unless they obey g = g ′ . The procedure for l b proceeds similarly to yield: The error operators l c and l d are more complicated.
We can imagine the second operator acting on state |h a , h b , k G , k L . This leads to this operator vanishing unless h −1 a g −1 k L g ′ k −1 L h a h b = 1 In the ground subspace, we know h b = 1, this implies i.e. the nonvanishing operators of the form l c depend explicitly on the logical state. A similar result is obtained for the error term l d : The second operator vanishes unless In the codespace this is equivalent to: There are two remaining kinds of terms which will arise in our perturbation treatment. They may take a diagonal form, e.g.Ê ∼  Â I Î B   in which case they will not contribute to low order terms (and will have little impact on the form of higher order terms). A similar treatment to Appendix E and Eq.(95-104) reveals that these operators act as both gauge and logical operators, just as in the cyclic case. Alternatively, error operators may consist of mixed L and Z operators, e.g.
It is a simple calculation to show that these kinds of operators will vanish except when π = I (the trivial representation) and g = 1. That is, the only non-vanishing operator of this form is the identity operator. These results show that the encoding we use will indeed prevent undesirable excitations from being permitted, leaving only the terms from the target Hamiltonian to arise in our perturbative treatment.