The magic layer: the T gate escapes the Clifford closure (candidate 5) #
Category: 1-Mathlib (CSD-free).
Glossary: https://glossary.constraintsurfacedynamics.com/magic-state/
Plain-language, CSD-role and formal statements of magic states, with this module as their
Lean anchor. Kept symmetric by scripts/check-glossary.sh.
The precise complement of the Gottesman–Knill mechanism (plan specs/magic-plan.md): GK-2
proved that H, S, CNOT conjugate every Pauli to a phase times a Pauli — the closure that
makes Clifford circuits classically trackable. This module proves the boundary is real:
the T gate (the π/8 gate) breaks it, which is why T is the standard route to universality
and why magic states are a resource.
- The Clifford hierarchy, level by level:
T² = S(tGate_tGate—Tsits one level above the Clifford group, its square descending into it), and ★tGate_conj_X:T X T† = (X + i·XZ)/√2— conjugation byTcarries the PauliXout of the Pauli family but into its Clifford-algebra span: the level-3 hierarchy statement, as a closed operator identity. - ★★ The no-go (
tGate_conj_X_not_pauli): there are noc, a, bwithT X T† = c·X^a Z^b. Together with GK-2 this brackets the Clifford group sharply: H, S, CNOT stay inside the Pauli-conjugation closure,Tprovably leaves it. The proof pins two coordinates and derives1 = ±i— a two-line arithmetic absurdity. - The magic state
|T⟩ = T·H|0⟩(magicState), coordinates(1, e^{iπ/4})/√2(magicState_apply), unit norm (inner_magicState_self) — the resource state whose consumption implementsTby Clifford operations alone in the standard injection circuit.
Honest scope. This module formalises what magic is — the provable escape from the
Clifford closure and the resource state — not how it is used or distilled: the
Bravyi–Kitaev 15-to-1 distillation protocol is not attempted (⚠️ RESIDUE(R-004)), no
universality claim is made — that would need a gate-synthesis density theorem
(⚠️ RESIDUE(R-005)) — and the gate-teleportation circuit injecting T from magicState
is not attempted (⚠️ RESIDUE(R-006)). No priority claim of any kind (CL-061 rule).
The T gate #
The T phase e^{iπ/4}.
Equations
- QuantumInfo.tPhase = Complex.exp (↑(Real.pi / 4) * Complex.I)
Instances For
The inverse T phase e^{−iπ/4}.
Equations
- QuantumInfo.tPhaseInv = Complex.exp (↑(-(Real.pi / 4)) * Complex.I)
Instances For
The T gate (π/8 gate) on qubit j: phase e^{iπ/4} on the z_j = 1 branch.
Equations
- QuantumInfo.tGate j ψ = (WithLp.equiv 2 ((Fin n → Fin 2) → ℂ)).symm fun (z : Fin n → Fin 2) => QuantumInfo.tPhase ^ ↑(z j) * ψ.ofLp z
Instances For
The inverse T gate.
Equations
- QuantumInfo.tGateInv j ψ = (WithLp.equiv 2 ((Fin n → Fin 2) → ℂ)).symm fun (z : Fin n → Fin 2) => QuantumInfo.tPhaseInv ^ ↑(z j) * ψ.ofLp z
Instances For
Conjugating X: out of the Pauli family, into its span #
★ The level-3 hierarchy identity: T X T† = (X + i·XZ)/√2 — conjugation by T
carries the Pauli X out of the Pauli family, but only into its two-term Clifford-algebra
span.
The T gate on a basis state: a pure phase.
The inverse T gate on a basis state: a pure phase.
★★ The no-go: T is not Clifford. There are no c, a, b with
T X T† = c · X^a Z^b — the conjugation escape is genuine, not a phase artefact. Pinning
the two basis columns forces 1 = ±i.
The magic state #
The magic state |T⟩ = T·H|0⟩ on one qubit.
Equations
- QuantumInfo.magicState = QuantumInfo.tGate 0 (QuantumInfo.hGate 0 (QuantumInfo.basisState fun (x : Fin 1) => 0))
Instances For
The magic state is a unit vector.