Checkpoint: Toric-Code Logic
This checkpoint consolidates Module 8. You should be able to take an toric code and, from first principles, state its parameters, identify its stabilizers and logical operators, and explain why each number is what it is. We work the bookkeeping end-to-end and then you reproduce it in code.
The parameter derivation, start to finish
Physical qubits. One qubit per edge of the square lattice on the torus. With vertices and faces, periodic boundary conditions give edges, so
Stabilizers and their redundancy. There are star operators and plaquette operators, but each family has exactly one relation:
because every edge is counted twice. So there are independent stars and independent plaquettes, for
Encoded qubits. Subtracting,
Equivalently for a genus- surface; the torus has . The two logical qubits correspond to the two independent noncontractible cycles, with logical operators (-strings around direct cycles) and (-strings around dual cycles) satisfying .
Distance. A logical operator is a noncontractible loop; the shortest such loop wraps one direction of the torus in a straight line of edges. Hence
Putting it together, the toric code is
A concrete instance
For : qubits, logical qubits, . The code is and corrects arbitrary error (even distance, so a weight-2 error can be ambiguous — another reason odd distances are preferred in practice).
Try it
Implement toricParams(L) returning for the toric code from the derivation
above, then return the sum for . The grader checks the combined value.
Sign in on the full site to ask questions and join the discussion.