From the Torus to the Bolza Octagon: Hyperbolic Surface and Color Codes
In the toric code, gluing opposite sides of a flat rectangle produces a torus. Walk across the rectangle along a noncontractible loop and you return to your starting qubit; lift that same walk to the infinite square grid and you arrive at the matching point one lattice period away.
Replace the Euclidean rectangle with a regular octagon in the hyperbolic plane and glue its opposite sides together. Instead of a single-handle torus, the cell closes into the Bolza surface, an orientable surface of genus \(g=2\) with two handles. Copies of the octagon tile the hyperbolic plane. That single glued octagon supports both surface codes and a color code: starting from a minimal four-square surface code on its radial spokes, we can refine the octagon into a three-colorable hyperbolic lattice for a \([[16,8,2]]\) color code, then return to surface codes to see how retiling and \(L\times L\) square refinement tune check weights and distances on the Bolza and Bring surfaces.
Glue the Bolza octagon for a four-square surface code
Jos Leys’s animation “From an Octagon to a Genus 2 Surface” visualizes how identifying boundary edges of a hyperbolic octagon curves and seals the polygon into a two-handled surface. The video uses its own side-pairing pattern to demonstrate the gluing, whereas the Bolza octagon in this post pairs opposite sides; either identification closes an octagon into an orientable surface of genus \(g=2\).
Just as on the torus, a surface code on any closed orientable surface places one data qubit on each edge, an \(X\) check at each vertex, and a \(Z\) check on each face. Homology fixes the number of encoded qubits at \(k=2g\)—stepping up from \(k=2\) on the torus to \(k=4\) on the genus-2 Bolza surface—while the choice of cellulation sets the check weights and the distances \(d_X\) and \(d_Z\).

Eight radial spokes from the center of the Bolza octagon to its outer corners form the \(\{4,8\}\) tiling and define a four-square \([[8,4,2]]\) surface code. Each spoke carries one of the eight data qubits. Gluing opposite boundary sides merges all eight outer corners into a single degree-8 vertex alongside the central vertex, while pairing opposite triangular sectors across the glued seams into four square \(Z\)-check faces. Pairs of spokes running between the center and the identified corner vertex already form noncontractible two-edge cycles, and the resulting code has \(k=4\) and \(d_X=d_Z=2\).
Subdividing the same Bolza octagon into triangles lets us trade edge qubits on a square cellulation for qubits inside a three-colored hyperbolic lattice, doubling the number of logical qubits to construct a \([[16,8,2]]\) color code.
Build the three-color tiling for the Bolza color code

The thick outline encloses 16 small triangles. Eight meet at the center of the cell, and eight surround them. Place a data qubit at the center of each triangle. Eight triangles meet at each vertex of the triangle mesh. Their qubits form a colored octagonal face supporting both an all-\(X\) check and an all-\(Z\) check on those eight qubits.
To count checks after gluing, count mesh vertices up to period shifts. The cell center gives face ⑤. The eight edge midpoints pair across opposite sides to give faces ① through ④. All eight outer corners glue to a single vertex, giving face ⑥. That leaves \(1+4+1=6\) face supports after gluing. On the infinite tiling, repeated labels such as two circled ①s mark distinct checks related by a period shift.
Three octagonal faces, one of each color, meet at every qubit, forming the three-colorable \(8.8.8\) tiling. Gluing the Bolza cell produces the \(8.8.8\)-16 color code of Higgott et al., Fig. S8.
Give a qubit two coordinates
Choose a reference triangle \(T\) and call its three side reflections \(a,b,c\). They generate the infinite reflection group \(W\), where a word \(g\) sends \(T\) to \(gT\). To cross side \(a\) as labeled on \(gT\), append \(a\) on the right to reach \(gaT\). Alternating \(a\) and \(b\) for eight steps walks around one octagonal check and back to the start, expressing the relation \((ab)^4=1\).
The capital letters \(A,B,C,D\) shift the entire period cell. Each is a product of side reflections, and together they generate the Bolza period group \(\Gamma_B\) inside \(W\). These shifts act on the left. In the inset, \(D\) sends the reference cell \(P\) and all its qubits to the right-hand copy \(DP\). Just as on the torus, a loop on the glued Bolza surface lifts to a walk ending at a period copy of its starting point.
| Notation | What it labels |
|---|---|
| \(W=\langle a,b,c\rangle\) | All small triangles in the infinite tiling |
| \(\Gamma_B=\langle A,B,C,D\rangle\) | The copies of the large period cell |
| \(W/\Gamma_B\) | The 16 qubit positions after identifying the copies |
The triangles \(wT\) and \(\gamma wT\) represent the same element of \(W/\Gamma_B\) for any \(\gamma\in\Gamma_B\). Since \(\Gamma_B\) is normal in \(W\), the classes multiply by \([u][v]=[uv]\).
Take the 16 qubits in \(P\) as representatives \(q_i\), where \(i\) names the position. Some subscripts come from words whose triangles lie outside \(P\). For example, \(q_{bab}\) sits at \(cacT\) inside \(P\) because \(D(bab)=cac\). Every qubit in the tiling is then \(\gamma q_i\), where \(\gamma\in\Gamma_B\) identifies its cell. In the inset, the two \(e\) labels mark \(q_e\) and \(Dq_e\), and applying \(Z\) to both is written \((1+D)q_e\).
To record a finite \(Z\)-error pattern, take each position \(i\) in turn and sum the shifts of the cells where \(q_i\) carries an error. These finite binary sums form the group ring \(\mathcal A=\mathbb F_2[\Gamma_B]\), with multiplication obtained by extending group composition linearly. The 16 coefficients form a vector in \(\mathcal A^{16}\).
Write a check that crosses a seam

Follow octagon ①, denoted \(f_{ab}^{e}\), centered on the left edge of \(P\). Four of its qubits lie in \(P\) and four lie in the neighboring cell \(D^{-1}P\), tagged by the factor \(D^{-1}\). The \(Z\)-check map sends the basis vector for ① to
$$ \begin{aligned} \partial_2(z_{ab}^{e})={}&q_e+q_a+q_{ab}+q_b\\ &+D^{-1}(q_{aba}+q_{abab}+q_{bab}+q_{ba}). \end{aligned} $$Conversely, to find the \(X\) syndrome of a \(Z\) error on \(q_{bab}\), collect the checks containing \(q_{bab}\). Because \(f_{ab}^{e}\) contains \(D^{-1}q_{bab}\), shifting the face by \(D\) brings that qubit to \(q_{bab}\). The error therefore flips the check at \(D f_{ab}^{e}\), contributing \(D x_{ab}^{e}\) to the syndrome. Each of the other two incident faces gives one more term. In general, whenever a reference face contains \(\gamma q_i\), its \(\gamma^{-1}\)-shift contains \(q_i\).
The \(Z\)-check map \(\partial_2\) and the \(X\)-syndrome map \(\partial_1\) form the chain complex
$$ \mathcal A^6 \xrightarrow{\partial_2} \mathcal A^{16} \xrightarrow{\partial_1} \mathcal A^6 . $$Let \(S\) consist of the six reference \(Z\)-check rows listed in the appendix. In row-vector coordinates, \(\partial_2(u)=uS\) and \(\partial_1(v)=vS^\dagger\), where \(\dagger\) transposes the matrix and sends each \(\gamma\) to \(\gamma^{-1}\), just as in the seam calculation. On the infinite tiling, each face has weight eight and any two distinct faces share either two qubits along an edge or none. Every overlap is even, so \(X\) and \(Z\) checks commute in every cell. In matrix form, \(SS^\dagger=0\).
Count the charges on the infinite tiling
The syndrome map tells us which defects a finite Pauli error can create. Two finite configurations of violated checks carry the same charge if a finite-support Pauli operator takes one to the other. Start with electric defects, the violated \(X\) checks. Apply \(Z\) to the qubits in two triangles that share an edge. The checks at the shared edge’s endpoints each flip twice and cancel. The checks at the two opposite corners flip once each. Because those opposite corners have the same color, this two-qubit \(Z\) hops a defect between same-color faces. Stepping along any path of adjacent triangles either leaves the corner of a chosen color fixed or hops it across such a pair. Since the triangle mesh is connected, a defect on any face of a given color carries the same charge. A single-qubit \(Z\) excites one face of each color, imposing \(R+G+B=0\).
That relation leaves at most four electric charges. To distinguish them, let \(p_R,p_G,p_B\) count the violated checks of each color modulo two. Every single-qubit \(Z\) flips these three parities together, leaving the relative parities \(p_R+p_B\) and \(p_G+p_B\) invariant under finite-support \(Z\) errors. The vacuum and single \(R,G,B\) defects realize all four parity pairs, so the electric charges are \(0,R,G,B\). The same argument for \(X\) errors gives four magnetic charges. Because a Pauli error’s \(Z\) and \(X\) components act independently on electric and magnetic defects, there are 16 anyon types in all, including the vacuum. Bolza shifts preserve face colors and hence every charge label.
Close the octagon and read the color-code parameters
Gluing opposite sides of \(P\) identifies every \(\gamma q_i\) with \(q_i\) and sets every shift \(\gamma\) in \(S\) to \(1\). This leaves \(n=16\) physical qubits, with the resulting \(6\times 16\) binary matrix \(H\) serving as both \(H_X\) and \(H_Z\).
In the appendix, the same-color pairs are (①, ②), (③, ④), and (⑤, ⑥). Each pair partitions the 16 positions in \(H\) and sums to the all-ones row, so that row together with ①, ③, and ⑤ spans all six rows. Reading down ①, ③, and ⑤ across the 16 qubits produces all eight binary triples. In any linear dependence, the \(000\) column forces the coefficient of the all-ones row to vanish, and the three weight-one triples force the remaining three coefficients to vanish. Thus \(\operatorname{rank}H=4\), giving
$$ k=16-\operatorname{rank}H_X-\operatorname{rank}H_Z=8. $$Every column of \(H\) contains one \(1\) per color, so a single-qubit \(Z\) or \(X\) flips at least one check and a \(Y\) flips checks of both types. Columns \(e\) and \(abab\) are identical, giving \(Z_eZ_{abab}\) zero syndrome. Each row of \(H\) has weight eight and overlaps every row in an even number of positions. It also overlaps any sum of rows evenly, so adding a row changes the support weight by a multiple of four. Starting from the empty support, this gives weights divisible by four for all pure \(Z\) stabilizers. Hence the weight-two \(Z_eZ_{abab}\) is a logical operator, and \(d=2\).
Retile and refine surface codes from Bolza to Bring
Returning from the \([[16,8,2]]\) color code to surface codes isolates the role of local geometry on a fixed topology: on any closed orientable surface of genus \(g\), homology keeps \(k=2g\) fixed while retiling reshapes check weights and distances. Even on the genus-2 Bolza octagon (\(k=4\)), the eight-edge \(\{4,8\}\) four-square code is only one option. We can reuse the \(\{8,3\}\) (\(8.8.8\)) octagon tiling from the color code, placing data qubits on its 24 octagon edges rather than inside its 16 triangles. That surface-code cellulation has 16 weight-3 vertex \(X\) checks and six weight-8 octagonal face \(Z\) checks, encoding the same \(k=4\) logical qubits with \(d_Z=6\) and \(d_X=2\).
Moving from \(\{4,8\}\) to \(\{8,3\}\) on the Bolza surface trades four-body \(Z\) checks and balanced distance for weight-3 \(X\) checks and a larger \(Z\) distance without altering \(k\). Working in the reverse direction—converting non-square faces into a square grid—standardizes \(Z\) checks to weight 4 so the lattice can be subdivided by \(L\times L\) refinement, connecting the Bolza octagon to higher-genus constructions such as Bring’s surface.

A similar change of tiling appears on the genus-4 Bring surface, where \(k=2g=8\). Both the pentagonal \(\{5,5\}\) \([[30,8,3]]\) surface code and the square \(\{4,5\}\) \([[60,8,4]]\) surface code live on this same surface (Quantum 8, 1372, p. 9; arXiv:1703.00590, p. 4). Each edge of the \(\{5,5\}\) tiling serves as the diagonal of a new square whose four corners are the two old endpoints together with the centers of the two adjacent pentagons. Carrying out this replacement across all 30 pentagonal edges produces a \(\{4,5\}\) grid with 30 square faces, 60 edges, and 24 vertices. Each square gives a weight-4 \(Z\) check, each vertex gives a weight-5 \(X\) check, and the shortest logical operators have weights \(d_Z=4\) and \(d_X=6\).

In the planar cut diagram of this 60-qubit \(\{4,5\}\) code, boundary edges carrying matching numbers are glued together. The highlighted logical \(Z\) string traverses edges 22, 24, 4, and 1; its two marked endpoints meet when the two boundary copies of edge 27 are identified, closing the four-edge path into a noncontractible cycle.
Once a surface is tiled by squares, \(L\times L\) refinement scales the distance at fixed genus. Replacing every square by an \(L\times L\) patch of smaller squares while retaining the boundary identifications leaves the underlying surface—and hence \(k=2g\)—unchanged, while finer edges force noncontractible loops to take more steps. Every square \(Z\) check and every newly introduced vertex \(X\) check, including those along subdivided old edges, has weight 4. Only the original vertices keep their initial degree. In the Bring \(\{4,5\}\) family, the 24 original vertex \(X\) checks retain weight 5 for every \(L\); at \(L=2\), refinement yields a \([[240,8,8]]\) code with \(d_Z=8\) and \(d_X=10\), supported by 120 weight-4 \(Z\) checks, 90 weight-4 \(X\) checks, and 24 weight-5 \(X\) checks (arXiv:1703.00590, p. 6). Refining the four-square Bolza \(\{4,8\}\) grid in the same way gives codes with \(n=8L^2\) and \(k=4\):
| Refinement \(L\) | Qubits \(n\) | \(d_Z\) | \(d_X\) |
|---|---|---|---|
| \(2\) | \(32\) | \(4\) | \(4\) |
| \(3\) | \(72\) | \(6\) | \(6\) |
| \(4\) | \(128\) | \(8\) | \(8\) |
Appendix
In a product of isometries, the rightmost factor acts first. The figure uses the following directions for the period shifts.
| Shift | Direction from the reference cell | Word in the reflections |
|---|---|---|
| \(A\) | Up | \(cbabca\) |
| \(B\) | Upper right | \(cabcba\) |
| \(C\) | Lower right | \(acabcb\) |
| \(D\) | Right | \(cacbab\) |
The reflection group has \(a^2=b^2=c^2=(ab)^4=(bc)^4=(ca)^4=1\). The entries below use \(Q(i,j,\ldots)=q_i+q_j+\cdots\). The face labels follow the numbered centers in the figure.
| Check | Row of \(S\) |
|---|---|
| ① \(f_{ab}^{e}\) | \(\begin{aligned}&Q(e,a,ab,b)\\ &+D^{-1}Q(aba,abab,bab,ba)\end{aligned}\) |
| ② \(f_{ab}^{c}\) | \(\begin{aligned}&Q(c,ca,abc,cb)\\ &+A Q(bc,aca,ac,acb)\end{aligned}\) |
| ③ \(f_{bc}^{e}\) | \(\begin{aligned}&Q(e,b,cb,c)\\ &+C^{-1}Q(bc,aca,abab,aba)\end{aligned}\) |
| ④ \(f_{bc}^{a}\) | \(\begin{aligned}&Q(a,ab,acb,ac)\\ &+B^{-1}Q(abc,ca,bab,ba)\end{aligned}\) |
| ⑤ \(f_{ca}^{e}\) | \(\begin{aligned}&Q(e,c,ca,bab)\\ &+Q(abab,aca,ac,a)\end{aligned}\) |
| ⑥ \(f_{ca}^{b}\) | Expanded below |
Check ⑥ meets several period cells around a corner. Its row is
$$ \begin{aligned} \partial_2(z_{ca}^{b})={}&q_b+C^{-1}q_{bc} +C^{-1}A^{-1}q_{abc}\\ &+C^{-1}A^{-1}Bq_{ab}\\ &+D^{-1}BA^{-1}C^{-1}q_{aba}\\ &+D^{-1}BA^{-1}q_{cb}\\ &+D^{-1}Bq_{acb}+D^{-1}q_{ba}. \end{aligned} $$