It was discussed how classical linear codes and CSS codes can be understood as chain complexes, and how the hypergraph product allows one to construct a CSS code from two classical codes. As an illustration, we consider how the toric code can be understood as a hypergraph product of two repetition codes. Take them as 1-D chain complexes A: A1 ⟶ A0 and B: B1 ⟶ B0 — bits A1, B1 on the edges of a ring, checks A0, B0 on its vertices, boundary map ∂A=HA. Their sizes: 6 and 6. The total product complex C = A⊗B is the toric code.

Input: two repetition codes
A 0⟶ A1 ∂A⟶ A0 ⟶0
B 0⟶ B1 ∂B⟶ B0 ⟶0
A repetition code on a ring: a data bit on every edge (A1), and a parity check on every vertex (A0) that reads the two bits on its edges and demands they agree. The check matrix ∂A=HA is exactly that rule: one row per check, a 1 for each bit it sums. Hover a matrix row — or a dot/edge on the axis — to see one parity check.
Output: total product complex C = A ⊗ B
0⟶ C2 ∂2⟶ C1 ∂1⟶ C0 ⟶0
C2 = A1⊗B1 faces · Z-checks
C1 = A1⊗B0 ⊕ A0⊗B1 qubits
C0 = A0⊗B0 vertices · X-checks
∂2 = [ I⊗∂B ; ∂A⊗I ] = HZT
∂1 = [ ∂A⊗I | I⊗∂B ] = HX
Every cell of the grid is a pair: one piece of A times one piece of B. The boundary maps apply ∂A and ∂B one factor at a time — the ⊗I copies the other factor unchanged. Hover any term to highlight its objects, and its A, B factors on the axes.
vertex / star (X) face / plaquette (Z) qubit (edge) ∂A (x) ∂B (y)
Each repetition code’s boundary is shown on its axis — click the “↻ periodic (x)” / “periodic (y)” label to toggle that direction between periodic (torus) and open boundary (dangling stubs).

An experiment for NAT3045 — Quantum Error Correction and Fault Tolerance, inspired by Bret Victor’s Explorable Explanations and Up and Down the Ladder of Abstraction. Feedback welcome: (enable JavaScript to show).