Eﬃcient color code decoders in d ≥ 2 dimensions from toric code decoders

We introduce an eﬃcient decoder of the color code in d ≥ 2 dimensions, the Restriction Decoder, which uses any d -dimensional toric code decoder combined with a local lifting procedure to ﬁnd a recovery operation. We prove that the Restriction Decoder successfully corrects errors in the color code if and only if the corresponding toric code decoding succeeds. We also numerically estimate the Restriction Decoder threshold for the color code in two and three dimensions against the bit-ﬂip and phase-ﬂip noise with perfect syndrome extraction. We report that the 2D color code threshold p 2D ≈ 10 . 2% on the square-octagon lattice is on a par with the toric code threshold on the square lattice.

One of the leading approaches to building scalable quantum computers is based on the twodimensional toric code [1][2][3] and exhibits the following desirable features: only geometrically local syndrome measurements are required, the accuracy threshold is high, and the overhead of fault-tolerant implementation of logical Clifford gates is low. However, due to geometric locality of stabilizer generators, there are certain limitations [4][5][6][7][8] on "easy-to-implement" logical gates. In particular, it is not known how to fault-tolerantly implement a non-Clifford gate with low overhead in the 2D toric code. The formidable qubit overhead of state distillation [9,10] associated with the necessary non-Clifford gate motivates the search for alternative ways of achieving universality.
The color code [11][12][13] provides an alternative to the toric code that may make faulttolerant computation on encoded qubits easier. Namely, in the 2D color code one can transversally implement the logical Clifford group, and by code switching and gauge fixing [14,15] between the 2D and 3D versions of the color code one can fault-tolerantly implement the logical non-Clifford T = diag(1, e iπ/4 ) gate [16][17][18][19]. Unfortunately, despite a close connection between the color and toric codes [20], the color code is generally considered to be more difficult to decode than the toric code [21,22]. In particular, the highest reported error-correction thresholds for the 2D color code with efficient decoding algorithms are around 7.8% ∼ 8.7% [23][24][25]. Those threshold values are clearly below the thresholds of 9.9% ∼ 10.3% for leading efficient toric code decoders, which include the Minimum-Weight Perfect Matching (MWPM) algorithm [3] and the Union-Find (UF) decoder [26]. This seemingly suboptimal performance of the color code is one of the reasons why the 2D toric code, not the 2D color code, is the leading quantum computation approach.

High-threshold decoder for the 2D color code
In this section we discuss the two-dimensional color code and the problem of color code decoding. Then, we describe the Restriction Decoder for the 2D color code as well as provide the numerical estimates of its threshold. For technical details about the Restriction Decoder we refer the reader to Sec. 4.3, where we analyze its general d-dimensional version for d ≥ 2.

A brief overview of the 2D color code
Stabilizer codes are quantum error correcting codes [34,35] specified by the stabilizer group S, which is an Abelian subgroup of the Pauli group P n generated by tensor products of Pauli operators on n qubits. The code space associated with the stabilizer group S is spanned by +1 eigenvectors of stabilizers S ∈ S, and thus for the code space to be non-trivial we require −I ∈ S. We focus our emphasis on CSS stabilizer codes [36,37], whose stabilizer group is generated by X-and Z-type stabilizer generators. Since for any CSS stabilizer code one can independently correct Pauli X and Z errors, in what follows we concentrate on correcting Z errors; correcting X errors can be done analogously.
The 2D color code is an example of a topological CSS stabilizer code [38], which is defined on a two-dimensional lattice L built of triangles; see Fig. 1(a). Importantly, we require that the vertices of L are 3-colorable, i.e., we can assign three colors R, G and B to the vertices in such a way that any two vertices incident to the same edge have different colors. Let us denote by ∆ 0 (L), ∆ 1 (L) and ∆ 2 (L) the sets of vertices, edges and triangular faces of the lattice L, respectively. We place one qubit on every face f ∈ ∆ 2 (L). The X-and Z-type stabilizer generators S X (v) and S Z (v) of the 2D color code are associated with every vertex v ∈ ∆ 0 (L). They are defined as products of Pauli X and Z operators on qubits on all the faces f ∈ ∆ 2 (L) neighboring the vertex v, i.e., S X (v) = f v X(f ) and S Z (v) = f v Z(f ). Logical Pauli X, Y and Z operators for the 2D color code can be implemented by string-like X, Y and Z operators forming non-contractible loops.

The problem of color code decoding
Let ⊆ ∆ 2 (L) be the set of faces identified with qubits affected by Z errors and σ ⊆ ∆ 0 (L) be the corresponding X-type syndrome, i.e., the set of all the X-type stabilizer generators anticommuting with the error . We refer to the violated stabilizer generators as 0D point-like excitations; see e.g. [27] for a comprehensive discussion. In the 2D color code there are three species of excitations labelled by one of three colors R, G and B. Observe that a two-qubit Pauli Z error on a pair of adjacent qubits leads to a pair of excitations of the same color, whereas a single-qubit Pauli Z error creates a triple of excitations of all three colors; see Fig. 1 (b). Note that the presence of any excitations in the system indicates that the encoded logical information suffered from some errors.
In order to remove all the excitations and subsequently return the encoded information back to the code space we need an efficient decoder. A decoder is a classical algorithm, which as the input takes a syndrome σ, i.e., an observed configuration of the excitations, and as the output returns an appropriate Pauli correction. Since the correction is a Z-type operator (as we want to correct Z errors), thus to describe that operator we just need to specify its support ϕ ⊆ ∆ 2 (L). We say that decoding succeeds if the initial error combined with the correction ϕ implements a trivial logical operator. For concreteness, in the rest of the paper we assume the phase-flip noise, which independently affects each qubit with Pauli Z error with probability p. Let us consider some code family defined on lattices labeled by their linear size L. We say that a decoder for the code (family) has a threshold p th if the probability of unsuccessful decoding p fail (p, L) goes to zero in the limit L → ∞ as long as p < p th .
One possible decoding strategy for the 2D color code is to find the most likely error consistent with the observed syndrome. This task, however, goes beyond solving the minimumweight perfect matching (MWPM) problem 1 as the color code excitations are not only created or removed in pairs but also in triples. Also, we emphasize that no decoder can simply ignore colors of the excitations since one can only remove either pairs of excitations of the same color or triples of excitations with three different colors. The aforementioned difficulties led to a belief that decoding of the 2D color code is more challenging than decoding of the 2D toric code [21,22]. (c) (d) Figure 1: (a) Qubits of the 2D color code are placed on the triangular faces of a two-dimensional lattice L with 3-colorable vertices, whereas X-and Z-type stabilizer generators S X (v) and S Z (v) (shaded in blue) are associated with every vertex v ∈ ∆ 0 (L). A logical Pauli X, Y or Z operator can be implemented by a string-like operator supported on faces shaded in green. (b) Qubits on a subset of faces ⊆ ∆ 2 (L) (shaded in grey) are affected by Pauli Z errors, which result in the X-type syndrome σ ⊆ ∆ 0 (L) (highlighted vertices). Observe that a single-qubit error (marked by 1) creates a triple of excitations of three different colors, whereas a two-qubit error (marked by 2) creates a pair of excitations of the same color. (c) The restricted lattice L RG is obtained from L by removing all B vertices of L, as well as all the edges and faces incident to the removed vertices. One can always find a subset of edges ρ RG ⊆ ∆ 1 (L RG ) (blue), whose 0-boundary matches the restricted syndrome σ RG ⊆ ∆ 0 (L RG ), i.e., Decoder finds a color code correction ϕ ⊆ ∆ 2 (L) (hatched in magenta) from ρ RG ∪ ρ RB (thick blue and green edges) by using a local lifting procedure. Namely, for every R vertex v ∈ ∆ R 0 (ρ RG ∪ ρ RB ) one finds a subset of neighboring faces τ v ⊆ St 2 (v), whose 1-boundary locally matches ρ RG ∪ ρ RB , i.e., Note that the initial error and the correction ϕ = v∈∆ R 0 (ρ RG ∪ρ RB ) τ v are not the same; rather, they form a stabilizer.

The Restriction Decoder for the 2D color code
Before we describe the main idea behind the Restriction Decoder for the 2D color code, we need to discuss a few concepts, such as boundaries and restricted lattices. Let α ⊆ ∆ 2 (L) be a subset of faces of the lattice L. We denote by ∂ 2 α ⊆ ∆ 1 (L) the set of all the edges of L, which belong to an odd number of faces of α. We refer to ∂ 2 α as the 1-boundary of α. Similarly, if β ⊆ ∆ 1 (L) is a subset of edges of L, then we define its 0-boundary ∂ 1 β ⊆ ∆ 0 (L) to be the set of all the vertices of L, which are incident to an odd number of edges of β. Finally, the restricted lattice L RG is obtained from the lattice L by removing all the vertices of color B as well as all the edges and faces incident to the removed vertices; see Fig. 1(c). In other words, the restricted lattice L RG only contains vertices of color R or G, as well as edges between them; the restricted lattice L RB is defined similarly.
Recall that the goal of color code decoding is to find a correction ϕ ⊆ ∆ 2 (L), which is a collection of two-dimensional faces, from a syndrome σ ⊆ ∆ 0 (L), which is a configuration of zero-dimensional excitations. By definition, σ is the set of all the vertices of L, which belong to an odd number of faces of the error ⊆ ∆ 2 (L). Let σ RG ⊆ ∆ 0 (L RG ) denote the set of all the R and G excitations of σ. We can view σ RG as the restriction of the syndrome σ to the restricted lattice L RG . We observe that the total number of R and G excitations has to be even, i.e., |σ RG | ≡ 0 mod 2, since the excitations in the 2D color code are either created in pairs of the same color, or in triples of three different colors. Thus, we can always find a subset of edges ρ RG ⊆ ∆ 1 (L RG ) of L RG , whose 0-boundary matches the R and G excitations, i.e., ∂ 1 ρ RG = σ RG ; see Fig. 1(c). Note that a similar discussion follows for the set of all the R and B excitations σ RB ⊆ ∆ 0 (L RB ).
The first step of the Restriction Decoder is to use the restricted lattices L RG and L RB and the restricted syndromes σ RG and σ RB in order to find ρ RG ⊆ ∆ 0 (L RG ) and ρ RB ⊆ ∆ 0 (L RB ) satisfying ∂ 1 ρ RG = σ RG and ∂ 1 ρ RB = σ RB , respectively. This step can be viewed as an instance of the MWPM problem, and thus can be efficiently solved by e.g. the blossom algorithm [39]. We remark that the task of finding ρ RG and ρ RB is analogous to the problem of decoding the 2D toric code defined on the restricted lattices L RG and L RB [24,25]. As we explain later in Sec. 4, this observation is a key to generalizing the Restriction Decoder to d ≥ 2 dimensions.
The second step of the Restriction Decoder uses a local lifting procedure, which allows us to find a correction ϕ from ρ RG ∪ ρ RB . Let β ⊆ ∆ 1 (L) be a subset of edges of the lattice L. We denote by ∆ R 0 (β) the set of all the R vertices belonging to the edges of β and define β| v to be the set of all the edges of β incident to a vertex v ∈ ∆ 0 (L). Also, we define St 2 (v) to be the set of all the faces of L containing v. Then, for every vertex v ∈ ∆ R 0 (ρ RG ∪ ρ RB ), the local lifting procedure finds a subset of faces As we show in the (Lift) Lemma 7, there always exists τ v satisfying the aforementioned condition. Moreover, one can find τ v in time O(|St 2 (v)|) [13]. As claimed, this step of the Restriction Decoder uses only geometrically local information, i.e., Finally, the Restriction Decoder returns ϕ = v∈∆ R 0 (ρ RG ∪ρ RB ) τ v as the output. We remark that it is a priori unclear that the output ϕ is a valid color code correction, i.e., all the excitations in σ are removed by ϕ. We address this issue in the (Successful Decoding) Theorem 2. Moreover, the performance of the Restriction Decoder depends on the chosen pair of restricted lattices.
We summarize the Restriction Decoder for the 2D color code on the lattice L.
• Construct restricted lattices L RG and L RB .
We emphasize that the Restriction Decoder differs from the decoding algorithm in Ref. [25] in a couple of important ways; see [13] for a detailed comparison. First, the Restriction Decoder uses only two restricted lattices L RG and L RB . This in turn leads to a substantial improvement of the threshold for the 2D color code on the square-octagon lattice over the thresholds of all the previous efficient color code decoders, as we demonstrate in the next subsection. Second, the Restriction Decoder uses a local lifting procedure, compared with a global lifting procedure for the decoding algorithm in Ref. [25]. This crucial simplification allows us to construct for the first time fully-local decoders for the color code in d ≥ 3 dimensions. Third, the Restriction Decoder never aborts and always returns a valid color code Fourth, a generalization of the decoding algorithm in Ref. [25] to d ≥ 2 dimensions results in a decoder whose complexity would rapidly increase with d, as could be seen in three dimensions [40]. On the other hand, the Restriction Decoder can be straightforwardly adapted to the d-dimensional color code, leading to a simple decoder with quite a satisfactory performance and the time complexity proportional to the time complexity of the toric code decoder that we choose to use. We numerically estimate the Restriction Decoder threshold for the 2D color code and the phase-flip noise, assuming perfect syndrome measurements. We consider the 2D color code on (a lattice dual to) the square-octagon lattice L with periodic boundary conditions, as illustrated in Fig. 2(a). We choose the restricted lattices L RG and L RB to contain degreefour vertices. In the first step of the Restriction Decoder we use the Blossom V algorithm provided by Kolmogorov [41] to find ρ RG and ρ RB within the restricted lattices L RG and L RB . We estimate the Restriction Decoder threshold p 2D ≈ 10.2% by plotting the decoding failure probability p fail (p, L) as a function of the phase-flip error rate p for lattices of different linear size L and finding their crossing point; see Fig. 2(b). We report that the 2D color code threshold matches the MWPM algorithm threshold for the 2D toric code on the square lattice. Lastly, we remark that the choice of restricted lattices determines the Restriction Decoder threshold, as we explain in Sec. 4.4.

Going beyond two dimensions
In this overview section, we describe decoding of CSS stabilizer codes. We start by constructing a CSS chain complex for any CSS code [25,42]. The formalism of chain complexes is useful not only for decoding, but also exemplifies the intimate connection between the CSS codes and the systematic procedure of gauging and ungauging stabilizer symmetries [43]. Then, we discuss geometric lattices which are needed to introduce the toric and color codes in d ≥ 2 dimensions. We also briefly explain the problem of toric code decoding.

CSS stabilizer codes and chain complexes
Any CSS code, whose stabilizer group, by definition, is generated by X-and Z-type stabilizer generators, can be described by a CSS chain complex where C Z , C Q and C X are F 2 -linear vector spaces with bases B Z = Z-type stabilizer generators, B Q = physical qubits and B X = X-type stabilizer generators, respectively. Note that the vectors in C Q are in a one-to-one correspondence with the subsets of qubits; similarly, vectors in C Z and C X correspond to Z-and X-type stabilizers. We choose linear maps ∂ Z : C Z → C Q and ∂ X : C Q → C X , called the boundary operators, in such a way that • the support of any Z-type stabilizer ω ∈ C Z is given by ∂ Z ω, • the X-type syndrome, which is the set of violated X-type stabilizer generators for any given Z-type error on the subset of qubits ∈ C Q , can be found as ∂ X .
The boundary operators ∂ Z and ∂ X can be identified with the parity-check matrices H T Z and H X of the CSS code. Note that the composition of two boundary operators is the zero operator, i.e., ∂ X • ∂ Z = 0, since any Z-type stabilizer has a trivial X-type syndrome. We illustrate the CSS chain complex construction with the examples of the toric and color codes in Sec. 2.4 and Sec. 2.6. Let ∈ C Q be the subset of physical qubits affected by Z errors. To decode Z errors we need to guess from the observed X-type syndrome ∂ X which subset of physical qubits ϕ ∈ C Q might have been affected. Decoding succeeds iff the error and the guess ϕ differ by some stabilizer, namely there exists ω ∈ C Z such that + ϕ = ∂ Z ω. Note that the X-syndrome of any valid Z-correction has to match the X-syndrome of the actual Z-error, i.e., ∂ X ϕ = ∂ X . However, it may happen that the error combined with the correction implements a non-trivial logical Z operator, i.e., + ϕ ∈ im ∂ Z , resulting in the decoding failure. Finally, we remark that X errors can be decoded in a similar way, however one needs to consider a chain complex dual to the one in Eq. (1).

Lattices
In order to discuss topological stabilizer codes, we need to introduce some notions to succinctly describe geometric lattices on which those codes are defined. A d-dimensional lattice L can be constructed by attaching d-dimensional cells to one another along their (d − 1)-dimensional faces. We denote by ∆ k (L) the set of all k-cells of the lattice L, where 0 ≤ k ≤ d, and assume that ∆ k (L) is finite. In particular, the sets ∆ 0 (L), ∆ 1 (L), ∆ 2 (L) and ∆ 3 (L) correspond to vertices, edges, two-dimensional faces and three-dimensional volumes of L. We say that the lattice L is a homogeneous simplicial d-complex [44] if: (i) every k-cell of L forms a k-simplex, which together with all its faces belongs to some d-cell of L, and (ii) the intersection of any two cells of L is a face of both of them, where 0 ≤ k ≤ d. In what follows, we restrict out attention to lattices without boundary. Now let us analyze the local structure of a lattice L, which is a homogeneous simplicial d-complex. Since we consider the lattice L without boundary, every (d − 1)-simplex of L belongs to exactly two different d-simplices. Let κ ∈ ∆ k (L) be a k-simplex, where 0 ≤ k ≤ d. We abuse the notation and denote by ∆ l (κ) the set of all l-simplices contained in κ, where l ≤ k. The set of all n-simplices of L which contain κ is called the n-star of κ and we denote it by where n ≥ k. The set of all n-simplices of L which do not intersect with κ but belong to the same d-simplices as κ is called the n-link of κ and we denote it by where n ≤ d − k − 1. We write Lk L n (κ) to explicitly state that we consider the n-link of δ within the lattice L. We also define a join ν * µ to be the simplex spanned by the vertices of two disjoint simplices ν and µ. In particular, the join ν * µ is the smallest simplex containing both ν and µ. We abuse the notation and write ν * α = {ν * κ|∀κ ∈ α}, where α ⊆ ∆ k (L) is some subset of k-simplices. We illustrate the notions of a star, link and join in Fig. 3.
We remark that for any [45], where 0 ≤ k < d. Moreover, one can show that there is a one-to-one correspondence between the elements of the k-link Lk k (δ) and the elements of

Boundary operators
Now we introduce C k (L) to be the F 2 -linear vector space with the set of k-cells ∆ k (L) of the lattice L as a basis. Note that there is a one-to-one mapping between vectors in are formal sums of k-cells, and subsets of ∆ k (L), and thus we treat them interchangeably. We define a (standard) boundary map ∂ k : C k (L) → C k−1 (L) as a linear map specified for every basis element κ ∈ ∆ k (L) by For brevity, we refer to vectors in C k (L) and the corresponding subsets of ∆ k (L) as k-chains for L. Let us consider a k-chain α for L. If ∂ k α = 0, then we call α a k-cycle for L and write α ∈ ker ∂ k . We call α a k-boundary for L and write α ∈ im ∂ k+1 if there exists a (k + 1)-chain β for L, such that α = ∂ k+1 β. Note that any k-boundary is a k-cycle, i.e., im ∂ k+1 ⊆ ker ∂ k , since the composition of two consecutive boundary operators is the zero map, i.e., ∂ k • ∂ k+1 = 0 for k ≥ 1.
We remark that we need boundary operators to define the toric code in Sec. 2.4. However, in order to discuss the color code, it is very convenient to generalize a notion of a boundary operator. Namely, for all k = n we introduce ∂ k,n : C k → C n as a linear map defined on every basis element κ ∈ ∆ k (L) by In this notation, ∂ k = ∂ k,k−1 . Recall that in general the composition of two generalized boundary operators is not the zero operator, i.e., ∂ n,m • ∂ k,n = 0, unless k = n + 1 = m + 2 or the lattice L satisfies some extra combinatorial conditions as in the case of color code lattices; see Sec. 2.6.

The toric code in d ≥ 2 dimensions
One of the most studied examples of topological stabilizer codes is the toric code. The d-dimensional toric code of type k can be defined on a d-dimensional lattice L built of ddimensional cells, where 1 ≤ k < d. We place one qubit at every k-cell κ in L. For every (k − 1)-cell µ and (k + 1)-cell ν we define X-and Z-stabilizer generators S X (µ) and S Z (ν) to be the product of either Pauli X or Z operators on qubits in the neighborhood of µ and ν, namely Equivalently, the CSS chain complex from Eq. (1) associated with the toric code is given by Non-trivial logical Z operators correspond to the k-cycles, which are not k-boundaries for L, and thus we view them as k-dimensional non-contractible objects. Any X-type syndrome corresponds to a (k−1)-boundary for L and we view it as a collection of the (d−1)-dimensional excitations. Lastly, we remark that non-trivial logical X operators and Z-type syndromes can be viewed as To illustrate the discussion, we consider the 3D toric code of type k = 1 on the cubic lattice L, see Fig. 11(b). We place qubits on edges of L, and define X-and Z-stabilizer generators for every vertex v and face f of L as the product of Pauli X and Z operators on qubits on edges adjacent to v and f , namely The logical Pauli X and Z operators form 2D sheet-like and 1D string-like objects, whereas X-and Z-syndromes can be viewed as 0D point-like and 1D loop-like excitations.

Toric code decoding
Now we discuss the problem of decoding Z errors in the d-dimensional toric code of type k, where 1 ≤ k < d. Let be a k-chain for L corresponding to the subset of qubits affected by Z errors. As we already mentioned, the information available to the decoder is the X-type syndrome σ = ∂ k , which is a (k−1)-boundary for L. We want to find a k-chain ϕ for L, which is consistent with the observed syndrome, i.e., ∂ k ϕ = σ. Recall that decoding succeeds if the initial error and the correction ϕ implement a trivial logical operator, i.e., + ϕ ∈ im ∂ k+1 . One decoding strategy is to choose ϕ as the most likely error for the given syndrome. Assuming that the phase-flip noise affects every qubit with the same probability, this strategy is equivalent to finding ϕ of the minimal size. In other words, toric code decoding can be reduced to the following problem, which we call the k-Minimum-Weight Filling (MWF) problem: for any (k − 1)-boundary σ ∈ im ∂ k for the lattice L find the smallest k-chain ϕ for L whose boundary ∂ k ϕ matches σ, i.e., Despite the fact that solving the k-MWF problem does not constitute the optimal decoding strategy for the toric code (as it returns the most likely error instead of the most likely equivalence class of errors), it usually yields quite satisfactory error-correction thresholds. We remark that in the special case of k = 1 the MWF problem corresponds to the MWPM problem, which can be efficiently solved by e.g. the blossom algorithm [39]. However, in a general case for k ∈ {1, d − 1, d} it is not known how to efficiently find a solution to the MWF problem 2 .
There is an alternative decoding strategy for the d-dimensional toric code of type k = 1, which does not require solving the MWF problem. This efficient strategy is based on a recently proposed cellular automaton, the Sweep Rule, which generalizes celebrated Toom's rule [47,48] to any locally Euclidean lattice; see the accompanying paper [33]. The resulting toric code decoder, the Sweep Decoder, is fully-local, naturally incorporates parallelization and generically exhibits high error-correction threshold, even in the presence of measurement errors. As we will see in Sec. 5.3, the Sweep Decoder allow us to develop for the very first time cellular-automaton decoders for the color code in d ≥ 3 dimensions.

The color code in d ≥ 2 dimensions
To define the d-dimensional color code, we need a d-dimensional lattice L, which is a homogeneous simplicial d-complex without boundary. In addition, we require that the vertices of L are (d + 1)-colorable, i.e., one can introduce a function where Z d+1 is a set of d + 1 colors and any two vertices connected by an edge have different color. We remark that one can equivalently define a d-dimensional color code lattice to be a d-colex. We postpone the detailed discussion of d-colexes to Sec. 3.1.
The d-dimensional color code of type k is constructed by placing one qubit at every d- we define X-and Z-stabilizer generators S X (µ) and S Z (ν) to be the product of Pauli X and Z operators on qubits adjacent to µ and ν, namely Equivalently, the CSS chain complex from Eq. (1) associated with the color code is given by Note that in Eq. (13), unlike in Eq. (8), we do need generalized boundary operators. Nontrivial logical Z operators correspond to the elements of ker ∂ d,k−1 \ im ∂ d−k−1,d and can be viewed as k-dimensional objects, similarly as for the toric code. Any X-type syndrome is identified with some element of im ∂ d,k−1 and thus can be viewed as a collection of (k − 1)-dimensional excitations. We defer the detailed description of logical operators of the ddimensional color code to Sec. 4.2.
To illustrate the discussion, we consider the 3D color code of type k = 1 on the bcc lattice L; see Fig. 11(a). Note that the bcc lattice L is built of tetrahedral volumes and the vertices of L are 4-colorable. We place qubits on tetrahedra of L, and define X-and Z-stabilizer generators for every vertex v and edge e of L as the product of Pauli X and Z operators on qubits on tetrahedra adjacent to v and e, namely The logical Pauli X-and Z-operators form 2D sheet-like and 1D string-like objects, whereas X-and Z-syndromes can be viewed as 0D point-like and 1D loop-like excitations.

Colexes and restricted lattices
In this section we introduce the notions of colorable d-balls and d-colexes in order to systematically construct any d-dimensional color code lattice L, where d ≥ 2. Our definition of d-colexes can be viewed as an alternative to the one provided in Ref. [12]. Then, we prove four technical lemmas regarding color code lattices, which are later needed for color code decoding in Sec. 4. Lastly, we discuss the construction of restricted lattices and prove the (Isomorphic Homology Groups) Theorem 1 relating homology groups of restricted lattices and the underlying color code lattice L.

A local structure of colexes
Now we provide two recursive definitions of a colorable d-ball and a d-colex.  Note that a d-colex L is formally defined as a finite collection of disjoint colorable d-balls B v , i.e., L = v∈V B v , where the vertices in V have the same color c * ∈ Z d+1 . One can show that the colex L gives rise to a discretization of some d-dimensional closed manifold and, subsequently, for any vertex u ∈ ∆ 0 (L) \ V the set St d (u) satisfies the definition of a colorable d-ball. We thus write B u = St d (u). We leave to the reader to show that for any color c ∈ Z d+1 \ {c * } the colex L can be decomposed as a finite collection of disjoint colorable d-balls centered at vertices of L of color c.
We remark that the (d + 1)-colorability of the vertices of a d-colex L is sufficient to guarantee that different color code stabilizers commute. However, this is not a necessary condition to define the color code on L, as just the local colorability within the neighborhood of every vertex of L is enough to ensure the commutation relations [49]. Moreover, the (d + 1)-colorability of the vertices implies that for any n < d and d-simplex δ ∈ L, all of the n-simplices contained in δ are of different colors, i.e., if µ, ν ∈ ∆ n (δ) are different, then color(ν) = color(µ). Here, we abuse the notation and write to denote the set of colors of all the vertices v ∈ ∆ 0 (α) of an n-chain α for L and refer to it as the color of α. Lastly, for notational convenience we denote by the set of all the vertices of α of some chosen color c * ∈ Z d+1 .

Four technical lemmas
We now present four technical lemmas. To make them easier to digest, we illustrate each of them with a figure in two dimensions. Our first lemma is illustrated in Fig. 5.
Lemma 1 (Local Restriction). Let the local restriction of an n-chain α for a d-colex L be defined as the set of all the n-simplices of α incident to a vertex v ∈ ∆ 0 (L), namely Let c * ∈ Z d+1 be any color. Then, We would like to clarify that in the (Local Restriction) Lemma 1 and in the rest of the article the operation of taking the local restriction has the highest order of precedence. For instance, ∂ n α| v is unambiguous and stands for ∂ n (α| v ).
Proof. Note that (i) and (ii) are an immediate consequence of the (d + 1)-colorability of the d-colex L and the definition of the local restriction α| v in Eq. (19). Moreover, α + α| v does not contain any n-simplices incident to the vertex v, which in turn implies that no (n − 1)-simplex incident to v belongs to ∂ n (α + α| v ). By linearity of the boundary map, we thus conclude that an (n − 1)-simplex µ ∈ St n−1 (v) belongs to ∂ n α if and only if it belongs to α| v , which is the statement of (iii). To One can thus show that ∂ n α| v is an (n − 1)-cycle for ∂B v . By definition, ∂B v is a (d − 1)colex homeomorphic to an (n − 1)-sphere, and hence ∂ n α| v is also an (n − 1)-boundary for ∂B v . Lastly, note that for any n-simplex ν ∈ St n (v) there exists a unique (n − 1)-simplex µ ∈ Lk n−1 (v), such that ν = v * µ. Thus, an (n − 1)-simplex µ belongs to ∂ n α| v if and only if an n-simplex v * µ belongs to α| v , leading to α| v = v * ∂ n α| v . This concludes the proof.
(a) (b) Figure 6: The two B vertices form a 0-boundary α. We can build a 1-chainβ of color (a) RB or (b) GB whose boundary is α.
Proof. Since α is an n-boundary for L, there exists an (n + 1)-chain β satisfying ∂ n+1 β = α. However, we have no guarantee about the color of β. Note that if n = d − 1, then |C| > n + 1 implies C = Z d+1 , and trivially color(β) ⊆ C. Thus, it suffices to consider the case of n < d−1.
Also, without loss of generality (possibly by reordering the colors) we assume that C = Z |C| . We proceed with a proof by induction over the colex dimension d. The base case for d = 1 is immediate, since we then have n = d − 1. Now assume the induction hypothesis for any colex of dimension smaller than d. Let color(β) ⊆ Z i+1 , where i ∈ color(β). If i + 1 ≤ |C|, then β = β satisfies the assumptions of the lemma. Otherwise, i ≥ |C| and the set of vertices of β of color i is non-empty, i.e., ∆ i 0 (β) = ∅. Consider an (n + 1)-chain Using the (Local Restriction) Lemma 1 we conclude that ∂ n+1 β| v is an n-boundary for ∂B v . By invoking the induction hypothesis for the (d − 1)-colex ∂B v , the n-boundary ∂ n+1 β| v for ∂B v and the subset of colors Z i , we can find an (n + 1)-chain β(v) for ∂B v , such that ∂ n+1 β(v) = ∂ n+1 (β| v ) and color( β(v)) ⊆ Z i . Therefore, we consider an (n + 1)-chain β for L defined as follows for which ∂ n+1 β = ∂ n+1 β = α. Moreover, using the (Local Restriction) Lemma 1 we obtain Thus, there exists j < i, such that color(β ) ⊆ Z j+1 and j ∈ color(β ). We repeat the reasoning by redefining i = j and β = β until we find β satisfying the assumptions of the lemma, which concludes the proof.
An example of our third lemma is shown in Fig. 7.
(a) (b) Figure 7: The 1-cycle in (a) which has color RGB is homologous to the 1-cycle in (b) that has color GB.
Proof. Without loss of generality, assume that C = Z n+1 , color(α) ⊆ Z i+1 and i ∈ color(α). Note that since α is a subset of n-simplices of L, thus |color(α)| ≥ n + 1. If i = n, then α = α satisfies the color requirement. In the case of i > n the set of vertices of α of color i is non-empty, i.e., ∆ i 0 (α) = ∅. Then, by invoking the (Local Restriction) Lemma 1 we obtain that for every v ∈ ∆ i 0 (α) an (n − 1)-chain ∂ n α| v is an (n − 1)-boundary for the (d − 1)-colex ∂B v and it also satisfies color(∂ n α| v ) ⊆ Z i . Thus, the (Colorable Filling) Lemma 2 guarantees that we can find an n-chain β(v) for ∂B v , such that ∂ n β(v) = ∂ n α| v and color( β(v)) ⊆ Z i . Moreover, β(v) is homologous to α| v , since, by definition, B v is homeomorphic to a d-disk. Now, we define an n-chain α for L as follows By construction, α is homologous to α and from the (Restriction) Lemma 1 we obtain color( α) ⊆ Z i . Thus, there exists j < i, such that color( α) ⊆ Z j+1 and j ∈ color( α). If j = n then α satisfies the color requirement, otherwise we repeat the reasoning with α = α and i = j until we find α of color C. This concludes the proof.  Lemma 4 (Colorable Link). Let α be an n-boundary for a d-colex L, where n < d. Assume that α has n + 1 colors, i.e., |color(α)| = n + 1. Then, there exists a (d − n − 1)-chain Ω(α) for L, such that color(Ω(α)) = Z d+1 \ color(α) and µ∈Ω(α) Lk n (µ) = α.
Similarly as in the proof of the (Colorable Filling) Lemma 2, we proceed with a proof by induction over the colex dimension d. The base case for d = 1 is immediate, since we then have n = d − 1. Now assume the induction hypothesis for any colex of dimension smaller than d. By invoking the induction hypothesis for the (d − 1)-colex ∂B v , the n-boundary ∂ n+1 β| v for ∂B v and the subset of colors ∂ n+1 β| v , we can find a (d − n − 2)-chain Ω(∂ n+1 β| v ) for ∂B v , such that color(Ω(∂ n+1 β| v )) = color(∂B v ) \ color(α) and Recall that Lk ∂Bv n (µ) denotes the n-link of µ ∈ ∆ d−n−2 (∂B v ) within the lattice ∂B v (not within the lattice L).

Restricted lattices
Definition 3 (Restricted Lattice). Let L be a d-colex (without boundary) and C ⊂ Z d+1 be a subset of k + 1 colors, where 1 ≤ k < d. The restricted lattice L C is a cell (k + 1)-complex constructed from L as follows.
• For 0 ≤ i ≤ k: i-cells in L C are the same as i-simplices in L of color included in C • Every (k + 1)-cell Ξ(δ) in L C is obtained by attaching a (k + 1)-disk along its boundary to the k-link Lk k (δ) of a (d−k −1)-simplex δ in L of color Z d+1 \C, and thus is uniquely identified with δ Similarly as for the lattice L, for i = 0, . . . , k + 1 we introduce F 2 -linear vector spaces C i (L C ) associated with the i-cells of the the restricted lattice L C and linear boundary maps Note that for i = 1, . . . , k and any ι ∈ ∆ i (L C ) we have ∂ C i ι = ∂ i ι, whereas for any Ξ(δ) ∈ C k+1 (L C ), by definition of (k + 1)-cells of L C , we have ∂ C k+1 Ξ(δ) = Lk k (δ). Moreover, one can show that Lk k (δ) is a k-boundary for L, which in turn leads to im ∂ C k+1 ⊂ im ∂ k+1 . We emphasize that in order to define the toric code of type k on the restricted lattice L C we just need to have cells of dimension up to k + 1 in L C . Moreover, the local modifications of the d-colex L we implement to construct L C do not change the structure of k-cycles and k-boundaries for L (which in turn determine the toric code logical subspace). We prove this fact in the (Isomorphic Homology Groups) Theorem 1.

Theorem 1 (Isomorphic Homology Groups).
The k th homology groups of L C and L are isomorphic, i.e., ker Proof. We use the second isomorphism theorem: if U and V are submodules of a module W , then the quotient modules (U + V )/V and U/(U ∩ V ) are isomorphic; see e.g. [50]. Namely, consider the following vector spaces W = ker ∂ k , U = ker ∂ C k and V = im ∂ k+1 . We have ker ∂ C k ⊂ ker ∂ k and im ∂ k+1 ⊆ ker ∂ k , as any k-cycle for L C is also a k-cycle for L and any k-boundary for L is a k-cycle for L. In the remaining we prove that: . To show (i), first note that U + V ⊆ ker ∂ k , since both U and V are subspaces of W . From the (Colorable Cycles) Lemma 3 we obtain that for any α ∈ ker ∂ k we can find α ∈ ker ∂ C k and β ∈ im ∂ k+1 such that α = α + β. This implies ker ∂ k ⊆ U + V and we obtain (i).
To show (ii), first note that im ∂ C k+1 ⊆ U ∩ V , since im ∂ C k+1 ⊂ im ∂ k+1 and im ∂ C k+1 ⊆ ker ∂ C k . Also, if α ∈ ker ∂ C k ∩ im ∂ k+1 , then α is a k-boundary for L of color C. Thus, using the (Colorable Link) Lemma 4 we can find a (d − k − 1)-chain Ω(α) for L, such that color(Ω(α)) = Z d+1 \ C and µ∈Ω(α) Lk n (µ) = α. Note that according to Eq. (28) in the definition of the restricted lattice Ω(α) corresponds to a (k+1)-chain for L C , namely Ξ(Ω(α)) = µ∈Ω(α) Ξ(µ). Since ∂ C k+1 Ξ(Ω(α)) = µ∈Ω(α) Lk k (µ) = α, this implies that α ∈ im ∂ C k+1 is a k-boundary for L C . Thus, we conclude that U ∩ V ⊆ im ∂ C k+1 and obtain (ii). We finish the proof by invoking the second isomorphism theorem and concluding that ker Lastly we remark that we can successively add i-cells to the restricted lattice L C to construct a d-dimensional lattice L C , where k +2 ≤ i ≤ d. Namely, every i-cell of L C corresponds to some (d − i)-simplex δ ∈ ∆ d−i (L) of color in Z d+1 \ C and is constructed by first finding all (d − i + 1)-simplices of color in Z d+1 \ C that contain δ, and then attaching an i-disk along its boundary to the corresponding (i − 1)-disks forming an (i − 1)-dimensional sphere (which have already been attached in the preceding inductive step). This inductive construction of L C can be viewed as a description of the i-skeleton of a cell complex corresponding to L C . We thus can treat L C on the same footing as L, namely as a discretization of some d-dimensional manifold.

Decoding the color code in d ≥ 2 dimensions
This section is devoted to the problem of decoding the d-dimensional color code, where d ≥ 2. First, we establish a morphism of chain complexes of the d-dimensional color and toric codes, which is a generalization of the result for d = 2 from Ref. [25]. Then, we discuss the structure of logical Pauli operators of the color code. Finally, we introduce the Restriction Decoder for the d-dimensional color code and prove the (Successful Decoding) Theorem 2 describing the performance of the Restriction Decoder. This in turn allows us to estimate the color code threshold from the toric code threshold.

Morphism between color and toric code chain complexes
Definition 4 (Restriction). Let L be a d-colex and C ⊂ Z d+1 be a subset of k +1 colors, where 1 ≤ k < d. The restriction π C is a triple of linear operators π (0) where δ C is defined as the k-simplex of color C belonging to the d-simplex δ ∈ ∆ d (L). Recall that L C is the restricted lattice and, according to Eq. (28), Ξ(ν) is the (k + 1)-face of L C corresponding to the (d−k−1)-simplex ν removed from L, and thus, by definition, ∂ C k+1 Ξ(α) = Lk k (ν).

Lemma 5 (Morphism).
Consider the color code of type k defined on a d-colex L, where 1 ≤ k < d and let C ⊂ Z d+1 be a subset of k + 1 colors. Then, the restriction π C is a morphism between chain complexes of the color code of type k on L and the toric code of type k on the restricted lattice L C . In other words, the following diagram is commutative Proof. Let us pick δ ∈ L and consider the right side of the diagram. We want to show that π (1) C (δ). Note that for any n < k all n-simplices of δ of colors included in C belong to the k-simplex δ C = π Thus, we obtain which shows commutativity of the right side of the diagram in Eq. (33). Now we analyze the left side of the diagram. Let us pick δ ∈ ∆ d−k−1 (L) and consider two cases. In the first case, when color(δ) = Z d+1 \ C, all the k-simplices in the k-link of δ have color C. Recall that Eq. (4) establishes a one-to-one correspondence between the elements of the k-link Lk k (δ) and the elements of the d-star St d (δ), which allows us to represent any µ ∈ St d (δ) as µ = δ * κ with κ ∈ Lk k (δ). Then, we also have π (1) C (δ * κ) = κ and thus In the other case, i.e., color(δ) = Z d+1 \ C, we define C = C ∪ color(δ), whose cardinality satisfies the following Let x = |C| − 1. Since C ⊇ color(δ), then the d-star St d (δ) of δ can be decomposed as a disjoint union of d-stars of x-simplices ξ of color C, which contain δ; see the (Disjoint Union) Lemma 2 in Ref. [18]. In other words Moreover, for any n-simplex ν with n < d the cardinality of the d-star St d (ν) is even, i.e., |St d (ν)| ≡ 0 mod 2; see the (Even Support) Lemma 4 in Ref. [18]. Since we consider arithmetic in F 2 , for any x-simplex ξ we have µ∈St d (ξ) ξ C = 0, where ξ C denotes the k-simplex of color C belonging to ξ. Thus, we obtain where in the last step we use π (2) C (δ) = 0, since color(δ) = Z d+1 \C. This shows commutativity of the left side of the diagram in Eq. (33) and thus concludes the proof.

Logical operators of the color code
Definition 5 (Membrane). Let L be a d-colex and γ ∈ ker ∂ k / im ∂ k+1 be an element of the k th homology group of L, where 1 ≤ k < d. Let C ⊂ Z d+1 be a subset of k colors and c * ∈ Z d+1 \ C. We define a (γ, C)-membrane to be a d-chain λ γ,C for L specified as follows where γ is a representative of γ, such that color( γ) = C {c * }, and We would like to make a couple of remarks on the definition of a (γ, C)-membrane.
(i) The (Colorable Cycles) Lemma 3 guarantees that we can find an k-cycle γ for L, which is a representative of γ and color( γ) = C {c * }.
(ii) By using the (Local Restriction) Lemma 1 we obtain that Recall that Lk ∂Bv is not guaranteed to be unique, and thus neither is Ω(v). Since ∂ k γ| v ⊆ ∆ k−1 (∂B v ), by using the (Local Restriction) Lemma 1 we arrive at (iii) A (γ, C)-membrane λ γ,C is uniquely specified the choice of γ and Ω(v) for every vertex v ∈ ∆ c * 0 ( γ). As we will see, different possible (γ, C)-membranes correspond to different representatives of the same logical operator of the color code. To provide the reader with some intuition, we remark that green shaded faces in Fig. 1(a) form a (γ, C)-membrane λ γ,C , where γ is associated with a dashed green curve and C denotes color G. We can then set c * as color R and choose γ to be the 1-chain of color RG that borders green shaded faces, i.e., γ = π (1) C * (λ γ,C ), where C * = C c * . Subsequently, Ω(v) includes all the edges of color RB that are incident to v and cross the dashed green curve. Lemma 6 (Logical Operators). Let L be a d-colex for the color code of type k and C ⊂ Z d+1 be a subset of k colors, where 1 ≤ k < d. Let γ ∈ ker ∂ k / im ∂ k+1 be an element of the k th homology group of L. Then, a Z-type operator supported on a (γ, C)-membrane is a logical operator for the color code, i.e., λ γ,C ∈ ker ∂ d,k−1 . Moreover, if γ ∈ (ker ∂ k \im ∂ k+1 )/ im ∂ k+1 , then the logical operator is non-trivial, i.e., λ γ,C ∈ im ∂ d−k−1,d .
Proof. We can straightforwardly verify that λ γ,C specified in Eq. (44) is a logical operator for the color code. Namely, Now let us assume that λ γ,C ∈ im ∂ d−k−1,d . Then, from the (Morphism) Lemma 5 we obtain π (1) where we use Eq. (47) and the (Local Restriction) Lemma 1. This leads to γ ∈ im ∂ C * k+1 ⊂ im ∂ k+1 , and by the contrapositive we conclude that if γ ∈ (ker ∂ k \ im ∂ k+1 )/ im ∂ k+1 , then λ γ,C ∈ im ∂ d−k−1,d , which finishes the proof. Now we make a couple of remarks on the logical operators of the color code.
(i) Consider a collection of subsets of k colors not containing some chosen color c * ∈ Z d+1 , i.e., C = {C ⊂ Z d+1 |c * ∈ C and |C| = k} (51) and a basis of the k th homology group for L, i.e., where b k = dim(ker ∂ k / im ∂ k+1 ) is the k th Betti number for L. Then, one can show that the set of Z-type operators supported on (γ, C)-membranes {λ γ,C } γ∈Γ,C∈C is a basis of Z-type logical operators for the color code on L; see Ref. [12]. Thus, the number of logical qubits of the color code is equal to |Γ| · |C| = b k d k .
(ii) One can verify that π (1) C * (λ γ,C ) = γ for all γ ∈ Γ and C ∈ C. Thus, using the (Morphism) Lemma 5 and the (Isomorphic Homology Groups) Theorem 1 one concludes that {π (1) C * (λ γ,C )} γ∈Γ is a basis of Z-type logical operators for the toric code on the restricted lattice L C * , where C * = C {c * }. This, in turn, leads to the following isomorphism between the logical operators of the color code on L and the logical operators of |C| = d k different toric codes, each defined on a different restricted lattice L C * .

Algorithm: Restriction Decoder
Require: d-colex L for the color code of type k, where 1 ≤ k < d toric code decoder TCdecoder local lifting procedure Lift Input: color code syndrome, i.e., a (k − 1)-chain σ ∈ im ∂ d,k−1 for L Output: color code correction, i.e., a d-chain τ for L define C = {C ⊂ Z d+1 |c * ∈ C and |C| = k} for some chosen color c * ∈ Z d+1 for C ∈ C do define C * = C {c * } find the restricted lattice L C * and the restricted syndrome π

Restriction Decoder for the color code
We would like to make a couple of remarks on the Restriction Decoder.
(i) TCdecoder(L C * , π (0) C * (σ)) is a decoder of the d-dimensional toric code of type k defined on the lattice L C * . The decoder takes as the input the lattice L C * and the syndrome π (0) C * (σ) ∈ im ∂ C * k , and returns some toric code correction, i.e., a k-chain ρ C for L C * satisfying ∂ C * k ρ C = π (0) C * (σ). We emphasize that one can use as TCdecoder any toric code decoder.
A priori, it is not clear that one can always find τ v satisfying the condition in Eq. (54) or that different possible choices of τ v do not affect whether or not the Restriction Decoder successfully corrects the error . We address those issues in the (Lift) Lemma 7 and the (Successful Decoding) Theorem 2.
(iii) The local lifting procedure Lift can be used to construct (γ, C)-membranes λ γ,C , and thus to find representatives of logical operators for the color code. Namely, where γ is a representative of γ satisfying color( γ) = C {c * }.
(iv) The complexity of the Restriction Decoder is determined by the complexity of the toric code decoder TCdecoder. Moreover, as long as |St d (v)| is upper-bounded by some constant for all v ∈ ∆ 0 (L), the local lifting procedure Lift can be implemented in constant time (albeit in time exponential in |St d (v)|). Namely, one can naively find a d-chain τ v by considering all possible subsets of St d (v) and finding one which satisfies Eq. (54). For more efficient ways of implementing Lift, see Ref. [13].
(v) Lastly, we emphasize that the Restriction Decoder is fully local (in the sense of space and time) as long as TCdecoder is fully local. In particular, one obtains a cellularautomaton decoder for the d-dimensional color code of type k, where 2 ≤ k < d, by using as TCdecoder the Sweep Decoder from Ref. [33]. We discuss that in Sec. 5.3.
In the rest of the proof we show that for all C ∈ C the (k − 1)-chain ξ(C) is indeed a (k − 1)-boundary for ∂B v . First, Eq. (56) implies that π , as the latter is derived from Eq. (56) by restricting attention to the (k − 1)-chains of color within C * . Thus, using the (Morphism) Lemma 5 and the fact that the operators π (0) C * (·) and ·| v commute, we arrive at By the construction of ρ C as a valid toric code correction, we have ∂ C * k ρ C = π (0) C * (σ). Using the (Local Restriction) Lemma 1 we obtain Combining Eqs. (59) and (60) leads to Thus, v ∈ ∆ 0 (ξ(C)) and the (Restriction) Lemma 1 implies that ξ(C) is a (k − 1)-boundary for ∂B v , which concludes the proof.
Theorem 2 (Successful Decoding). Let L be a d-colex for the color code of type k, where 1 ≤ k < d. Let ⊆ L be a Z-type error and σ = ∂ d,k−1 be the corresponding X-syndrome. Then, the output v∈∆ c * 0 (ρ) τ v of the Restriction Decoder is a valid color code correction for the error , i.e., + v∈∆ c * 0 (ρ) τ v ∈ ker ∂ d,k−1 . Moreover, the Restriction Decoder introduces no logical error iff for all C ∈ C the toric code decoder TCdecoder(L C * , π (0) C * (σ)) introduces no logical error, i.e., Proof. First note that C∈C C = Z d+1 . Thus, one can show that + v∈∆ c * 0 (ρ) τ v ∈ ker ∂ d,k−1 holds if and only if π We straightforwardly verify the latter. By definition of ρ C we have On the other hand, by using the (Local Restriction) Lemma 1 we find Note that in the above we use two facts: . This leads to Therefore, by using the the (Morphism) Lemma 5 and Eq. (54) we obtain for any C ∈ C. Thus, the output of the Restriction Decoder is indeed a valid color code correction.
To show the equivalence in Eq. (62) we observe that for all C ∈ C where we use Eq. (54). Since + v∈∆ c * 0 (ρ) τ v ∈ ker ∂ d,k−1 and π (1) C * ( ) + ρ C ∈ ker ∂ C * k , then by invoking the isomorphism in Eq. (53) we conclude that the equivalence in Eq. (62) has to hold. This finishes the proof of the theorem.

Estimating the color code threshold from the toric code threshold
We can find an estimate of the Restriction Decoder threshold for the d-dimensional color code of type k on the lattice L in terms of the thresholds of the d-dimensional toric codes of type k on the restricted lattices L C * for C ∈ C. Recall that 1 ≤ k < d, C = {C ⊂ Z d+1 |c * ∈ C and |C| = k} and C * = C {c * } for some chosen color c * ∈ Z d+1 . Namely, from the (Successful Decoding) Theorem 2 we know that the Restriction Decoder introduces no logical error if and only if TCDecoder for the toric code on L C * introduces no logical error for all C ∈ C. If the noise affecting the color code on L is modeled by the bit-flip or phase-flip noise, then the effective noise affecting the toric code on L C * is also described by the bit-flip or phase-flip noise. Importantly, no correlations between errors within the same restricted lattice L are introduced, however the noise strength changes and may vary for different qubits depending on the local structure of L C * .
Let the color code on L be affected by the phase-flip noise of strength p and f C * (p) capture the effective noise strength affecting the toric code on L C * . Note that the function f C * (·) depends on the local structure of L C * . Let q C * be the TCDecoder threshold for the toric code on L C * . By definition, if f C * (p) < q C * , then with high probability TCDecoder introduces no logical error. Note that the performance of the Restriction Decoder is limited by the worst performance of TCDecoder for the toric codes on the restricted lattices L C * for all C ∈ C. Thus, the Restriction Decoder threshold p L for the color code on L can be estimated as where f −1 C * (·) denotes the inverse function of f C * (·) (in the neighborhood (0, ε) where it exists).

More examples of decoding in 2D and 3D
In this section we illustrate color code decoding using the Restriction Decoder with a couple of examples in 2D and 3D. In particular, we discuss some variants of the Restriction Decoder, which: (i) provide an almost-linear time decoding, (ii) do not need restricted lattices, and (iii) can be implemented via cellular automata. Also, we numerically estimate the Restriction Decoder thresholds for the 3D color code from the 3D toric code thresholds.

Almost-linear time decoding of 0D point-like excitations in the color code
As we already mentioned, we can use any toric code decoder as a subroutine in the Restriction Decoder. In particular, for the 0D point-like excitations we could use the UF decoder [26]. Then, the runtime of the resulting Restriction Decoder would be almost linear in the number of qubits N , i.e., a worst case complexity of decoding would be O (N α(N )), where α(N ) is a very slowly growing function of N and for all practical purposes α(N ) ≤ 3; see Ref. [26] for the details.
For an illustration, let us consider the 2D color code on (a lattice dual to) the squareoctagon lattice L and the phase-flip noise, assuming perfect syndrome measurements; see Fig. 2(a). We choose the restricted lattices L RG and L RB in the same way as in Sec. 1.4, i.e., we set c * = R and C = {G, B}. We numerically estimate the threshold of the Restriction Decoder (which uses the UF decoder as a subroutine) to be p 2D ≈ 9.8%; see Fig. 9(a). We remark that we can estimate the color code threshold from the UF decoder threshold for the 2D toric code. First, note that L RG and L RB are the same and we refer to them as the 2-square lattices. Since there is an error on the edge of the restricted lattice iff there is exactly one error on two triangles containing that edge in the original lattice L, thus the effective noise strength for the toric code on the 2-square lattice is We numerically find the thresholds of the UF decoder for the 2D toric code on the 2-square lattice to be q 0D 2sq ≈ 17.7%; see Fig. 9(b). Finally, by using Eq. (68) we estimate the threshold of the Restriction Decoder (which uses the UF decoder as a subroutine) to be p 2D ≈ f −1 2sq (q 0D 2sq ) ≈ 9.8%, which is in agreement with our previous numerical estimation.

Decoding the 2D color code without restricted lattices
We can further simplify the Restriction Decoder for the 2D color code described in Sec. 1.3. Namely, we do not need to construct restricted lattices at all! We illustrate this practical simplification in Fig. 10.
The first step of a simplified version of the Restriction Decoder is to find two subsets of edges ρ RG , ρ RB ⊆ ∆ 1 (L), whose 0-boundaries respectively match the restricted syndromes σ RG , σ RB ⊆ ∆ 0 (L), i.e., ∂ 1 ρ RG = σ RG and ∂ 1 ρ RB = σ RB . We can find ρ RG and ρ RB by using any decoder for the 2D toric code on the lattice L and the syndromes σ RG and σ RB . Note that this time ρ RG and ρ RB may contain vertices of color B or G, respectively, since they are not limited to be only supported within the restricted lattices L RG and L RB .
The second step of the simplified decoder is to use a local lifting procedure to find a correction ϕ ⊆ ∆ 2 (L) from ρ RG + ρ RB . This time, however, we apply the lifting procedure not only to all R vertices of ρ RG + ρ RB , but also to all the B and G vertices of ρ RG and ρ RB , respectively. Similarly as before, for every vertex v ∈ ∆ R 0 ( ρ RG + ρ RB ) we find a subset of faces τ v ⊆ St 2 (v), such that its 1-boundary locally matches ρ RG + ρ RB , i.e., ( (a) (b) Figure 10: A simplified version of the Restriction Decoder for the 2D color code, which does not require restricted lattices. We assume the same initial error ⊆ ∆ 2 (L) as in Fig. 1(b). (a) We find a subset of edges ρ RG ⊆ ∆ 1 (L) (blue), whose 0-boundary matches the restricted syndrome σ RG ⊆ ∆ 0 (L), i.e., ∂ 1 ρ RG = σ RG . Note that there is a B vertex which belongs to ρ RG . (b) The simplified decoder finds the color code correction ϕ ⊆ ∆ 2 (L) by using a local lifting procedure for all the R vertices of ρ RG + ρ RB , as well as for all the B and G vertices of ρ RG and ρ RB , respectively. We depict the output of the local lifting procedure for the R, G and B vertices as the faces hatched in magenta, light green and light blue, respectively. Note that the initial error (shaded in grey) combined with the correction ϕ forms a stabilizer.
Finally, the output of the simplified decoder is We leave to the readers to show that ϕ is a valid color code correction.

Cellular automaton decoder of the 3D color code
We note that it seems impossible to have a strictly local (in the sense of space and time) decoder for two-dimensional topological stabilizer codes, since their syndrome is identified with zero-dimensional objects and they always have one-dimensional string-like logical operators [51][52][53]. For instance, in the 2D toric code one could have a pair of violated stabilizers separated by an arbitrarily large distance due to a string-like error. If the decoder used only local information about the syndrome, it would not know the relative positioning of the pair of violated stabilizers and thus could not find a recovery operator. This observation is consistent with all known decoding strategies, which rely on non-local information, either explicitly, as in the case of the MWPM algorithm [3], or implicitly, as in the case of the renormalization-group decoders [54][55][56][57]. It is possible, however, to construct a cellular automaton decoder of the color code in three dimensions, since one type of the syndrome forms 1D loop-like objects. We emphasize that if one wanted a fully local decoder for both X and Z errors, then one would need to consider the 4D color code of type k = 2. For simplicity, we focus on decoding Z errors in the 3D color code of type k = 2, as it captures all the important aspects of cellular-automaton decoding.
Similarly as for the 2D case in Sec. 5.2, we consider a simplified version of the Restriction Decoder, which does not use restricted lattices. Let ⊆ ∆ 3 (L) be the set of qubits affected by Z errors and σ = ∂ 3,1 be the corresponding X-type syndrome. First, we consider three restricted syndromes σ RGB , σ RGY , σ RBY ⊆ ∆ 1 (L) and for each of them we use the Sweep Decoder from Ref. [33] in the original lattice L to find ρ RGB , ρ RGY , ρ RBY ⊆ ∆ 2 (L). Then, in order to find a correction ϕ ⊆ ∆ 3 (L) we use a local lifting procedure. As in the 2D case, ρ RGB may contain vertices of color Y since we do not use the restricted lattice L RGB but the original lattice L; similarly for ρ RGY and ρ RBY . Thus, we need to apply the local lifting procedure to all the R vertices of ρ RGB + ρ RGY + ρ RBY , as well as to all the Y , B and G of ρ RGB , ρ RGY and ρ RBY , respectively.
For the convenience of the reader we summarize a simplified version of the Restriction Decoder for the Z errors in the 3D color code of type k = 2 on the lattice L. We emphasize that this simplified decoder can be implemented via a cellular automaton, and thus is fully local.
• For every triple of colors C ∈ {RGB, RGY, RBY } use the Sweep Decoder on the lattice L for the restricted syndrome σ C in order to find ρ C ⊆ ∆ 2 (L).
• Use the local lifting procedure for every R vertex of ρ RGB + ρ RGY + ρ RBY , as well as for every vertex of color RGBY \ C belonging to ρ C .
Since this simplified version of the Restriction Decoder only uses the initial lattice L (instead of three restricted lattices L RGB , L RGY and L RBY ), it is relatively easy to implement.

Numerical estimates of the 3D color code threshold from the 3D toric code threshold
We now consider the 3D color code of type k = 1 on the bcc lattice L; see Fig. 11(a). We assume the phase-flip noise and perfect syndrome extraction, and set c * = R and C = {G, B, Y }. Recall that qubits are placed on tetrahedral volumes of L and the X-type syndrome can be viewed as 0D point-like excitations. Note that the restricted lattice L RG forms the cubic lattice, whereas the restricted lattices L RB and L RY form the cubic diamond lattices; see Fig. 11(b)(c). We observe that for any C ∈ C there is an error on the edge of the restricted lattice L C * , where C * = C {c * }, iff there is an odd number of errors on tetrahedra containing that edge in the original lattice L. Thus, we find the effective noise strength for the toric code on the cubic and the diamond cubic lattices to be We numerically find the thresholds of the MWPM algorithm for the 3D toric code on the cubic and the diamond cubic lattices to be q 0D cub ≈ 2.95% and q 0D dia ≈ 5.8%, respectively; see Fig. 12(a)(b). Using Eq. (68), we arrive at an estimate of the Restriction Decoder threshold for the 3D color code on the bcc lattice and 0D point like excitations We verify tightness of the estimate of the Restriction Decoder threshold by directly implementing the Restriction Decoder based on the MWPM algorithm and the local lifting procedure Lift, as described in Sec. 4.3. We find the threshold to be p 0D bcc ≈ 0.77%, which is in agreement with Eq. (73); see Fig. 12(d). This value compares favorably with the clustering decoder  threshold p 0D clu ≈ 0.46% [58] (which was estimated for the 3D color code but not on the bcc lattice).
We can also estimate the Restriction Decoder threshold for the bit-flip noise. In that case the Z-type syndrome forms 1D loop-like excitations, as it is some subset of edges of L. We set c * = R and C = {GB, GY, BY }. Observe that all the restricted lattices L RGB , L RGY and L RBY form the same lattice, which we call the 3 4 bcc lattice; see Fig. 11(d). Moreover, for any C ∈ C there is an error on the face of the restricted lattice L C * , where C * = C {c * }, iff there is exactly one error on two neighboring tetrahedra containing that face in the original lattice L. Thus, the effective noise strength for the toric code on the 3 4 bcc lattice is We numerically find the threshold of the Sweep Decoder from Ref. [33] for the toric code on the 3 4 bcc to be q 1D 3

Discussion
In our work we provide an efficient solution to an open problem of decoding the color code in d ≥ 2 dimensions. Namely, we introduce the Restriction Decoder, which combines any d-dimensional toric code decoder with a local lifting procedure to find a recovery operation for the color code. Furthermore, we prove that the Restriction Decoder successfully corrects errors in the color code if and only if the corresponding toric code decoding succeeds. As an immediate consequence, we obtain that the performance of the Restriction Decoder is determined by the performance of the toric code decoder that we use, minimized over the toric codes on the restricted lattices that we select. We remark that the Restriction Decoder for the color code in d ≥ 3 dimensions can be implemented via a cellular automaton if one uses as the toric code decoder the Sweep Decoder introduced in the accompanying article [33]. We numerically estimate the Restriction Decoder threshold for the color code in two and three dimensions against the phase-flip and bit-flip noise, assuming perfect syndrome extraction. The Restriction Decoder threshold p 2D ≈ 10.2% for the 2D color code on (a lattice dual to) the square-octagon lattice is on a par with the thresholds 9.9 ∼ 10.3% of the leading efficient decoders for the 2D toric code on the square lattice [3,26], as well as with the optimal decoding threshold 10.9% for the 2D color code [59]. We remark that the Restriction Decoder surpasses the highest previously reported 2D color code threshold, which was achieved by heuristic neural-network decoding [27]. We also estimate the Restriction Decoder thresholds for correcting 0D point-like and 1D loop-like excitations in the 3D color code on the bcc lattice to be p 0D bcc ≈ 0.77% and p 1D bcc ≈ 13.1%. Note that those values should be compared with the optimal decoding thresholds p 0D opt ≈ 1.9% and p 1D opt ≈ 27.6% estimated via statistical-mechanical mappings [60].
We emphasize that there is a lot of structure in the color code decoding problem, mainly due to the colorability of the lattice (see Ref. [61] for a local modification of the color code and its lattice). This combinatorial structure makes the problem challenging but at the same time may allow for color code decoders, which do not rely on toric code decoding as a subroutine. In particular, incorporating the colorability of the lattice into the Sweep Rule [33] could lead to native cellular-automaton decoders for the color code with error-correction thresholds higher than the ones we numerically estimated.
Our discussion assumes perfect syndrome extraction, however in a realistic scenario one needs to account for measurement errors. To decode 0D point-like excitations in the presence of measurement errors, one needs to perform multiple rounds of syndrome extraction and then use the collected data to find out the appropriate correction. In order to decode 1D loop-like (or higher-dimensional) excitations we expect to use a version of the Restriction Decoder based on the cellular-automaton Greedy Sweep Decoder [33,62], which only requires local (possibly faulty) syndrome information. We do not perceive any fundamental difficulties with incorporating a possibility of measurement errors into the Restriction Decoder, as well as incorporating the boundaries; see, for instance, the follow-up work [63].