Topological Codes
A topological quantum code stores information in global degrees of freedom that sufficiently small local probes cannot distinguish. Local checks reveal where errors have violated constraints, while logical operators extend across the system. The toric code makes the central idea precise: an error string has detectable endpoints, but a closed string winding around a torus can change encoded information without leaving any syndrome.
This page uses local Pauli stabilizer codes to connect geometry, decoding, and Hamiltonian protection. The same code space can support an actively corrected memory or be the ground space of a mathematical Hamiltonian. Those uses require different physical mechanisms. In particular, growing code distance does not imply a growing energy barrier or a long passive quantum-memory lifetime.
Required background. Stabilizer Formalism explains commuting checks and logical Paulis. CSS Codes supplies the binary check-matrix language.
Helpful background. Surface Code gives a complete planar patch and repeated-measurement examples. Topological Order Preview develops the many-body interpretation.
Local Checks and Nonlocal Information
Section titled “Local Checks and Nonlocal Information”Let project onto a stabilizer code space. Its signed Hermitian generators obey , commute with one another, and generate no . Choose independent generators, so
Each factor keeps the positive-check sector. Repeating a dependent factor does not change the projector, but counting it as an independent constraint would give the wrong number of logical qubits.
In a geometrically local family, each chosen check has bounded spatial diameter and bounded weight, and each qubit participates in boundedly many checks as the system grows. A local code need not be topological: the three-qubit repetition code, for example, has local checks but a single-qubit logical . The topological families considered here additionally have a growing scale below which regions cannot hold logical information.
For a correctable region , every operator supported there satisfies
The coefficient can depend on the probe, but not on the encoded state. Thus local expectation values agree in all logical states, and the probe has no matrix elements between distinct logical basis states within the code. This condition is equivalent to exact correction of an erasure on , where the lost region is known; see Why QEC Is Possible for the recovery argument.
Any set of fewer than qubits is correctable as a known erasure. Unknown errors are a different task: correcting every error on up to unknown qubits requires . Furthermore, a disconnected union of individually correctable regions need not be correctable. Many small pieces together can support an entire logical string.
When discussing distance, ignore scalar Pauli phases: is nontrivial if it commutes with all checks but is not a stabilizer up to phase. Then
Geometry explains why a logical operator must extend far, but the actual minimum weight depends on the cellulation, aspect ratio, and boundaries. Topology alone does not supply a numerical distance.
The Toric Code: Endpoints and Winding Loops
Section titled “The Toric Code: Endpoints and Winding Loops”Take a periodic square lattice, with , and put one qubit on each edge. At each vertex , measure the product of on its four incident edges; on each face , measure the product of around its boundary:
A star and a face meet on zero or two edges, so the checks commute. The product of all stars is , since every edge occurs twice. The product of all faces is also . These are the only dependencies in their respective sectors on this connected periodic square lattice.
There are data qubits and independent checks. Hence : the ground/code space has dimension four. Do not confuse this with four encoded qubits. A genus- closed orientable surface similarly gives for this toric construction. The color-code construction has a different count, .
A product of along an open edge path flips the star checks at its two endpoints. Interior stars meet the path twice and remain positive. Adding the boundary of a face changes the path but not its endpoints; algebraically this multiplies by a stabilizer. A contractible loop is a product of face checks, so it acts trivially on the code space.
A loop winding once around the torus has no endpoints but need not be a face boundary. Its product is a logical operator. A conjugate logical follows a dual-lattice loop intersecting it once. They anticommute because exactly one physical qubit receives both and . These statements are the basic toric-code construction of Kitaev.
For this rectangular lattice,
Every nontrivial cycle must wind in at least one direction, which costs at least that many edges. Straight winding loops attain the bound. The dual argument gives the same bound for ; a mixed logical Pauli cannot evade both sector bounds.
| Lattice | Data qubits | Logical qubits | Distance |
|---|---|---|---|
| 50 | 2 | 5 | |
| 54 | 2 | 3 | |
| 90 | 2 | 5 |
All three lattices have the same topology. The second has more qubits than the first but a shorter nontrivial loop. Increasing area without increasing the shortest circumference does not improve the distance.
Two recoveries can remove the same endpoints
Section titled “Two recoveries can remove the same endpoints”On a five-edge periodic row, let act on horizontal edge , with indices around the row. Consider
The short and long paths have the same two endpoints. Both and remove the syndrome of . Yet , whereas is the complete winding loop, a logical . A final all-positive syndrome does not distinguish successful recovery from this logical error.
Top: identify opposite sides of the square to obtain a torus; the two marks labeled are the same vertex. Edge qubits carry the solid two-edge path or dashed three-edge path . Both connect and , but their union winds around the torus. Bottom: a five-edge logical string is assembled by single-edge steps. Every intermediate open string has two violated stars and energy above the ground space; the completed loop has zero excitation energy. These are discrete Pauli steps, not a real-time dynamical trajectory.
With independent errors of probability on each of the 50 edges, the probabilities of these two particular patterns, with no other errors, have ratio
At , the shorter pattern is 99 times as likely. This compares two individual patterns, not the total probabilities of their logical classes. A class can contain many other patterns; a maximum-likelihood decoder sums their probabilities. Circuit correlations and biased noise can change the preferred recovery. Dennis and collaborators develop this connection between homology and decoding.
Chains, Boundaries, and Recovery Classes
Section titled “Chains, Boundaries, and Recovery Classes”The geometric reasoning has a compact algebraic form. Use binary coefficients so that adding an edge to itself cancels it. Let be vector spaces of face, edge, and vertex subsets. Their boundary maps satisfy
For a -error chain , the star syndrome is . A face stabilizer is a boundary . Undetected chains are cycles, , and cycles that are face boundaries act trivially. The quotient
records the remaining -logical classes. The sector uses the dual complex; its intersection pairing with the sector gives the logical commutation signs.
If a recovery chain matches the observed boundary, then is closed. Recovery succeeds precisely when
Thus decoding seeks the right class, not a reconstruction of the exact physical error. One can change a recovery by a stabilizer without changing its action, but changing it by a nontrivial cycle changes the encoded state.
Boundaries that allow endpoints
Section titled “Boundaries that allow endpoints”In a planar surface code, some boundaries allow the endpoint charge of a string to disappear. Collect the compatible boundary cells into . A string ending on is closed relative to , because endpoints within are ignored by the relative boundary map. Its logical class belongs to
A string between two compatible boundary components is logical only if its relative class is nonzero. It must not be removable by adding face boundaries and chains contained in . The conjugate sector usually uses different boundary types. Bravyi and Kitaev’s lattice-with-boundary construction formalizes these rules.
Punctures create additional boundary components; twists can change charge labels when strings cross a defect line. Moving or changing these objects can implement logical operations, but the full sequence of measured checks and error propagation matters. See Lattice Surgery for a concrete measurement-based operation.
This edge-chain construction is a model, not a definition of every topological code. Color codes use related colored strings and string nets. Subsystem codes also have gauge operators. Non-Abelian fusion spaces and three-dimensional fracton models require more than ordinary binary loops.
An Energy Gap Is Not an Energy Barrier
Section titled “An Energy Gap Is Not an Energy Barrier”An actively measured code can be defined without any energetic preference for its code space. To study passive protection, instead suppose the toric-code checks are physically realized as the Hamiltonian
Every violated check raises the energy by . On a closed torus, violations occur with even parity in each sector because the products of all stars and all faces are identities. The spectral gap is therefore , attained by two endpoint excitations. Different boundaries or couplings can change that number.
For an open string, only the two endpoint stars are violated. Extending the string moves an endpoint without increasing the number of violations. Complete a noncontractible loop and the endpoints annihilate: the final state is another state in the same ground space.
For the five-edge row in the figure, if applies to its first consecutive edges, the excitation energy is
The logical operator has weight five but can be built while paying at most . For any larger square torus the same construction has length and maximum cost . Since the first nonidentity single-qubit Pauli creates at least two violations, is also a lower bound on such paths. The minimum logical barrier is exactly in this model.
Generally, an energy barrier is a minimax quantity: choose a local sequence from the identity to a nontrivial logical Pauli, find its largest intermediate excitation energy, then minimize over such sequences and logical Paulis. It is an energy, not a time. A large distance counts qubits in the final operator; a barrier counts simultaneous energetic defects along the way.
Bravyi and Terhal prove a constant-barrier obstruction for two-dimensional stabilizer Hamiltonians with bounded-range Pauli checks and bounded local interaction strengths. At least one logical Pauli can be assembled with a barrier that does not grow with system size. This does not obstruct active correction, and it is not a theorem about arbitrary subsystem or non-Pauli Hamiltonians.
Passive lifetime needs dynamics
Section titled “Passive lifetime needs dynamics”A thermal memory model must also specify temperature, allowed transitions, bath coupling, boundaries, and the final readout or recovery. Entropy counts how many harmful paths are available; defect mobility affects how quickly they are explored. A diverging energy barrier alone would not settle that dynamical problem, and an Arrhenius factor by itself is not a universal lifetime formula.
For quantum storage, retaining one classical observable is insufficient. A memory may preserve logical populations indefinitely while destroying the relative phase between them. One should test preservation of arbitrary logical states, or entanglement with an external reference, under the stated storage and recovery procedure.
Zero-temperature perturbative stability is another question. Bravyi, Hastings, and Michalakis prove spectral stability for suitable local commuting-projector Hamiltonians satisfying local indistinguishability and an additional local-to-global consistency condition, under sufficiently weak local perturbations. These hypotheses preserve an isolated low-energy band; they do not specify a finite-temperature bath or establish a growing storage lifetime.
Active Correction and the Anyon Interpretation
Section titled “Active Correction and the Anyon Interpretation”An active memory repeatedly measures checks, resets ancillas, and infers a correction from the outcome history. A physical correction can be postponed by tracking a Pauli frame. With noisy reports, a decoder uses changes between rounds, together with preparation and final-measurement boundaries; it cannot rely only on the last snapshot. The syndrome-measurement page gives the corresponding circuits and detector examples.
A threshold concerns suppression of logical failure along a growing family under a specified noise model, extraction schedule, decoder, and task. A finite improvement from one distance to another is a useful observation but does not prove an asymptotic threshold. A static energy gap neither supplies nor replaces these ingredients.
The Hamiltonian picture gives check violations another interpretation. In the toric model, star violations are commonly called electric charges , and face violations magnetic charges . The letters are labels of emergent excitation types, not a claim that a star violation carries literal electrical charge. Open strings create pairs; open dual strings create pairs. Taking one type around the other gives a mutual phase .
The underlying algebra is simple. For strings and , let count their shared-qubit crossings modulo two. Then
A minus sign on a complete state is an unobservable global phase unless compared coherently with another branch. An interferometric protocol can make it a measurable relative phase, as Exercise 6 shows. This clarifies what a programmed braid experiment must actually measure.
A gate-based device can reproduce this code algebra without its material realizing a deconfined-anyon Hamiltonian. Conversely, a material with topological order does not automatically supply initialization, controlled braiding, readout, and protected non-Clifford gates. Anyons and Braiding develops the excitation theory, while Topological Quantum Computation treats operations on fusion spaces. Non-Abelian braid operators act as matrices, rather than only the binary intersection sign used here.
What Locality Allows and Restricts
Section titled “What Locality Allows and Restricts”Two-dimensional Euclidean locality limits the simultaneous rate and distance. For bounded-dimensional particles of bounded spatial density with bounded-range commuting-projector constraints, Bravyi, Poulin, and Terhal prove
where depends on local dimension and interaction range, not on system size. A nonzero limiting rate therefore forces bounded distance in this setting. This tradeoff uses Euclidean locality, not merely sparse checks. General quantum LDPC codes can use connectivity outside those geometric assumptions.
Locality also constrains logical gates. Under the Bravyi–König hypotheses, code-preserving constant-depth circuits with bounded-range gates on growing-distance two-dimensional local stabilizer codes implement logical Clifford operations. Non-Clifford computation can use other mechanisms, such as injection and adaptive measurement. A gate that preserves the code algebra need not have a constant-depth local implementation.
Higher dimensions change the geometry of logical operators and excitations: strings can be replaced by membranes, and different sectors can have different barriers. The four-dimensional toric memory studied by Dennis and collaborators illustrates why the two-dimensional endpoint argument is not universal. Haah’s three-dimensional cubic code has no arbitrarily long string logical operators under its stated definition. Neither “higher-dimensional” nor “no strings” alone proves a practical self-correcting quantum memory; the Hamiltonian and dynamics still need analysis.
Exercises
Section titled “Exercises”1. Local checks without local invisibility
Section titled “1. Local checks without local invisibility”For the three-qubit repetition code spanned by and , evaluate . Why does this fail the local-indistinguishability condition despite the local checks and ?
Solution
On the code basis, is , not a scalar multiple of the identity. A local measurement distinguishes the two logical basis states. The checks are local and protect against a specified bit-flip error set, but the full Pauli distance is one. In contrast, a region containing fewer than qubits in a distance- code cannot reveal the logical label.
2. Count rectangular toric-code qubits
Section titled “2. Count rectangular toric-code qubits”Derive for the periodic lattice, and explain why lengthening only the second direction does not improve its distance.
Solution
There are 27 vertices, 27 faces, and 54 edges. Star and face ranks are each 26, so . A three-edge winding loop is nontrivial, and no shorter nontrivial primal or dual cycle exists. Thus . Increasing the nine-edge circumference leaves the three-edge loop available, so the distance remains three.
3. Equal syndromes, unequal recovery
Section titled “3. Equal syndromes, unequal recovery”For the figure’s error and recoveries , compute the residual operator and compare the two pattern probabilities at . Why is this not a complete maximum-likelihood calculation?
Solution
The common endpoints give both recoveries the syndrome of . Because , . The other product contains all five row edges and is a logical loop. Their particular error-pattern probabilities are and . Their ratio is . To compare logical-class probabilities, sum over every pattern compatible with the measured syndrome in each class, including stabilizer-related deformations. The two terms alone do not give those sums.
4. A chain closed only relative to a boundary
Section titled “4. A chain closed only relative to a boundary”A chain joins two components of a boundary set that can absorb its endpoint charge. Explain when it is a logical operator, even though its ordinary boundary is nonzero.
Solution
Its ordinary boundary is the sum of its two endpoints in . The relative complex identifies chains supported in with zero, so is a relative cycle. It is logical if its class in is nonzero: it cannot be removed using face boundaries and chains in . The conjugate Pauli sector generally requires a different compatible boundary set. Merely ending at a physical edge is insufficient.
5. Distance, gap, and barrier on the same torus
Section titled “5. Distance, gap, and barrier on the same torus”For the uniform-coupling toric Hamiltonian with , find the distance, spectral gap, and minimum barrier for single-qubit Pauli paths to any nontrivial logical Pauli.
Solution
The distance is . Excitations have even star and face parity, so the lowest nonzero energy is , achieved by an open one-edge string. Growing a winding string maintains two endpoints until they annihilate at completion; its maximum energy is . Every path starts with a nonidentity single-qubit Pauli that creates at least two violated checks, so no lower maximum is possible. Hence the minimum barrier is also . Equality of gap and barrier is a property of this Hamiltonian, not a general identity. None of these numbers specifies a thermal lifetime.
6. Make a crossing sign observable
Section titled “6. Make a crossing sign observable”Let Pauli strings anticommute and obey . Compare with the identity. If an ancilla in controls whether is applied, what does measuring its reveal?
Solution
Anticommutation gives . Applied unconditionally, this changes only a global phase. Controlled application instead produces
The ancilla’s outcome is . If the strings commute, their commutator is and the ancilla remains , giving . The coherent comparison converts the string-algebra sign into a relative phase; it does not itself establish a material Hamiltonian or thermal protection.
7. Apply the geometric tradeoff
Section titled “7. Apply the geometric tradeoff”Could a bounded-range commuting-projector family on a two-dimensional Euclidean lattice have both and ? What changes if only bounded check weight is assumed?
Solution
The proposed parameters give , contradicting for any fixed as grows. Bounded check weight alone does not imply the required bounded-range Euclidean embedding. Thus this particular theorem cannot exclude an abstract sparse family with a different connectivity; a separate argument would be needed.
8. A classical bit that outlives quantum coherence
Section titled “8. A classical bit that outlives quantum coherence”Suppose logical flips occur as a Poisson process of rate , without recovery. Find the channel at time , its action on logical , and its entanglement fidelity for one half of a Bell pair. Does preservation of demonstrate a protected quantum memory?
Solution
An even number of flips gives and an odd number gives . Poisson averaging gives
The adjoint channel fixes but multiplies and by . Applying to one half of a Bell pair produces an orthogonal Bell state, so the entanglement fidelity is , tending to . Logical populations survive, but phase coherence and reference entanglement do not. A long-lived signal alone tests a classical component of the information.
References
Section titled “References”- S. Bravyi, M. B. Hastings, and S. Michalakis, “Topological quantum order: stability under local perturbations,” Journal of Mathematical Physics 51, 093512 (2010), doi:10.1063/1.3490195, arXiv:1001.0344.
- S. B. Bravyi and A. Y. Kitaev, “Quantum codes on a lattice with boundary” (1998), arXiv:quant-ph/9811052.
- S. Bravyi and R. König, “Classification of topologically protected gates for local stabilizer codes,” Physical Review Letters 110, 170503 (2013), doi:10.1103/PhysRevLett.110.170503, arXiv:1206.1609.
- S. Bravyi, D. Poulin, and B. M. Terhal, “Tradeoffs for reliable quantum information storage in 2D systems,” Physical Review Letters 104, 050503 (2010), doi:10.1103/PhysRevLett.104.050503, arXiv:0909.5200.
- S. Bravyi and B. M. Terhal, “A no-go theorem for a two-dimensional self-correcting quantum memory based on stabilizer codes,” New Journal of Physics 11, 043029 (2009), doi:10.1088/1367-2630/11/4/043029, arXiv:0810.1983.
- E. Dennis, A. Kitaev, A. Landahl, and J. Preskill, “Topological quantum memory,” Journal of Mathematical Physics 43, 4452–4505 (2002), doi:10.1063/1.1499754, arXiv:quant-ph/0110143.
- J. Haah, “Local stabilizer codes in three dimensions without string logical operators,” Physical Review A 83, 042330 (2011), doi:10.1103/PhysRevA.83.042330, arXiv:1101.1962.
- A. Y. Kitaev, “Fault-tolerant quantum computation by anyons,” Annals of Physics 303, 2–30 (2003), doi:10.1016/S0003-4916(02)00018-0, arXiv:quant-ph/9707021.