Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§5.2, unnumbered: controlled X,H,T with one ancilla

Open
QAlgorithms.Papers.Independent.Intakethird100.P85.controlledGates_oneAncilla

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

Let r≥0r\ge0r≥0 be a number of positive controls and let M∈{X,H,T}M\in\{X,H,T\}M∈{X,H,T}. Let Λr(M)\Lambda^r(M)Λr(M) apply MMM to its target precisely when every control is 111, and otherwise act as the identity. There is an elementary Clifford+T circuit CCC on r+2r+2r+2 wires such that, for every input vector ψ\psiψ on the r+1r+1r+1 data wires,

UC(ψ⊗∣0⟩)=Λr(M)ψ⊗∣0⟩.U_C(\psi\otimes|0\rangle)=\Lambda^r(M)\psi\otimes|0\rangle.UC​(ψ⊗∣0⟩)=Λr(M)ψ⊗∣0⟩.

The helper is trailing and returns exactly to zero. With r=0r=0r=0, the controlled operation is simply MMM. These implementations establish the one-ancilla sufficiency step.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intakethird100_P85
Formal statement
noncomputable section

namespace QAlgorithms.Papers.Independent.Intakethird100.P85

open scoped Classical BigOperators

open QAlgorithms

open QAlgorithms.Papers.Independent.Gap48.P10
  (InZomega InDomega Residue bits residue residueMultiply Reducible)

open QAlgorithms.Papers.Independent.Support21.P13
  (synthesisRing integralRing coordinateValue HTLetter htWordMatrix EntriesInRing cliffordTLibrary)

local notation "omega" => QAlgorithms.gateT true true

local notation "sqrtTwo" => ((Real.sqrt 2 : ℝ) : ℂ)

/-- Section 5.2, PDF p.5: all positive multiply-controlled X,H,T gates use one clean helper. -/
theorem controlledGates_oneAncilla :
    ∀ r : ℕ, ∀ M ∈ ({pauliX, hadamard, gateT} : Set (Matrix Bool Bool ℂ)),
      ∃ c : Circuit gateSet ((r + 1) + 1),
        ImplementsWithCleanAncillas c.unitary (multiplyControlled r M) := by sorry

end QAlgorithms.Papers.Independent.Intakethird100.P85

end
Source
Exact synthesis of multiqubit Clifford+T circuits, arXiv:1212.0506v3, PDF p. 5, §5.2, unnumbered: controlled X,H,T with one ancilla
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

Let ω=eiπ/4\omega=e^{i\pi/4}ω=eiπ/4. For every natural number rrr and every matrix

M∈{X=(0110),H=12(111−1),T=diag⁡(1,ω)},M\in\left\{ X=\begin{pmatrix}0&1\\1&0\end{pmatrix}, \quad H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, \quad T=\operatorname{diag}(1,\omega) \right\},M∈{X=(01​10​),H=2​1​(11​1−1​),T=diag(1,ω)},

there exists a finite circuit ccc on (r+1)+1(r+1)+1(r+1)+1 wires using HHH, S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i), TTT, CNOT, and the zero-wire scalar gate ω\omegaω, such that

C(ψ⊗∣0⟩)=(Vr,Mψ)⊗∣0⟩for every ψ∈CQr+1.C\bigl(\psi\otimes|0\rangle\bigr) = (V_{r,M}\psi)\otimes|0\rangle \qquad\text{for every }\psi\in\mathbb C^{Q_{r+1}}.C(ψ⊗∣0⟩)=(Vr,M​ψ)⊗∣0⟩for every ψ∈CQr+1​.

Here QmQ_mQm​ is the set of length-mmm Boolean strings; the last wire is the appended ∣0⟩|0\rangle∣0⟩ wire; CCC is the reverse-ordered product of the gate matrices embedded on injectively assigned wires, with all unassigned bits preserved; and CNOT sends (a,b)(a,b)(a,b) to (a,bxora)(a,b\mathbin{\mathrm{xor}}a)(a,bxora). The matrix Vr,MV_{r,M}Vr,M​ preserves the first rrr bits and applies MMM to the last bit precisely when all first rrr input bits are true, applying the identity to that bit otherwise. The zero-wire gate embeds as ωI\omega IωI. The equality is required for every vector ψ\psiψ, without a normalization assumption. When r=0r=0r=0, the condition on the controls is vacuous and V0,M=MV_{0,M}=MV0,M​=M.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me