Fault-tolerant gates on hypergraph product codes

Hypergraph product codes are a class of quantum low density parity check (LDPC) codes discovered by Tillich and Z\'emor. These codes have a constant encoding rate and were recently shown to have a constant fault-tolerant error threshold. With these features, they asymptotically offer a smaller overhead compared to topological codes. However, existing techniques to perform logical gates in hypergraph product codes require many separate code blocks, so only becomes effective with a very large number of logical qubits. Here, we demonstrate how to perform Clifford gates on this class of codes using code deformation. To this end, we generalize punctures and wormhole defects, the latter introduced in a companion paper. Together with state injection, we can perform a universal set of gates within a single block of the class of hypergraph product codes.


I. INTRODUCTION
Quantum error correcting codes can be used to simulate an ideal quantum circuit using noisy circuit components [1][2][3][4]. These simulations are characterized by a tug-of-war between the size of the circuit and the accuracy of the result. Larger problem instances require larger circuits, and therefore larger error correcting codes; this however creates more opportunities for errors to accumulate. To compensate for this increased error accumulation, we must lower the logical fault rate. By choosing our quantum error correcting code appropriately, we can increase the code size n logarithmically with the size of the logical circuit and still find that the global logical error rate decreases exponentially in the code size n.
Not all error correcting codes are equivalent. The size of the noisy circuit depends on the quantum error correcting code being used. Finding codes which minimize the size of the circuit to achieve a target logical error rate is a subject of active research.
A large amount of work in both theory and experiment focuses on topological codes [5][6][7]. These codes have the desired ability to suppress errors exponentially in the size n of the codes. Furthermore, topology guarantees that each qubit, be it data qubit or ancilla qubit for readout, is only connected to a constant number of other qubits in its neighborhood. These properties, among others, make these codes suitable for serving as the architecture for quantum computers.
One drawback of topological codes is their ability to store logical qubits. Indeed, each logical qubit in a topological code is encoded in a distinct block of size n. The number of physical qubits required to simulate a single logical qubit therefore increases with the size of the quantum computer.
In contrast, quantum low density parity check (LDPC) codes [8,9] are generalizations of topological codes that overcome this increasing encoding overhead. LDPC codes refer to families of codes where all qubits (data qubits and ancilla qubits for readout) are only connected to a constant number of other qubits. This constant is independent of the block size and thus simplifies the process of syndrome extraction. In [9], Gottesman proposed a construction that combines techniques for efficient syndrome extraction with ideas to perform logical gates on block codes. The result was a conditional statement: if 'good' quantum LDPC codes exist, the number of physical qubits required to simulate a logical qubit becomes a constant, independent of the size of the quantum computer.
The difference between LDPC codes and topological codes is that the connectivity need no longer be spatially local. By sacrificing locality, these codes overcome one of the shortcomings of the surface code and this permits a 'wholesale effect'. Increasing the size n of the code lets us encode k qubits, where k can increase with n. We can find codes for which the logical error probability decreases exponentially with n with a fixed k/n ratio. This is to be contrasted with topological codes that also achieve an exponential error suppression with n, but with k = 1 and hence vanishing encoding rate 1/n. Good LDPC codes are elusive. It is hard to enforce the commutation relations between stabilizers of a quantum code while simultaneously maintaining low connectivity. Topological codes use topology to achieve this, but there are strong constraints on the number of logical qubits they can simulate and how effectively they can do so [10,11]. These constraints are a consequence of locality. Although no doubt simpler to engineer, locality is not a fundamental constraint. There exist techniques that permit qubits that are not adjacent to share entanglement in various architectures [12][13][14][15]. This motivates theoretical investigations of LDPC codes that are not constrained by locality. Only with a complete understanding of the potential benefits of LDPC codes will we be able to decide if they are worth the extra experimental effort.
One of the leading candidates for LDPC codes are the so-called hypergraph product codes which eschew topology, and instead engineer commutation relations using algebraic / graph-theoretic techniques [16]. The hypergraph product is itself not a code family, but rather a technique to construct quantum codes from classical codes. If we input two classical codes to the hypergraph product machinery, the resulting quantum code inherits properties of the classical codes. Importantly, if the classical code families are LDPC then the quantum code families will also be LDPC. Furthermore, if the classical code families have a code dimension k scaling linearly in the block size n, then so does the code dimension of the quantum code family. With regards to distance, the hypergraph product code construction yields quantum codes with distance scaling as the square-root of the block size. Up to constants, this is the same functional dependence between the distance and the block size as the surface code (but it applies to all the logical qubits). So in short, quantum LDPC code achieve the same error suppression as topological codes, but do so at a constant encoding rate.
When these codes were first proposed, it was unclear if they possessed an efficient decoding algorithm. Naively applying decoders for classical codes to their quantum counterparts does not work because of degeneracy [17]; there exist low-weight errors that confuse the classical decoding algorithm. We needed an inherently quantum decoding algorithm, but it was not clear if one existed. Since then, the situation has changed significantly.
Leverrier et al. [18] were the first to show that we could overcome this problem. For certain classes of hypergraph product codes called quantum expander codes, they discovered an algorithm called smallset-flip that overcame the degeneracy issue. The small-set-flip algorithm was shown to function in linear time and is therefore efficient. Secondly, it was shown that the small-set-flip algorithm came with a performance guarantee. Suppose an adversary were handed the ability to target qubits and apply a Pauli error of choice on each qubit to inflict maximum damage. The small-set-flip algorithm can protect against errors whose weight is less than the square-root of the block size (up to some constant).
Of course, this is a pessimistic error model; errors that occur in nature may not be orchestrated by an adversary. The local stochastic error model is one way to model errors that occur naturally. Roughly, it states that the probability of an error decays exponentially with the number of qubits afflicted. Fawzi et al. showed that the small-set-flip algorithm is capable of correcting a constant fraction of such errors [19].
In a followup work, Fawzi et al. demonstrated that these codes are even resilient to syndrome errors [20]; we only need to measure the syndromes once in order to proceed with decoding. If we applied the smallset-flip algorithm to decode in the presence of potentially incorrect syndromes, then it is guaranteed that the number of physical errors on the qubits is upperbounded by a function of the number of syndrome errors. Thus so long as we do not have too many syndrome errors, we are guaranteed that we can reduce the weight of the error on the physical qubits.
These works put the hypergraph product code on solid theoretical foundation. In trying to reason about its threshold however, the best bounds were very weak. Numerical work has sought to remedy this. Kovalev et al. [21] estimated the threshold of the hypergraph product codes using a statistical mechanical mapping. These computations are independent of a decoder, and instead estimate the threshold using a proxy. Grospellier and Krishna [22] estimated the threshold of the hypergraph product code using the small-set-flip algorithm. The focus of this work was a class of hypergraph product codes with qubit degree 11 and check degree 10 and 12. These codes were subject to an independent bit and phase flip error model. The estimates for the thresholds are several orders of magnitudes better than previous analytical lower bounds.
On a related note, Liu and Poulin have studied small codes using a neural-network [23]. Finally, Pan-teleev and Kalachev [24] showed very promising results for related codes. The observed threshold can be comparable to the one observed for the surface code, but in general will depend strongly on the code parameters such as the encoding rate and the weight of the checks.
These results demonstrate that hypergraph product codes are efficient fault-tolerant quantum memories. In this paper, we describe the first techniques to perform Clifford gates fault tolerantly on hypergraph product codes. Our method is an instance of code deformation, a general framework to perform gates on quantum codes. Continuing in the spirit of the hypergraph product construction, we express defects on the surface code as purely algebraic and graph-theoretic concepts. Importantly, the code remains LDPC over the course of code deformation. Fault tolerance follows because the modifications we make at each step are local (in a graph-theoretic sense). The generalized defects are capable of encoding several logical qubits. If we choose to use a subset of these qubits to encode information, then the rest can be considered as gauge qubits. We discuss constraints on code deformation that keeps the spaces of logical and gauge qubits separate. To conclude, we show that we can achieve a universal gate set on the logical qubits via state injection.
We emphasize at this point that we are not providing a technique to compile a Clifford gate of interest. We provide a framework within which it is possible to realize Clifford gates via code deformation. These Clifford gates can then be composed to generate a larger group of transformations. We show that the framework is sufficiently rich to realize all different types of generating gates, but depending on the code, this may or may not encompass the entire space of Clifford operators. We will return to this discussion later.
This approach can be contrasted to Gottesman's work which entails partitioning logical qubits into blocks of LDPC codes. Each block is of 'intermediate' size and a computation with k logical qubits requires blocks whose size scales as O(k/ poly log(k)). Gates are then performed by state injection using ancilla states. The size of these blocks limits the number of gates that can be implemented at any given time. Furthermore, the savings of LDPC codes become compelling only as we increase the block size. Partitioning the logical qubits into blocks implies that it will take longer for this effect to manifest. In contrast, we propose performing quantum computation on a single block. Our proposal does not limit the number of qubits that can be processed at any given time to a constant. On the other hand, the time required to perform a gate could scale so it is unclear whether these gates will be faster.
Outline of the paper: In section II, we begin by reviewing some facts about classical codes and proceed to recall the definition of the hypergraph product code.
In section III, we describe how to deform the hypergraph product code by introducing a puncture. This puncture shall itself be described as a hypergraph product of subgraphs of the graphs that together form the quantum code. Section III A includes the definition of a puncture, and describes how they arise in two types, smooth and rough. In section III C, we describe the logical operators supported on the puncture.
We generalize puncture defects in section IV, and discuss how to create a wormhole.
Unlike a surface code, a puncture will be capable of supporting several logical qubits. In section V, we study how to perform code deformation. We first impose constraints on code deformation with multiple logical qubits in order to guarantee that the process is not error prone in section V A. We proceed to list the requirements to perform all Clifford gates on the hypergraph product code in section V B. After discussing state injection in section V D, we conclude by discussing point-like punctures in V E. Pointlike punctures are useful in demonstrating how the notion of topology may generalize to purely graphtheoretic conditions. From a condensed-matter physics perspective, these punctures can be seen as a generalization of anyons from two-dimensionnal manifolds to general graph structures, which could be of independent interest.

A. Classical and quantum codes
Classical codes: A classical code C = [n, k, d] ⊆ F n 2 over n bits is the (right-)kernel of a matrix H ∈ F m×n 2 , known as its parity check matrix. The code dimension k is the dimension of the kernel, dim (ker(H)), and d is the minimum Hamming distance between a pair of vectors in C. In general, we could have redundant checks and so m ≥ n − k. We let rs(H) denote the rowspan of the matrix H and H t be the transpose of H. Each row of H encodes a parity constraint that we refer to as a check and we label c ∈ C. Likewise we label the columns of H by variable indices v ∈ V. Let 1 V , 1 C denote the identity on F V 2 and F C 2 respectively. For u, v ∈ F n 2 , we let u, v = ∑ n i=1 u i v i denote the inner product between them. An LDPC code is a code family {C n } n such that as a function of the block size n, the number of bits in the support of a check is upper bounded by a constant, as are the number of checks a bit is connected to [25]. In other words, the number of non-zero elements in each row and column of the parity-check matrix is bounded by a constant with respect to the block-size n. The factor graph G(C) of a code C lets us infer properties of the code C from the properties of the graph. The graph G(C) = (V ∪ C, E) is a bipartite graph, where V = [n] and C = [m]. We draw an edge between check node c ∈ C and variable node v ∈ V if and only if H cv = 1. Given a subset P ⊆ V ∪ C, the neighborhood of P is denoted Γ(P) and is defined as Quantum codes: Let P = {I, X, Y, Z} denote the Pauli group and P n = P ⊗n denote the n-fold tensor product of the Pauli group. A quantum error correcting code is specified by a group Q ⊆ P n . The stabilizer S of the code is the center Z(Q), and the quotient group G := Q/S is called the (pure) gauge group. The set of logical operators is then defined as N (Q) \ Q. A stabilizer code is a code such that G = ∅ and Q is an Abelian group.
Just like the individual rows of the classical parity check matrix generate a linear space of constraints, we can choose a generating set of checks for the stabilizer group S. Much like its classical counterpart, the factor graph G Q can be use to represent the stabilizer generator, and provides a visual representation of Q. The only difference is that the edges could carry labels of Pauli elements X, Y or Z, indicating the action of a check on a qubit.

B. The hypergraph product code
The hypergraph product code is a way to construct a quantum code Q given two classical codes C 1 and C 2 . This can naturally be extended to families of classical codes. If the two classical code families are LDPC, then so is the resulting quantum code family. The resulting code is a CSS code [26,27], i.e. the stabilizer generators are either products of only X operators or only Z operators. For simplicity, we shall consider the graph product of a code C with itself.
Graph-theoretic description: Let G = (V ∪ C, E) be a bipartite graph. Let Q denote the quantum code obtained from the hypergraph product of G with itself. The factor graph G Q of Q is defined as G Q = G × G. Its nodes are partitioned as follows: This representation highlights that this construction yields two kinds of qubits -those emerging from the product of two variable nodes (VV nodes) and those emerging from the product of two check nodes (CC nodes). We draw an edge between (a 1 , a 2 ) and (b 1 The X and Z stabilizers of the code are specified via their symplectic representation [28]. The parity check matrices of the quantum code are denoted H X and H Z respectively, where In this expression, VV nodes are in the left partition while CC nodes are in the right partition. Let d min = min{d, d} denote the minimum of the distance of the two codes. The hypergraph product Q is a n 2 + m 2 , k 2 + k 2 , d min quantum code.
We shall refer to the logical operators of the quantum code Q as the embedded logical operators to distinguish them from the logical operators that we introduce later by creating defects. The embedded logical operators of the code are described as follows.

Lemma 1. (Embedded logical operators)
1. the X logical operators of Q are spanned by 2. the Z logical operators of Q are spanned by Proof. The style of the proof follows arguments presented in lemma 17 of [16]. We first show that the spaces above are contained in the set of logical operators, and then use counting arguments to show that this must be the entire space of logical operators.
We deal with the X type logical operators and note that the Z logical operators follow using a similar argument. Let α be an X logical operator, i.e.
This object clearly commutes with the Z stabilizers.
For the sake of contradiction, assume that α is in fact in the span of the X stabilizers, i.e. that there exists a non-trivial vector a ∈ F V×C 2 such that a H X = α. Without loss of generality, let us assume that the VV portion of α is non-trivial and let π(α) be the projection of α on to the VV type qubits.

It follows that
For u, v ∈ V, we can index the elements of π(α) as π(α) [u, v]. Furthermore, for fixed u ∈ V, we let π(α)[u, * ] denote the vector over F V 2 obtained by fixing the first component of π(α). Similarly, we can index the elements of a as a [v, c] for v ∈ V and c ∈ C and let a[v, * ] denote the vector over F C 2 . Eq. 3 implies that there exists some index u ∈ V such that where b u := a[u, * ] and β u := π(α)[u, * ]. However, this is a contradiction since β u ∈ F V 2 / rs(H) and lies outside the row-span of H.
The row rank of H is n − k and so the number of cosets in F n 2 / rs(H) is n − (n − k) = k. Therefore the number of elements in ker(H) ⊗ F n 2 / rs(H) is k 2 . Similarly, the number of cosets F m 2 / rs(H t ) is m − (m − k) = k. Therefore the number of elements in F m 2 / rs(H t ) ⊗ ker(H t ) is k 2 . On counting the operators, we see that there are indeed k 2 vectors of VV type and k 2 vectors of CC type, thus adding up to the correct number of logical operators.
Example: consider the surface code generated using two copies of the repetition code [3,1,3] as shown in fig. (1) below. Its factor graph G runs vertically on the left and horizontally on the bottom. Variable nodes have been colored blue and indexed by numerals whereas check nodes are green and indexed by letters. The product of two nodes is represented as Mapping this to the surface code, we choose a convention where Z stabilizers correspond to plaquettes and X stabilizers correspond to vertices. To break it down further, we could consider each of the constituent parts of the definition above. First, note that the qubits of VV type, depicted using two concentric circles, represent horizontal edges in the surface code whereas qubits of CC type, depicted using concentric squares, are vertical edges of the surface code. The action of the X stabilizers on qubits of VV type is defined by the matrix 1[1, 2, 3] ⊗ H and is depicted in fig. 2(a). Similarly, the action of the X stabilizers on qubits of CC type is defined by H t ⊗1[A, B] and is depicted in fig. 2 In a similar manner, we can obtain the representation for Z stabilizers. By overlaying these diagrams, we obtain fig. (1).

III. PUNCTURES
A puncture is a defect on the hypergraph product created by removing both qubits and stabilizers belonging to some (small) portion of the code. This shall be effected by measuring single-qubit Pauli operators within the interior of the puncture. This is similar to creating a puncture on the surface code [29].

A. Definition
We begin this section with some notation. Let S ⊆ V denote a connected subset of variable nodes. N = Γ(S) ⊆ C is its neighborhood and A = Γ −1 (S) is its ancestor as shown in fig. 3(a).
Similarly, let T ⊆ C denote a connected subset of check nodes. M = Γ(T) ⊆ V is its neighborhood and B = Γ −1 (T) is its inverse neighborhood as shown in fig. 3(b).
For any set C ′ ⊆ C, we let 1 C ′ denote the projector on C ′ over F C 2 . We also write H C ′ = 1 C ′ H for the restriction of the parity check matrix to C ′ . At this juncture, we make some observations that will be useful later.
To create a puncture on the quantum code, we will stop measuring certain stabilizers, and modify others when carving out a portion of the interior. The punctures will be classified by how stabilizers are modified.

Definition 2 (Smooth puncture). Let S ⊆ V and T ⊆ C be connected sets of variable and check nodes. Let N, A and M, B denote induced sets as defined above. A smooth puncture is defined by the stabilizers H ′ X and H ′ Z where
Note that this is not exactly the graph product of the two subgraphs selected by T and S. This is verified by noting that it is missing elements from M × S. Rather it follows the hypergraph product construction on the interior nodes of both graphs. For simplicity, we abuse notation and refer to this as the graph product T × S.
The defining trait of a smooth puncture is that Z stabilizers are not broken across its boundary. We refer to the schematic in fig. 4(a) below. Such stabilizers would have to be of the form (c, v) for some check c ∈ C and v ∈ V where either the check node c or the variable node v are in the boundary of T or S respectively. This does not exist by construction -check nodes in T are contained entirely within the puncture, as are variable nodes in S. The internal qubits of a smooth puncture are the nodes B × S ∪ T × A and will be measured in the Z basis to create the puncture. The qubits on the boundary of a smooth puncture correspond to the sets The X stabilizers on the boundary of a smooth puncture correspond to the sets Their support on the interior of the puncture, B × S ∪ T × A, is removed. Therefore X stabilizers on the boundary of a smooth puncture are broken. In a similar manner, a rough puncture can be created by interchanging the roles of T and S on the graphs. It is formally defined as follows.

Definition 3 (Rough puncture). Let S ⊆ V and T ⊆ C be connected sets of variable and check nodes. Let N, A and M, B denote induced sets as defined above. A rough puncture is defined by the stabilizers H
Abusing notation, this can be thought of as a graph product S × T.
The defining trait of a rough puncture is that X stabilizers are not broken across the boundary. We refer to the schematic in fig. 4 (b) for the following discussion. Such stabilizers would have to be of the form (v, c) for some check c ∈ C and v ∈ V where either the check node c or the variable node v are in the boundary of S or T respectively. For the same reasons as before, such nodes do not exist. The internal qubits of a rough puncture are the nodes S × B ∪ A × T and will be measured in the X basis to create the puncture. The qubits on the boundary of a rough puncture correspond to the sets The Z stabilizers on the boundary of a rough puncture correspond to the sets Their support on the interior of the puncture, S × B ∪ A × T is removed. Hence Z stabilizers on the boundary of a rough puncture are broken.
To deform Q, we remove the edges that are contained in a puncture. Algebraically, it is described by This code is itself not a hypergraph product code but is clearly LDPC. We are merely puncturing an LDPC code; by removing edges, we cannot increase the weight of checks.
We first show that the code defined this way obeys the desired commutation relations. Before doing so, it is useful to note the following identity: This follows from the fact that the neighborhoods of sets B and A are completely contained within the sets T and S by definition.

Lemma 4. The punctured code forms a valid stabilizer code.
Proof. Consider a smooth puncture created by two subsets T ⊆ C and S ⊆ V. The case of a rough puncture follows similarly. The punctured code has stabilizers We already know that H X H t Z = 0 (mod 2). We need to check the other relations.
In the last line, we have used the identity in eq. 4. Inspecting the last two equations, we find that each term appears twice. Therefore the sum of all the terms in these two equations is 0 mod 2 as desired.
For convenience, we have summarized this section in table I.

B. Example: Surface code
We illustrate these ideas with the surface code. This code is formed using two [5,1,5] repetition codes. We choose the sets T = {b, c} and S = {3, 4}. For the sake of completeness, all the neighbors and ancestors are listed below. These subsets, along with the quantum code they generate, are shown in fig. (5).  In the algebraic description, we let H T and H S be the matrices correspond to the subcodes corresponding to the subsets selected above.
The X and Z stabilizers that are removed from the puncture can then be described as

C. Logical Pauli operators for punctures
Mirroring the surface code, punctured hypergraph product codes support two types of logical operators loop-type operators that exist only on the boundary of the puncture and chain-type operators that are supported on the boundary of the puncture and also extend into the rest of the code. For the rest of this section, we let T ⊆ C and S ⊆ V be some connected subsets. The sets M ⊆ V, N ⊆ C are the respective neighborhoods, and B ⊆ V, A ⊆ C are the respective ancestors. We shall derive the form of the logical operators for a smooth puncture defined as above. The logical operators of a rough puncture will follow by exchanging the roles of S and T.
Before proceeding, we impose certain constraints on how S and T are chosen. These constraints apply to smooth and rough punctures both. The constraints stipulate that certain subcodes associated with S and T are correctable, i.e. if these portions of the code were erased then we do not lose any codewords of the underlying code in this process.
These conditions imply that certain subsets of the parity check matrix also have trivial kernels.

Lemma 6.
The correctability condition implies the following relations: Proof. Both claims follow identical proofs. We show one of them here and then outline the proof for the rest. Observe that we may write H N as the sum of matrices supported only on S and S c respectively: If there existed an element β ∈ F V 2 such that supp {β} ∈ S, and β ∈ ker(H S ), then this would violate the condition that ker(H N ) is empty.
Similarly, the other claims follow once we note the identities listed below: This completes the proof.
Henceforth we shall only consider punctures that are correctable. To foreshadow the next few results, we will argue that this condition can be used together with the cleaning lemma [10] to guarantee that the embedded logical operators of the quantum code are unaffected by the puncture.

Logical Z operators
We first establish that creating a puncture will not affect the embedded logical Z operators.

Lemma 7.
There are no embedded Z logical operators supported within the interior of the puncture.
Proof. The proof idea is to show that if a logical operator were completely contained within the puncture, then we would violate condition 5, part 1. This will entail projecting down to the level of the classical code until we arrive at a contradiction.
Let α ∈ L Z be a logical Z operator , i.e. as given by lemma 1 For the sake of contradiction, let α be supported entirely within the interior of the puncture, i.e. only on Without loss of generality, suppose the VV part of α is non-trivial. Let π(α) denote the projection of α on to the VV qubits. Let us index the elements of π(α) using variable nodes u, v ∈ V as π(α) [u, v]. Furthermore, let π(α)[u, * ] denote the vector obtained by fixing the first component to u. Since π(α) is non-trivial and supported on B × S, there must exist at least one u ∈ B such that the vector β u := π(α)[u, * ] is non-trivial.
Furthermore, it also implies that β u is supported only on S. However, this in turn implies that there exists a non-trivial element in ker(H S ).
As shown in lemma 6, this violates condition 5 since if ker(H N ) is empty, then so is ker(H S ) Therefore there cannot be any logical Z operators completely contained within the interior.
The next lemma will be useful in showing that operators in the row-space of H ′ Z are not in the span of the Z stabilizers H Z + H ′ Z , i.e. they are not redundant. These operators will later be used to construct logical operators.

Lemma 8. The stabilizers H
Proof. The proof idea is to study the overlap of the interior and exterior, and show that if there was a vector in the common support then we would violate condition 5, part 1.
For the sake of contradiction, suppose there exist vectors a, b ∈ F C×V 2 such that The stabilizers H ′ Z in the interior and H Z + H ′ Z in the exterior only share support along the boundary Projecting both sides of eq. 7 on to the sets M × S ∪ T × N, i.e. the sets containing the interior and the boundary, we get By rearranging terms, we can find some non-trivial vector c ∈ F C×V 2 such that this can be expressed as Proof. We begin from first principles. The stabilizers are given by H X + H ′ X and the single-qubit operators in the interior of the puncture are described by the matrix . We can assume that α is not supported in the interior, and consider the kernel of H X + H ′ X instead of H X + H ′ X +I int . We use lemma 7 together with the cleaning lemma [10] to note that the embedded logicals are unaffected by the puncture. Any other Z type operator that is supported in the interior will anti-commute with the single-qubit X measurements used to generate the puncture and therefore will be removed.
The operator α must therefore lie in the kernel of H X outside the puncture. This contains the embedded logical operators and products of old stabilizers that were not in the interior. We shall only focus on the latter here in order to obtain the new logical operators.
The stabilizers in the interior are spanned by H ′ Z . Those operators in rs(H ′ Z ) but not supported in the interior are thus what we seek. The interior of the puncture corresponds to Inspecting the VV and CC parts of this equation separately, we find that we must have Equivalently, the space we desire is spanned by Part 2: rs(H Z + H ′ Z ) We refer to lemma 8 which states that the span of the stabilizers from within the puncture are independent of those outside the puncture. Therefore the space defined by eq. 13 is not in the span of the Z stabilizers.

Logical X operators
We now discuss the logical X operators associated to a smooth puncture.

Lemma 10.
There are no embedded logical X operators within the puncture.
Proof. The proof idea is to show that if a logical X operator were contained entirely within the puncture, then it violates the assumptions that the interior is correctable.
Let α be a logical X operator, i.e. as given by lemma 1 which for the sake of contradiction is contained entirely within the interior B × S ∪ T × A. Without loss of generality, let us assume that the VV part of α is non-trivial. Let π(α) denote the projection of α on to the VV qubits. Let us index the elements of π(α) using variable nodes u, v ∈ V. It follows that π(α) is supported entirely on B × S.
By assumption, since α is supported entirely on the interior, β v is supported only on B. However this in turn implies that there exists a non-trivial element in ker(H B ).
As shown in lemma 6, this violates condition 5, part 2. Therefore the puncture cannot contain any logical X operators.
The next lemma will help show that certain X operators are not in the span of the stabilizer H X + H ′ X . These operators will then be used to construct logical X operators. These are comprised of codewords of the classical codes that are complementary to the subgraphs chosen by S and T. In other words, they will involve the terms ker(H T c ) and ker(H t S c ). In the proof that follows, we shall make certain claims on these spaces. Note that since the neighborhood the set B is contained in the set T, it implies that the neighborhood of T c is contained within B c . Similarly, the neighborhood of S c is contained within A c . Therefore when studying ker(H T c ) and ker(H t S c ), we shall assume that their support is contained in B c and A c respectively.
and it lies in one of the two following sets: Then α does not lie in the row-span of H X + H ′ X .
Proof. The proof idea is to successively project down to the level of the constituent classical codes until we arrive at a contradiction.
We shall focus on the first object, and note the other follows identically.
For the sake of contradiction, let α ∈ (ker(H T c ) ⊗ F S 2 / rs(H A )|0 m 2 ) such that it is in the row-span of H X + H ′ X . It follows that α has non-trivial support on (M \ B) × S. By assumption, there exists a vector a ∈ F V×C 2 such that Let us index a as a [v, c] for v ∈ V and c ∈ C. Similarly, let π(α) denote the projection of α on to its VV part and let us index its elements as π(α) [u, v] for u, v ∈ V.
We shall study the VV part first, and this will help us understand the support of the co-ordinate vector a. We wish to show that As noted above, π(α) is supported on (M \ B) × S. Therefore, if we had then for all v ∈ S, π(α)[ * , v] cannot have support on M \ B. This follows from the fact that the VV portion of 14 is In turn it would not be a part of ker(H T c ) and this violates the assumption on α. For u ∈ B c , π(α)[u, * ] is supported on F S 2 / rs(H A ) and therefore a[u, * ] must be supported on A c . This implies eq. 15.
With this condition on the support of α obtained from the VV side, we shall now show that we run into problems on the CC side. Since the CC portion of α is trivial, We may project this from the right on to the set T × C to obtain; it is on this set that we will run into a contradiction. After projection, this equation becomes For some c ∈ A c , we must have b c := a[ * , c] such that b c has non-trivial support on M \ B.
The vector b has non-trivial support on M \ B as explained, and therefore eq. 17 implies that However this is not possible since ker(H T ) is empty, as stated in condition 5, part 2. This completes the proof.
These operators can be classified in terms of the (classical) codespaces associated with H T c and H t S c .

Theorem 12. Let O Z be the Z operators defined by
and let Ω X = ker(H Z +O Z ) denote the X type operators in its kernel.
The logical X operators are described by Before proceeding to the proof, we make the following observations and highlight important features of this claim. At first glance, the logical operators appear to break into two types, the VV type logicals defined by ker(H T c ) and the CC type operators defined by ker(H t S c ). Thus the logical X operators are defined by the code spaces that are left over after the portions corresponding to T and S have been carved out.
The set H Z +O Z represents Z stabilizers outside the puncture. Vectors in the kernel of H Z +O Z are unaffected by the addition of the puncture, and in that sense represent some invariant space. The space Ω X thus contains X stabilizers and logicals whose support does not overlap with the puncture. To help this object seem less alien, let us return to the surface code and consider an example.
Consider a smooth puncture defined on a surface code with only smooth boundaries. This could define a logical qubit with the X string running from the boundary of the smooth puncture to one of the boundaries of the lattice. Depending on the arrangement, this logical operator could be supported only on CC qubits or only VV qubits as shown in fig. 6. However, these two objects are equivalent up to stabilizer. This equivalence is captured by Ω X .
Furthermore, consider a lattice with two smooth and rough boundaries as shown in panels (c) and (d) of fig. 6. The two representations of the logical X operator shown running from the smooth puncture to the boundary are equivalent up to an embedded logical X operator, and X stabilizers. This equivalence is also captured by Ω X .
With these comments, we proceed to the proof of theorem 12.
Proof. We start from first principles. Recall that we defined the matrix I int = (1 B ⊗ 1 S |1 T ⊗ 1 A ). The logicals are defined as Part 1: ker(H Z + H ′ Z ) We would like to understand the structure of vectors α ∈ ker(H Z + H ′ Z ). We shall assume that α is not supported on the interior of the puncture B × S ∪ T × A. If α is supported within the interior, it can be removed using the single-qubit operators described by I int . As shown by lemma 10, the embedded logical X operators are unaffected by the puncture.
We shall argue that α ought to have a certain structure using a proxy. Let us define a ∈ F C×V 2 as The only occasion when a is non-trivial is when α is supported on the boundary. If not, α is either a stabilizer or logical belonging to the code that is unaffected by the puncture. We shall mod out by this set, and this will correspond to Ω X .
The VV and CC portions of eq. 19 stipulate that respectively.
Equivalently, this means that Part 2: rs(H X + H ′ X +I int ) Since the operators we are interested in only lie outside the puncture by assumption, we may ignore I int and need only concern ourselves with rs(H X + H ′ X ). Let g ∈ ker(H T c ) and x ∈ rs(H A ) such that a H A = x. Its product g ⊗ x is clearly in ker(H T c ) ⊗ rs(H A ) and therefore in the kernel of H Z + H ′ Z . We shall show that this vector lies in the span of the X stabilizers as well. Indeed, it can be expressed as In a similar manner, we can show that any vector in rs(H t B ) ⊗ ker(H t S c ) is in the row span of H X + H ′ X .
As was already shown in lemma 8, any vector α ∈ F n 2 +m 2 2 that is in the row span of do not lie in the row span of the stabilizer H X + H ′ X . This completes the proof.

IV. WORMHOLES
We have now established how to construct punctures by carving out portions of the hypergraph product code. On the surface code, punctures facilitate CNOT gates on encoded qubits via braiding, but it is limited. This process maps physical (and logical) X operators to X operators and Z operators to Z operators. In other words, it is a CSS-preserving operation. To complete even just the Clifford group, we require operations that can map X operators to Z operators, on the physical and logical levels. In particular, we need ways to perform logical single-qubit Clifford operations. On a 2-dimensional code, twist defects [30][31][32][33] can be used to encode qubits, and also perform single-qubit Clifford gates on these qubits.
Twist defects however rely on symmetries of 2-dimensional codes that do not naturally extend to general LDPC codes. For instance, an error chain on the surface code has two frustrated stabilizers on either end regardless of the length of the chain. LDPC codes however do not possess these properties. For instance, expander codes have the property that the number of frustrated stabilizers grows with the size of the error. For these reasons, we have to look for other ways of generalizing twist defects.
In a companion paper, we introduce a defect called a wormhole that addresses this issue. Rather than rely on line-like defects, it builds upon and generalizes puncture defects. Since we already know how to construct punctures on the hypergraph product code, it is natural to extend them to wormholes.
The key idea is to entangle stabilizers along the boundaries of punctures. Doing so yields hybrid stabilizers whose weight does not scale with the size of the puncture. As we shall see, these stabilizers are created by measuring two-qubit Pauli operators. These measurements locally break the CSS nature of the code and serve as a resource to complete the Clifford group.
Let G = (V ∪ C, E) be a bipartite graph corresponding to a classical code C. Consider a hypergraph product of a graph G with itself. As before, let S ⊆ V and T ⊆ C be connected subsets of variable nodes and check nodes respectively. Furthermore the induced subgraphs do not overlap, i.e. they obey N ∩ T = M ∩ S = ∅. These sets must be correctable, i.e., they obey conditions specified in definition 5.
The wormhole is created by entangling the stabilizers along the boundaries of two punctures. This alters the structure of the code along the boundaries, and we must ensure that these enlarged regions remain correctable. Hence, we need to strengthen the notion of correctability to include the neighborhoods that define the punctures.
This will be necessary because the stabilizers on the boundary of the puncture will be removed to form hybrid stabilizers. To argue that the logical operators that emerge have certain properties, we shall use the above extended correctability condition. Equivalently these can be thought of as the conditions for a puncture defined using the sets S := M and T := N.
With these constraints established, we can associate a smooth puncture to the product T × S and a rough puncture to the product S × T. These punctures will be used to construct a wormhole in the following sections.

A. Measurements and hybrid-stabilizers
Within the interior of the punctures, we perform the same measurements as we did to initialize a puncture -single-qubit X measurements within the smooth puncture and single-qubit Z measurements within the rough puncture. We then perform two-qubit measurements along the boundaries of the two punctures. This yields hybrid stabilizers.
For what follows, it will be helpful to use the schematic for the smooth and rough puncture shown in fig.  7. Recall that the boundaries of punctures are described as follows: For any VV qubit (u, u ′ ) or CC qubit (c, c ′ ), we shall let P(u, u ′ ) or P(c, c ′ ) denote the single-qubit Pauli operator P on that qubit. The hybrid-stabilizers are generated by the following measurements along these boundaries.

VV qubits: for every
These two-qubit measurements do not commute with the stabilizers located on the boundary of the puncture. The next proposition will list the hybrid stabilizers we choose to resolve anti-commutations due to these measurements. Suppose P and Q are some sets of variable and check nodes respectively, sets of the form P × Q will refer to X stabilizer and Q × P to Z stabilizers. We shall write P × Q ↔ Q × P to denote the hybrid stabilizer formed by pairing stabilizers in a natural way. In other words, for p ∈ P and q ∈ Q, we let P × Q ↔ Q × P denote the hybrid stabilizers acting as X on the support of (p, q) and Z on the support of (q, p). As a matter of convention, the operators with X support are always denoted on the left, and those with Z support on the right.
The proposition states that the set of stabilizers that we choose to form hybrids are those that are adjacent to the puncture minus those in the interior. In other words, this is the set of stabilizers that live on the boundary of the punctures.

Proposition 14. Upon performing the measurements listed above, the new hybrid-stabilizers are associated with
where the double-arrow denotes the one-to-one pairing between the two sets as described above.
Proof. Since we begin with a puncture, certain stabilizers have already been removed from our code. These correspond to the stabilizers B × A of X type and A × B of Z type from the interior of respective punctures. We remove these stabilizers from a larger set corresponding to M × N and N × M respectively. With the interior carved out, this leaves only the boundary of the two punctures.
Next, consider two nodes c, v such that c ∈ N and v ∈ M. The Z stabilizer (c, v) will anti-commute with the X measurements if either c ∈ N \ A or v ∈ M \ B. By symmetry, any X measurement on the support of the Z stabilizer (c, v) will also act as Z on the support of the X stabilizer (v, c). The two individual stabilizers are frustrated, but this can be resolved by pairing them.
This produces the desired hybrid stabilizers.
The weight of the hybrid-stabilizers is thus independent of the size of the code. For this reason, this construction guarantees that we still have an LDPC code.
Thus when creating a wormhole, we begin as before by carving out certain portions of the code. Then, we perform two-qubit measurements along the boundaries of these punctures. We remove X and Z stabilizers from the code either because they lie within a puncture, or they anti-commute with a two-qubit measurement and are replaced by a hybrid stabilizer.
The code thus has the following X, Z and hybrid (denoted h) stabilizers: We conclude by reiterating the origin of these objects. Note that there are two punctures that are used to create the wormhole, one smooth and one rough. The set of all X stabilizers corresponds to V × C, but we subtract those stabilizers in these punctures. This corresponds to S × T from the rough puncture and M × N from the smooth puncture and the hybrid stabilizers. Similarly, the set of all Z stabilizers corresponds corresponds to C × V, but we subtract the stabilizers T × S from the smooth puncture and N × M from the rough puncture and the hybrid stabilizers. The hybrid stabilizers are created using the boundaries of these sets and are stated in proposition 14. The last two lines of hybrid stabilizers correspond to the two-qubit measurements used to generate the wormhole. We remind the reader that in this notation, operators with X support are to the left of the arrow, and those with Z support are to the right of the arrow.

B. Logical Pauli operators for wormholes
When we create a wormhole from two punctures, there are two ways in which stabilizers are updated. First, there are stabilizers within the puncture that are jettisoned because they anti-commute with the single-qubit measurements. Second, there are stabilizers on the boundary of the puncture that are replaced by hybrid stabilizers. This results in two sets of logical operators for the wormhole as we shall see below.
As in the case of punctures, there are two varieties of logical operators: loop-type operators and chain-type operators. These logical operators are inherited from the underlying punctures.
The first set of logical operators can be described as the logical operators corresponding to the punctures S × T and T × S. Given the symmetry of the construction, there is a one-to-one correspondence between the loop-type logical X operators around the rough puncture S × T and the loop-type logical Z operators around the smooth puncture T × S. Proof. To show that these objects are no longer part of the stabilizer group but commute with the X and Z stabilizers, we point to the proof of theorem 9. The development is similar save for the new stabilizers, the new two-qubit operators that were measured along the boundaries of the two punctures.
Type 1: Note that the measurements surrounding the smooth puncture are of Z type and will therefore commute with the loop-type logical Z operators of type 1. Furthermore, these logical operators are defined only along the boundary of the puncture T × S. A product of the two-qubit stabilizers is necessarily defined on both punctures, as X on the puncture T × S and Z on the puncture S × T. Therefore this implies that the proposed logical operators of type 1 cannot be in the span of the stabilizers.

Type 2:
The logical operators of type 2 are defined on (Γ(N) \ S) × M ∪ N × (Γ(M) \ T). Thus they do not interact with the two-qubit measurements. For the same reason, they cannot be expressed as a product of the two-qubit measurement operators. By definition 13, these objects do not affect the embedded logical operators, and are themselves not in the span of the Z stabilizer.
Before proceeding to the conjugate logical operators, it will be useful to highlight a symmetry of this construction. For logical Z operators, we chose the vector of Z operators around the puncture T × S for type 1 and N × M for type 2. Equivalently we could have chosen the vector of X operators around the puncture S × T for type 1 or M × N for type 2. The next lemma states that these two choices are equivalent.

Lemma 16. Every logical loop-type operator for a wormhole has two equivalent representations: an X type loop around one puncture or a Z type loop around the other.
Proof. We shall deal with each type in turn.

Type 1:
Consider loop-type logical X operators that emerge from the puncture S × T. These logical operators are supported on (N \ A) × T ∪ S × (M \ B). Each qubit on this boundary has a unique partner on the other boundary T × (N \ A) ∪ (M \ B) × S. By symmetry, there is a one-to-one correspondence between the loop-type logical X operators on S × T and the loop-type logical Z operators on T × S. These can be mapped to one another because of the two-qubit measurements.

Type 2:
Let G S , G T be the matrices whose rows span ker(H t S ) and ker(H T ) respectively.
Let g ∈ G t S and f ∈ G t T be any two rows of G t S and G t T respectively. By the considerations above and theorem 9, we can define α Z as a loop-type operator around T × S, where Similarly, α X can be defined as a loop-type operator around S × T, where is also a logical operator.
To show that these are in the span of the stabilizers, note that the hybrid stabilizers are given by Thus the operator maps the loop-type logical Z operator to the loop-type logical X operator.
Since this is true for arbitrary f and g, any operator in the space can be mapped between one puncture and the other.
The logical X operator for the wormhole are products of chain-type operators. The form of these operators are given in theorem 12.

Lemma 17. For every loop-type logical Z operator L Z around T × S and the unique loop-type logical X operator L X on S × T corresponding to L Z , let the conjugate chain-type operators be Q X and Q Z respectively. The product Q X Q Z is the conjugate logical operator to the operator L Z .
Proof. Following the proof of theorem 12, the logical chain-type operators evidently commute with the X and Z stabilizers and are not spanned by them.
From the symmetry of the construction, any overlap with the two-qubit measurement operators always occurs in pairs if at all. Therefore these operators commute with the two-qubit stabilizers.
Furthermore since the two-qubit measurement operators are only supported on the boundary, it cannot span the logical chain-type operators. Since the chain-type operators anti-commute with the logical looptype operators, it cannot be expressed as a product of stabilizers alone.

V. CODE DEFORMATION
Having described how to create defects, we can now proceed to discuss how to use them. Logical transformations will be effected using a technique called code deformation (see for instance [29,31,34,35]). The core idea behind this technique is to perform a sequence of T − 1 elementary transformations of a code C =: C (1) , obtaining codes C (2) , ..., C (T−1) , C (T) in the process.
Each elementary transformation is comprised of measurements of Pauli operators. As shown in the schematic, the overall result is to leave the codespace globally unchanged, i.e. C (1) = C (T) = C, but the logical operators of the code may, and hopefully will, undergo a non-trivial transformation. Since this transformation maps all Pauli operators to Pauli operators, the resulting operation must be a logical Clifford operation.
We begin by reviewing code deformation to highlight some useful properties. Rather than focus right away on hypergraph product codes, we step back and study code deformation as it applies to general quantum codes. Our intent is to track the transformation of the logical operators.

A. Non-mixing
For all t ∈ {1, ..., T}, the quantum error correcting code C (t) is defined on n qubits for some fixed n. At step t, C (t) is the eigenspace of the stabilizer group S (t) .
The logical operators of the code are denoted L (t) . These are the objects that we wish to track as we transform the code. Let Z := S (t) ∩ S (t+1) be the operators that are common to both S (t) and S (t+1) .
The following lemma states that when we transition from C (t) to C (t+1) , the logical operators that need to be updated are either removed entirely or mapped by multiplying by a stabilizer element.
Lemma 18. If a logical operator L ∈ L (t) anti-commutes with the measurement of S (t+1) ∈ S (t+1) /Z , then it is either 1. L is moved to the space of errors; or 2. there exists a unique S ′ ∈ S (t) \ Z such that L → LS ′ .
Proof. Consider any element S ∈ S (t+1) \ Z. One of two things can happen to S as we transition from step t to t + 1: 1. S can commute with all of S (t) \ Z, i.e. S ∈ L (t) .
2. S can commute with some element S ′ ∈ S (t) \ Z. This element S ′ can be chosen uniquely because if there were any other element S 0 that anti-commuted with S, we map S 0 → S 0 S ′ .
In turn, this leads to two possibilities for the logical operators L (t) . Suppose we have an operator L ∈ L (t) that anti-commutes with an element S ∈ S (t+1) \ Z. We then update the logical as follows: 1. If S is an operator in L (t) , then we remove the operator L from the logical operators. It must now be an error.
2. If there exists an element S ′ ∈ S (t) \ Z such that S anti-commutes with S ′ , then L → LS ′ .
This proves the claim.
In addition, the sets S (t) and L (t) can also exchange operators. The operators in S (t) \ S (t+1) that commute with all of S (t+1) will be transformed into logical operators. For instance, this happens when we create a new logical qubit in the surface code by forming a puncture. Recall that stabilizer generators and errors can be partitioned into pairs such that a stabilizer generator S and error E only anti-commute with each other, and commute with all other operators. When a stabilizer S is transformed into a logical operator, the conjugate errors E becomes the unique conjugate error. If there is no unique conjugate error, then this space cannot be used to store a qubit. For instance this happens when we have a smooth puncture on a lattice with only rough boundaries. The string of X from the smooth boundary of the puncture cannot be terminated on the boundary. Thus creating a smooth puncture on a lattice with only rough boundaries cannot be used to store a qubit (because there are redundant checks).
The operators in L (t) that are in the span of S (t+1) \ S (t) will be removed from the stabilizer group.
This analysis proves that logical operators transform linearly as summarized by the following lemma.

Lemma 19.
For t ∈ {1, ..., T}, let L (t) denote the set of logical operators of the code C (t) . Let L (t) ∈ F k×n 2 and S (t) ∈ F (n−k)×n 2 be the generator matrix for this space. There exists a matrix Q (t) such that we can write the logical operators L (t) as As we proceed with code deformation, we will encounter problems unique to codes that carry several logical qubits. We define below the notions of non-mixing and small transformations as guidelines for studying such transformations.
First, there may potentially be several ways of updating the logical operators. This is because there is no preferred basis for us to express the logical operators in the intermediary steps. Equivalently, the matrix Q (t) is not unique as there could be several different ways of expressing the logical operators over the course of code deformation. However, the global transformation Q = Q (T) Q (T−1) . . . Q (2) Q (1) generated by the entire sequence of code deformation is unique if we choose the same logical operator basis for For t ∈ {1, ..., T}, let L (t) denote the set of logical operators of the code C (t) . Let be a partition of the set of logical operators L (t) into good and bad operators. These sets are defined such that the operators in the set g all have weight above some threshold, whereas those in b have weight below this threshold. Furthermore, assume that L (t) g contains k ′ < k independent operators. The set of qubits defined by {L (t) b } b shall be considered as gauge qubits. We wish to avoid the space of gauge qubits interacting with our logical qubits and to this end, define the non-mixing condition.
Definition 20 (Non-mixing). We say that code deformation is non-mixing with respect to the partition if there exists a direct-sum decomposition where matrices Q g is rank k ′ over the good partition.
By guaranteeing that an operation is non-mixing with respect to this partition, we can show that the gauge qubits do not affect the logical qubits. The constraint on the rank will guarantee that none of the good logical operators are mapped to either the stabilizers or gauge operators over the course of code deformation.
The non-mixing condition is important because we cannot guarantee that the number of logical operators will remain a constant over the course of code deformation. In general, hypergraph product codes need not be translation invariant like the toric code; even if we maintain a puncture of a fixed radius, the number of logical operators created by this puncture could change as it moves. If we move a puncture by enlarging it and then shrinking it, this could also change the number of logical operators supported by the puncture. However the two conditions on the high-weight operators regulate their transformation.
To illustrate, we consider encoding logical qubits on the surface in a slightly unusual way. Consider the pair of punctures on the surface code shown in fig. 8. This pair shall be treated as a single entity that encodes a logical qubit. The logical Z operator is the loop encircling the pair, denoted Z. The logical X operator is a string of Xs running from the boundary of a puncture to the boundary of the lattice, denoted X. The operator A running between punctures is a low-weight string of Xs and this logical operator is a potential liability. We therefore treat it as a gauge qubit. When encoding information, we only store logical information using the qubit defined by Z and X. So long as we do not braid using A or drag another defect between these two punctures, this troublesome chain will not cause a problem. In this way the operation will be non-mixing because the operator A will never be entangled with other qubits of interest.

B. Code deformation on the hypergraph product code
We now return to hypergraph product codes, and in this section shall discuss how to perform Clifford gates with the help of an ancilla. We begin by recalling lemma 1 from [36]. It stated that we can perform all Clifford gates on a qubit of interest, labelled 1, with the help on an ancillary qubit, labelled a, as follows.

Lemma 21. Let A and B be distinct, non-trivial single-qubit Pauli operators. Let S and T be two Pauli operators, not necessarily distinct. The two-qubit measurements A 1 S a and B 1 T a , together with all single-qubit Pauli measurements on qubit a are sufficient to generate the single-qubit Clifford group on qubit 1.
First, we point out that regardless of whether the qubit 1 is an embedded logical qubit, or merely another wormhole, the ancilla qubit(s) shall be encoded in a wormhole. Second, we will require these wormholes to encode Y resource states. For reasons that will become clear shortly, we will find it difficult to perform single-qubit Y measurements on the logical level. If however we are provided ancilla qubits that are prepared in the Y state, we may use these objects catalytically to perform a Y measurement. This is necessary, at least as per lemma 21, to complete the Clifford group.
In addition to these single-qubit gates, we also require entangling gates between multiple logical qubits. The following circuit shows how this too can be accomplished on the logical level with the help of an ancilla and Pauli measurements. This completes the requirements to perform Clifford gates. In the next subsection, we shall study how exactly to perform these measurements.

C. Measurements and traceability
The measurements of Pauli operators described above will have to be performed on the logical operator and the ancilla qubit encoded in a wormhole. In addition, we use a regular puncture based qubit to perform the measurement. This puncture shall be referred to as a needle.
We are interested in logical operators of the needle that can be measured fault tolerantly. In turn these operators will be used to measure the logical Pauli operators of a wormhole or even an embedded logical qubit. For instance, suppose we have a smooth puncture that has high weight X and Z operators. The looptype operator can be measured by shrinking the size of the puncture while simultaneously maintaining the size of the chain-type conjugate logical operator. This would of course make the logical qubit susceptible to logical Z error. However this will not affect the measurement outcome so long as the logical X operator remains high weight. Similarly, the chain-type logical X operator can be measured fault tolerantly by shrinking its size while maintaining the size of the loop-type Z logical operator. Unfortunately, the logical Y operator of a puncture cannot be measured fault tolerantly as this would require that we minimize both the size of the chain-type operator as well as that of the loop-type operator. The logical qubit would then become unprotected, and the measurement outcome error prone. The impossibility to fault-tolerantly measure Y operators will cause some problems as we shall see below.
Let w denote a logical qubit, or sets of logical qubits whose state we wish to measure. This could refer to a set of logicals on the wormhole, or an embedded logical, or some combination thereof. Let P p refer to a logical operator of the puncture that is fault tolerantly measurable. A logical operator Q w on system w is said to be traceable if there is a unitary operation U implementable by code deformation such that Such operations will be used to measure traceable operators Q w in order to effect measurements of logical operators in lemma 21. The operator Q w shall be measured using the standard ancilla-assisted way: we shall prepare the ancilla in an eigenstate of P p , applying the unitary U and then measure the operator P p .
If Q w is either X or Z, then we need to find an operator P p and an operation U such that On the other hand, if Q w = Y, then the situation is complicated for reasons we will discuss shortly. In such a case, we shall assume that we are given access to an another system b prepared in a Y state. The aim is to perform the operation which would not have been possible without the system b. If we now use this operation to perform a Y w Y b measurement, then we can do so without affecting the state of system b. In this way, the system b serves as a catalyst and can be used for the next Y measurement on w. In the next subsection, we shall discuss how to obtain such a resource states to serve as catalysts.
We now make some remarks about traceability, but before doing so, we remark that this completes the requirements to perform Clifford gates on the system w.
We begin by noting that the advantage of the wormhole in this process is that it permits both the X and Z type logical operators associated to a defect to be traced. This has been via example in our companion paper [36]; whether or not a logical operator is traceable on a specific code is a code dependent question. The other advantage of a wormhole is that it permits the use of a Y resource state whose role is catalytic. Without the wormhole, the Y resource states would be consumed and we would therefore require a constant supply of these states.
In the case of the surface code, the new wormhole defects that we have introduced make it possible to trace both the X and Z type logicals associated to a wormhole [36]. Suppose that P p above is the logical X operator of a smooth puncture. As it traces the support of a logical Y = iXZ operator, it will encounter the location when the X and Z logical operators cross. As shown in fig. 10, the trailing chain-type X operator is mapped to the logical Y operator and this has the effect of breaking the original protocol. So instead of mapping X p to Y w X p as desired, we are mapping it to Y w Y p . Completing the protocol would require measuring Y p , but this cannot be done because it is not fault tolerantly measurable. Not all is lost however; we may find that products of logical Y operators are traceable. As an example, this was demonstrated in the case of the surface code with wormhole defects [36], so the framework we describe is sufficiently rich to enable the complete Clifford group in principle.
We would like to highlight that we are not providing a constructive approach to compiling specific logical operators. Compiling the operation required to trace operators not only depends on the code, but also on the representation of the logical we are interested in performing. The process described merely provides a framework within which to search for such an operation. For instance, given a specific code, we could search for non-trivial Clifford operators that we can perform using brute force. Once a set of Clifford operations has been found, these can be used as a basis to compose Clifford gates of interest using standard compiling tools.
We consider an example, perhaps perverse, to illustrate that simply having a wormhole and a puncture is insufficient to generate all Clifford gates. Suppose we have two copies of the toric code that are disconnected from each other. If we were to initialize a wormhole and a needle on one of the two codes, then clearly this is insufficient to perform all gates fault tolerantly on all logical qubits. This is because there is clearly no way for the needle to move to the second code. This suggests that in general, the ability to perform all gates may be closely tied to graph connectivity. We will return to this idea in section V E.

D. Resource states
Clifford gates by themselves only generate a finite group [28]. Furthermore, the techniques that we have discussed above only map Pauli operators to Pauli operators. Therefore they can at best generate logical Clifford operations.
As is well known, it is sufficient to add any gate that is not already in the Clifford group to achieve a universal gate set. One such non-Clifford gate is the T gate, defined as T = e iπZ/ 8 We assume that we have access to physical T gates and wish to construct a logical T gate. The technique presented here will mean that this logical T gate is not inherently fault tolerant. In turn the T gate will be noisy and therefore need to be distilled [37].
By its definition, the logical T = e iπZ/8 gate can be executed on the support of the logical Z operator. Suppose we have a logical qubit encoded in a smooth puncture prepared in the |+ state. The logical Z operator is a loop-type operator that is supported only on the boundary of the puncture. We can inject the T gate on to the code by performing an explicit circuit on this boundary. One might hope that the stabilizers and logicals on the boundary obey some symmetry such as triorthogonality [38]. In that case, the circuit to inject the T gate could be made fault tolerant as we would merely require transversal physical T gates in order to implement the transversal logical T gate. However we do not assume that the puncture obeys these symmetries, and thus the circuit to perform the T is not fault tolerant. Thus we would want to minimize the size of the circuit to minimize the number of faulty locations. To this end, we may shrink the puncture i.e. reduce the size of the boundary that supports the logical qubit. Upon performing the T circuit, we increase the size of the puncture again to make it resistant to logical Z type errors. While doing so of course, the logical qubit is still subject to logical Z errors and is thus subject to dephasing errors. The end result is a noisy version of the T state defined as | A = T |+ .
Once we have several such logical qubits carrying potentially noisy T states, we can perform state distillation on the hypergraph product code. State distillation is a technique that uses several noisy T states and produces fewer, but higher fidelity copies of the T state. These higher fidelity copies can then be used in the computation if they are sufficiently reliable. State distillation only requires Clifford gates and Pauli measurements, and these are operations we already have the ingredients to perform.
To perform a logical T on an embedded logical qubit, we can use the T gate and a single-qubit teleportation circuit [39].
In addition to using resource states to inject the T gate, we also require resource states that are prepared in the Y basis as was discussed in the previous section. However since these resource states are used catalytically, they can be prepared once before the beginning of the computation. To prepare these states, we follow a procedure similar to the preparation of a T state. We shall perform the circuit required to prepare a puncture qubit in a logical Y state. We note that the circuit to prepare the Y state will have to be performed on the support of both the X and Z logical operators. To minimize the size of this circuit, we therefore reduce the size of both the loop-type and the chain-type logical operators. This circuit will likely not be fault tolerant; after performing the circuit we will have to increase the size of the loop-type and chain-type logical operators. During this period the logical qubit supported on the puncture may be subject to depolarizing noise.
Once we have prepared several such logical qubits, we will have access to several noisy Y resource states.
To purify theme, we will have to perform distillation. Of course, there may be more optimal ways to prepare these states, but this is sufficient to generate the desired resource states.

E. Point-like punctures
Before we conclude, we consider a scheme that involves the movement of point-like punctures. This deviates slightly from the framework that we have discussed above, and since the punctures are pointlike, the setup is not fault tolerant. However, we feel that it still may help understand movement in these codes.
When discussing the surface code, traceability is relatively simple. We can move a rough puncture around a smooth puncture and thereby perform a non-trivial Clifford operation. Whether or not such an operation is possible is dictated by topology; a rough puncture can trace any closed loop of Z operators. The situation is not so simple in the case of hypergraph product codes.
In this subsection, we discuss when logical operators are traceable using a point-like puncture to serve as the needle. Of course, using a point-like puncture is not fault tolerant as the loop-type logical operators are low-weight and therefore error prone. This discussion will however shed light on when something non-trivial is possible. It also illustrates that we can generalize braiding to graph-theoretic concepts.
We shall show that in the case of point-like punctures, traceability can be cast as walks on a graph. Thus whether or not a logical operator is traceable boils down to verifying whether a certain path on a graph exists. This shows that it may be possible to efficiently verify when an operator is traceable.
Consider a point-like puncture, i.e. one created by removing a single stabilizer generator. For the sake of illustration, this puncture is smooth. Code deformation entails that there exist a series of steps such that the point-like puncture corresponds to T j × S j for j = 1, ..., N.
Let T j = {c j }, S j = {v j } be singleton sets and let T j × S j be the associated point-like puncture. The logical Z operator α that emerges is then just the support of the Z stabilizer (c j , v j ) i.e. α j := Γ(c j ) × v j ∪ c j × Γ(v j ). Let the conjugate logical operator be β j . Let us study how these objects transform as we transition from step j to step j + 1.
Moving a single step: Suppose we consider moving this puncture by changing T j → T j+1 = {c j+1 }, where c j and c j+1 share a bit u j in their common neighborhood as shown in fig. 11. In the growth phase, we would measure X on the qubit (u, v j ). This anti-commutes with all the Z stabilizers that are incident to (u, v j ), i.e. (c 1 , v j ), (c 2 , v j ) and (c j+1 , v j ). The logical Z operator α j (corresponding to (c j , v j )) also anti-commutes with this operation. These objects are updated per the stabilizer update rule. We multiply the operators (c 1 , v j ), (c 2 , v j ) and α j by (c j+1 , v j ). The stabilizer (c j+1 , v j ) is itself removed from the stabilizer group.
In the contraction phase, we measure the stabilizer (c j , v j ), returning it to the stabilizer group. This anti-commutes with the measurement X(u, v j ). This also anti-commutes with the logical operator β j . To resolve this anti-commutation relation, we map β j → β j+1 := β j X(u, v). We then discard X(u, v) from the stabilizer group.
Thus the logical operator β j has grown by a single qubit. However, we have not yet returned to the code space. The logical operator β j+1 still anti-commutes with the operators (c 1 , v j ) and (c 2 , v j ). These objects have still not been returned to the stabilizer group. We highlight this matter because it is this issue that does not allow us to fit the movement of a point-like puncture into the framework described in the previous sections.
There are two concerns associated with these frustrated stabilizers: 1. Will they return to the stabilizer group?
2. Will the weight of these objects grow or remain upper bounded by some constant?
First, since the path we traverse corresponds to a logical, it must commute with all the stabilizers. Thus at some point during the course of the point-like puncture moving, it will commute with each stabilizer that it frustrated. Exactly when these operators will be returned to the stabilizer group will depend on the path being traversed.
Secondly, the weight of these stabilizers is always guaranteed to be upper bounded by a constant. In fact, these frustrated operators are always pairwise products of the puncture at step j and themselves. For instance, consider the example above where we transitioned by one step, from j to j + 1. In the very next step, suppose the next point to be removed corresponds to the stabilizer (c j+2 , v j ). The stabilizer (c j+1 , v j ) is returned to the stabilizer group. Therefore the frustrated stabilizers (c 1 , v j ) and (c 2 , v j ) are now multiplied by (c j+2 , v j ). This will continue until we measure another qubit in the support of (c 1 , v j ) and (c 2 , v j ), at which point they will return to the stabilizer group.
For a point-like puncture, this analysis shows that the logical can grow one qubit at a time. With this insight, we can cast the problem of whether or not a logical is traceable as a graph problem. In this problem, we first consider a logical operator, say Q, that has no Y operators in its support. We use this operator to define a graph G Q as follows. The stabilizers that are adjacent to the qubits become the vertices of G Q and the qubits in the support of Q become the edges of G Q . If there exists a sequence of stabilizers that we can puncture, each connected by a single-qubit then this path becomes traceable.
In particular, this can be cast as Eulerian cycle [40]. Eulerian cycle is an efficient algorithm that can be stated as follows: Algorithm 1 Eulerian cycle 1: Input: Graph G = (V, E). 2: Output: A path on the graph such that every edge is traversed exactly once if it exists.
It is well known that an Eulerian cycle exists only when the degree of each vertex in the graph is even. Thus given a graph with n vertices, the existence of an Eulerian cycle can be verified efficiently. This example shows that braiding may generalize to a purely graph-theoretic concept. Moreover, there may exist an efficient algorithm to answer when a logical is traceable.

VI. CONCLUSIONS
We have provided a general framework to implement Clifford gates on hypergraph product codes. This framework is based on code deformation, and generalizes defect based encoding from topological codes. In particular, we generalize wormhole defects introduced in a companion paper [36]. These defects ensure that the code remains LDPC at each step of code deformation.
In contrast to a previous scheme suggested by Gottesman, these operations are defined on a single block. The generalized punctures that we obtain are capable of encoding several logical qubits. We discussed a framework that is rich enough to permit all Clifford gates on encoded qubits. Whether a particular code permits these gates is a code dependent question. Finally, we discussed the movement of point-like charges on these graphs. These defects serve to illustrate that something non-trivial can be accomplished on hypergraph product codes. Furthermore they demonstrate how braiding can be generalized to a purely graph-theoretic notion.
Of course, this is merely a proof of concept, and there is a lot of work to be done in the future. In no particular order, we discuss some issues that need to be addressed; this is by no means a complete list. Using point-like punctures helps us understand that traceability in certain instances is connected to Eulerian cycle. As punctures become larger however, it is unclear how this algorithm will generalize. Furthermore, we would like efficient algorithms that can verify whether a given representation of a logical is traceable.
We believe that addressing these questions will be intimately connected to the specific code we wish to use. It is of course important to consider specific classes of codes to understand which Clifford gates we can generate using this process. At this juncture however, this seems premature as there is as yet no consensus as to which hypergraph product codes offer the best performance. As the theory progresses, this will likely be informed by decoding algorithms, but perhaps the ability to perform Clifford gates could also factor into this choice. The punctures may exhibit symmetries that do not require state distillation to prepare resource states. Since these codes are no longer local, it is unclear what sorts of gates can be implemented transversally, and which cannot.
Addressing these questions will help establish the role of hypergraph product codes in quantum computation.

VII. ACKNOWLEDGEMENTS
AK would like to thank Christophe Vuillot, Daniel Gottesman, Vivien Londe and Nicolas Delfosse for discussions. AK also acknowledges the support of the Fonds de Recherche -Nature et Technologie (FRQNT) for the B2X scholarship. This work was partially funded by Canada's NRC and NSERC. David Poulin is a CIFAR Fellow in the Quantum Information Science program.