Math
Error-correcting codes
Inject X, Z or Y on a 3D code board, read the syndrome and reveal the recovery. Compare the remaining logical operator and input-state fidelity, then test exact probabilities against an ensemble of runs.

What happens
Inject X, Z or Y on a 3D code board, read the syndrome and reveal the recovery. Compare the remaining logical operator and input-state fidelity, then test exact probabilities against an ensemble of runs.
One logical qubit, not copies. Gates and syndrome measurements are ideal. The decoder sees the syndrome, not the injected error.
Click a chip to cycle I → X → Z → Y. Start with one X in the bit-flip code, then try Z or two X errors. Use Next to reveal the syndrome and recovery.
Equations used in the module
Equations physical Pauli: I, X, Z, Y = iXZ (global phase ignored) bit code: |0_L> = |000>, |1_L> = |111>; checks Z0Z1, Z1Z2 phase code: |0_L> = |+++>, |1_L> = |--->; checks X0X1, X1X2 Shor: |0_L> = GHZ+^3, |1_L> = GHZ-^3; GHZ± = (|000> ± |111>)/sqrt(2) logical success: residual operator I on the entire code space F_I = 1; F_X = sin²θ cos²φ; F_Z = cos²θ; F_Y = sin²θ sin²φ bare: P = 1-p (one type), (1-p)² (independent X and Z) repetition: P_own = 1-3p²+2p³; P_both = P_own (1+(1-2p)³)/2 Shor: f = 3p_x²(1-p_x)+p_x³; o = (1-(1-2p_z)³)/2 P = (1+(1-2f)³)/2 · ((1-o)³+3o(1-o)²) p_x = p; p_z = 0 or p; ideal encoding, syndrome measurement and recovery


