Skip to content

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.

Let PP project onto a stabilizer code space. Its signed Hermitian generators SaS_a obey Sa2=IS_a^2=I, commute with one another, and generate no −I-I. Choose rr independent generators, so

P=∏a=1rI+Sa2,k=n−r.P=\prod_{a=1}^{r}\frac{I+S_a}{2}, \qquad k=n-r.

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 ZZ. The topological families considered here additionally have a growing scale below which regions cannot hold logical information.

For a correctable region RR, every operator supported there satisfies

PORP=c(OR)P.P O_R P=c(O_R)P.

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 RR, where the lost region is known; see Why QEC Is Possible for the recovery argument.

Any set of fewer than dd qubits is correctable as a known erasure. Unknown errors are a different task: correcting every error on up to tt unknown qubits requires 2t<d2t<d. 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: LL is nontrivial if it commutes with all checks but is not a stabilizer up to phase. Then

d=min⁡L nontrivial logical Pauli∣supp⁡L∣.d=\min_{L\text{ nontrivial logical Pauli}} |\operatorname{supp}L|.

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 Lx×LyL_x\times L_y square lattice, with Lx,Ly≥3L_x,L_y\ge3, and put one qubit on each edge. At each vertex vv, measure the product AvA_v of XX on its four incident edges; on each face ff, measure the product BfB_f of ZZ around its boundary:

Av=∏e∋vXe,Bf=∏e∈∂fZe.A_v=\prod_{e\ni v}X_e, \qquad B_f=\prod_{e\in\partial f}Z_e.

A star and a face meet on zero or two edges, so the checks commute. The product of all stars is II, since every edge occurs twice. The product of all faces is also II. These are the only dependencies in their respective sectors on this connected periodic square lattice.

There are n=2LxLyn=2L_xL_y data qubits and 2(LxLy−1)2(L_xL_y-1) independent checks. Hence k=2k=2: the ground/code space has dimension four. Do not confuse this with four encoded qubits. A genus-gg closed orientable surface similarly gives k=2gk=2g for this toric construction. The color-code construction has a different count, k=4gk=4g.

A product of ZZ 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 ZZ 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 ZZ product is a logical operator. A conjugate logical XX follows a dual-lattice loop intersecting it once. They anticommute because exactly one physical qubit receives both XX and ZZ. These statements are the basic toric-code construction of Kitaev.

For this rectangular lattice,

d=min⁡(Lx,Ly).d=\min(L_x,L_y).

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 XX; a mixed logical Pauli cannot evade both sector bounds.

Lattice Data qubits nn Logical qubits kk Distance dd
5×55\times5 50 2 5
3×93\times9 54 2 3
5×95\times9 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 ZhjZ_{h_j} act on horizontal edge hjh_j, with indices j=0,…,4j=0,\ldots,4 around the row. Consider

E=Zh0Zh1,R=Zh0Zh1,R′=Zh2Zh3Zh4.\begin{aligned} E&=Z_{h_0}Z_{h_1},\\ R&=Z_{h_0}Z_{h_1},\\ R'&=Z_{h_2}Z_{h_3}Z_{h_4}. \end{aligned}

The short and long paths have the same two endpoints. Both RR and R′R' remove the syndrome of EE. Yet RE=IRE=I, whereas R′ER'E is the complete winding loop, a logical ZZ. A final all-positive syndrome does not distinguish successful recovery from this logical error.

Periodic square lattice with short and winding recoveries sharing two endpoints, above the energy of a logical string grown one edge at a time

Top: identify opposite sides of the square to obtain a 5×55\times5 torus; the two marks labeled aa are the same vertex. Edge qubits carry the solid two-edge path RR or dashed three-edge path R′R'. Both connect aa and bb, but their union winds around the torus. Bottom: a five-edge logical ZZ string is assembled by single-edge steps. Every intermediate open string has two violated stars and energy 4J4J above the ground space; the completed loop has zero excitation energy. These are discrete Pauli steps, not a real-time dynamical trajectory.

With independent ZZ errors of probability pp on each of the 50 edges, the probabilities of these two particular patterns, with no other errors, have ratio

Pr⁡(E)Pr⁡(R′)=1−pp.\frac{\Pr(E)}{\Pr(R')}=\frac{1-p}{p}.

At p=0.01p=0.01, 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.

The geometric reasoning has a compact algebraic form. Use binary coefficients so that adding an edge to itself cancels it. Let C2,C1,C0C_2,C_1,C_0 be vector spaces of face, edge, and vertex subsets. Their boundary maps satisfy

C2→∂2C1→∂1C0,∂1∂2=0.C_2\xrightarrow{\partial_2}C_1 \xrightarrow{\partial_1}C_0, \qquad \partial_1\partial_2=0.

For a ZZ-error chain ee, the star syndrome is ∂1e\partial_1e. A face stabilizer is a boundary ∂2f\partial_2 f. Undetected chains are cycles, e∈ker⁡∂1e\in\ker\partial_1, and cycles that are face boundaries act trivially. The quotient

H1(Λ;F2)=ker⁡∂1im⁡∂2H_1(\Lambda;\mathbb F_2) =\frac{\ker\partial_1}{\operatorname{im}\partial_2}

records the remaining ZZ-logical classes. The XX sector uses the dual complex; its intersection pairing with the ZZ sector gives the logical commutation signs.

If a recovery chain rr matches the observed boundary, then e+re+r is closed. Recovery succeeds precisely when

[e+r]=0in H1.[e+r]=0\quad\text{in }H_1.

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.

In a planar surface code, some boundaries allow the endpoint charge of a ZZ string to disappear. Collect the compatible boundary cells into BB. A string ending on BB is closed relative to BB, because endpoints within BB are ignored by the relative boundary map. Its logical class belongs to

H1(Λ,B;F2).H_1(\Lambda,B;\mathbb F_2).

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 BB. The conjugate XX 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 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

Htoric=−J∑vAv−J∑fBf,J>0.\begin{aligned} H_{\rm toric}&=-J\sum_v A_v-J\sum_f B_f,\\ J&>0. \end{aligned}

Every violated check raises the energy by 2J2J. 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 4J4J, attained by two endpoint excitations. Different boundaries or couplings can change that number.

For an open ZZ 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 EmE_m applies ZZ to its first mm consecutive edges, the excitation energy is

ϵ(Em)={0,m=0 or 5,4J,m=1,2,3,4.\epsilon(E_m)= \begin{cases} 0,&m=0\text{ or }5,\\ 4J,&m=1,2,3,4. \end{cases}

The logical operator has weight five but can be built while paying at most 4J4J. For any larger square torus the same construction has length LL and maximum cost 4J4J. Since the first nonidentity single-qubit Pauli creates at least two violations, 4J4J is also a lower bound on such paths. The minimum logical barrier is exactly 4J4J 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.

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 ZZ 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 ee, and face violations magnetic charges mm. The letters are labels of emergent excitation types, not a claim that a star violation carries literal electrical charge. Open ZZ strings create ee pairs; open dual XX strings create mm pairs. Taking one type around the other gives a mutual phase −1-1.

The underlying algebra is simple. For strings Z(γ)Z(\gamma) and X(γ∗)X(\gamma^*), let I2I_2 count their shared-qubit crossings modulo two. Then

Z(γ)X(γ∗)=(−1)I2X(γ∗)Z(γ).Z(\gamma)X(\gamma^*) =(-1)^{I_2}X(\gamma^*)Z(\gamma).

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.

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

kd2≤Cn,kd^2\le Cn,

where CC depends on local dimension and interaction range, not on system size. A nonzero limiting rate k/nk/n 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.

1. Local checks without local invisibility

Section titled “1. Local checks without local invisibility”

For the three-qubit repetition code spanned by ∣000⟩|000\rangle and ∣111⟩|111\rangle, evaluate PZ1PPZ_1P. Why does this fail the local-indistinguishability condition despite the local checks Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3?

Solution

On the code basis, PZ1PPZ_1P is diag⁡(1,−1)\operatorname{diag}(1,-1), not a scalar multiple of the identity. A local Z1Z_1 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 dd qubits in a distance-dd code cannot reveal the logical label.

Derive n,k,dn,k,d for the 3×93\times9 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 k=54−26−26=2k=54-26-26=2. A three-edge winding loop is nontrivial, and no shorter nontrivial primal or dual cycle exists. Thus d=3d=3. Increasing the nine-edge circumference leaves the three-edge loop available, so the distance remains three.

For the figure’s error EE and recoveries R,R′R,R', compute the residual operator and compare the two pattern probabilities at p=0.01p=0.01. Why is this not a complete maximum-likelihood calculation?

Solution

The common endpoints give both recoveries the syndrome of EE. Because R=ER=E, RE=IRE=I. The other product contains all five row edges and is a logical ZZ loop. Their particular error-pattern probabilities are p2(1−p)48p^2(1-p)^{48} and p3(1−p)47p^3(1-p)^{47}. Their ratio is (1−p)/p=99(1-p)/p=99. 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 cc joins two components of a boundary set BB 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 BB. The relative complex identifies chains supported in BB with zero, so cc is a relative cycle. It is logical if its class in H1(Λ,B;F2)H_1(\Lambda,B;\mathbb F_2) is nonzero: it cannot be removed using face boundaries and chains in BB. 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 L×LL\times L toric Hamiltonian with L≥3L\ge3, find the distance, spectral gap, and minimum barrier for single-qubit Pauli paths to any nontrivial logical Pauli.

Solution

The distance is LL. Excitations have even star and face parity, so the lowest nonzero energy is 4J4J, achieved by an open one-edge string. Growing a winding string maintains two endpoints until they annihilate at completion; its maximum energy is 4J4J. 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 4J4J. Equality of gap and barrier is a property of this Hamiltonian, not a general identity. None of these numbers specifies a thermal lifetime.

Let Pauli strings U,VU,V anticommute and obey U2=V2=IU^2=V^2=I. Compare UVUVUVUV with the identity. If an ancilla in ∣+⟩|+\rangle controls whether UVUVUVUV is applied, what does measuring its XX reveal?

Solution

Anticommutation gives UVUV=−IUVUV=-I. Applied unconditionally, this changes only a global phase. Controlled application instead produces

∣0⟩−∣1⟩2⊗∣ψ⟩=∣−⟩⊗∣ψ⟩.\frac{|0\rangle-|1\rangle}{\sqrt2} \otimes|\psi\rangle =|-\rangle\otimes|\psi\rangle.

The ancilla’s XX outcome is −1-1. If the strings commute, their commutator is II and the ancilla remains ∣+⟩|+\rangle, giving +1+1. The coherent comparison converts the string-algebra sign into a relative phase; it does not itself establish a material Hamiltonian or thermal protection.

Could a bounded-range commuting-projector family on a two-dimensional Euclidean lattice have both k=0.1nk=0.1n and d=nd=\sqrt n? What changes if only bounded check weight is assumed?

Solution

The proposed parameters give kd2=0.1n2kd^2=0.1n^2, contradicting kd2≤Cnkd^2\le Cn for any fixed CC as nn 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 ZZ flips occur as a Poisson process of rate γ\gamma, without recovery. Find the channel at time tt, its action on logical X,ZX,Z, and its entanglement fidelity for one half of a Bell pair. Does preservation of ZZ demonstrate a protected quantum memory?

Solution

An even number of flips gives II and an odd number gives ZZ. Poisson averaging gives

peven=1+e−2γt2,podd=1−e−2γt2,Et(ρ)=pevenρ+poddZ‾ρZ‾.\begin{aligned} p_{\rm even}&=\frac{1+e^{-2\gamma t}}2,\\ p_{\rm odd}&=\frac{1-e^{-2\gamma t}}2,\\ \mathcal E_t(\rho)&=p_{\rm even}\rho +p_{\rm odd}\overline Z\rho\overline Z. \end{aligned}

The adjoint channel fixes Z‾\overline Z but multiplies X‾\overline X and Y‾\overline Y by e−2γte^{-2\gamma t}. Applying ZZ to one half of a Bell pair produces an orthogonal Bell state, so the entanglement fidelity is pevenp_{\rm even}, tending to 1/21/2. Logical populations survive, but phase coherence and reference entanglement do not. A long-lived ZZ signal alone tests a classical component of the information.