8 The toric code
The \(L \times L\) square lattice on the torus, read as a chain complex. The \(2L^2\) edges are the qubits; vertices carry the \(Z\)-checks and faces the \(X\)-checks.
The \(L \times L\) square lattice on the torus, packaged as a definition 52: \(C_0\) is spanned by vertices, \(C_1\) by the \(2L^2\) edges (the physical qubits), \(C_2\) by faces, with \(\partial _2\) the face boundary and \(\partial _1\) the edge boundary.
\(H_1\) of definition 65, i.e. the first homology of the torus with \(\mathbb {F}_2\) coefficients.
\(\dim _{\mathbb {F}_2} H_1 = 2\) for every \(L \ge 2\), recovering \(H_1(T^2; \mathbb {F}_2) \cong \mathbb {F}_2^2\) and hence \(k = 2\).
By theorem 58 it suffices to compute \(\dim Z_1\) and \(\dim B_1\). Rank-nullity applied to \(\partial _1\) gives \(\dim Z_1 = 2L^2 - \operatorname {rank}\partial _1\), and \(\operatorname {rank}\partial _1 = L^2 - 1\) because the only relation among the vertex checks is that they all multiply to the identity. Dually \(\operatorname {rank}\partial _2 = L^2 - 1\), the kernel of \(\partial _2\) being spanned by the all-ones face chain. Subtracting gives \(2\).
8.1 Wrapping invariants
The homology of the torus is detected by two \(\mathbb {F}_2\)-valued winding numbers, counting how often a chain wraps horizontally and vertically. They are defined on all chains, are unchanged by adding a boundary, and together separate homology classes.
\(h(c) \in \mathbb {F}_2\) counts, modulo two, the vertical edges of the chain \(c\) crossing a fixed horizontal cut of the torus — the number of times \(c\) wraps horizontally.
The vertical counterpart of definition 68.
Both wrapping numbers vanish on \(B_1\), so they descend to well-defined functions on \(H_1\).
It is enough to check a single face, since \(\partial _2\) is linear and the faces span \(C_2\). A face has exactly two vertical edges, which either both cross the cut or both miss it; either way the count is even.
\(\varphi : H_1 \to \mathbb {F}_2^2\), \([c] \mapsto (h(c), v(c))\), well defined by theorem 70.
\(\varphi \) is a linear isomorphism \(H_1 \cong \mathbb {F}_2^2\): a cycle is a boundary if and only if it wraps trivially in both directions.
Surjectivity is witnessed by the horizontal and vertical loop chains. Injectivity is the substantive direction: a cycle with \(h = v = 0\) is shown to be a boundary. With theorem 67 giving \(\dim H_1 = 2\), a surjection onto \(\mathbb {F}_2^2\) is automatically injective.
8.2 The code and its distance
The \(L \times L\) toric code presented as a definition 38 with \(n = 2L^2\) and \(k = 2\).
The natural generating set has \(2L^2\) elements, two more than the \(n - k = 2L^2 - 2\) that a presentation (definition 40) demands, because the vertex checks multiply to the identity and so do the face checks. The packaging therefore uses a *trimmed* list, and the homological identities are what prove the trimmed list generates the same subgroup.
The natural generating set of the toric code has \(2L^2\) elements, two more than the \(n - k = 2L^2 - 2\) that a presentation (definition 40) demands: the vertex checks multiply to the identity, and so do the face checks, so the full list has dependent rows. The packaging therefore uses a trimmed generator list, and the homological identities are what prove the trimmed list generates the same subgroup. Distance proofs stated against the untrimmed stabilizer group are carried across by theorem 33.
\(d_X = L\): every nontrivial \(X\)-type logical operator has weight at least \(L\), and a horizontal loop achieves it.
Upper bound: the horizontal loop chain is a cycle with \(h = 1\), hence non-boundary by theorem 72, and has exactly \(L\) edges. Lower bound: a nontrivial class has \(h = 1\) or \(v = 1\); say \(h = 1\). Then the chain meets each of the \(L\) disjoint horizontal cuts an odd number of times, so it contains at least one edge per cut, giving at least \(L\) edges in total.
\(d_Z = L\), by the same argument on the dual lattice.
The dual complex of definition 65 is again an \(L \times L\) torus lattice with the roles of faces and vertices exchanged, so the argument of theorem 74 applies verbatim to the dual wrapping invariants.
For every \(L \ge 2\) the \(L \times L\) toric code (definition 73) has distance exactly \(L\), so it is an \([[2L^2, 2, L]]\) code.
For a CSS code \(d = \min (d_X, d_Z)\), and both are \(L\) by theorem 74 and theorem 75. The chain-level bounds are moved to Pauli weights by theorem 64, and the result is transported from the hand-built stabilizer group to the packaged code of definition 73 by theorem 33.
The \([[2L^2, 2, L]]\) toric code as an inhabitant of definition 46, for every \(L \ge 2\).