Documentation

CslibFrontier.Computability.Circuit.Quantum.PhaseGates

Controlled single-qubit gates, Z and T phase gates, and the Clifford + T decomposition #

This module defines the controlled-V two-qubit gate (Gate.controlled), the single-qubit register phase gates Gate.pauliZ (diag(1, -1), obtained by reindexing Cslib.Quantum.pauliZ) and Gate.phaseT (diag(1, e^{i π / 4})), and proves the exact 2-term Clifford decomposition T = e^{i π / 8} cos (π / 8) · I - i e^{i π / 8} sin (π / 8) · Z (Gate.phaseT_eq_comb_pauliZ) together with its magic ℓ₁ weight cos (π / 8) + sin (π / 8) = √(1 + 1 / √2) (Gate.cos_add_sin_pi_div_eight).

Main definitions #

Main results #

References #

noncomputable def Cslib.Quantum.Gate.controlled (V : ↥(Gate 1)) :
↥(Gate 2)

The controlled-V two-qubit gate (|0, b⟩ ↦ |0, b⟩, |1, b⟩ ↦ |1⟩ ⊗ V |b⟩) for any single-qubit gate V : Gate 1.

@[simp]
theorem Cslib.Quantum.Gate.controlled_apply (V : ↥(Gate 1)) (y x : Fin 2 → Bool) :
↑(controlled V) y x = if y 0 = x 0 then if x 0 = true then ↑V (fun (x : Fin 1) => y 1) fun (x_1 : Fin 1) => x 1 else if y 1 = x 1 then 1 else 0 else 0
noncomputable def Cslib.Quantum.Gate.pauliZ :
↥(Gate 1)

Single-qubit Pauli-Z register gate (diag(1, -1)), reindexing Cslib.Quantum.pauliZ along Fin 1 → Bool ≃ Bool.

@[simp]
theorem Cslib.Quantum.Gate.pauliZ_apply (y x : Fin 1 → Bool) :
↑pauliZ y x = if y 0 = x 0 then if y 0 = true then -1 else 1 else 0
noncomputable def Cslib.Quantum.Gate.phaseT :
↥(Gate 1)

Single-qubit T (π / 4 phase) gate (diag(1, e^{i π / 4})).

@[simp]
theorem Cslib.Quantum.Gate.phaseT_apply (y x : Fin 1 → Bool) :
↑phaseT y x = if y 0 = x 0 then if x 0 = true then Complex.exp (Complex.I * (↑Real.pi / 4)) else 1 else 0

Exact Clifford + T magic norm identity: cos (π / 8) + sin (π / 8) = √(1 + 1 / √2).

Exact 2-term Clifford decomposition of Gate.phaseT: T = e^{i π / 8} cos (π / 8) · I - i e^{i π / 8} sin (π / 8) · Z, whose absolute coefficients sum to cos (π / 8) + sin (π / 8) = √(1 + 1 / √2).