Documentation

CsdLean4.Mathlib.QuantumInfo.CliffordTAngle

The rotation angle of T·HTH is an irrational multiple of π #

Category: 1-Mathlib (CSD-free; staged for upstream). BACKLOG #68, part (a) of R-005 (specs/magic-plan.md, "The split").

T·HTH is e^{iπ/4} times an element of SU(2) whose half-trace is cos²(π/8) (trace_htht, det_htht): a rotation by the angle htAngle with cos(htAngle/2) = cos²(π/8), so cos htAngle = (2√2 − 1)/4. That angle is an irrational multiple of 2π, which is why the powers of one Clifford+T word already fill a whole one-parameter rotation subgroup — the engine of Clifford+T universality.

The obstruction is arithmetic. If θ is a rational multiple of 2π then e^{iθ} is a root of unity, hence an algebraic integer, and so is its inverse, so 2 cos θ is an algebraic integer (★ isIntegral_two_mul_cos_of_eq_two_pi_mul, a general fact Mathlib lacks at the pin). But x = 2 cos htAngle = √2 − 1/2 satisfies x² + x = 7/4, so if it were an algebraic integer then 7/4 would be one too, and ℤ is integrally closed in ℚ (★ not_isIntegral_of_sq_add_self_eq).

Honest scope #

⚠️ This is the angle of one Clifford+T word and the density of its own powers. That ⟨H, T⟩ is dense in U(2) modulo phase needs a second axis and the Euler decomposition: BACKLOG #81, done 2026-09-26 in CsdLean4/Mathlib/QuantumInfo/CliffordTDensity.lean. The extension to U(2ⁿ) is #70–#73. No efficiency claim: Solovay–Kitaev is #74 and is not attempted.

References: M. A. Nielsen, I. L. Chuang, Quantum Computation and Quantum Information §4.5.3 and Exercise 4.11; C. M. Dawson, M. A. Nielsen, quant-ph/0505030 §2 (the Solovay–Kitaev setting); specs/magic-plan.md; specs/BACKLOG.md #68; specs/future-work.md.

Two cosines of rational angles are algebraic integers #

theorem isIntegral_two_mul_cos_of_eq_two_pi_mul {θ : ℝ} {q : ℚ} (hθ : θ = 2 * Real.pi * ↑q) :

★ 2 cos θ is an algebraic integer whenever θ is a rational multiple of 2π: e^{iθ} is then a root of unity, so it and its inverse are algebraic integers, and 2 cos θ is their sum.

x² + x = 7/4 has no algebraic-integer solution #

theorem not_isIntegral_of_sq_add_self_eq {x : ℝ} (hx : x ^ 2 + x = 7 / 4) :

★ No algebraic integer satisfies x² + x = 7/4: it would make 7/4 an algebraic integer, and ℤ is integrally closed in ℚ.

The angle of T·HTH #

Half the rotation angle of T·HTH: the angle whose cosine is cos²(π/8).

Equations
Instances For

    The rotation angle of T·HTH.

    Equations
    Instances For

      ★★ The angle of T·HTH is an irrational multiple of 2π.

      ★ The integer multiples of htAngle are dense in the circle ℝ/2πℤ.

      The subgroup generated by htAngle and 2π is dense in ℝ.

      theorem QuantumInfo.CliffordT.exists_zsmul_htAngle_approx (α : ℝ) {ε : ℝ} (hε : 0 < ε) :
      ∃ (k : ℤ) (m : ℤ), |↑k * htAngle + ↑m * (2 * Real.pi) - α| < ε

      ★★ Every angle is an integer multiple of htAngle modulo 2π, to any accuracy. This is the form the gate-approximation argument consumes: repeating the Clifford+T word T·HTH k times realises any rotation about its axis, as closely as required.

      The gate #

      noncomputable def QuantumInfo.CliffordT.hGateM :
      Matrix (Fin 2) (Fin 2) ℂ

      The Hadamard as a 2 × 2 matrix.

      Equations
      Instances For
        noncomputable def QuantumInfo.CliffordT.tGateM :
        Matrix (Fin 2) (Fin 2) ℂ

        The T gate as a 2 × 2 matrix.

        Equations
        Instances For

          The trace of the Clifford+T word: (1 + e^{iπ/4})²/2.

          The determinant of the Clifford+T word: e^{iπ/2} = i.

          e^{iπ/8}, the square root of the T phase.

          Equations
          Instances For

            1 + e^{iπ/4} = 2 cos(π/8) e^{iπ/8}.

            ★ The gate's rotation angle is htAngle: tr(T·HTH) = 2 cos(htAngle/2) e^{iπ/4}, and det(T·HTH) = e^{iπ/2} (det_htht), so e^{−iπ/4}·T·HTH lies in SU(2) with half-trace cos(htAngle/2) = cos²(π/8): it is a rotation by htAngle.