Z-error patterns on the encoded magic state: detection and the logical Z̄ #
Category: 1-Mathlib (CSD-free; staged for upstream). BACKLOG #77, part (c) of R-004
(specs/magic-plan.md, "The split").
The 15-to-1 protocol injects T (BACKLOG #66–#67) into each qubit of the encoded |+̄⟩; a noisy
resource leaves a Z-error pattern e ∈ 𝔽₂¹⁵ on the encoded magic state
|Ā'⟩ = T^{⊗15}|+̄⟩ = |0̄⟩ + e^{−iπ/4}|1̄⟩ (tTrans_logicalPlus), i.e. the state Z_e |Ā'⟩. The
X-checks X^{row i} are then measured:
Z_ecommutes withX^{row i}up to the sign(−1)^{(syndrome e)ᵢ}(pauliOp_z_comm_row), so on any state fixed by the checks the measurement of checkiis deterministic with outcome(syndrome e)ᵢ(★measProj_row_z): a pattern with nonzero syndrome is rejected with certainty (exists_reject_of_syndrome_ne_zero), a pattern with zero syndrome passes every check;- an undetected pattern acts on the code space as the logical
Z̄to the power of its parity:Z_e|0̄⟩ = |0̄⟩andZ_e|1̄⟩ = (−1)^{|e|}|1̄⟩(pauliOp_z_logical0/1, frombdot_codeword— a pattern orthogonal to the rows is orthogonal to the code — andbdot e 𝟙 = |e| mod 2,parity_val,parity_eq_one_iff_odd); ★★pauliOp_z_encodedMagic: the accepted state is|0̄⟩ + (−1)^{|e|} e^{−iπ/4}|1̄⟩, the encodedT†|+⟩for even|e|and its logicalZ̄-flip for odd|e|; - reading the logical coefficients as a qubit (
outQubit e), the output is√2 · T†|+⟩for even|e|and√2 · Z T†|+⟩for odd|e|(outQubit_eq,magicConj), andS T†|+⟩ = |A⟩(sGate_magicConj): the protocol distils the magic state up to the CliffordS.
syndromeF (on Fin 2 labels) agrees with ReedMuller15.syndrome (syndromeF_eq), so the
counts of ReedMuller15.lean apply: no undetected pattern of weight 1 or 2, exactly 35 of
weight 3, 2¹¹ in all.
Honest scope #
⚠️ The output is read off the logical coefficients here; the explicit decoding circuit is
QuantumInfo/ReedMuller15Decoder.lean (BACKLOG #79, 2026-09-27), sixteen CNOTs that put those
coefficients on wire 0. The probabilities over the pattern under independent noise, and the 35 p³ bound, are
BACKLOG #78.
References: S. Bravyi, A. Kitaev, PRA 71 (2005) 022316 §IV; specs/magic-plan.md;
specs/BACKLOG.md #77; specs/future-work.md.
The X-check syndrome of a Z-pattern: (syndrome e)ᵢ = e · row i.
Equations
Instances For
The parity e · 𝟙 = |e| mod 2 of a pattern.
Equations
Instances For
The rows are the columns of ReedMuller15.lean (ZMod 2 is Fin 2).
The Fin 2 syndrome is the ZMod 2 syndrome of ReedMuller15.lean, definitionally.
Z_e against the X-checks #
Z_e |x⟩ = (−1)^{e · x} |x⟩.
Undetected patterns act as the logical Z̄^{parity} #
The encoded magic state is fixed by every X-check.
★★ The accepted state: an undetected pattern e turns the encoded magic state into
|0̄⟩ + (−1)^{|e|} e^{−iπ/4}|1̄⟩ — the encoded T†|+⟩ for even |e|, its logical Z̄-flip for odd.
The decoded output #
The conjugate magic state T†|+⟩ = T† H |0⟩.
Equations
- QuantumInfo.ReedMuller15.magicConj = QuantumInfo.tGateInv 0 (QuantumInfo.hGate 0 (QuantumInfo.basisState fun (x : Fin 1) => 0))
Instances For
S T†|+⟩ = |A⟩: the distilled state is the magic state up to the Clifford S.
The logical coefficients of the accepted state, read as one qubit:
|0⟩ + (−1)^{|e|} e^{−iπ/4}|1⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Z^s on one qubit.
Equations
- QuantumInfo.ReedMuller15.zPow s ψ = if s = 0 then ψ else QuantumInfo.pauliOp 0 (QuantumInfo.unitV 0) ψ