Toric code intuition

Essence

The square Toric code stores information in how Pauli strings wind around a torus, while local star and plaquette checks reveal only where an error string ends. A local disturbance can create, move, or annihilate endpoint defects, but changing a winding class requires a string to cross an entire periodic direction.

The dashed square in the viewer is a fundamental domain, not a patch with physical edges. Its top and bottom are identified, as are its left and right. This one distinction explains why the entry has two logical qubits and why it must not inherit the open Surface code's boundary strings or construction recipe.

The complete cell, rank, homology, and distance argument is worked in homology and distance.

Design problem

We want sparse, geometrically local checks whose violations say where a Pauli fault occurred without measuring the encoded state. Put data qubits on edges of a periodic square lattice. For every vertex measure the product of X on its incident edges; for every face measure the product of Z around its boundary.

Why this pairing? A Z error anticommutes with the two neighboring X stars, so a chain of Z errors cancels internal violations and leaves defects only at its endpoints. Dually, an X chain leaves violated Z plaquettes at its endpoints. The syndrome is therefore the boundary of the error chain.

The catch is also the feature. A closed chain has no endpoints. If it bounds a contractible region, it is a stabilizer product and does nothing logically. If it winds around the torus, it has the same zero syndrome but changes encoded information. Error correction is the decision between these homology classes, not merely a request to find any chain with the observed boundary. See syndrome and decoding.

Derivation chain

  1. Let C2, C1, and C0 be the binary vector spaces generated by faces, edges, and vertices. The face-boundary map d2: C2 -> C1 marks the four edges of each plaquette; the edge-boundary map d1: C1 -> C0 marks the two endpoints of each edge.
  2. A boundary has no boundary, so d1 d2 = 0. Taking HX=d1 and HZ=d2^T gives HX HZ^T=0, exactly the CSS commutation condition. The constructor computes and validates this identity.
  3. The periodic square domain contains L² vertices, L² faces, and 2L² edges. The product of all stars is identity because every edge appears twice; the same holds for all plaquettes. Each connected sector has only that global dependency, so the total stabilizer rank is 2L²-2 and the code encodes two qubits.
  4. Cycles in ker(d1) are closed primal strings. Quotienting by im(d2) identifies cycles that differ by local plaquette boundaries. The two surviving torus directions have shortest square-lattice representatives of weight L. The dual quotient gives their crossing X partners. Hence the family is [[2L²,2,L]].
  5. The same matrices arise from HGP of two square cyclic repetition parity maps. The transpose orientation matters. Open repetition maps instead give the planar Surface witness. The exact ordered equality is derived in the cyclic-HGP dictionary and rerun by the reproduction script.

The Level-2 map links every proof and states which parts are constructor-verified and which are literature-bounded.

Multiple pictures

Sparse CSS matrix. HX lists vertex-edge incidence and HZ lists face-edge incidence. This picture is best for rank, commutation, syndrome calculation, exact finite distance, and symplectic gate checks.

Chain complex and homology. C2 -> C1 -> C0 explains why commutation is a topological identity and why a zero-syndrome loop can still be logical. It also makes the Surface boundary change precise: the torus uses absolute homology; an open patch uses relative homology.

Cyclic hypergraph product. The two one-dimensional periodic parity maps become the two lattice directions. Their kernel and transpose-kernel sectors expose the two logical sectors algebraically. This is an exact dictionary, not a claim that every HGP output is Toric.

Anyons and strings. Endpoint defects are electric or magnetic charges; moving a charge extends a string, and crossing primal and dual logical strings records their mutual statistics. This picture is best for deformations and logical commutation.

Statistical mechanics. All corrections with one syndrome split into four logical classes. Their total probabilities become partition functions of disorder sectors. Matching chooses a light representative; maximum likelihood compares class free energies. The model changes when the channel, check noise, or circuit changes.

Tensor and fermion dictionaries. PEPS virtual symmetry packages topological degeneracy into local tensors. Under restricted coherent channels, a Majorana mapping makes correction simulation efficient. These are curated representations with explicit source boundaries, not new code identities or universal decoders. Details and limitations are in representations.

Why these parameters

The physical count is a cell count: each of the L² vertices contributes one horizontal and one vertical outgoing edge, giving n=2L² without double counting. There are 2L² written checks, but one global relation in the star sector and one in the plaquette sector reduce the independent count to 2L²-2. Therefore k=n-rank(S)=2.

For the upper distance bound, choose one straight noncontractible primal or dual loop; it has weight L and is logical. For the lower bound, any logical cycle must have nonzero winding in at least one direction. Cutting the torus along L parallel dual cuts, a winding primal cycle intersects every cut and therefore uses at least L edges. The dual argument treats X logicals. Thus d=L, not merely d<=L.

The committed L2 and L3 instances are deliberately small enough for exact distance enumeration. They also exercise the nontrivial periodic seams and the four constructor-derived logical supports. Larger L changes resource scale but not the proof. Homology and distance contains the full lower-bound argument.

Failure modes

A decoder receives a syndrome, not the error chain. Two candidate corrections with the same endpoints differ by a closed cycle. If that difference is contractible, they are logically equivalent; if it winds, choosing the wrong class completes a logical operator. This is the core failure event.

With perfect syndrome and independent Pauli noise, minimum-weight matching is a standard baseline. With noisy measurements, defects become changes between rounds and decoding takes place in spacetime. A circuit model additionally contains correlated hook faults and schedule choices. Known erasure locations, correlated Pauli noise, and coherent rotations each change the inference problem again.

Threshold values are therefore tuples, not properties of the bare matrix. A tuple must name the physical channel, syndrome/circuit model, decoder, normalization, boundary condition, and asymptotic observable. The threshold ledger keeps these regimes separate and explains why the card carries no universal scalar.

The code is topological but not automatically self-correcting in two dimensions: local thermal processes can grow a logical string without an energy barrier proportional to L. Active repeated measurement and decoding remain part of a memory protocol.

Operations story

The constructor exposes four noncontractible supports. It checks that each commutes with every stabilizer, lies outside the stabilizer row space, and has the intended symplectic intersection with exactly one conjugate partner. Those strings implement logical Pauli operations or, more commonly, Pauli-frame updates.

For two identically indexed blocks, pairwise physical CNOT implements logical CNOT on both homology sectors. The symplectic conjugation preserves the full two-block stabilizer group and maps the logical generators correctly; this is rerun in reproduce.py. Physical alignment, transport faults, and correlated decoding are architecture costs, not consequences of the matrix proof.

A proposed constant-depth Clifford toolkit combines fold-transversal pairings, Dehn twists, and single-shot logical Pauli measurements. The card marks that toolkit claimed because fault tolerance depends on its geometric and decoder protocol. The bare code has no native universal non-Clifford story under local constant-depth operations; twist enrichment or external resource states must be named. See operations and realizations.

Hardware evidence has two distinct milestones. One neutral-atom experiment prepared a finite Toric state on periodic geometry. A later experiment ran repeated syndrome extraction with atom replacement and reloading. The latter also reported a finite two-distance comparison, but neither row is relabeled as a model-independent threshold demonstration.

Litmus questions

Q1: Why does a star commute with a neighboring plaquette even though X and Z anticommute on one qubit? A: They share two edge qubits at that corner. The two minus signs multiply to plus; non-neighbors share no edge.

Q2: Why are there only 2L²-2 independent stabilizers when 2L² checks are written? A: Multiplying all stars uses every edge twice and gives identity, and the same is true for all plaquettes. On the connected torus each sector has one such global dependency.

Q3: What distinguishes a stabilizer loop from a logical loop? A: Both are closed and have zero syndrome. A stabilizer loop bounds a contractible region; a logical loop represents a nonzero homology class and winds around a periodic direction.

Q4: Why does the code encode two logical qubits rather than one? A: The torus has two independent winding directions. Each supplies a primal logical and a crossing dual conjugate, giving two Pauli pairs.

Q5: Why is HGP of open repetition maps not the Toric construction? A: Open maps are rectangular and remove the transpose-kernel sector, producing an open planar Surface patch with boundary strings. Toric uses square cyclic maps and retains two logical sectors.

Q6: Why is minimum-weight matching not automatically maximum likelihood? A: Matching selects one low-cost chain. Maximum likelihood sums the probabilities of all chains in each logical class, so degeneracy and path entropy can change the preferred class.

Q7: Does a prepared Toric code state demonstrate repeated quantum error correction? A: No. State preparation verifies access to a stabilizer sector; repeated QEC additionally requires mid-circuit syndrome rounds, decoding, and logical memory evidence.

Q8: Does sharing a bulk phase make Honeycomb and Toric the same code? A: No. Selected Honeycomb frames map locally to Toric stabilizers, but the full Honeycomb object is a time-periodic measurement protocol with spacetime detectors and a nontrivial anyon-frame evolution.