Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Exact synthesis of single-qubit unitaries over Clifford-cyclotomic gate sets

Definition
QAlgorithms_Papers_Independent_Intakenext100_P03

by Gohan · Oct 31, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

The objects the formalized statements of Exact synthesis of single-qubit unitaries over Clifford-cyclotomic gate sets (arXiv:1501.04944) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • BlochMat
  • hZero: The paper's H0, including its absolute phase, equation (2), PDF p.4.
  • cliffordGroup: Exactly <H0,S>, using each generator and its adjoint, PDF p.4. The monoid closure is the group generated by these unitary matrices.
  • cyclotomicZRotation: Uz(theta)=diag(1,exp(i theta)), equation (4), PDF p.4.
  • cyclotomicRoot: The root zeta_m=exp(2 pi i/m), PDF p.4; only positive m occurs in results.
  • cyclotomicSynthesisRing: R_n as an actual subring of C, PDF p.4.
  • integerRing: Z[zeta_(2n)], PDF pp.19,21.
  • cyclotomicGroup: G_n=<C,Uz(pi/n)>, equation (3), PDF p.4. Adjoint generators implement inverses.
  • ringUnitaries: Actual U_2(R_n), with no quotient by scalar phase, PDF pp.3,12.
  • positiveAxisRotation: Positive-axis rotations, equation before (6), PDF p.5.
  • homomorphicBloch: Homomorphic Bloch representation. Printed (9) has transposed indices; changed to Re tr(P_i U P_j U†)/2 because pp.11,17 use left cancellation and row patterns. This source correction requires independent moderation.
  • blochCliffords: Image of the specifically generated Clifford group, PDF p.6.
  • PhaseEquivalent: Equality up to a single global phase, PDF p.5.
  • SynthesisLetter: Gate words for Definition 2.1, PDF p.5. A rotation letter has positive unit cost; any member of the source's precise Clifford group has cost zero.
  • synthesisWordMatrix: A word is multiplied in the source's printed left-to-right order, PDF p.5.
  • synthesisWordCost: Actual number of elementary Uz(pi/n) occurrences, PDF p.5.
  • minimumRotationCost: T_n(U), the least achievable word cost modulo global phase, PDF p.5. The fallback 0 is off-domain only: all uses below assume U in G_n, where a positive-letter word exists (inverse rotations have finite order 2n).
  • canonicalProduct: Product of canonical rotations in printed order, equation (14), PDF p.7.
  • IsCyclotomicCanonical: Precisely the canonical-form constraints; optimality is not a premise, Lemma 3.1, PDF p.7. The empty list is allowed.
  • canonicalCost: The canonical non-Clifford cost, equation (24), PDF p.10.
  • IsTwoPower: Power-of-two test, equations (23),(32), PDF pp.10,15.
  • denominatorWeight: q_a, equation (23), PDF p.10, verified in the PDF. The quotient is n/gcd(a,n). For valid a and n=2^k s, a power-of-two quotient has 2<=j<=k, so both natural subtractions here agree with integer subtraction.
  • denominatorBeta: beta, equation (23), PDF p.10; k is positive in every use.
  • denominatorAlpha: alpha=2^(2^(1-k))=2^(1/2^(k-1)), PDF p.15; no natural negative power.
  • cosineNumerator: c_a, equivalently equation (33), PDF p.15. This is exactly the piecewise normalization (32), with exponent 1-2^(1-j) in its power-of-two branch.
  • sineNumerator: s_a with the same normalization, equations (32),(33), PDF p.15.
  • realCyclotomicField: Frac(R_n intersect R), realized inside C, PDF pp.10,18. The smallest subfield containing the real subring is its fraction field.
  • numeratorField: The larger field K=Q({c_a,s_a},alpha), PDF p.15.
  • InIntegers: Algebraic integrality in the named field, Appendix A, PDF pp.28-29.
  • IntegerDivides: Divisibility requires nonzero divisor and integral quotient in F, Definition A.2, PDF pp.9,28. This is not divisibility in C.
  • IntegerCoprime: Principal-ideal coprimality, expressed by the equivalent Bezout identity in O_F, Definition A.5, PDF p.29.
  • IntegerUnit: Unit in O_F, rather than a nonzero element of C, PDF p.15.
  • ReducedDenominator: A nonzero entry and a beta/alpha-reduced numerator, PDF pp.10,16.
  • RowHasExponent: Row contains an entry with reduced exponent r, PDF p.10.
  • RowHasCoprime: Row contains an entry whose normalized numerator is coprime to the base, PDF pp.10,17. Zero entries are explicitly excluded.
  • DenominatorPattern: All three clauses of Theorems 4.1 and 6.3, PDF pp.10,16-17. Every comparison ranges over reduced nonzero entries. Row coprimality and attainment of both maxima are retained, not just a row upper bound.
  • canonicalTotalWeight: N=sum q_ai, PDF p.10.
  • MinusOneIsTwoPower: Positive t with 2^t=-1 modulo the odd part s; add 1 avoids natural negative integers. For s=1 this is true, as required, PDF p.13.
  • zRotationsIn: Actual z-rotations inside a matrix group, PDF p.12.
  • finiteZRotations: Equation (27), with endpoint represented by Fin(2n), PDF p.12.
  • finitePhases: Equation (30), actual roots of unity, PDF p.13.
  • unitPhases: Elements of R_n of complex modulus one, PDF p.13.
  • equalityFraction: f_N, PDF pp.13-14. N is cast before division. All uses have N positive even.
  • SmallParameter: Exactly the five parameters of Section 7 Parts 2-3, PDF pp.19-23.
  • twoPrime: The unique prime above 2 on the five parameters, PDF p.19. Intersection of all primes containing 2 specifies it without choosing a prime or assuming the source's uniqueness result as an input. Outside those parameters no theorem uses this helper.
  • integralValuation: Exponent of the prime ideal in an integral principal ideal, Definition 7.2, PDF p.19. emultiplicity uses ideal multiplication, not element divisibility.
  • extendedOrder: Extended embedding that preserves infinity, PDF p.19.
  • primeValuation: Additive ideal-normalized valuation on R_n, Definition 7.2, PDF p.19. A least dyadic denominator clears z, then its contribution to the valuation is subtracted. Both integral valuations are finite for nonzero arguments on the five parameters. Zero stays +infinity. The off-ring value is -infinity and is never used by the source statements.
  • columnComplexity: mu(x,y)=-min(v_p(x),v_p(y)), Definition 7.3, PDF p.20. Normalized pairs have finite complexity even when one coordinate is zero.
  • smallComplexity: mu_n=v_p(1+i), PDF p.20.
  • IsBinaryRepresentative: Literal binary integral-basis representative of Z[zeta_(2n)] mod 2, PDF pp.21-22. It is an actual complex number, not an abstract residue class.
  • NormSumEven: Mod 2 of the whole squared-modulus sum is zero, Lemma 7.5, PDF p.22.
  • reducedColumn: The constructed pair (c_k,d_k), with order H0*Uz essential, PDF p.22.
Definition code
import Definitions.Def_QAlgorithms_Defs_Gates
import Definitions.Def_QAlgorithms_Defs_QubitBlochMaps

/-!
Statement targets from Forest--Gosset--Kliuchnikov--McKinnon,
arXiv:1501.04944v2. Two encoding-level algorithm targets are explicitly deferred.
The frozen ordered Pauli basis is imported from QAlgorithms.Defs.QubitBlochMaps.
Paper-specific names distinguish concepts from unrelated frozen short names.
The Bloch map uses the homomorphic trace convention required by the source proof;
this transposes printed equation (9) and the printed elementary rotations.
Compilation and independent moderation are pending the batch handoff.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Intakenext100.P03

open scoped BigOperators Classical

-- Reuse the Mathlib matrix type without declaring a second Mat.
local notation "Mat" => Matrix Bool Bool ℂ

abbrev BlochMat := Matrix (Fin 3) (Fin 3) ℝ

/-- The paper's H0, including its absolute phase, equation (2), PDF p.4. -/
def hZero : Mat :=
  fun a b => if a && b then -(1 + Complex.I) / 2 else (1 + Complex.I) / 2

/-- Exactly <H0,S>, using each generator and its adjoint, PDF p.4.
The monoid closure is the group generated by these unitary matrices. -/
def cliffordGroup : Submonoid Mat :=
  Submonoid.closure ({hZero, QAlgorithms.phaseS, star hZero,
    star QAlgorithms.phaseS} : Set Mat)

/-- Uz(theta)=diag(1,exp(i theta)), equation (4), PDF p.4. -/
def cyclotomicZRotation (theta : ℝ) : Mat :=
  Matrix.diagonal fun b => if b then Complex.exp (Complex.I * (theta : ℂ)) else 1

/-- The root zeta_m=exp(2 pi i/m), PDF p.4; only positive m occurs in results. -/
def cyclotomicRoot (m : ℕ) : ℂ := Complex.exp (2 * Real.pi * Complex.I / (m : ℂ))

/-- R_n as an actual subring of C, PDF p.4. -/
def cyclotomicSynthesisRing (n : ℕ) : Subring ℂ :=
  Subring.closure ({cyclotomicRoot (2 * n), (2 : ℂ)⁻¹} : Set ℂ)

/-- Z[zeta_(2n)], PDF pp.19,21. -/
def integerRing (n : ℕ) : Subring ℂ :=
  Subring.closure ({cyclotomicRoot (2 * n)} : Set ℂ)

/-- G_n=<C,Uz(pi/n)>, equation (3), PDF p.4. Adjoint generators implement inverses. -/
def cyclotomicGroup (n : ℕ) : Submonoid Mat :=
  Submonoid.closure ((cliffordGroup : Set Mat) ∪
    {cyclotomicZRotation (Real.pi / n), star (cyclotomicZRotation (Real.pi / n))})

/-- Actual U_2(R_n), with no quotient by scalar phase, PDF pp.3,12. -/
def ringUnitaries (n : ℕ) : Set Mat :=
  {U | U ∈ Matrix.unitaryGroup Bool ℂ ∧ ∀ i j, U i j ∈ cyclotomicSynthesisRing n}

-- Ordered X,Y,Z coordinates (PDF p.4) reuse frozen QubitChannels.sigma.

/-- Positive-axis rotations, equation before (6), PDF p.5. -/
def positiveAxisRotation (p : Fin 3) (theta : ℝ) : Mat :=
  ((1 + Complex.exp (Complex.I * (theta : ℂ))) / 2) • (1 : Mat) +
    ((1 - Complex.exp (Complex.I * (theta : ℂ))) / 2) • QAlgorithms.QubitChannels.sigma p

/-- Homomorphic Bloch representation. Printed (9) has transposed indices;
changed to Re tr(P_i U P_j U†)/2 because pp.11,17 use left cancellation and
row patterns. This source correction requires independent moderation. -/
def homomorphicBloch (U : Mat) : BlochMat :=
  fun i j => (Matrix.trace (QAlgorithms.QubitChannels.sigma i * U * QAlgorithms.QubitChannels.sigma j * star U)).re / 2

/-- Image of the specifically generated Clifford group, PDF p.6. -/
def blochCliffords : Set BlochMat := {M | ∃ C ∈ cliffordGroup, homomorphicBloch C = M}

/-- Equality up to a single global phase, PDF p.5. -/
def PhaseEquivalent (U V : Mat) : Prop :=
  ∃ phi : ℝ, U = Complex.exp (Complex.I * (phi : ℂ)) • V

/-- Gate words for Definition 2.1, PDF p.5. A rotation letter has positive unit
cost; any member of the source's precise Clifford group has cost zero. -/
inductive SynthesisLetter where
  | clifford : {C : Mat // C ∈ cliffordGroup} → SynthesisLetter
  | rotation : SynthesisLetter

/-- A word is multiplied in the source's printed left-to-right order, PDF p.5. -/
def synthesisWordMatrix (n : ℕ) (w : List SynthesisLetter) : Mat :=
  (w.map fun g => match g with
    | .clifford C => C.val
    | .rotation => cyclotomicZRotation (Real.pi / n)).prod

/-- Actual number of elementary Uz(pi/n) occurrences, PDF p.5. -/
def synthesisWordCost (w : List SynthesisLetter) : ℕ :=
  (w.map fun g => match g with
    | .clifford _ => 0
    | .rotation => 1).sum

/-- T_n(U), the least achievable word cost modulo global phase, PDF p.5.
The fallback 0 is off-domain only: all uses below assume U in G_n, where a
positive-letter word exists (inverse rotations have finite order 2n). -/
def minimumRotationCost (n : ℕ) (U : Mat) : ℕ :=
  if h : ∃ c : ℕ, ∃ w : List SynthesisLetter,
      synthesisWordCost w = c ∧ PhaseEquivalent U (synthesisWordMatrix n w)
  then Nat.find h else 0

/-- Canonical data: the axis/exponent list and the actual residual matrix D,
not a nonunique phase/Clifford witness pair, PDF pp.6-7. -/
local notation "CanonicalData" => List (Fin 3 × ℕ) × Matrix Bool Bool ℂ

/-- Product of canonical rotations in printed order, equation (14), PDF p.7. -/
def canonicalProduct (n : ℕ) (d : CanonicalData) : Mat :=
  (d.1.map fun pa => positiveAxisRotation pa.1 (pa.2 * Real.pi / n)).prod

/-- Precisely the canonical-form constraints; optimality is not a premise,
Lemma 3.1, PDF p.7. The empty list is allowed. -/
def IsCyclotomicCanonical (n : ℕ) (U : Mat) (d : CanonicalData) : Prop :=
  (∀ pa ∈ d.1, 1 ≤ pa.2 ∧ pa.2 < n / 2) ∧
  (∀ i : ℕ, ∀ x y : Fin 3 × ℕ,
    d.1[i]? = some x → d.1[i + 1]? = some y → x.1 ≠ y.1) ∧
  (∃ phi : ℝ, Complex.exp (Complex.I * (phi : ℂ)) • d.2 ∈ cliffordGroup) ∧
  U = canonicalProduct n d * d.2

/-- The canonical non-Clifford cost, equation (24), PDF p.10. -/
def canonicalCost (n : ℕ) (d : CanonicalData) : ℕ :=
  (d.1.map fun pa => min pa.2 (n / 2 - pa.2)).sum

/-- Power-of-two test, equations (23),(32), PDF pp.10,15. -/
def IsTwoPower (d : ℕ) : Prop := ∃ j : ℕ, d = 2 ^ j

/-- q_a, equation (23), PDF p.10, verified in the PDF. The quotient is
n/gcd(a,n). For valid a and n=2^k s, a power-of-two quotient has 2<=j<=k,
so both natural subtractions here agree with integer subtraction. -/
def denominatorWeight (n k a : ℕ) : ℕ :=
  if IsTwoPower (n / Nat.gcd a n) then
    2 ^ (k - 1) - 2 ^ (k - Nat.log 2 (n / Nat.gcd a n))
  else 2 ^ (k - 1)

/-- beta, equation (23), PDF p.10; k is positive in every use. -/
def denominatorBeta (k : ℕ) : ℂ :=
  if k = 1 then 2 else ((2 * Real.cos (Real.pi / (2 : ℝ) ^ k) : ℝ) : ℂ)

/-- alpha=2^(2^(1-k))=2^(1/2^(k-1)), PDF p.15; no natural negative power. -/
def denominatorAlpha (k : ℕ) : ℂ := ((2 : ℝ) ^ (1 / (2 : ℝ) ^ (k - 1)) : ℝ)

/-- c_a, equivalently equation (33), PDF p.15. This is exactly the piecewise
normalization (32), with exponent 1-2^(1-j) in its power-of-two branch. -/
def cosineNumerator (n k a : ℕ) : ℂ :=
  denominatorAlpha k ^ denominatorWeight n k a * (Real.cos (Real.pi * a / n) : ℂ)

/-- s_a with the same normalization, equations (32),(33), PDF p.15. -/
def sineNumerator (n k a : ℕ) : ℂ :=
  denominatorAlpha k ^ denominatorWeight n k a * (Real.sin (Real.pi * a / n) : ℂ)

/-- Frac(R_n intersect R), realized inside C, PDF pp.10,18. The smallest
subfield containing the real subring is its fraction field. -/
def realCyclotomicField (n : ℕ) : Subfield ℂ :=
  Subfield.closure {z | z ∈ cyclotomicSynthesisRing n ∧ z.im = 0}

/-- The larger field K=Q({c_a,s_a},alpha), PDF p.15. -/
def numeratorField (n k : ℕ) : Subfield ℂ :=
  Subfield.closure {z | z = denominatorAlpha k ∨ ∃ a : ℕ, 1 ≤ a ∧ a < n / 2 ∧
    (z = cosineNumerator n k a ∨ z = sineNumerator n k a)}

/-- Algebraic integrality in the named field, Appendix A, PDF pp.28-29. -/
def InIntegers (F : Subfield ℂ) (z : ℂ) : Prop := z ∈ F ∧ IsIntegral ℤ z

/-- Divisibility requires nonzero divisor and integral quotient in F,
Definition A.2, PDF pp.9,28. This is not divisibility in C. -/
def IntegerDivides (F : Subfield ℂ) (b w : ℂ) : Prop :=
  InIntegers F b ∧ InIntegers F w ∧ b ≠ 0 ∧
    ∃ q : ℂ, InIntegers F q ∧ w = b * q

/-- Principal-ideal coprimality, expressed by the equivalent Bezout identity
in O_F, Definition A.5, PDF p.29. -/
def IntegerCoprime (F : Subfield ℂ) (w b : ℂ) : Prop :=
  InIntegers F w ∧ InIntegers F b ∧ ∃ u v : ℂ,
    InIntegers F u ∧ InIntegers F v ∧ u * w + v * b = 1

/-- Unit in O_F, rather than a nonzero element of C, PDF p.15. -/
def IntegerUnit (F : Subfield ℂ) (w : ℂ) : Prop :=
  InIntegers F w ∧ ∃ v : ℂ, InIntegers F v ∧ w * v = 1

/-- A nonzero entry and a beta/alpha-reduced numerator, PDF pp.10,16. -/
def ReducedDenominator (F : Subfield ℂ) (b : ℂ) (z : ℝ) (r : ℕ) : Prop :=
  z ≠ 0 ∧ ∃ w : ℂ, InIntegers F w ∧ ¬ IntegerDivides F b w ∧
    (z : ℂ) = w / b ^ r

/-- Row contains an entry with reduced exponent r, PDF p.10. -/
def RowHasExponent (F : Subfield ℂ) (b : ℂ) (M : BlochMat)
    (i : Fin 3) (r : ℕ) : Prop := ∃ j, ReducedDenominator F b (M i j) r

/-- Row contains an entry whose normalized numerator is coprime to the base,
PDF pp.10,17. Zero entries are explicitly excluded. -/
def RowHasCoprime (F : Subfield ℂ) (b : ℂ) (M : BlochMat)
    (i : Fin 3) (r : ℕ) : Prop :=
  ∃ j : Fin 3, M i j ≠ 0 ∧ ∃ w : ℂ, IntegerCoprime F w b ∧
    (M i j : ℂ) = w / b ^ r

/-- All three clauses of Theorems 4.1 and 6.3, PDF pp.10,16-17.
Every comparison ranges over reduced nonzero entries. Row coprimality and
attainment of both maxima are retained, not just a row upper bound. -/
def DenominatorPattern (F : Subfield ℂ) (b : ℂ) (M : BlochMat)
    (N q : ℕ) (p : Fin 3) : Prop :=
  (∀ i j, M i j ≠ 0 → ∃ r, ReducedDenominator F b (M i j) r) ∧
  (∀ i j r, ReducedDenominator F b (M i j) r → r ≤ N) ∧
  (∃ i, RowHasExponent F b M i N) ∧
  ({i : Fin 3 | RowHasCoprime F b M i N} : Set (Fin 3)).ncard = 2 ∧
  (∃! i : Fin 3, ¬ RowHasExponent F b M i N) ∧
  (∀ i : Fin 3, ¬ RowHasExponent F b M i N →
    (∀ j r, ReducedDenominator F b (M i j) r → r ≤ N - q) ∧
    RowHasExponent F b M i (N - q) ∧ RowHasCoprime F b M i (N - q) ∧ i = p)

/-- N=sum q_ai, PDF p.10. -/
def canonicalTotalWeight (n k : ℕ) (d : CanonicalData) : ℕ :=
  (d.1.map fun pa => denominatorWeight n k pa.2).sum

/-- Positive t with 2^t=-1 modulo the odd part s; add 1 avoids natural
negative integers. For s=1 this is true, as required, PDF p.13. -/
def MinusOneIsTwoPower (s : ℕ) : Prop :=
  ∃ t : ℕ, 0 < t ∧ Nat.ModEq s (2 ^ t + 1) 0

/-- Actual z-rotations inside a matrix group, PDF p.12. -/
def zRotationsIn (G : Set Mat) : Set Mat :=
  {U | U ∈ G ∧ ∃ theta : ℝ, U = cyclotomicZRotation theta}

/-- Equation (27), with endpoint represented by Fin(2n), PDF p.12. -/
def finiteZRotations (n : ℕ) : Set Mat :=
  {U | ∃ j : Fin (2 * n), U = cyclotomicZRotation (Real.pi * j.val / n)}

/-- Equation (30), actual roots of unity, PDF p.13. -/
def finitePhases (n : ℕ) : Set ℂ :=
  {z | ∃ j : Fin (2 * n), z = cyclotomicRoot (2 * n) ^ j.val}

/-- Elements of R_n of complex modulus one, PDF p.13. -/
def unitPhases (n : ℕ) : Set ℂ := {z | z ∈ cyclotomicSynthesisRing n ∧ ‖z‖ = 1}

/-- f_N, PDF pp.13-14. N is cast before division. All uses have N positive even. -/
def equalityFraction (N : ℕ) : ℝ :=
  (2 / (N : ℝ)) * (((Finset.range (N + 1)).filter fun n =>
    0 < n ∧ Even n ∧ (cyclotomicGroup n : Set Mat) = ringUnitaries n).card : ℝ)

/-- Exactly the five parameters of Section 7 Parts 2-3, PDF pp.19-23. -/
def SmallParameter (n : ℕ) : Prop := n ∈ ({2, 4, 6, 8, 12} : Finset ℕ)

/-- The unique prime above 2 on the five parameters, PDF p.19.
Intersection of all primes containing 2 specifies it without choosing a
prime or assuming the source's uniqueness result as an input. Outside those
parameters no theorem uses this helper. -/
def twoPrime (n : ℕ) : Ideal (integerRing n) :=
  sInf {p : Ideal (integerRing n) | p.IsPrime ∧ (2 : integerRing n) ∈ p}

/-- Exponent of the prime ideal in an integral principal ideal, Definition 7.2,
PDF p.19. emultiplicity uses ideal multiplication, not element divisibility. -/
def integralValuation (n : ℕ) (z : integerRing n) : ℕ∞ :=
  emultiplicity (twoPrime n) (Ideal.span ({z} : Set (integerRing n)))

/-- Extended embedding that preserves infinity, PDF p.19. -/
def extendedOrder (v : ℕ∞) : EReal :=
  if v = ⊤ then ⊤ else (v.toNat : EReal)

/-- Additive ideal-normalized valuation on R_n, Definition 7.2, PDF p.19.
A least dyadic denominator clears z, then its contribution to the valuation
is subtracted. Both integral valuations are finite for nonzero arguments
on the five parameters. Zero stays +infinity. The off-ring value is -infinity
and is never used by the source statements. -/
def primeValuation (n : ℕ) (z : ℂ) : EReal :=
  if z = 0 then ⊤
  else if h : ∃ d : ℕ, z * (2 : ℂ) ^ d ∈ integerRing n then
    extendedOrder (integralValuation n
      ⟨z * (2 : ℂ) ^ Nat.find h, Nat.find_spec h⟩) -
      (Nat.find h : EReal) * extendedOrder (integralValuation n 2)
  else ⊥

/-- mu(x,y)=-min(v_p(x),v_p(y)), Definition 7.3, PDF p.20.
Normalized pairs have finite complexity even when one coordinate is zero. -/
def columnComplexity (n : ℕ) (x y : ℂ) : EReal :=
  -min (primeValuation n x) (primeValuation n y)

/-- mu_n=v_p(1+i), PDF p.20. -/
def smallComplexity (n : ℕ) : EReal := primeValuation n (1 + Complex.I)

/-- Literal binary integral-basis representative of Z[zeta_(2n)] mod 2,
PDF pp.21-22. It is an actual complex number, not an abstract residue class. -/
def IsBinaryRepresentative (n : ℕ) (z : ℂ) : Prop :=
  ∃ a : Fin (Nat.totient (2 * n)) → Fin 2,
    z = ∑ i, ((a i).val : ℂ) * cyclotomicRoot (2 * n) ^ i.val

/-- Mod 2 of the whole squared-modulus sum is zero, Lemma 7.5, PDF p.22. -/
def NormSumEven (n : ℕ) (a b : ℂ) : Prop :=
  ∃ q : integerRing n,
    ((Complex.normSq a + Complex.normSq b : ℝ) : ℂ) = 2 * (q : ℂ)

/-- The constructed pair (c_k,d_k), with order H0*Uz essential, PDF p.22. -/
def reducedColumn (n : ℕ) (x y : ℂ) (k : ℤ) : Bool → ℂ :=
  (hZero * cyclotomicZRotation (Real.pi * (k : ℝ) / n)).mulVec (fun b => if b then y else x)

/-! Small sanity examples pin conventions and off-domain behavior. -/

example : hZero false false = (1 + Complex.I) / 2 := rfl

example : QAlgorithms.QubitChannels.sigma 0 = QAlgorithms.pauliX := by simp [QAlgorithms.QubitChannels.sigma]

example : cyclotomicZRotation 0 = 1 := by ext a b; cases a <;> cases b <;> simp [cyclotomicZRotation]

example : synthesisWordMatrix 4 [] = 1 := rfl

example : synthesisWordCost [.rotation, .rotation] = 2 := rfl

example (D : Mat) : canonicalProduct 2 ([], D) = 1 := rfl

example : canonicalCost 2 ([], (1 : Mat)) = 0 := rfl

example (n : ℕ) : (0 : ℂ) ∈ cyclotomicSynthesisRing n := (cyclotomicSynthesisRing n).zero_mem

example (n : ℕ) : primeValuation n 0 = ⊤ := by simp [primeValuation]

example : extendedOrder ⊤ = ⊤ := by simp [extendedOrder]

example : MinusOneIsTwoPower 1 := by
  exact ⟨1, by decide, by decide⟩

example (theta : ℝ) : cyclotomicZRotation theta false false = 1 := rfl

example (theta : ℝ) : cyclotomicZRotation theta false true = 0 := by simp [cyclotomicZRotation]

example : hZero ∈ cliffordGroup := Submonoid.subset_closure (by simp)

example (n : ℕ) : cyclotomicZRotation (Real.pi / n) ∈ cyclotomicGroup n :=
  Submonoid.subset_closure (Or.inr (by simp))

example (U : Mat) : PhaseEquivalent U U := by
  exact ⟨0, by simp⟩

example (n : ℕ) : synthesisWordMatrix n [.rotation, .rotation] =
    cyclotomicZRotation (Real.pi / n) * cyclotomicZRotation (Real.pi / n) := by simp [synthesisWordMatrix]

example (F : Subfield ℂ) (b : ℂ) (r : ℕ) :
    ¬ ReducedDenominator F b 0 r := by simp [ReducedDenominator]

example (F : Subfield ℂ) (b : ℂ) (i : Fin 3) (r : ℕ) :
    ¬ RowHasExponent F b (0 : BlochMat) i r := by
  simp [RowHasExponent, ReducedDenominator]

example (n : ℕ) : IsBinaryRepresentative n 0 := by
  exact ⟨fun _ => 0, by simp⟩

example (n : ℕ) : NormSumEven n 0 0 := by
  exact ⟨0, by simp⟩

example : equalityFraction 0 = 0 := by simp [equalityFraction]

end QAlgorithms.Papers.Independent.Intakenext100.P03
Source
Exact synthesis of single-qubit unitaries over Clifford-cyclotomic gate sets, arXiv:1501.04944v2, https://arxiv.org/abs/1501.04944v2
Read-back

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

QAlgorithms.Papers.Independent.Intakenext100.P03.BlochMat

BlochMat\mathrm{BlochMat}BlochMat is an abbreviation for the type of real 3×33\times33×3 matrices, with rows and columns indexed by {0,1,2}\{0,1,2\}{0,1,2}.

QAlgorithms.Papers.Independent.Intakenext100.P03.DenominatorPattern

For any subfield FFF of C\mathbb CC, complex number bbb, real 3×33\times33×3 matrix MMM, natural numbers N,qN,qN,q, and row index p∈{0,1,2}p\in\{0,1,2\}p∈{0,1,2}, let OF\mathcal O_FOF​ be the elements of FFF integral over Z\mathbb ZZ. For row and column indices i,j∈{0,1,2}i,j\in\{0,1,2\}i,j∈{0,1,2} and r∈Nr\in\mathbb Nr∈N, define the local condition

Rij(r)  ⟺  Mij≠0 ∧ ∃w∈OF,Mij=wbr ∧ ¬(b∈OF∧b≠0∧∃v∈OF, w=bv),R_{ij}(r)\iff M_{ij}\ne0\ \land\ \exists w\in\mathcal O_F,\quad M_{ij}=\frac{w}{b^r}\ \land\ \neg\bigl(b\in\mathcal O_F\land b\ne0\land \exists v\in\mathcal O_F,\ w=bv\bigr),Rij​(r)⟺Mij​=0 ∧ ∃w∈OF​,Mij​=brw​ ∧ ¬(b∈OF​∧b=0∧∃v∈OF​, w=bv),

where the equality is in C\mathbb CC; write Ei(r)E_i(r)Ei​(r) for ∃j Rij(r)\exists j\,R_{ij}(r)∃jRij​(r), and write Ci(r)C_i(r)Ci​(r) for the condition that there exist j∈{0,1,2}j\in\{0,1,2\}j∈{0,1,2} and w,u,v∈OFw,u,v\in\mathcal O_Fw,u,v∈OF​ with b∈OFb\in\mathcal O_Fb∈OF​, Mij≠0M_{ij}\ne0Mij​=0, uw+vb=1uw+vb=1uw+vb=1, and Mij=w/brM_{ij}=w/b^rMij​=w/br in C\mathbb CC. The defined predicate is the conjunction of the following requirements: every nonzero entry MijM_{ij}Mij​ satisfies Rij(r)R_{ij}(r)Rij​(r) for some natural number rrr; every rrr satisfying any Rij(r)R_{ij}(r)Rij​(r) obeys r≤Nr\le Nr≤N; at least one row satisfies Ei(N)E_i(N)Ei​(N); exactly two rows satisfy Ci(N)C_i(N)Ci​(N); exactly one row fails Ei(N)E_i(N)Ei​(N); and every row iii failing Ei(N)E_i(N)Ei​(N) has all its exponents bounded by N−qN-qN−q, satisfies both Ei(N−q)E_i(N-q)Ei​(N−q) and Ci(N−q)C_i(N-q)Ci​(N−q), and equals ppp. Here N−q=max⁡(N−q,0)N-q=\max(N-q,0)N−q=max(N−q,0) is truncated natural-number subtraction, and no hypothesis q≤Nq\le Nq≤N is imposed. Exponent zero is included, b0=1b^0=1b0=1, and division by zero is zero. The conjunction cannot hold when N=0N=0N=0 or q=0q=0q=0, since the exceptional row would then be required both to fail and to satisfy Ei(N)E_i(N)Ei​(N).

QAlgorithms.Papers.Independent.Intakenext100.P03.InIntegers

For any subfield FFF of C\mathbb CC and any z∈Cz\in\mathbb Cz∈C, this predicate means that z∈Fz\in Fz∈F and zzz is integral over Z\mathbb ZZ, meaning that zzz is a root of a monic polynomial with integer coefficients.

QAlgorithms.Papers.Independent.Intakenext100.P03.IntegerCoprime

For any subfield FFF of C\mathbb CC and any w,b∈Cw,b\in\mathbb Cw,b∈C, this predicate means that w,b∈Fw,b\in Fw,b∈F are integral over Z\mathbb ZZ and that there exist u,v∈Fu,v\in Fu,v∈F, also integral over Z\mathbb ZZ, such that

uw+vb=1.uw+vb=1.uw+vb=1.

There is no separate nonzero requirement on either www or bbb; if either is zero, the equation requires the other to have an inverse in FFF that is integral over Z\mathbb ZZ.

QAlgorithms.Papers.Independent.Intakenext100.P03.IntegerDivides

For any subfield FFF of C\mathbb CC and any b,w∈Cb,w\in\mathbb Cb,w∈C, this predicate means that bbb and www both belong to FFF and are integral over Z\mathbb ZZ, that b≠0b\ne0b=0, and that there exists q∈Fq\in Fq∈F, integral over Z\mathbb ZZ, with w=bqw=bqw=bq. Thus the predicate is false when b=0b=0b=0, including when w=0w=0w=0.

QAlgorithms.Papers.Independent.Intakenext100.P03.IntegerUnit

For any subfield FFF of C\mathbb CC and any w∈Cw\in\mathbb Cw∈C, this predicate means that w∈Fw\in Fw∈F is integral over Z\mathbb ZZ and that there exists v∈Fv\in Fv∈F, integral over Z\mathbb ZZ, satisfying wv=1wv=1wv=1. In particular, the equation excludes w=0w=0w=0.

QAlgorithms.Papers.Independent.Intakenext100.P03.IsBinaryRepresentative

For every natural number nnn and complex number zzz, being a binary representative means that there exist coefficients a0,…,aφ(2n)−1a_0,\ldots,a_{\varphi(2n)-1}a0​,…,aφ(2n)−1​, each equal to 000 or 111, such that

z=∑j=0φ(2n)−1ajζj,ζ=exp⁡ ⁣(2πi2n),z=\sum_{j=0}^{\varphi(2n)-1}a_j\zeta^j, \qquad \zeta=\exp\!\left(\frac{2\pi i}{2n}\right),z=j=0∑φ(2n)−1​aj​ζj,ζ=exp(2n2πi​),

where φ\varphiφ is Euler’s totient function and the coefficients are regarded as complex numbers in the sum. Neither uniqueness of the coefficients nor any additional restriction on zzz is required. This includes n=0n=0n=0: since φ(0)=0\varphi(0)=0φ(0)=0, the coefficient family and sum are empty, so precisely z=0z=0z=0 satisfies the condition.

QAlgorithms.Papers.Independent.Intakenext100.P03.IsCyclotomicCanonical

For every natural number nnn, complex 2×22\times22×2 matrix UUU, and datum d=(L,D)d=(L,D)d=(L,D) consisting of a finite list LLL of pairs (p,a)∈{0,1,2}×N(p,a)\in\{0,1,2\}\times\mathbb N(p,a)∈{0,1,2}×N and a complex 2×22\times22×2 matrix DDD, this predicate requires all four of the following: every pair in LLL satisfies 1≤a<⌊n/2⌋1\le a<\lfloor n/2\rfloor1≤a<⌊n/2⌋; for every natural index rrr and pairs (p,a),(p′,a′)(p,a),(p',a')(p,a),(p′,a′), if these occupy positions rrr and r+1r+1r+1 of LLL, then p≠p′p\ne p'p=p′; there exists a real ϕ\phiϕ such that eiϕDe^{i\phi}DeiϕD belongs to the multiplicative submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where H0=1+i2(111−1)H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}H0​=21+i​(11​1−1​) and S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i); and

U=(∏(p,a) in Llist order[1+eiaπ/n2I2+1−eiaπ/n2σp])D,σ0=(0110),σ1=(0−ii0),σ2=diag⁡(1,−1).U=\left(\prod_{(p,a)\text{ in }L}^{\text{list order}} \left[\frac{1+e^{ia\pi/n}}2 I_2+ \frac{1-e^{ia\pi/n}}2\sigma_p\right]\right)D, \qquad \sigma_0=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad \sigma_1=\begin{pmatrix}0&-i\\i&0\end{pmatrix},\quad \sigma_2=\operatorname{diag}(1,-1).U=​(p,a) in L∏list order​[21+eiaπ/n​I2​+21−eiaπ/n​σp​]​D,σ0​=(01​10​),σ1​=(0i​−i0​),σ2​=diag(1,−1).

The adjacency requirement applies only when both indexed entries exist. An empty list satisfies the first two requirements and makes the product the identity, so the last equality becomes U=DU=DU=D. For n=0,1,2,3n=0,1,2,3n=0,1,2,3, the exponent bounds force the list to be empty. All divisions by nnn in the displayed factors take the value zero when n=0n=0n=0.

QAlgorithms.Papers.Independent.Intakenext100.P03.IsTwoPower

For a natural number ddd, this predicate means that there exists a natural number jjj, including j=0j=0j=0, such that d=2jd=2^jd=2j. Thus 111 is included and 000 is excluded.

QAlgorithms.Papers.Independent.Intakenext100.P03.MinusOneIsTwoPower

For any natural number sss, this predicate means that there exists a natural number t>0t>0t>0 such that

2t+1≡0(mods),2^t+1\equiv 0\pmod s,2t+1≡0(mods),

equivalently, sss divides 2t+12^t+12t+1. The exponent must be strictly positive. The predicate holds for s=1s=1s=1 and fails for s=0s=0s=0, since congruence modulo zero is equality and 2t+12^t+12t+1 is positive.

QAlgorithms.Papers.Independent.Intakenext100.P03.NormSumEven

For every natural number nnn and complex numbers a,ba,ba,b, the condition means that there exists an element qqq of the smallest subring of C\mathbb CC containing ζ=exp⁡(2πi/(2n))\zeta=\exp(2\pi i/(2n))ζ=exp(2πi/(2n)) such that

∣a∣2+∣b∣2=2q|a|^2+|b|^2=2q∣a∣2+∣b∣2=2q

as an equality in C\mathbb CC, with the real quantity on the left embedded into C\mathbb CC. No separate integrality or nonzero assumptions are imposed on a,ba,ba,b. The case a=b=0a=b=0a=b=0 satisfies the condition with q=0q=0q=0. The parameter n=0n=0n=0 is included: division by zero makes ζ=1\zeta=1ζ=1, so in that case the condition says that ∣a∣2+∣b∣2|a|^2+|b|^2∣a∣2+∣b∣2 is twice an integer.

QAlgorithms.Papers.Independent.Intakenext100.P03.PhaseEquivalent

For complex 2×22\times22×2 matrices UUU and VVV, this predicate means that there exists a real number ϕ\phiϕ such that U=eiϕVU=e^{i\phi}VU=eiϕV, where the scalar multiplies every entry of VVV. Neither matrix is required to be unitary or nonzero; in particular, the zero matrix is phase equivalent to itself.

QAlgorithms.Papers.Independent.Intakenext100.P03.ReducedDenominator

For any subfield FFF of C\mathbb CC, any b∈Cb\in\mathbb Cb∈C, any real number zzz, and any natural number rrr, write OF={u∈F:u is integral over Z}\mathcal O_F=\{u\in F:u\text{ is integral over }\mathbb Z\}OF​={u∈F:u is integral over Z}. This predicate means that z≠0z\ne0z=0 and there exists w∈OFw\in\mathcal O_Fw∈OF​ such that

z=wbrin C,¬(b∈OF ∧ b≠0 ∧ ∃q∈OF, w=bq).z=\frac{w}{b^r} \quad\text{in }\mathbb C, \qquad \neg\bigl(b\in\mathcal O_F\ \land\ b\ne0\ \land\ \exists q\in\mathcal O_F,\ w=bq\bigr).z=brw​in C,¬(b∈OF​ ∧ b=0 ∧ ∃q∈OF​, w=bq).

No assumption that bbb is nonzero or integral is imposed separately. The exponent rrr may be zero, in which case b0=1b^0=1b0=1 even for b=0b=0b=0; when b=0b=0b=0 and r>0r>0r>0, division by zero gives zero, so the required nonzero zzz makes the predicate impossible.

QAlgorithms.Papers.Independent.Intakenext100.P03.RowHasCoprime

For any subfield FFF of C\mathbb CC, complex number bbb, real 3×33\times33×3 matrix MMM, row index i∈{0,1,2}i\in\{0,1,2\}i∈{0,1,2}, and natural number rrr, let OF\mathcal O_FOF​ consist of the elements of FFF integral over Z\mathbb ZZ. This predicate means that there exist a column index j∈{0,1,2}j\in\{0,1,2\}j∈{0,1,2} and w,u,v∈OFw,u,v\in\mathcal O_Fw,u,v∈OF​, with b∈OFb\in\mathcal O_Fb∈OF​, such that

Mij≠0,uw+vb=1,Mij=wbr in C.M_{ij}\ne0,\qquad uw+vb=1,\qquad M_{ij}=\frac{w}{b^r}\text{ in }\mathbb C.Mij​=0,uw+vb=1,Mij​=brw​ in C.

There is no separate requirement that bbb be nonzero. The exponent r=0r=0r=0 is allowed, including for b=0b=0b=0; if b=0b=0b=0 and r>0r>0r>0, the nonzero-entry requirement is impossible because division by zero gives zero.

QAlgorithms.Papers.Independent.Intakenext100.P03.RowHasExponent

For any subfield FFF of C\mathbb CC, complex number bbb, real 3×33\times33×3 matrix MMM, row index i∈{0,1,2}i\in\{0,1,2\}i∈{0,1,2}, and natural number rrr, let OF\mathcal O_FOF​ consist of the elements of FFF integral over Z\mathbb ZZ. This predicate means that there exist a column index j∈{0,1,2}j\in\{0,1,2\}j∈{0,1,2} and w∈OFw\in\mathcal O_Fw∈OF​ such that

Mij≠0,Mij=wbr in C,¬(b∈OF ∧ b≠0 ∧ ∃v∈OF, w=bv).M_{ij}\ne0,\qquad M_{ij}=\frac{w}{b^r}\text{ in }\mathbb C,\qquad \neg\bigl(b\in\mathcal O_F\ \land\ b\ne0\ \land\ \exists v\in\mathcal O_F,\ w=bv\bigr).Mij​=0,Mij​=brw​ in C,¬(b∈OF​ ∧ b=0 ∧ ∃v∈OF​, w=bv).

The exponent r=0r=0r=0 is allowed, with b0=1b^0=1b0=1; for b=0b=0b=0 and r>0r>0r>0, this predicate is impossible because division by zero gives zero.

QAlgorithms.Papers.Independent.Intakenext100.P03.SmallParameter

For any natural number nnn, this predicate means exactly

n∈{2,4,6,8,12}.n\in\{2,4,6,8,12\}.n∈{2,4,6,8,12}.

QAlgorithms.Papers.Independent.Intakenext100.P03.SynthesisLetter

This defines a type of letters with two forms: a Clifford letter carrying a complex 2×22\times22×2 matrix CCC belonging to the multiplicative submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where H0=1+i2(111−1)H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}H0​=21+i​(11​1−1​), S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i), and †\dagger† denotes conjugate transpose; or a rotation letter carrying no additional data. The generated submonoid consists of finite products of these generators, including the identity as the empty product.

QAlgorithms.Papers.Independent.Intakenext100.P03.blochCliffords

blochCliffords\mathrm{blochCliffords}blochCliffords is the set of real 3×33\times33×3 matrices MMM for which there exists a complex 2×22\times22×2 matrix CCC that is a finite product of H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, allowing the empty product I2I_2I2​, and satisfies

Mab=12Re⁡tr⁡(σaCσbC†)for every a,b∈{0,1,2},M_{ab}=\frac12\operatorname{Re}\operatorname{tr}(\sigma_aC\sigma_bC^\dagger) \quad\text{for every }a,b\in\{0,1,2\},Mab​=21​Retr(σa​Cσb​C†)for every a,b∈{0,1,2},

where

H0=1+i2(111−1),S=(100i),σ0=(0110),σ1=(0−ii0),σ2=(100−1).H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, \quad S=\begin{pmatrix}1&0\\0&i\end{pmatrix}, \quad \sigma_0=\begin{pmatrix}0&1\\1&0\end{pmatrix}, \quad \sigma_1=\begin{pmatrix}0&-i\\i&0\end{pmatrix}, \quad \sigma_2=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.H0​=21+i​(11​1−1​),S=(10​0i​),σ0​=(01​10​),σ1​=(0i​−i0​),σ2​=(10​0−1​).

All displayed 2×22\times22×2 matrices use Boolean order false, true, and †\dagger† denotes conjugate transpose.

QAlgorithms.Papers.Independent.Intakenext100.P03.canonicalCost

For every natural number nnn and datum d=(L,D)d=(L,D)d=(L,D), where LLL is a finite list of pairs (p,a)∈{0,1,2}×N(p,a)\in\{0,1,2\}\times\mathbb N(p,a)∈{0,1,2}×N and DDD is a complex 2×22\times22×2 matrix, this defines

∑(p,a) in Lmin⁡ ⁣(a,max⁡ ⁣(⌊n/2⌋−a,0)).\sum_{(p,a)\text{ in }L}\min\!\left(a,\max\!\left(\lfloor n/2\rfloor-a,0\right)\right).(p,a) in L∑​min(a,max(⌊n/2⌋−a,0)).

The axis ppp and matrix DDD do not affect the value. No canonicality assumption or exponent bounds are required. The empty list has cost 000, and any entry with a≥⌊n/2⌋a\ge\lfloor n/2\rfloora≥⌊n/2⌋ contributes 000, because subtraction of natural numbers is truncated at zero.

QAlgorithms.Papers.Independent.Intakenext100.P03.canonicalProduct

For every natural number nnn and datum d=(L,D)d=(L,D)d=(L,D), where LLL is a finite list of pairs (p,a)(p,a)(p,a) with p∈{0,1,2}p\in\{0,1,2\}p∈{0,1,2} and a∈Na\in\mathbb Na∈N, and DDD is a complex 2×22\times22×2 matrix, this defines the product in list order of the matrices

Rp(aπ/n)=1+eiaπ/n2I2+1−eiaπ/n2σp,σ0=(0110),σ1=(0−ii0),σ2=(100−1).R_p(a\pi/n)=\frac{1+e^{ia\pi/n}}{2}I_2+ \frac{1-e^{ia\pi/n}}{2}\sigma_p, \qquad \sigma_0=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad \sigma_1=\begin{pmatrix}0&-i\\i&0\end{pmatrix},\quad \sigma_2=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.Rp​(aπ/n)=21+eiaπ/n​I2​+21−eiaπ/n​σp​,σ0​=(01​10​),σ1​=(0i​−i0​),σ2​=(10​0−1​).

The component DDD is unused, and no bounds on the exponents or conditions on consecutive axes are imposed. The empty product is I2I_2I2​. At n=0n=0n=0, division by zero makes every angle zero and every factor I2I_2I2​.

QAlgorithms.Papers.Independent.Intakenext100.P03.canonicalTotalWeight

For any natural numbers n,kn,kn,k and any data ddd whose first component is a finite list [(p1,a1),…,(pL,aL)][(p_1,a_1),\ldots,(p_L,a_L)][(p1​,a1​),…,(pL​,aL​)] of axis indices pℓ∈{0,1,2}p_\ell\in\{0,1,2\}pℓ​∈{0,1,2} and natural numbers aℓa_\ellaℓ​, this defines

canonicalTotalWeight⁡(n,k,d)=∑ℓ=1Lw(n,k,aℓ),w(n,k,a)={2k−1−2 k−log⁡2 ⁣(n/gcd⁡(a,n)),∃j∈N, n/gcd⁡(a,n)=2j,2k−1,otherwise.\operatorname{canonicalTotalWeight}(n,k,d)=\sum_{\ell=1}^{L}w(n,k,a_\ell), \qquad w(n,k,a)= \begin{cases} 2^{k-1}-2^{\,k-\log_2\!\left(n/\gcd(a,n)\right)},& \exists j\in\mathbb N,\ n/\gcd(a,n)=2^j,\\ 2^{k-1},&\text{otherwise}. \end{cases}canonicalTotalWeight(n,k,d)=ℓ=1∑L​w(n,k,aℓ​),w(n,k,a)={2k−1−2k−log2​(n/gcd(a,n)),2k−1,​∃j∈N, n/gcd(a,n)=2j,otherwise.​

Here the quotient and logarithm are natural-number operations, with the logarithm being the integer base-two logarithm, and every subtraction is truncated at zero, including the subtraction between the two powers. Natural-number division by zero and the logarithm of zero both return zero. The power-of-two condition includes 1=201=2^01=20. No canonical-form conditions on ddd are required; the axis indices and the second component of ddd are ignored, repeated entries are counted repeatedly, and an empty list gives zero. The definition also applies when n=0n=0n=0 or k=0k=0k=0.

QAlgorithms.Papers.Independent.Intakenext100.P03.cliffordGroup

cliffordGroup\mathrm{cliffordGroup}cliffordGroup is the smallest multiplicative submonoid of complex 2×22\times22×2 matrices containing H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where Boolean indices are ordered false, true,

H0=1+i2(111−1),S=(100i),H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, \qquad S=\begin{pmatrix}1&0\\0&i\end{pmatrix},H0​=21+i​(11​1−1​),S=(10​0i​),

and †\dagger† denotes conjugate transpose. Thus its elements are exactly the finite products of these four matrices, including the empty product I2I_2I2​; the closure used here is closure under multiplication and inclusion of the identity.

QAlgorithms.Papers.Independent.Intakenext100.P03.columnComplexity

For every natural number nnn and complex numbers x,yx,yx,y, the column complexity is the extended real number

−min⁡{vn(x),vn(y)}.-\min\{v_n(x),v_n(y)\}.−min{vn​(x),vn​(y)}.

Here vnv_nvn​ is defined as follows. Put ζ=exp⁡(2πi/(2n))\zeta=\exp(2\pi i/(2n))ζ=exp(2πi/(2n)), let OnO_nOn​ be the smallest subring of C\mathbb CC containing ζ\zetaζ, and let PnP_nPn​ be the intersection of all prime ideals of OnO_nOn​ containing 222. For u∈Onu\in O_nu∈On​, take the multiplicity of PnP_nPn​ in the principal ideal (u)(u)(u), valued in N∪{∞}\mathbb N\cup\{\infty\}N∪{∞}, and regard it as an extended real number, sending infinite multiplicity to +∞+\infty+∞; denote the result by νn(u)\nu_n(u)νn​(u). Then vn(0)=+∞v_n(0)=+\inftyvn​(0)=+∞. For nonzero zzz, if there is a natural number ddd with 2dz∈On2^d z\in O_n2dz∈On​, choose the least such ddd and set vn(z)=νn(2dz)−d νn(2)v_n(z)=\nu_n(2^d z)-d\,\nu_n(2)vn​(z)=νn​(2dz)−dνn​(2), using extended real arithmetic; if no such ddd exists, set vn(z)=−∞v_n(z)=-\inftyvn​(z)=−∞. No positivity assumption on nnn or nonzero assumption on x,yx,yx,y is imposed. In particular, the complexity of (0,0)(0,0)(0,0) is −∞-\infty−∞, and it is +∞+\infty+∞ if either nonzero coordinate has no such ddd. When n=0n=0n=0, division by zero in the exponential is interpreted as zero, so ζ=1\zeta=1ζ=1 and O0O_0O0​ is the integer subring of C\mathbb CC.

QAlgorithms.Papers.Independent.Intakenext100.P03.cosineNumerator

For any natural numbers n,k,an,k,an,k,a, this defines the complex number

AkWn,k,acos⁡ ⁣(πan),Ak=2 1/2k−1,Wn,k,a={2k−1−2k−log⁡2d,if d=2j for some j∈N,2k−1,otherwise,d=ngcd⁡(a,n).A_k^{W_{n,k,a}}\cos\!\left(\frac{\pi a}{n}\right), \qquad A_k=2^{\,1/2^{k-1}}, \qquad W_{n,k,a}= \begin{cases} 2^{k-1}-2^{k-\log_2 d},&\text{if }d=2^j\text{ for some }j\in\mathbb N,\\ 2^{k-1},&\text{otherwise}, \end{cases} \quad d=\frac{n}{\gcd(a,n)}.AkWn,k,a​​cos(nπa​),Ak​=21/2k−1,Wn,k,a​={2k−1−2k−log2​d,2k−1,​if d=2j for some j∈N,otherwise,​d=gcd(a,n)n​.

Here AkA_kAk​ and the cosine are real numbers embedded in C\mathbb CC; the power defining AkA_kAk​ is a real power. The division defining ddd is natural-number division, log⁡2d\log_2 dlog2​d is the natural-number logarithm, and every subtraction in the definition of Wn,k,aW_{n,k,a}Wn,k,a​ and in k−1k-1k−1 is truncated at zero. Natural-number division by zero and log⁡20\log_2 0log2​0 are both zero. There are no positivity or range restrictions on n,k,an,k,an,k,a; in particular, when n=0n=0n=0, real division by zero makes the cosine factor 111, so the result is AkW0,k,aA_k^{W_{0,k,a}}AkW0,k,a​​.

QAlgorithms.Papers.Independent.Intakenext100.P03.cyclotomicGroup

For every natural number nnn, cyclotomicGroup(n)\mathrm{cyclotomicGroup}(n)cyclotomicGroup(n) is the smallest multiplicative submonoid of complex 2×22\times22×2 matrices containing every finite product of H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, together with ZnZ_nZn​ and Zn†Z_n^\daggerZn†​, where, in Boolean order false, true,

H0=1+i2(111−1),S=(100i),Zn=(100ei(π/n)),H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, \qquad S=\begin{pmatrix}1&0\\0&i\end{pmatrix}, \qquad Z_n=\begin{pmatrix}1&0\\0&e^{i(\pi/n)}\end{pmatrix},H0​=21+i​(11​1−1​),S=(10​0i​),Zn​=(10​0ei(π/n)​),

and †\dagger† denotes conjugate transpose. Its elements are exactly finite products of these six generators, including the empty product I2I_2I2​. Natural numbers n=0n=0n=0 are included: real division gives π/0=0\pi/0=0π/0=0, so Z0=I2Z_0=I_2Z0​=I2​ and this case is the submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†.

QAlgorithms.Papers.Independent.Intakenext100.P03.cyclotomicRoot

For every natural number mmm, including m=0m=0m=0, cyclotomicRoot(m)\mathrm{cyclotomicRoot}(m)cyclotomicRoot(m) is the complex number

exp⁡ ⁣(2πim).\exp\!\left(\frac{2\pi i}{m}\right).exp(m2πi​).

Division is the total complex division operation, so at m=0m=0m=0 the exponent is 000 and the defined value is 111.

QAlgorithms.Papers.Independent.Intakenext100.P03.cyclotomicSynthesisRing

For every natural number nnn, cyclotomicSynthesisRing(n)\mathrm{cyclotomicSynthesisRing}(n)cyclotomicSynthesisRing(n) is the smallest unital subring of C\mathbb CC containing exp⁡(2πi/(2n))\exp(2\pi i/(2n))exp(2πi/(2n)) and 1/21/21/2. Equivalently, it consists of polynomial expressions in these two complex numbers with integer coefficients. The definition includes n=0n=0n=0: since division by zero gives exp⁡(2πi/0)=1\exp(2\pi i/0)=1exp(2πi/0)=1, this case is the subring Z[1/2]\mathbb Z[1/2]Z[1/2].

QAlgorithms.Papers.Independent.Intakenext100.P03.cyclotomicZRotation

For every real θ\thetaθ, cyclotomicZRotation(θ)\mathrm{cyclotomicZRotation}(\theta)cyclotomicZRotation(θ) is the diagonal complex matrix indexed by Booleans, with diagonal entry 111 at false and eiθe^{i\theta}eiθ at true, and zero off the diagonal:

cyclotomicZRotation(θ)=(100eiθ).\mathrm{cyclotomicZRotation}(\theta)= \begin{pmatrix}1&0\\0&e^{i\theta}\end{pmatrix}.cyclotomicZRotation(θ)=(10​0eiθ​).

QAlgorithms.Papers.Independent.Intakenext100.P03.denominatorAlpha

For every natural number kkk, this defines the complex number with zero imaginary part whose real value is

αk=2 1/2max⁡(k−1,0).\alpha_k=2^{\,1/2^{\max(k-1,0)}}.αk​=21/2max(k−1,0).

The outer exponentiation is real exponentiation, while k−1k-1k−1 is natural-number subtraction truncated at zero. In particular, both k=0k=0k=0 and k=1k=1k=1 give αk=2\alpha_k=2αk​=2.

QAlgorithms.Papers.Independent.Intakenext100.P03.denominatorBeta

For every natural number kkk, this defines the complex number

βk={2,k=1,2cos⁡(π/2k),k≠1,\beta_k= \begin{cases} 2,&k=1,\\ 2\cos(\pi/2^k),&k\ne1, \end{cases}βk​={2,2cos(π/2k),​k=1,k=1,​

with the real value in the second branch regarded as a complex number with zero imaginary part. The definition includes k=0k=0k=0, for which β0=−2\beta_0=-2β0​=−2.

QAlgorithms.Papers.Independent.Intakenext100.P03.denominatorWeight

For arbitrary natural numbers n,k,an,k,an,k,a, set q=n/gcd⁡(a,n)q=n/\gcd(a,n)q=n/gcd(a,n), using natural-number division, whose value is 000 when the divisor is 000. This defines the natural number

{2 k−1−2 k−⌊log⁡2q⌋,if q=2j for some j∈N,2 k−1,otherwise,\begin{cases} 2^{\,k-1}-2^{\,k-\lfloor\log_2 q\rfloor}, &\text{if }q=2^j\text{ for some }j\in\mathbb N,\\ 2^{\,k-1},&\text{otherwise}, \end{cases}{2k−1−2k−⌊log2​q⌋,2k−1,​if q=2j for some j∈N,otherwise,​

where every subtraction, both in the exponents and between the powers, is natural-number subtraction truncated at zero, and the natural-number logarithm takes value 000 at q=0q=0q=0. No positivity assumptions are imposed. In particular, q=1q=1q=1 satisfies the first condition and gives weight 000; n=0n=0n=0 gives q=0q=0q=0 and weight 2max⁡(k−1,0)2^{\max(k-1,0)}2max(k−1,0); and at k=0k=0k=0, the weight is 000 in the first branch and 111 in the second.

QAlgorithms.Papers.Independent.Intakenext100.P03.equalityFraction

For every natural number NNN, this defines the real number

2N #{n∈N: 1≤n≤N, n is even, Gn=Un}.\frac{2}{N}\, \#\left\{n\in\mathbb N:\ 1\le n\le N,\ n\text{ is even},\ G_n=\mathcal U_n\right\}.N2​#{n∈N: 1≤n≤N, n is even, Gn​=Un​}.

Here RnR_nRn​ is the smallest subring of C\mathbb CC containing e2πi/(2n)e^{2\pi i/(2n)}e2πi/(2n) and 1/21/21/2, and Un\mathcal U_nUn​ is the set of all complex 2×22\times22×2 unitary matrices whose entries lie in RnR_nRn​. To define GnG_nGn​, put

H0=1+i2(111−1),S=(100i),Zn=(100eiπ/n).H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, \qquad S=\begin{pmatrix}1&0\\0&i\end{pmatrix}, \qquad Z_n=\begin{pmatrix}1&0\\0&e^{i\pi/n}\end{pmatrix}.H0​=21+i​(11​1−1​),S=(10​0i​),Zn​=(10​0eiπ/n​).

Let CCC be the submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where †\dagger† denotes conjugate transpose; then GnG_nGn​ is the submonoid generated by all elements of CCC together with ZnZ_nZn​ and Zn†Z_n^\daggerZn†​. Generated submonoids consist of finite products and include the empty product, the identity matrix. The counted equality is equality of the complete sets of matrices. The cardinality is converted to a real number before multiplication; when N=0N=0N=0, real division by zero gives zero and the defined value is zero.

QAlgorithms.Papers.Independent.Intakenext100.P03.extendedOrder

For any v∈N∪{∞}v\in\mathbb N\cup\{\infty\}v∈N∪{∞}, this defines an extended real number by

extendedOrder⁡(v)={+∞,v=∞,r,v=r∈N.\operatorname{extendedOrder}(v)= \begin{cases} +\infty,&v=\infty,\\ r,&v=r\in\mathbb N. \end{cases}extendedOrder(v)={+∞,r,​v=∞,v=r∈N.​

Thus finite natural values are embedded into the real numbers, and the infinite value is sent to positive infinity; the output is never negative infinity.

QAlgorithms.Papers.Independent.Intakenext100.P03.finitePhases

For any natural number nnn, this defines the set

{(e2πi/(2n))j: j∈N, 0≤j<2n}⊆C.\left\{\left(e^{2\pi i/(2n)}\right)^j:\ j\in\mathbb N,\ 0\le j<2n\right\}\subseteq\mathbb C.{(e2πi/(2n))j: j∈N, 0≤j<2n}⊆C.

When n=0n=0n=0, the index set is empty, so this set is empty, even though complex division by zero is defined to return zero and hence the expression e2πi/0e^{2\pi i/0}e2πi/0 itself equals 111.

QAlgorithms.Papers.Independent.Intakenext100.P03.finiteZRotations

For any natural number nnn, this defines the set of complex 2×22\times22×2 matrices

{(100eiπj/n): j∈N, 0≤j<2n},\left\{ \begin{pmatrix}1&0\\0&e^{i\pi j/n}\end{pmatrix} :\ j\in\mathbb N,\ 0\le j<2n \right\},{(10​0eiπj/n​): j∈N, 0≤j<2n},

with Boolean rows and columns ordered as false, true. Membership requires the existence of such an index jjj. When n=0n=0n=0, there are no eligible indices, so the set is empty.

QAlgorithms.Papers.Independent.Intakenext100.P03.hZero

hZerohZerohZero is the complex matrix indexed by Boolean row and column labels whose entry is −(1+i)/2-(1+i)/2−(1+i)/2 when both labels are true, and (1+i)/2(1+i)/2(1+i)/2 otherwise, where i2=−1i^2=-1i2=−1. In the order false, true, it is

hZero=1+i2(111−1).hZero=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}.hZero=21+i​(11​1−1​).

QAlgorithms.Papers.Independent.Intakenext100.P03.homomorphicBloch

For every complex 2×22\times22×2 matrix UUU indexed by Booleans, with no unitarity hypothesis, homomorphicBloch(U)\mathrm{homomorphicBloch}(U)homomorphicBloch(U) is the real 3×33\times33×3 matrix whose entries, for all a,b∈{0,1,2}a,b\in\{0,1,2\}a,b∈{0,1,2}, are

homomorphicBloch(U)ab=12Re⁡tr⁡(σaUσbU†),σ0=(0110),σ1=(0−ii0),σ2=(100−1).\mathrm{homomorphicBloch}(U)_{ab} =\frac12\operatorname{Re}\operatorname{tr}(\sigma_aU\sigma_bU^\dagger), \qquad \sigma_0=\begin{pmatrix}0&1\\1&0\end{pmatrix}, \quad \sigma_1=\begin{pmatrix}0&-i\\i&0\end{pmatrix}, \quad \sigma_2=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.homomorphicBloch(U)ab​=21​Retr(σa​Uσb​U†),σ0​=(01​10​),σ1​=(0i​−i0​),σ2​=(10​0−1​).

Here †\dagger† denotes conjugate transpose, and the Boolean matrix indices are ordered false, true.

QAlgorithms.Papers.Independent.Intakenext100.P03.integerRing

For every natural number nnn, integerRing(n)\mathrm{integerRing}(n)integerRing(n) is the smallest unital subring of C\mathbb CC containing exp⁡(2πi/(2n))\exp(2\pi i/(2n))exp(2πi/(2n)), equivalently the set of polynomial expressions in that number with integer coefficients. The definition includes n=0n=0n=0, when the exponential is 111 because complex division by zero is zero, and the resulting subring is Z\mathbb ZZ embedded in C\mathbb CC.

QAlgorithms.Papers.Independent.Intakenext100.P03.integralValuation

For every natural number nnn and every element zzz of the smallest subring An⊆CA_n\subseteq\mathbb CAn​⊆C containing e2πi/(2n)e^{2\pi i/(2n)}e2πi/(2n), let pn\mathfrak p_npn​ be the intersection of all prime ideals of AnA_nAn​ containing 222, with the empty intersection interpreted as the whole-ring ideal. This defines an element of N∪{∞}\mathbb N\cup\{\infty\}N∪{∞} by

integralValuation⁡(n,z)=sup⁡{r∈N: pn r∣(z)},\operatorname{integralValuation}(n,z) =\sup\{r\in\mathbb N:\ \mathfrak p_n^{\,r}\mid (z)\},integralValuation(n,z)=sup{r∈N: pnr​∣(z)},

where (z)(z)(z) is the ideal generated by zzz and divisibility is multiplication-based ideal divisibility: pn r∣(z)\mathfrak p_n^{\,r}\mid(z)pnr​∣(z) means that (z)=pn rJ(z)=\mathfrak p_n^{\,r}J(z)=pnr​J for some ideal JJJ of AnA_nAn​. The value is ∞\infty∞ if these exponents are unbounded; in particular, z=0z=0z=0 gives ∞\infty∞. No positivity assumption on nnn or nonzero assumption on zzz is required, and no primality of the intersection is assumed.

QAlgorithms.Papers.Independent.Intakenext100.P03.minimumRotationCost

For every natural number nnn and complex 2×22\times22×2 matrix UUU, this defines the least natural number ccc for which there exist a finite word containing exactly ccc rotation letters and a real number ϕ\phiϕ such that U=eiϕWU=e^{i\phi}WU=eiϕW, where WWW is the product in word order obtained by interpreting each rotation letter as diag⁡(1,eiπ/n)\operatorname{diag}(1,e^{i\pi/n})diag(1,eiπ/n) and each Clifford letter as its carried matrix. The allowed carried matrices form the multiplicative submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, with H0=1+i2(111−1)H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}H0​=21+i​(11​1−1​) and S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i). Empty products are identities. If no such word exists, the defined value is 000; thus a value of 000 also occurs when no representation exists. There is no restriction on nnn or assumption on UUU; at n=0n=0n=0, division by zero makes every rotation factor the identity.

QAlgorithms.Papers.Independent.Intakenext100.P03.numeratorField

For any natural numbers n,kn,kn,k, this defines the smallest subfield of C\mathbb CC containing AkA_kAk​ and all the numbers

AkWn,k,acos⁡ ⁣(πan)andAkWn,k,asin⁡ ⁣(πan)(1≤a<⌊n2⌋, a∈N),A_k^{W_{n,k,a}}\cos\!\left(\frac{\pi a}{n}\right) \quad\text{and}\quad A_k^{W_{n,k,a}}\sin\!\left(\frac{\pi a}{n}\right) \qquad\left(1\le a<\left\lfloor\frac n2\right\rfloor,\ a\in\mathbb N\right),AkWn,k,a​​cos(nπa​)andAkWn,k,a​​sin(nπa​)(1≤a<⌊2n​⌋, a∈N),

where real numbers are embedded in C\mathbb CC, Ak=2 1/2k−1A_k=2^{\,1/2^{k-1}}Ak​=21/2k−1 uses real exponentiation, and, with d=n/gcd⁡(a,n)d=n/\gcd(a,n)d=n/gcd(a,n),

Wn,k,a={2k−1−2k−log⁡2d,if d=2j for some j∈N,2k−1,otherwise.W_{n,k,a}= \begin{cases} 2^{k-1}-2^{k-\log_2 d},&\text{if }d=2^j\text{ for some }j\in\mathbb N,\\ 2^{k-1},&\text{otherwise}. \end{cases}Wn,k,a​={2k−1−2k−log2​d,2k−1,​if d=2j for some j∈N,otherwise.​

The quotient defining ddd is natural-number division, log⁡2\log_2log2​ is the natural-number logarithm with log⁡20=0\log_2 0=0log2​0=0, and all natural-number subtractions are truncated at zero. Natural-number division by zero is zero. There are no restrictions on nnn or kkk; for n<4n<4n<4 there are no eligible values of aaa, so only AkA_kAk​ is required as a generator.

QAlgorithms.Papers.Independent.Intakenext100.P03.positiveAxisRotation

For every p∈{0,1,2}p\in\{0,1,2\}p∈{0,1,2} and every real θ\thetaθ, positiveAxisRotation(p,θ)\mathrm{positiveAxisRotation}(p,\theta)positiveAxisRotation(p,θ) is the complex 2×22\times22×2 matrix

1+eiθ2I2+1−eiθ2σp,σ0=(0110),σ1=(0−ii0),σ2=(100−1),\frac{1+e^{i\theta}}{2}I_2+ \frac{1-e^{i\theta}}{2}\sigma_p, \qquad \sigma_0=\begin{pmatrix}0&1\\1&0\end{pmatrix}, \quad \sigma_1=\begin{pmatrix}0&-i\\i&0\end{pmatrix}, \quad \sigma_2=\begin{pmatrix}1&0\\0&-1\end{pmatrix},21+eiθ​I2​+21−eiθ​σp​,σ0​=(01​10​),σ1​=(0i​−i0​),σ2​=(10​0−1​),

where the rows and columns of the displayed matrices are ordered false, true.

QAlgorithms.Papers.Independent.Intakenext100.P03.primeValuation

For any natural number nnn and any complex number zzz, let AnA_nAn​ be the smallest subring of C\mathbb CC containing e2πi/(2n)e^{2\pi i/(2n)}e2πi/(2n), and let pn\mathfrak p_npn​ be the intersection of all prime ideals of AnA_nAn​ containing 222, with an empty intersection equal to the whole-ring ideal. For a∈Ana\in A_na∈An​, define vn(a)v_n(a)vn​(a) as the supremum in N∪{∞}\mathbb N\cup\{\infty\}N∪{∞} of the natural numbers rrr for which (a)=pn rJ(a)=\mathfrak p_n^{\,r}J(a)=pnr​J for some ideal JJJ of AnA_nAn​. Let v^n(a)\widehat v_n(a)vn​(a) be the corresponding extended real number, sending finite natural values to those real numbers and ∞\infty∞ to +∞+\infty+∞. The declaration defines

primeValuation⁡(n,z)={+∞,z=0,v^n(z2d)−d v^n(2),z≠0 and d=min⁡{e∈N: z2e∈An} exists,−∞,z≠0 and no such d exists.\operatorname{primeValuation}(n,z)= \begin{cases} +\infty,&z=0,\\ \widehat v_n(z2^d)-d\,\widehat v_n(2), &z\ne0\text{ and }d=\min\{e\in\mathbb N:\ z2^e\in A_n\}\text{ exists},\\ -\infty,&z\ne0\text{ and no such }d\text{ exists}. \end{cases}primeValuation(n,z)=⎩⎨⎧​+∞,vn​(z2d)−dvn​(2),−∞,​z=0,z=0 and d=min{e∈N: z2e∈An​} exists,z=0 and no such d exists.​

The minimum may be zero. No finiteness assumptions on either order in the middle branch are imposed, so its arithmetic uses the total multiplication and subtraction operations on extended real numbers even when an order is infinite. The definition also includes n=0n=0n=0, where complex division by zero makes A0=ZA_0=\mathbb ZA0​=Z.

QAlgorithms.Papers.Independent.Intakenext100.P03.realCyclotomicField

For every natural number nnn, let RnR_nRn​ be the smallest subring of C\mathbb CC containing exp⁡(2πi/(2n))\exp(2\pi i/(2n))exp(2πi/(2n)) and 1/21/21/2. This defines the smallest subfield of C\mathbb CC containing every z∈Rnz\in R_nz∈Rn​ whose imaginary part is zero:

realCyclotomicField⁡(n)=the subfield generated by {z∈Rn:Im⁡z=0}.\operatorname{realCyclotomicField}(n) =\text{the subfield generated by }\{z\in R_n:\operatorname{Im}z=0\}.realCyclotomicField(n)=the subfield generated by {z∈Rn​:Imz=0}.

The parameter nnn may be zero; division by zero in C\mathbb CC is zero, so the exponential generator is then exp⁡(0)=1\exp(0)=1exp(0)=1.

QAlgorithms.Papers.Independent.Intakenext100.P03.reducedColumn

For every natural number nnn, complex numbers x,yx,yx,y, and integer kkk, the reduced column is the function on the two Boolean values whose components, ordered as false and true, are

(1+i2(x+eiπk/ny)1+i2(x−eiπk/ny)).\begin{pmatrix} \dfrac{1+i}{2}\left(x+e^{i\pi k/n}y\right)\\[2mm] \dfrac{1+i}{2}\left(x-e^{i\pi k/n}y\right) \end{pmatrix}.​21+i​(x+eiπk/ny)21+i​(x−eiπk/ny)​​.

Equivalently, it is obtained by multiplying (x,y)T(x,y)^{\mathsf T}(x,y)T first by diag⁡(1,eiπk/n)\operatorname{diag}(1,e^{i\pi k/n})diag(1,eiπk/n) and then by 1+i2(111−1)\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}21+i​(11​1−1​). There are no normalization or nonzero assumptions on the column, and kkk may be negative. When n=0n=0n=0, the angle πk/n\pi k/nπk/n is defined to be zero, so the exponential factor is 111.

QAlgorithms.Papers.Independent.Intakenext100.P03.ringUnitaries

For every natural number nnn, ringUnitaries(n)\mathrm{ringUnitaries}(n)ringUnitaries(n) is the set of complex 2×22\times22×2 matrices UUU, indexed by Booleans, such that UUU is unitary and every entry UabU_{ab}Uab​, for all Boolean row and column labels a,ba,ba,b, belongs to the smallest unital subring of C\mathbb CC containing exp⁡(2πi/(2n))\exp(2\pi i/(2n))exp(2πi/(2n)) and 1/21/21/2. Here unitarity means U†U=UU†=I2U^\dagger U=UU^\dagger=I_2U†U=UU†=I2​. The parameter n=0n=0n=0 is included; in that case the entry ring is Z[1/2]\mathbb Z[1/2]Z[1/2], since the exponential defined using division by zero is 111.

QAlgorithms.Papers.Independent.Intakenext100.P03.sineNumerator

For any natural numbers n,k,an,k,an,k,a, this defines the complex number

AkWn,k,asin⁡ ⁣(πan),Ak=2 1/2k−1,Wn,k,a={2k−1−2k−log⁡2d,if d=2j for some j∈N,2k−1,otherwise,d=ngcd⁡(a,n).A_k^{W_{n,k,a}}\sin\!\left(\frac{\pi a}{n}\right), \qquad A_k=2^{\,1/2^{k-1}}, \qquad W_{n,k,a}= \begin{cases} 2^{k-1}-2^{k-\log_2 d},&\text{if }d=2^j\text{ for some }j\in\mathbb N,\\ 2^{k-1},&\text{otherwise}, \end{cases} \quad d=\frac{n}{\gcd(a,n)}.AkWn,k,a​​sin(nπa​),Ak​=21/2k−1,Wn,k,a​={2k−1−2k−log2​d,2k−1,​if d=2j for some j∈N,otherwise,​d=gcd(a,n)n​.

Here AkA_kAk​ and the sine are real numbers embedded in C\mathbb CC; the power defining AkA_kAk​ is a real power. The division defining ddd is natural-number division, log⁡2d\log_2 dlog2​d is the natural-number logarithm, and all displayed subtractions involving natural numbers are truncated at zero. Natural-number division by zero and log⁡20\log_2 0log2​0 are both zero. No positivity or range restrictions are imposed on n,k,an,k,an,k,a; when n=0n=0n=0, real division by zero makes the sine factor zero, so the result is zero.

QAlgorithms.Papers.Independent.Intakenext100.P03.smallComplexity

For every natural number nnn, the small complexity is the extended real number vn(1+i)v_n(1+i)vn​(1+i). To define this value, put ζ=exp⁡(2πi/(2n))\zeta=\exp(2\pi i/(2n))ζ=exp(2πi/(2n)), let OnO_nOn​ be the smallest subring of C\mathbb CC containing ζ\zetaζ, and let PnP_nPn​ be the intersection of all prime ideals of OnO_nOn​ containing 222. For u∈Onu\in O_nu∈On​, let νn(u)\nu_n(u)νn​(u) be the extended real value of the multiplicity of PnP_nPn​ in the principal ideal (u)(u)(u), with infinite multiplicity represented by +∞+\infty+∞. If some natural number ddd satisfies 2d(1+i)∈On2^d(1+i)\in O_n2d(1+i)∈On​, choose the least such ddd; the small complexity is

νn ⁣(2d(1+i))−d νn(2).\nu_n\!\left(2^d(1+i)\right)-d\,\nu_n(2).νn​(2d(1+i))−dνn​(2).

If no such ddd exists, it is −∞-\infty−∞. These operations use extended real arithmetic. The definition includes n=0n=0n=0: then the exponential uses division by zero equal to zero, O0O_0O0​ is the integer subring of C\mathbb CC, and no such ddd exists, so the small complexity is −∞-\infty−∞.

QAlgorithms.Papers.Independent.Intakenext100.P03.synthesisWordCost

For every finite list www of letters, this defines its cost as the sum of 000 for each Clifford letter and 111 for each rotation letter, hence the number of rotation letters in the list. A Clifford letter carries a complex 2×22\times22×2 matrix in the multiplicative submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where H0=1+i2(111−1)H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}H0​=21+i​(11​1−1​) and S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i); a rotation letter has no payload. The empty list has cost 000.

QAlgorithms.Papers.Independent.Intakenext100.P03.synthesisWordMatrix

For every natural number nnn, including 000, and every finite list www of letters, this defines a complex 2×22\times22×2 matrix by replacing each Clifford letter by its carried matrix and each rotation letter by diag⁡(1,eiπ/n)\operatorname{diag}(1,e^{i\pi/n})diag(1,eiπ/n), then multiplying the resulting matrices in list order. A carried Clifford matrix must belong to the multiplicative submonoid generated by H0,S,H0†,S†H_0,S,H_0^\dagger,S^\daggerH0​,S,H0†​,S†, where H0=1+i2(111−1)H_0=\frac{1+i}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}H0​=21+i​(11​1−1​) and S=diag⁡(1,i)S=\operatorname{diag}(1,i)S=diag(1,i); this submonoid includes the empty product. An empty word evaluates to the identity matrix. Division by zero is defined to be zero here, so when n=0n=0n=0, every rotation letter also evaluates to the identity matrix.

QAlgorithms.Papers.Independent.Intakenext100.P03.twoPrime

For any natural number nnn, let AnA_nAn​ be the smallest subring of C\mathbb CC containing e2πi/(2n)e^{2\pi i/(2n)}e2πi/(2n). This defines the ideal

pn=⋂p a prime ideal of An2∈pp.\mathfrak p_n=\bigcap_{\substack{\mathfrak p\text{ a prime ideal of }A_n\\2\in\mathfrak p}}\mathfrak p.pn​=p a prime ideal of An​2∈p​⋂​p.

Thus it takes the infimum, under ideal inclusion, of all prime ideals containing 222; the definition imposes no additional condition that this intersection itself be prime. If the indexing collection is empty, its intersection is the whole-ring ideal. The definition includes n=0n=0n=0, for which division by zero makes the exponential generator equal to 111 and A0=ZA_0=\mathbb ZA0​=Z.

QAlgorithms.Papers.Independent.Intakenext100.P03.unitPhases

For any natural number nnn, let RnR_nRn​ be the smallest subring of C\mathbb CC containing e2πi/(2n)e^{2\pi i/(2n)}e2πi/(2n) and 1/21/21/2. This defines

{z∈Rn: ∣z∣=1}.\{z\in R_n:\ |z|=1\}.{z∈Rn​: ∣z∣=1}.

The parameter nnn need not be positive. For n=0n=0n=0, division by zero makes the exponential generator equal to 111, so R0=Z[1/2]R_0=\mathbb Z[1/2]R0​=Z[1/2] and the defined set is {−1,1}\{-1,1\}{−1,1}.

QAlgorithms.Papers.Independent.Intakenext100.P03.zRotationsIn

For any set GGG of complex 2×22\times22×2 matrices indexed by Boolean values, this defines the set

{U∈G: ∃θ∈R,U=(100eiθ)},\left\{U\in G:\ \exists\theta\in\mathbb R,\quad U=\begin{pmatrix}1&0\\0&e^{i\theta}\end{pmatrix}\right\},{U∈G: ∃θ∈R,U=(10​0eiθ​)},

where rows and columns are ordered as false, true. The angle is unrestricted and need not be unique; no assumptions on GGG are imposed.

Human review
  • Endorsed by Shuze Chen · Oct 31, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 31, 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