Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Gradient Flows for Optimisation and Quantum Control: Foundations and Applications

Definition
QAlgorithms_Papers_Independent_Advance50_P38

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

prove2quantum

The objects the formalized statements of Gradient Flows for Optimisation and Quantum Control: Foundations and Applications (arXiv:0802.4195) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • realHSPairing: Real Hilbert--Schmidt pairing (123), PDF p.22.
  • frobSq: Squared Frobenius norm, never the default matrix norm.
  • comm: The source's commutator.
  • skew: Skew-Hermitian part, including 1/2.
  • IsSpecialSkew: Special skew-Hermitian matrices include trace zero (101).
  • realTraceOverlap: Real overlap (115), for arbitrary complex A,C.
  • vInner: Inner product (176), conjugate-linear in its first argument.
  • rankOneMatrix: Rank-one operator xx dagger.
  • pureStateTransfer: Pure transfer (169); normalization is imposed only where the source does.
  • IsHSProjection: Universal property of the real orthogonal projection.
  • hsOrthogonal: Orthogonal complement for the given real pairing.
  • matrixCarrier: Ambient matrix image of a subgroup of GL(n,C).
  • matrixLieSet: Actual real Lie algebra via its one-parameter subgroups; H is closed at use.
  • basisProjection: Real orthonormal-basis expression (124).
  • skewPauli: The skew-Hermitian generators (111), not Hermitian Pauli matrices.
  • LocalQubitIndex
  • localGenerator: Generator in tensor position k, (112).
  • localAlgebra: Real local algebra (121).
  • localProjection: Formula (127), including denominator 2^n.
  • numericalRadius: Radius (100); attainment is part of the statement below.
  • ComplexCollinear: Complex collinearity means dependence, allowing either matrix to vanish.
  • lineCosSq: Squared cosine between complex lines (114), used only for nonzero A,C.
  • IsSUGradient: Gradient defined by (106) with right-trivialized metric (103), using actual derivatives along exp(t Omega)U rather than an assumed formula.
  • unitaryGradientField: Ascent field (108).
  • unitaryAscentStep: Step (109), with C dagger as fixed by (104)--(108) and Table II U1.
  • colVec: Column vectorization (172), with column coordinate first.
  • rectangularSigma: Rectangular diagonal matrix of singular values.
  • FullSVD: Full SVD with nonnegative decreasing singular values, PDF p.27.
  • svdOptimizer: Sufficient determinant-one optimizer (171).
  • cSpectralSq: Squared C-spectral norm, Corollary IV.1, PDF p.27.
  • ArrayIndex: Lexicographic array indexing (179), with factors in their stated order.
  • tensorProduct: Outer product (177).
  • tensorUnitary: Tensor product of actual SU factors (174).
  • unitTensorFactors: Unit Euclidean norm of each factor, not the Pi sup norm.
  • tensorSeed: Product of the first basis vectors, (180).
  • pureProductProjectors: Pure product states as projectors, (167).
  • centralizerAlgebra: Centralizer algebra (197), in u(N) with no trace-zero restriction.
  • centralizerMatrix: Homogeneous linear system (199), in column vectorization order.
  • IsBoundedQuadratic: Bounded quadratic form means the diagonal of a bounded symmetric real bilinear form, exactly (202), PDF p.35.
  • orbitEulerStep: Standard Euler update (156), PDF p.25.
  • IsSmoothHilbertEmbedding: A finite-dimensional manifold smoothly embedded in a real Hilbert space. The topology is the induced topology and the differential is injective. These are conditions on the actual map, not an arbitrary tangent-space label.
  • embeddedRestriction: The restriction of an ambient map through its two embeddings. Membership of the image supplies existence; embedding injectivity supplies uniqueness.
  • metricRepresentative: Metric dual representative; the fallback is used only outside the nondegenerate finite-dimensional metrics appearing in the theorems.
  • riemannianGradient: Riemannian gradient (33) constructed from the actual smooth positive metric and the manifold differential, not supplied as unrelated field data.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Gates
import Definitions.Def_QAlgorithms_Defs_Information

/-! Statements from arXiv:0802.4195v2. All added definitions are paper-local.
Orthogonality of complex matrices is real. Frobenius norms are explicit. -/

namespace QAlgorithms.Papers.Independent.Advance50.P38

open scoped BigOperators Topology Manifold ContDiff

noncomputable section

/-- Real Hilbert--Schmidt pairing (123), PDF p.22. -/
def realHSPairing {ι κ : Type*} [Fintype ι] [Fintype κ] (A B : Matrix ι κ ℂ) : ℝ :=
  (Matrix.trace (A.conjTranspose * B)).re

/-- Squared Frobenius norm, never the default matrix norm. -/
def frobSq {ι κ : Type*} [Fintype ι] [Fintype κ] (A : Matrix ι κ ℂ) : ℝ :=
  ∑ i, ∑ j, Complex.normSq (A i j)

/-- The source's commutator. -/
def comm {ι : Type*} [Fintype ι] (A B : Matrix ι ι ℂ) := A * B - B * A

/-- Skew-Hermitian part, including 1/2. -/
def skew {ι : Type*} (A : Matrix ι ι ℂ) := (2 : ℂ)⁻¹ • (A - A.conjTranspose)

/-- Special skew-Hermitian matrices include trace zero (101). -/
def IsSpecialSkew {ι : Type*} [Fintype ι] (A : Matrix ι ι ℂ) : Prop :=
  A.conjTranspose = -A ∧ Matrix.trace A = 0

/-- Real overlap (115), for arbitrary complex A,C. -/
def realTraceOverlap {ι : Type*} [Fintype ι] (A C U : Matrix ι ι ℂ) : ℝ :=
  (Matrix.trace (C.conjTranspose * (U * A * U.conjTranspose))).re

/-- Inner product (176), conjugate-linear in its first argument. -/
def vInner {ι : Type*} [Fintype ι] (x y : ι → ℂ) : ℂ := ∑ i, star (x i) * y i

/-- Rank-one operator xx dagger. -/
def rankOneMatrix {ι : Type*} (x : ι → ℂ) : Matrix ι ι ℂ :=
  QAlgorithms.pureDensity (WithLp.toLp 2 x)

/-- Pure transfer (169); normalization is imposed only where the source does. -/
def pureStateTransfer {ι : Type*} [Fintype ι] (x y : ι → ℂ) (U : Matrix ι ι ℂ) : ℝ :=
  (Matrix.trace (rankOneMatrix x * U * rankOneMatrix y * U.conjTranspose)).re

/-- Universal property of the real orthogonal projection. -/
def IsHSProjection {ι : Type*} [Fintype ι] (S : Set (Matrix ι ι ℂ))
    (g p : Matrix ι ι ℂ) : Prop := p ∈ S ∧ ∀ h ∈ S, realHSPairing (g - p) h = 0

/-- Orthogonal complement for the given real pairing. -/
def hsOrthogonal {ι : Type*} [Fintype ι] (S : Set (Matrix ι ι ℂ)) :
    Set (Matrix ι ι ℂ) := {g | ∀ h ∈ S, realHSPairing g h = 0}

/-- Ambient matrix image of a subgroup of GL(n,C). -/
def matrixCarrier {n : ℕ} (H : Subgroup ((Matrix (Fin n) (Fin n) ℂ))ˣ) : Set ((Matrix (Fin n) (Fin n) ℂ)) :=
  {A | ∃ u : ((Matrix (Fin n) (Fin n) ℂ))ˣ, u ∈ H ∧ (u : (Matrix (Fin n) (Fin n) ℂ)) = A}

/-- Actual real Lie algebra via its one-parameter subgroups; H is closed at use. -/
def matrixLieSet {n : ℕ} (H : Subgroup ((Matrix (Fin n) (Fin n) ℂ))ˣ) : Set ((Matrix (Fin n) (Fin n) ℂ)) :=
  {A | ∀ t : ℝ, NormedSpace.exp (t • A) ∈ matrixCarrier H}

/-- Real orthonormal-basis expression (124). -/
def basisProjection {n m : ℕ} (b : Fin m → (Matrix (Fin n) (Fin n) ℂ)) (g : (Matrix (Fin n) (Fin n) ℂ)) : (Matrix (Fin n) (Fin n) ℂ) :=
  ∑ j, realHSPairing (b j) g • b j

example {n : ℕ} (g : (Matrix (Fin n) (Fin n) ℂ)) : basisProjection (fun j : Fin 0 => Fin.elim0 j) g = 0 := by
  simp [basisProjection]

example {ι κ : Type*} [Fintype ι] [Fintype κ] : frobSq (0 : Matrix ι κ ℂ) = 0 := by
  simp [frobSq]

/-- The skew-Hermitian generators (111), not Hermitian Pauli matrices. -/
def skewPauli (a : Fin 3) : (Matrix (Fin 2) (Fin 2) ℂ) :=
  if a = 0 then Complex.I • (fun i j =>
    QAlgorithms.pauliX (decide (i.val = 1)) (decide (j.val = 1)))
  else if a = 1 then (-Complex.I) • (fun i j =>
    QAlgorithms.pauliY (decide (i.val = 1)) (decide (j.val = 1)))
  else Complex.I • (fun i j =>
    QAlgorithms.pauliZ (decide (i.val = 1)) (decide (j.val = 1)))

abbrev LocalQubitIndex (n : ℕ) := Fin n → Fin 2

/-- Generator in tensor position k, (112). -/
def localGenerator {n : ℕ} (k : Fin n) (a : Fin 3) : Matrix (LocalQubitIndex n) (LocalQubitIndex n) ℂ :=
  fun i j => ∏ l, if l = k then skewPauli a (i l) (j l) else if i l = j l then 1 else 0

/-- Real local algebra (121). -/
def localAlgebra (n : ℕ) : Submodule ℝ (Matrix (LocalQubitIndex n) (LocalQubitIndex n) ℂ) :=
  Submodule.span ℝ (Set.range (fun ka : Fin n × Fin 3 => localGenerator ka.1 ka.2))

/-- Formula (127), including denominator 2^n. -/
def localProjection {n : ℕ} (g : Matrix (LocalQubitIndex n) (LocalQubitIndex n) ℂ) :=
  ((2 : ℝ) ^ n)⁻¹ • ∑ k : Fin n, ∑ a : Fin 3, realHSPairing g (localGenerator k a) • localGenerator k a

example : skewPauli 1 0 1 = -1 := by
  change (-Complex.I) * (-Complex.I) = -1
  simp

example : skewPauli 0 0 1 = Complex.I := by
  change Complex.I * 1 = Complex.I
  simp

/-- Radius (100); attainment is part of the statement below. -/
def numericalRadius {n : ℕ} (A C : (Matrix (Fin n) (Fin n) ℂ)) : ℝ :=
  sSup {r | ∃ U : Matrix.specialUnitaryGroup (Fin n) ℂ,
    r = ‖Matrix.trace (C.conjTranspose * ((U : (Matrix (Fin n) (Fin n) ℂ)) * A * (U : (Matrix (Fin n) (Fin n) ℂ)).conjTranspose))‖}

/-- Complex collinearity means dependence, allowing either matrix to vanish. -/
def ComplexCollinear {n : ℕ} (A C : (Matrix (Fin n) (Fin n) ℂ)) : Prop :=
  ∃ a b : ℂ, (a ≠ 0 ∨ b ≠ 0) ∧ a • A + b • C = 0

/-- Squared cosine between complex lines (114), used only for nonzero A,C. -/
def lineCosSq {n : ℕ} (A C U : (Matrix (Fin n) (Fin n) ℂ)) : ℝ :=
  Complex.normSq (Matrix.trace (C.conjTranspose * (U * A * U.conjTranspose))) /
    (frobSq A * frobSq C)

/-- Gradient defined by (106) with right-trivialized metric (103), using
actual derivatives along exp(t Omega)U rather than an assumed formula. -/
def IsSUGradient {n : ℕ} (A C U V : (Matrix (Fin n) (Fin n) ℂ)) : Prop :=
  ∃ K : (Matrix (Fin n) (Fin n) ℂ), IsSpecialSkew K ∧ V = K * U ∧
    ∀ Omega : (Matrix (Fin n) (Fin n) ℂ), IsSpecialSkew Omega →
      HasDerivAt (fun t : ℝ => realTraceOverlap A C (NormedSpace.exp (t • Omega) * U)) (realHSPairing K Omega) 0

/-- Ascent field (108). -/
def unitaryGradientField {n : ℕ} (A C U : (Matrix (Fin n) (Fin n) ℂ)) : (Matrix (Fin n) (Fin n) ℂ) :=
  -skew (comm (U * A * U.conjTranspose) C.conjTranspose) * U

/-- Step (109), with C dagger as fixed by (104)--(108) and Table II U1. -/
def unitaryAscentStep {n : ℕ} (A C U : (Matrix (Fin n) (Fin n) ℂ)) (a : ℝ) : (Matrix (Fin n) (Fin n) ℂ) :=
  NormedSpace.exp (a • (-skew (comm (U * A * U.conjTranspose) C.conjTranspose))) * U

/-- Column vectorization (172), with column coordinate first. -/
def colVec {a b : ℕ} (X : Matrix (Fin a) (Fin b) ℂ) : Fin b × Fin a → ℂ :=
  fun ji => X ji.2 ji.1

/-- Rectangular diagonal matrix of singular values. -/
def rectangularSigma {a b : ℕ} (s : Fin (min a b) → ℝ) : Matrix (Fin a) (Fin b) ℂ :=
  fun i j => if h : i.val < min a b then
    if i.val = j.val then (s ⟨i.val, h⟩ : ℂ) else 0 else 0

/-- Full SVD with nonnegative decreasing singular values, PDF p.27. -/
structure FullSVD {a b : ℕ} (X : Matrix (Fin a) (Fin b) ℂ) where
  V : Matrix.unitaryGroup (Fin a) ℂ
  W : Matrix.unitaryGroup (Fin b) ℂ
  singularValues : Fin (min a b) → ℝ
  nonneg : ∀ i, 0 ≤ singularValues i
  sorted : Antitone singularValues
  reconstruction : X = (V : (Matrix (Fin a) (Fin a) ℂ)) * rectangularSigma singularValues * (W : (Matrix (Fin b) (Fin b) ℂ)).conjTranspose

/-- Sufficient determinant-one optimizer (171). -/
def svdOptimizer {a b : ℕ} {X Y : Matrix (Fin a) (Fin b) ℂ}
    (sx : FullSVD X) (sy : FullSVD Y) : Matrix (Fin b × Fin a) (Fin b × Fin a) ℂ :=
  Matrix.kronecker ((sx.W : (Matrix (Fin b) (Fin b) ℂ)).map star) (sx.V : (Matrix (Fin a) (Fin a) ℂ)) *
    Matrix.kronecker (sy.W : (Matrix (Fin b) (Fin b) ℂ)).transpose (sy.V : (Matrix (Fin a) (Fin a) ℂ)).conjTranspose

example : colVec (!![(1 : ℂ), 2; 3, 4]) (0, 1) = 3 := by rfl

/-- Squared C-spectral norm, Corollary IV.1, PDF p.27. -/
def cSpectralSq {a b : ℕ} (A C : Matrix (Fin a) (Fin b) ℂ) : ℝ :=
  sSup {r | ∃ V : Matrix.unitaryGroup (Fin a) ℂ,
    ∃ W : Matrix.unitaryGroup (Fin b) ℂ,
      r = Complex.normSq (Matrix.trace (C.conjTranspose * (V : (Matrix (Fin a) (Fin a) ℂ)) * A * (W : (Matrix (Fin b) (Fin b) ℂ)).conjTranspose))}

/-- Lexicographic array indexing (179), with factors in their stated order. -/
abbrev ArrayIndex {r : ℕ} (d : Fin r → ℕ) := (k : Fin r) → Fin (d k)

/-- Outer product (177). -/
def tensorProduct {r : ℕ} {d : Fin r → ℕ} (z : (k : Fin r) → Fin (d k) → ℂ) :
    ArrayIndex d → ℂ := fun i => ∏ k, z k (i k)

/-- Tensor product of actual SU factors (174). -/
def tensorUnitary {r : ℕ} {d : Fin r → ℕ}
    (U : (k : Fin r) → Matrix.specialUnitaryGroup (Fin (d k)) ℂ) :
    Matrix (ArrayIndex d) (ArrayIndex d) ℂ := fun i j => ∏ k, (U k : (Matrix (Fin (d k)) (Fin (d k)) ℂ)) (i k) (j k)

/-- Unit Euclidean norm of each factor, not the Pi sup norm. -/
def unitTensorFactors {r : ℕ} {d : Fin r → ℕ} (z : (k : Fin r) → Fin (d k) → ℂ) : Prop :=
  ∀ k, ∑ j, Complex.normSq (z k j) = 1

/-- Product of the first basis vectors, (180). -/
def tensorSeed {r : ℕ} (d : Fin r → ℕ) : ArrayIndex d → ℂ :=
  fun i => if ∀ k, (i k).val = 0 then 1 else 0

/-- Pure product states as projectors, (167). -/
def pureProductProjectors {r : ℕ} (d : Fin r → ℕ) :
    Set (Matrix (ArrayIndex d) (ArrayIndex d) ℂ) :=
  {P | ∃ z : (k : Fin r) → Fin (d k) → ℂ, unitTensorFactors z ∧ P = rankOneMatrix (tensorProduct z)}

example : tensorProduct (d := fun _ : Fin 0 => 2) (fun k => Fin.elim0 k) = fun _ => 1 := by
  funext i
  simp [tensorProduct]

/-- Centralizer algebra (197), in u(N) with no trace-zero restriction. -/
def centralizerAlgebra {n : ℕ} (E : (Matrix (Fin n) (Fin n) ℂ)) : Set ((Matrix (Fin n) (Fin n) ℂ)) :=
  {K | K.conjTranspose = -K ∧ comm K E = 0}

/-- Homogeneous linear system (199), in column vectorization order. -/
def centralizerMatrix {n : ℕ} (E : (Matrix (Fin n) (Fin n) ℂ)) :
    Matrix (Fin n × Fin n) (Fin n × Fin n) ℂ :=
  Matrix.kronecker (1 : (Matrix (Fin n) (Fin n) ℂ)) E - Matrix.kronecker E.transpose (1 : (Matrix (Fin n) (Fin n) ℂ))

/-- Bounded quadratic form means the diagonal of a bounded symmetric
real bilinear form, exactly (202), PDF p.35. -/
def IsBoundedQuadratic {H : Type*} [NormedAddCommGroup H] [NormedSpace ℝ H]
    (beta : H → ℝ) : Prop :=
  ∃ B : H →L[ℝ] H →L[ℝ] ℝ, (∀ v w, B v w = B w v) ∧ ∀ v, beta v = B v v

example {H : Type*} [NormedAddCommGroup H] [NormedSpace ℝ H] :
    IsBoundedQuadratic (fun _ : H => 0) := by
  exact ⟨0, fun _ _ => rfl, fun _ => rfl⟩

/-- Standard Euler update (156), PDF p.25. -/
def orbitEulerStep {n : ℕ} (X C : (Matrix (Fin n) (Fin n) ℂ)) (a : ℝ) : (Matrix (Fin n) (Fin n) ℂ) :=
  X + a • comm X (skew (comm X C.conjTranspose))

/-- A finite-dimensional manifold smoothly embedded in a real Hilbert space.
The topology is the induced topology and the differential is injective.
These are conditions on the actual map, not an arbitrary tangent-space label. -/
def IsSmoothHilbertEmbedding
    {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    {M : Type*} [TopologicalSpace M] [ChartedSpace E M]
    {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H]
    (i : M → H) : Prop :=
  ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, H) ∞ i ∧ Function.Injective i ∧
    (∀ s : Set M, IsOpen s ↔ ∃ t : Set H, IsOpen t ∧ s = i ⁻¹' t) ∧
    ∀ x, Function.Injective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, H) i x)

/-- The restriction of an ambient map through its two embeddings. Membership
of the image supplies existence; embedding injectivity supplies uniqueness. -/
def embeddedRestriction {M N H Hprime : Type*} (i : M → H) (j : N → Hprime)
    (F : H → Hprime) (hF : ∀ x, ∃ y, j y = F (i x)) : M → N :=
  fun x => Classical.choose (hF x)

example {M H : Type*} (i : M → H) (x : M) :
    embeddedRestriction i id id (fun x => ⟨i x, rfl⟩) x = i x := by
  exact Classical.choose_spec (show ∃ y, id y = id (i x) from ⟨i x, rfl⟩)

/-- Metric dual representative; the fallback is used only outside the
nondegenerate finite-dimensional metrics appearing in the theorems. -/
def metricRepresentative {V : Type*} [Zero V] (g : V → V → ℝ) (L : V → ℝ) : V := by
  classical
  exact if h : ∃ v, ∀ w, g v w = L w then Classical.choose h else 0

example {V : Type*} [Zero V] [Subsingleton V] (g : V → V → ℝ) (L : V → ℝ) :
    metricRepresentative g L = 0 := by
  exact Subsingleton.elim _ _

/-- Riemannian gradient (33) constructed from the actual smooth positive
metric and the manifold differential, not supplied as unrelated field data. -/
def riemannianGradient
    {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    {M : Type*} [TopologicalSpace M] [ChartedSpace E M]
    [IsManifold 𝓘(ℝ, E) ∞ M]
    (g : Bundle.ContMDiffRiemannianMetric 𝓘(ℝ, E) ∞ E
      (fun x : M => TangentSpace 𝓘(ℝ, E) x)) (f : M → ℝ) (x : M) :
    TangentSpace 𝓘(ℝ, E) x :=
  metricRepresentative (fun v w => g.inner x v w) (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, ℝ) f x)

/-- Sanity examples for the elementary local definitions. These pin zero,
empty-product, scalar-field and sign conventions; they are not theorem proofs. -/

example {n : ℕ} (A : (Matrix (Fin n) (Fin n) ℂ)) : comm A A = 0 := by
  simp [comm]

example {n : ℕ} : skew (0 : (Matrix (Fin n) (Fin n) ℂ)) = 0 := by
  simp [skew]

example {n : ℕ} : IsSpecialSkew (0 : (Matrix (Fin n) (Fin n) ℂ)) := by
  simp [IsSpecialSkew]

example {n : ℕ} (C U : (Matrix (Fin n) (Fin n) ℂ)) : realTraceOverlap 0 C U = 0 := by
  simp [realTraceOverlap]

example : vInner (fun _ : Fin 1 => (1 : ℂ)) (fun _ => 1) = 1 := by
  simp [vInner]

example : rankOneMatrix (fun _ : Fin 1 => (1 : ℂ)) 0 0 = 1 := by
  simp [rankOneMatrix, QAlgorithms.pureDensity]

example {n : ℕ} (y : Fin n → ℂ) (U : (Matrix (Fin n) (Fin n) ℂ)) : pureStateTransfer 0 y U = 0 := by
  have hzero : rankOneMatrix (0 : Fin n → ℂ) = 0 := by
    ext i j
    simp [rankOneMatrix, QAlgorithms.pureDensity]
  simp [pureStateTransfer, hzero]

example {n : ℕ} (H : Subgroup ((Matrix (Fin n) (Fin n) ℂ))ˣ) : (1 : (Matrix (Fin n) (Fin n) ℂ)) ∈ matrixCarrier H := by
  exact ⟨1, H.one_mem, rfl⟩

example {n : ℕ} : hsOrthogonal (∅ : Set ((Matrix (Fin n) (Fin n) ℂ))) = Set.univ := by
  ext x
  simp [hsOrthogonal]

example (g : Matrix (LocalQubitIndex 0) (LocalQubitIndex 0) ℂ) : localProjection g = 0 := by
  simp [localProjection]

example {a b : ℕ} : rectangularSigma (a := a) (b := b) (fun _ => 0) = 0 := by
  ext i j
  simp [rectangularSigma]

example : unitTensorFactors (d := fun _ : Fin 0 => 2) (fun k => Fin.elim0 k) := by
  intro k
  exact Fin.elim0 k

example {n : ℕ} (E : (Matrix (Fin n) (Fin n) ℂ)) : (0 : (Matrix (Fin n) (Fin n) ℂ)) ∈ centralizerAlgebra E := by
  simp [centralizerAlgebra, comm]

example {n : ℕ} (X C : (Matrix (Fin n) (Fin n) ℂ)) : orbitEulerStep X C 0 = X := by
  simp [orbitEulerStep]

end

end QAlgorithms.Papers.Independent.Advance50.P38
Source
Gradient Flows for Optimisation and Quantum Control: Foundations and Applications, arXiv:0802.4195v2, https://arxiv.org/abs/0802.4195v2
Read-back

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

QAlgorithms.Papers.Independent.Advance50.P38.ArrayIndex

For any natural number rrr and any family of natural numbers dkd_kdk​, indexed by 0≤k<r0\le k<r0≤k<r, ArrayIndex(d)\mathrm{ArrayIndex}(d)ArrayIndex(d) abbreviates the set of tuples i=(ik)k=0r−1i=(i_k)_{k=0}^{r-1}i=(ik​)k=0r−1​ with 0≤ik<dk0\le i_k<d_k0≤ik​<dk​ for every kkk. When r=0r=0r=0, this set contains exactly the empty tuple; if some dk=0d_k=0dk​=0, it is empty.

QAlgorithms.Papers.Independent.Advance50.P38.ComplexCollinear

For every natural number nnn and every pair of complex n×nn\times nn×n matrices A,CA,CA,C, this predicate means that there exist complex numbers a,ba,ba,b, at least one of which is nonzero, such that

aA+bC=0.aA+bC=0.aA+bC=0.

Either coefficient may individually be zero. In particular, the predicate holds whenever either matrix is zero, and it holds for the unique pair of empty matrices when n=0n=0n=0.

QAlgorithms.Papers.Independent.Advance50.P38.FullSVD

For any natural numbers a,ba,ba,b and complex a×ba\times ba×b matrix XXX, a value of FullSVD⁡(X)\operatorname{FullSVD}(X)FullSVD(X) consists of a unitary complex a×aa\times aa×a matrix VVV, a unitary complex b×bb\times bb×b matrix WWW, and real numbers sis_isi​ indexed by 0≤i<min⁡(a,b)0\le i<\min(a,b)0≤i<min(a,b), together with the requirements that si≥0s_i\ge0si​≥0 for every iii, that sj≤sis_j\le s_isj​≤si​ whenever i≤ji\le ji≤j, and that

X=VΣ(s)W†,Σ(s)ij={si,i=j<min⁡(a,b),0,otherwise.X=V\Sigma(s)W^\dagger, \qquad \Sigma(s)_{ij}= \begin{cases} s_i,&i=j<\min(a,b),\\ 0,&\text{otherwise}. \end{cases}X=VΣ(s)W†,Σ(s)ij​={si​,0,​i=j<min(a,b),otherwise.​

The matrices V,WV,WV,W need not have determinant 111. This declares the required data and properties, without asserting existence of such data for every XXX. Zero dimensions are allowed; then the list of sis_isi​ and its nonnegativity and ordering conditions are empty.

QAlgorithms.Papers.Independent.Advance50.P38.IsBoundedQuadratic

For any real normed vector space HHH and any function β:H→R\beta:H\to\mathbb Rβ:H→R, this property means that there exists a continuous real-linear map BBB from HHH into the space of continuous real-linear maps H→RH\to\mathbb RH→R such that

B(v,w)=B(w,v)for all v,w∈H,β(v)=B(v,v)for all v∈H.B(v,w)=B(w,v)\quad\text{for all }v,w\in H, \qquad \beta(v)=B(v,v)\quad\text{for all }v\in H.B(v,w)=B(w,v)for all v,w∈H,β(v)=B(v,v)for all v∈H.

Thus the required witness is a continuous symmetric real bilinear form whose diagonal values equal β\betaβ.

QAlgorithms.Papers.Independent.Advance50.P38.IsHSProjection

For any finite type ι\iotaι, equipped with a finite enumeration, any set SSS of complex square matrices indexed by ι\iotaι, and any two such matrices g,pg,pg,p, this predicate means

p∈Sand∀h∈S, Re⁡tr⁡ ⁣((g−p)†h)=0,p\in S \quad\text{and}\quad \forall h\in S,\ \operatorname{Re}\operatorname{tr}\!\left((g-p)^\dagger h\right)=0,p∈Sand∀h∈S, Retr((g−p)†h)=0,

where the dagger denotes conjugate transpose. The set SSS is arbitrary and need not be a subspace. If SSS is empty, the predicate is false. If ι\iotaι is empty, the orthogonality condition always holds, so the predicate reduces to p∈Sp\in Sp∈S.

QAlgorithms.Papers.Independent.Advance50.P38.IsSUGradient

For any natural number nnn, including 000, and arbitrary complex n×nn\times nn×n matrices A,C,U,VA,C,U,VA,C,U,V, the predicate IsSUGradient⁡(A,C,U,V)\operatorname{IsSUGradient}(A,C,U,V)IsSUGradient(A,C,U,V) means that there exists a complex n×nn\times nn×n matrix KKK with K†=−KK^\dagger=-KK†=−K, tr⁡K=0\operatorname{tr}K=0trK=0, and V=KUV=KUV=KU, such that for every complex n×nn\times nn×n matrix Ω\OmegaΩ satisfying Ω†=−Ω\Omega^\dagger=-\OmegaΩ†=−Ω and tr⁡Ω=0\operatorname{tr}\Omega=0trΩ=0, the real-valued function

t⟼Re⁡tr⁡ ⁣(C†(etΩU)A(etΩU)†)t\longmapsto \operatorname{Re}\operatorname{tr} \!\left(C^\dagger(e^{t\Omega}U)A(e^{t\Omega}U)^\dagger\right)t⟼Retr(C†(etΩU)A(etΩU)†)

has derivative Re⁡tr⁡(K†Ω)\operatorname{Re}\operatorname{tr}(K^\dagger\Omega)Retr(K†Ω) at t=0t=0t=0, where etΩe^{t\Omega}etΩ is the matrix exponential. The predicate itself does not require UUU to be unitary or to have determinant 111. For n=0n=0n=0, all matrices and traces are empty, and the predicate holds for the unique possible matrices.

QAlgorithms.Papers.Independent.Advance50.P38.IsSmoothHilbertEmbedding

Let EEE be a real normed vector space, let MMM be a topological space equipped with a charted-space structure modeled on EEE, let HHH be a real inner product space, and let i:M→Hi:M\to Hi:M→H be a function. This property is the conjunction of four requirements: iii is infinitely differentiable in the manifold sense using these charts and the standard chart structure on HHH; iii is injective; for every subset s⊆Ms\subseteq Ms⊆M,

s is open in M⟺∃ t⊆H,t is open in H and s=i−1(t);s\text{ is open in }M \quad\Longleftrightarrow\quad \exists\,t\subseteq H,\quad t\text{ is open in }H\ \text{and }s=i^{-1}(t);s is open in M⟺∃t⊆H,t is open in H and s=i−1(t);

and, for every x∈Mx\in Mx∈M, the manifold differential dix:TxM→Hd i_x:T_xM\to Hdix​:Tx​M→H is injective. Completeness of HHH and a separate smooth-manifold assumption on MMM are not among this definition’s hypotheses.

QAlgorithms.Papers.Independent.Advance50.P38.IsSpecialSkew

For any finite type ι\iotaι, equipped with a finite enumeration, and any complex square matrix AAA indexed by ι\iotaι, this predicate means that both

A†=−Aandtr⁡(A)=0,A^\dagger=-A \quad\text{and}\quad \operatorname{tr}(A)=0,A†=−Aandtr(A)=0,

where A†A^\daggerA† is the conjugate transpose. If ι\iotaι is empty, both conditions hold for its unique square matrix.

QAlgorithms.Papers.Independent.Advance50.P38.LocalQubitIndex

For every natural number nnn, this abbreviates the set of all functions from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to {0,1}\{0,1\}{0,1}, equivalently all length-nnn strings with entries 000 or 111. When n=0n=0n=0, this set contains exactly one element, the empty function.

QAlgorithms.Papers.Independent.Advance50.P38.basisProjection

For all natural numbers n,mn,mn,m, every indexed family b0,…,bm−1b_0,\ldots,b_{m-1}b0​,…,bm−1​ of complex n×nn\times nn×n matrices, and every complex n×nn\times nn×n matrix ggg, this defines

Bb(g)=∑j=0m−1Re⁡tr⁡(bj∗g) bj,B_b(g)=\sum_{j=0}^{m-1}\operatorname{Re}\operatorname{tr}(b_j^{*}g)\,b_j,Bb​(g)=j=0∑m−1​Retr(bj∗​g)bj​,

where X∗X^{*}X∗ denotes conjugate transpose and each coefficient acts by real scalar multiplication. No independence, spanning, or orthonormality condition on bbb is required. When m=0m=0m=0, the sum is the zero matrix; n=0n=0n=0 is also allowed.

QAlgorithms.Papers.Independent.Advance50.P38.cSpectralSq

For any natural numbers a,ba,ba,b, including zero, and arbitrary complex a×ba\times ba×b matrices A,CA,CA,C, define

cSpectralSq⁡(A,C)=sup⁡{∣tr⁡(C†VAW†)∣2:V†V=VV†=Ia, W†W=WW†=Ib},\operatorname{cSpectralSq}(A,C) = \sup\left\{ \left|\operatorname{tr}(C^\dagger VAW^\dagger)\right|^2: V^\dagger V=VV^\dagger=I_a,\ W^\dagger W=WW^\dagger=I_b \right\},cSpectralSq(A,C)=sup{​tr(C†VAW†)​2:V†V=VV†=Ia​, W†W=WW†=Ib​},

where VVV ranges over complex a×aa\times aa×a unitary matrices and WWW over complex b×bb\times bb×b unitary matrices, without determinant restrictions. The supremum is taken in the real numbers. No nonzero or normalization assumptions are imposed on A,CA,CA,C; if either dimension is zero, every displayed trace is zero and the defined value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.centralizerAlgebra

For any natural number nnn and any complex n×nn\times nn×n matrix EEE, the defined set consists exactly of complex n×nn\times nn×n matrices KKK such that

K∗=−KandKE−EK=0,K^*=-K \qquad\text{and}\qquad KE-EK=0,K∗=−KandKE−EK=0,

where K∗K^*K∗ denotes conjugate transpose and multiplication is ordinary matrix multiplication. No trace condition is imposed on KKK, and no additional condition is imposed on EEE. The case n=0n=0n=0 is included; in that case the unique empty matrix satisfies both conditions.

QAlgorithms.Papers.Independent.Advance50.P38.centralizerMatrix

For every natural number nnn and every complex n×nn\times nn×n matrix EEE, this defines the complex matrix indexed by pairs in {0,…,n−1}2\{0,\ldots,n-1\}^2{0,…,n−1}2 to be

In⊗E−ET⊗In,I_n\otimes E-E^{\mathsf T}\otimes I_n,In​⊗E−ET⊗In​,

where ⊗\otimes⊗ is the Kronecker product and ETE^{\mathsf T}ET is the transpose without complex conjugation. Its entry at row (p,q)(p,q)(p,q) and column (r,s)(r,s)(r,s) is δprEqs−Erpδqs\delta_{pr}E_{qs}-E_{rp}\delta_{qs}δpr​Eqs​−Erp​δqs​. The definition includes n=0n=0n=0, when the indexing set is empty.

QAlgorithms.Papers.Independent.Advance50.P38.colVec

For any natural numbers a,ba,ba,b and complex a×ba\times ba×b matrix XXX, define a complex-valued function on {0,…,b−1}×{0,…,a−1}\{0,\ldots,b-1\}\times\{0,\ldots,a-1\}{0,…,b−1}×{0,…,a−1} by

colVec⁡(X)(j,i)=Xij.\operatorname{colVec}(X)(j,i)=X_{ij}.colVec(X)(j,i)=Xij​.

Thus the function is indexed by the column index followed by the row index. If a=0a=0a=0 or b=0b=0b=0, its domain is empty.

QAlgorithms.Papers.Independent.Advance50.P38.comm

For any finite type ι\iotaι, equipped with a finite enumeration, and any complex square matrices A,BA,BA,B indexed by ι\iotaι, this defines the matrix AB−BAAB-BAAB−BA, with entries

(AB−BA)ij=∑k∈ιAikBkj−∑k∈ιBikAkj.(AB-BA)_{ij}=\sum_{k\in\iota}A_{ik}B_{kj}-\sum_{k\in\iota}B_{ik}A_{kj}.(AB−BA)ij​=k∈ι∑​Aik​Bkj​−k∈ι∑​Bik​Akj​.

The index type may be empty, in which case this is the unique empty square matrix.

QAlgorithms.Papers.Independent.Advance50.P38.embeddedRestriction

For arbitrary types M,N,H,H′M,N,H,H'M,N,H,H′ and functions i:M→Hi:M\to Hi:M→H, j:N→H′j:N\to H'j:N→H′, and F:H→H′F:H\to H'F:H→H′, suppose a witness is given that, for every x∈Mx\in Mx∈M, there exists y∈Ny\in Ny∈N such that j(y)=F(i(x))j(y)=F(i(x))j(y)=F(i(x)). This defines a function f:M→Nf:M\to Nf:M→N by using classical choice to select such a yyy for each xxx. No topology, smoothness, or injectivity is assumed, and the required yyy need not be unique; an empty domain MMM is allowed.

QAlgorithms.Papers.Independent.Advance50.P38.frobSq

For any finite types ι\iotaι and κ\kappaκ, equipped with finite enumerations, and any complex matrix AAA with rows indexed by ι\iotaι and columns indexed by κ\kappaκ, this defines

∑i∈ι∑j∈κ∣Aij∣2,\sum_{i\in\iota}\sum_{j\in\kappa}|A_{ij}|^2,i∈ι∑​j∈κ∑​∣Aij​∣2,

where ∣z∣2=(Re⁡z)2+(Im⁡z)2|z|^2=(\operatorname{Re}z)^2+(\operatorname{Im}z)^2∣z∣2=(Rez)2+(Imz)2. If either index type is empty, the value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.hsOrthogonal

For any finite type ι\iotaι, equipped with a finite enumeration, and any set SSS of complex square matrices indexed by ι\iotaι, this defines the set

{g: ∀h∈S, Re⁡tr⁡(g†h)=0},\left\{g:\ \forall h\in S,\ \operatorname{Re}\operatorname{tr}(g^\dagger h)=0\right\},{g: ∀h∈S, Retr(g†h)=0},

where ggg ranges over all complex square matrices indexed by ι\iotaι, and the dagger denotes conjugate transpose. No subspace assumption is imposed on SSS. If SSS is empty, this set contains every such matrix; if ι\iotaι is empty, it contains the unique empty square matrix for every SSS.

QAlgorithms.Papers.Independent.Advance50.P38.lineCosSq

For any natural number nnn, including 000, and arbitrary complex n×nn\times nn×n matrices A,C,UA,C,UA,C,U, define

lineCosSq⁡(A,C,U)=∣tr⁡(C†UAU†)∣2(∑i,j=0n−1∣Aij∣2)(∑i,j=0n−1∣Cij∣2),\operatorname{lineCosSq}(A,C,U) = \frac{\left|\operatorname{tr}(C^\dagger UAU^\dagger)\right|^2} {\left(\sum_{i,j=0}^{n-1}|A_{ij}|^2\right) \left(\sum_{i,j=0}^{n-1}|C_{ij}|^2\right)},lineCosSq(A,C,U)=(∑i,j=0n−1​∣Aij​∣2)(∑i,j=0n−1​∣Cij​∣2)​tr(C†UAU†)​2​,

where †\dagger† denotes conjugate transpose. There is no unitarity assumption on UUU or nonzero assumption on A,CA,CA,C. Division by zero is defined to give 000, so this value is 000 if either AAA or CCC is zero, including when n=0n=0n=0.

QAlgorithms.Papers.Independent.Advance50.P38.localAlgebra

For every natural number nnn, this defines the real linear subspace of complex matrices indexed by length-nnn strings over {0,1}\{0,1\}{0,1} consisting of all real linear combinations of the matrices Lk,aL_{k,a}Lk,a​, for 0≤k<n0\le k<n0≤k<n and a∈{0,1,2}a\in\{0,1,2\}a∈{0,1,2}, where

(Lk,a)i,j=(Sa)i(k),j(k)∏0≤ℓ<nℓ≠kδi(ℓ),j(ℓ),S0=(0ii0),S1=(0−110),S2=(i00−i).(L_{k,a})_{i,j} =(S_a)_{i(k),j(k)} \prod_{\substack{0\le \ell<n\\ \ell\ne k}}\delta_{i(\ell),j(\ell)}, \qquad S_0=\begin{pmatrix}0&\mathrm i\\ \mathrm i&0\end{pmatrix},\quad S_1=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix},\quad S_2=\begin{pmatrix}\mathrm i&0\\ 0&-\mathrm i\end{pmatrix}.(Lk,a​)i,j​=(Sa​)i(k),j(k)​0≤ℓ<nℓ=k​∏​δi(ℓ),j(ℓ)​,S0​=(0i​i0​),S1​=(01​−10​),S2​=(i0​0−i​).

Here δ\deltaδ is 111 for equal indices and 000 otherwise, and empty products equal 111. When n=0n=0n=0, the generating family is empty and this subspace is {0}\{0\}{0}.

QAlgorithms.Papers.Independent.Advance50.P38.localGenerator

For every natural number nnn, every position k∈{0,…,n−1}k\in\{0,\ldots,n-1\}k∈{0,…,n−1}, and every a∈{0,1,2}a\in\{0,1,2\}a∈{0,1,2}, this defines a complex matrix Lk,aL_{k,a}Lk,a​ whose rows and columns are indexed by strings i,j:{0,…,n−1}→{0,1}i,j:\{0,\ldots,n-1\}\to\{0,1\}i,j:{0,…,n−1}→{0,1}, with entries

(Lk,a)i,j=(Sa)i(k),j(k)∏0≤ℓ<nℓ≠kδi(ℓ),j(ℓ),S0=(0ii0),S1=(0−110),S2=(i00−i),(L_{k,a})_{i,j} =(S_a)_{i(k),j(k)} \prod_{\substack{0\le \ell<n\\ \ell\ne k}}\delta_{i(\ell),j(\ell)}, \qquad S_0=\begin{pmatrix}0&\mathrm i\\ \mathrm i&0\end{pmatrix},\quad S_1=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix},\quad S_2=\begin{pmatrix}\mathrm i&0\\ 0&-\mathrm i\end{pmatrix},(Lk,a​)i,j​=(Sa​)i(k),j(k)​0≤ℓ<nℓ=k​∏​δi(ℓ),j(ℓ)​,S0​=(0i​i0​),S1​=(01​−10​),S2​=(i0​0−i​),

where δu,v=1\delta_{u,v}=1δu,v​=1 if u=vu=vu=v and 000 otherwise, and an empty product equals 111. For n=0n=0n=0, there is no admissible position kkk.

QAlgorithms.Papers.Independent.Advance50.P38.localProjection

For every natural number nnn and every complex matrix ggg indexed by length-nnn strings over {0,1}\{0,1\}{0,1}, this defines

Pn(g)=2−n∑k=0n−1∑a=02Re⁡tr⁡(g∗Lk,a) Lk,a,P_n(g)=2^{-n}\sum_{k=0}^{n-1}\sum_{a=0}^{2} \operatorname{Re}\operatorname{tr}(g^{*}L_{k,a})\,L_{k,a},Pn​(g)=2−nk=0∑n−1​a=0∑2​Retr(g∗Lk,a​)Lk,a​,

where X∗X^{*}X∗ denotes conjugate transpose, all displayed coefficients act by real scalar multiplication, and

(Lk,a)i,j=(Sa)i(k),j(k)∏0≤ℓ<nℓ≠kδi(ℓ),j(ℓ),S0=(0ii0),S1=(0−110),S2=(i00−i).(L_{k,a})_{i,j} =(S_a)_{i(k),j(k)} \prod_{\substack{0\le \ell<n\\ \ell\ne k}}\delta_{i(\ell),j(\ell)}, \qquad S_0=\begin{pmatrix}0&\mathrm i\\ \mathrm i&0\end{pmatrix},\quad S_1=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix},\quad S_2=\begin{pmatrix}\mathrm i&0\\ 0&-\mathrm i\end{pmatrix}.(Lk,a​)i,j​=(Sa​)i(k),j(k)​0≤ℓ<nℓ=k​∏​δi(ℓ),j(ℓ)​,S0​=(0i​i0​),S1​=(01​−10​),S2​=(i0​0−i​).

Here δ\deltaδ is 111 for equal indices and 000 otherwise, and empty products equal 111. When n=0n=0n=0, the outer sum is empty and Pn(g)=0P_n(g)=0Pn​(g)=0.

QAlgorithms.Papers.Independent.Advance50.P38.matrixCarrier

For every natural number nnn, including n=0n=0n=0, and every subgroup HHH of the multiplicative group of units of the complex n×nn\times nn×n matrix ring, this defines the set

{A∈Cn×n: ∃u, u∈H and the underlying matrix of u is A}.\left\{A\in\mathbb C^{n\times n}:\ \exists u,\ u\in H\ \text{and the underlying matrix of }u\text{ is }A\right\}.{A∈Cn×n: ∃u, u∈H and the underlying matrix of u is A}.

Here a unit is a matrix equipped with a two-sided multiplicative inverse. For n=0n=0n=0, the defined set consists of the unique empty square matrix.

QAlgorithms.Papers.Independent.Advance50.P38.matrixLieSet

For every natural number nnn and subgroup HHH of the group of invertible complex n×nn\times nn×n matrices, this defines the set

LH={A∈Mn(C): ∀t∈R, ∃u∈H, the underlying matrix of u=exp⁡(tA)}.L_H=\{A\in M_n(\mathbb C):\ \forall t\in\mathbb R,\ \exists u\in H,\ \text{the underlying matrix of }u=\exp(tA)\}.LH​={A∈Mn​(C): ∀t∈R, ∃u∈H, the underlying matrix of u=exp(tA)}.

Here exp⁡\expexp is the matrix exponential and tAtAtA uses real scalar multiplication. The definition includes n=0n=0n=0, in which case the unique empty matrix belongs to this set.

QAlgorithms.Papers.Independent.Advance50.P38.metricRepresentative

For any type VVV equipped with a distinguished element 000, and any functions g:V×V→Rg:V\times V\to\mathbb Rg:V×V→R and L:V→RL:V\to\mathbb RL:V→R, this definition returns a classically chosen element v∈Vv\in Vv∈V satisfying

∀w∈V,g(v,w)=L(w)\forall w\in V,\qquad g(v,w)=L(w)∀w∈V,g(v,w)=L(w)

if such an element exists, and returns 000 if no such element exists. No vector-space structure, linearity, symmetry, positivity, continuity, or uniqueness is assumed; when several elements satisfy the equation, the definition chooses one without specifying which.

QAlgorithms.Papers.Independent.Advance50.P38.numericalRadius

For every natural number nnn and every pair of complex n×nn\times nn×n matrices A,CA,CA,C, this defines the real number

R(A,C)=sup⁡{∣tr⁡(C∗UAU∗)∣: U∈SU(n)},R(A,C)= \sup\left\{ \left|\operatorname{tr}(C^{*}UAU^{*})\right|:\ U\in\mathrm{SU}(n) \right\},R(A,C)=sup{∣tr(C∗UAU∗)∣: U∈SU(n)},

where SU(n)\mathrm{SU}(n)SU(n) consists of unitary complex n×nn\times nn×n matrices with determinant 111, X∗X^{*}X∗ denotes conjugate transpose, and the absolute value is the complex modulus. The definition includes zero matrices and n=0n=0n=0; for n=0n=0n=0, all traces in the set are 000, so the value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.orbitEulerStep

For every natural number nnn, complex n×nn\times nn×n matrices X,CX,CX,C, and real number aaa, put Y=XC∗−C∗XY=XC^*-C^*XY=XC∗−C∗X, where ∗^*∗ denotes conjugate transpose. This defines the complex n×nn\times nn×n matrix

X+a2(X(Y−Y∗)−(Y−Y∗)X).X+\frac a2\bigl(X(Y-Y^*)-(Y-Y^*)X\bigr).X+2a​(X(Y−Y∗)−(Y−Y∗)X).

There are no Hermitian, unitary, or sign assumptions on these inputs; a=0a=0a=0 is allowed, and n=0n=0n=0 gives the matrix with empty indexing set.

QAlgorithms.Papers.Independent.Advance50.P38.pureProductProjectors

For any natural number rrr and any family of natural dimensions dkd_kdk​ for 0≤k<r0\le k<r0≤k<r, let III be the set of tuples i=(ik)i=(i_k)i=(ik​) with 0≤ik<dk0\le i_k<d_k0≤ik​<dk​. The defined set consists exactly of complex matrices PPP indexed by I×II\times II×I for which there exists a family of complex vectors zk:{0,…,dk−1}→Cz_k:\{0,\ldots,d_k-1\}\to\mathbb Czk​:{0,…,dk​−1}→C satisfying

∑j=0dk−1∣zk(j)∣2=1for every k,Pii′=(∏k=0r−1zk(ik))(∏k=0r−1zk(ik′))‾.\sum_{j=0}^{d_k-1}|z_k(j)|^2=1\quad\text{for every }k, \qquad P_{ii'}= \left(\prod_{k=0}^{r-1}z_k(i_k)\right) \overline{\left(\prod_{k=0}^{r-1}z_k(i'_k)\right)}.j=0∑dk​−1​∣zk​(j)∣2=1for every k,Pii′​=(k=0∏r−1​zk​(ik​))(k=0∏r−1​zk​(ik′​))​.

For r=0r=0r=0, this set contains exactly the one-by-one matrix with entry 111. If some dk=0d_k=0dk​=0, the normalization requirement is impossible and the defined set is empty.

QAlgorithms.Papers.Independent.Advance50.P38.pureStateTransfer

For any finite type ι\iotaι, equipped with a finite enumeration, any functions x,y:ι→Cx,y:\iota\to\mathbb Cx,y:ι→C, and any complex square matrix UUU indexed by ι\iotaι, this defines

Re⁡tr⁡ ⁣(R(x) U R(y) U†),R(x)ij=xixj‾,R(y)ij=yiyj‾,\operatorname{Re}\operatorname{tr}\!\left(R(x)\,U\,R(y)\,U^\dagger\right), \qquad R(x)_{ij}=x_i\overline{x_j},\quad R(y)_{ij}=y_i\overline{y_j},Retr(R(x)UR(y)U†),R(x)ij​=xi​xj​​,R(y)ij​=yi​yj​​,

where U†U^\daggerU† is the conjugate transpose. Neither vector is required to be normalized or nonzero, and UUU is not required to be unitary. If either vector is zero, or if ι\iotaι is empty, the value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.rankOneMatrix

For any type ι\iotaι, with no finiteness assumption, and any function x:ι→Cx:\iota\to\mathbb Cx:ι→C, this defines the complex square matrix whose entries are

R(x)ij=xixj‾.R(x)_{ij}=x_i\overline{x_j}.R(x)ij​=xi​xj​​.

No normalization or nonzero condition is imposed on xxx; in particular, x=0x=0x=0 gives the zero matrix. An empty index type gives the unique empty square matrix.

QAlgorithms.Papers.Independent.Advance50.P38.realHSPairing

For any finite types ι\iotaι and κ\kappaκ, equipped with finite enumerations, and any complex matrices A,BA,BA,B with rows indexed by ι\iotaι and columns indexed by κ\kappaκ, this defines the real number

Re⁡tr⁡(A†B),\operatorname{Re}\operatorname{tr}(A^\dagger B),Retr(A†B),

where A†A^\daggerA† is the conjugate transpose of AAA. Either index type may be empty; in either case the value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.realTraceOverlap

For any finite type ι\iotaι, equipped with a finite enumeration, and any complex square matrices A,C,UA,C,UA,C,U indexed by ι\iotaι, this defines the real number

Re⁡tr⁡ ⁣(C†(UAU†)),\operatorname{Re}\operatorname{tr}\!\left(C^\dagger(UAU^\dagger)\right),Retr(C†(UAU†)),

where the dagger denotes conjugate transpose. There are no unitarity, Hermitian, or normalization assumptions on these matrices. The index type may be empty, in which case the value is 000.

QAlgorithms.Papers.Independent.Advance50.P38.rectangularSigma

For any natural numbers a,ba,ba,b and any real-valued function sss on {0,…,min⁡(a,b)−1}\{0,\ldots,\min(a,b)-1\}{0,…,min(a,b)−1}, define the complex a×ba\times ba×b matrix Σ(s)\Sigma(s)Σ(s) by

Σ(s)ij={si,i<min⁡(a,b) and i=j,0,otherwise.\Sigma(s)_{ij}= \begin{cases} s_i,& i<\min(a,b)\ \text{and}\ i=j,\\ 0,&\text{otherwise}. \end{cases}Σ(s)ij​={si​,0,​i<min(a,b) and i=j,otherwise.​

The real values sis_isi​ are regarded as complex numbers. No nonnegativity or ordering assumption on sss is imposed. If either dimension is zero, the matrix has no entries.

QAlgorithms.Papers.Independent.Advance50.P38.riemannianGradient

Let EEE be a real normed vector space, and let MMM be a topological space equipped with a charted-space structure modeled on EEE that makes it a smooth real manifold. Given a smooth Riemannian metric ggg on its tangent bundle, any function f:M→Rf:M\to\mathbb Rf:M→R, and any x∈Mx\in Mx∈M, this definition returns a classically chosen tangent vector v∈TxMv\in T_xMv∈Tx​M satisfying

∀w∈TxM,gx(v,w)=Dfx(w),\forall w\in T_xM,\qquad g_x(v,w)=D f_x(w),∀w∈Tx​M,gx​(v,w)=Dfx​(w),

if such a vector exists, and returns the zero tangent vector otherwise. Here DfxD f_xDfx​ is the manifold derivative supplied by the total derivative operation, which returns the zero linear map when fff is not differentiable at xxx. The definition imposes no smoothness or differentiability assumption on fff, and no finite-dimensionality, Hausdorffness, or second-countability assumption on MMM or its model space.

QAlgorithms.Papers.Independent.Advance50.P38.skew

For any type ι\iotaι, with no finiteness assumption, and any complex square matrix AAA indexed by ι\iotaι, this defines

12(A−A†),(12(A−A†))ij=12(Aij−Aji‾),\frac12(A-A^\dagger), \qquad \left(\frac12(A-A^\dagger)\right)_{ij} =\frac12\left(A_{ij}-\overline{A_{ji}}\right),21​(A−A†),(21​(A−A†))ij​=21​(Aij​−Aji​​),

where A†A^\daggerA† is the conjugate transpose. An empty index type is allowed and gives the unique empty square matrix.

QAlgorithms.Papers.Independent.Advance50.P38.skewPauli

For each index a∈{0,1,2}a\in\{0,1,2\}a∈{0,1,2}, this defines a complex 2×22\times22×2 matrix SaS_aSa​, with rows and columns ordered 0,10,10,1, by

S0=(0ii0),S1=(0−110),S2=(i00−i),S_0=\begin{pmatrix}0&\mathrm i\\ \mathrm i&0\end{pmatrix}, \qquad S_1=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}, \qquad S_2=\begin{pmatrix}\mathrm i&0\\ 0&-\mathrm i\end{pmatrix},S0​=(0i​i0​),S1​=(01​−10​),S2​=(i0​0−i​),

where i2=−1\mathrm i^2=-1i2=−1.

QAlgorithms.Papers.Independent.Advance50.P38.svdOptimizer

For any natural numbers a,ba,ba,b, complex a×ba\times ba×b matrices X,YX,YX,Y, and supplied decompositions X=VXΣ(sX)WX†X=V_X\Sigma(s_X)W_X^\daggerX=VX​Σ(sX​)WX†​ and Y=VYΣ(sY)WY†Y=V_Y\Sigma(s_Y)W_Y^\daggerY=VY​Σ(sY​)WY†​, where each VVV is unitary of size aaa, each WWW is unitary of size bbb, each sss is a nonnegative nonincreasing real list of length min⁡(a,b)\min(a,b)min(a,b), and Σ(s)ij=si\Sigma(s)_{ij}=s_iΣ(s)ij​=si​ when i=j<min⁡(a,b)i=j<\min(a,b)i=j<min(a,b) and is zero otherwise, define

svdOptimizer⁡(sX,sY)=(WX‾⊗VX)(WYT⊗VY†).\operatorname{svdOptimizer}(s_X,s_Y) =(\overline{W_X}\otimes V_X)(W_Y^{\mathsf T}\otimes V_Y^\dagger).svdOptimizer(sX​,sY​)=(WX​​⊗VX​)(WYT​⊗VY†​).

Here the arguments denote the complete supplied decompositions, the bar is entrywise complex conjugation, T\mathsf TT is transpose, †\dagger† is conjugate transpose, and ⊗\otimes⊗ is the Kronecker product. The result is indexed in both rows and columns by pairs (j,i)(j,i)(j,i) with 0≤j<b0\le j<b0≤j<b, 0≤i<a0\le i<a0≤i<a. No determinant-one condition is required; zero dimensions are allowed and give an empty matrix.

QAlgorithms.Papers.Independent.Advance50.P38.tensorProduct

For any natural number rrr, any family of natural dimensions dkd_kdk​ for 0≤k<r0\le k<r0≤k<r, and any family of complex vectors zk:{0,…,dk−1}→Cz_k:\{0,\ldots,d_k-1\}\to\mathbb Czk​:{0,…,dk​−1}→C, the defined tensor product is the complex vector indexed by tuples i=(ik)i=(i_k)i=(ik​) with 0≤ik<dk0\le i_k<d_k0≤ik​<dk​, whose coordinate is

(⨂k=0r−1zk)i=∏k=0r−1zk(ik).\left(\bigotimes_{k=0}^{r-1}z_k\right)_i=\prod_{k=0}^{r-1}z_k(i_k).(k=0⨂r−1​zk​)i​=k=0∏r−1​zk​(ik​).

No normalization or positivity of the dimensions is required. For r=0r=0r=0, the sole coordinate, indexed by the empty tuple, is the empty product 111; if some dimension is zero, there are no coordinates.

QAlgorithms.Papers.Independent.Advance50.P38.tensorSeed

For any natural number rrr and any family of natural dimensions dkd_kdk​ for 0≤k<r0\le k<r0≤k<r, the defined seed is the complex vector indexed by tuples i=(ik)i=(i_k)i=(ik​) with 0≤ik<dk0\le i_k<d_k0≤ik​<dk​, given by

ed(i)={1,ik=0 for every k,0,otherwise.e_d(i)= \begin{cases} 1,&i_k=0\text{ for every }k,\\ 0,&\text{otherwise}. \end{cases}ed​(i)={1,0,​ik​=0 for every k,otherwise.​

No positivity of the dimensions is assumed. When r=0r=0r=0, the condition is vacuous and the coordinate at the empty tuple is 111; if some dk=0d_k=0dk​=0, the vector has no coordinates.

QAlgorithms.Papers.Independent.Advance50.P38.tensorUnitary

For any natural number rrr, any family of natural dimensions dkd_kdk​ for 0≤k<r0\le k<r0≤k<r, and any family Uk∈SU(dk)U_k\in SU(d_k)Uk​∈SU(dk​) of complex special unitary matrices, the defined matrix is indexed in both rows and columns by tuples i=(ik)i=(i_k)i=(ik​) with 0≤ik<dk0\le i_k<d_k0≤ik​<dk​, and has entries

Uij=∏k=0r−1(Uk)ikjk.\mathcal U_{ij}=\prod_{k=0}^{r-1}(U_k)_{i_kj_k}.Uij​=k=0∏r−1​(Uk​)ik​jk​​.

Thus the definition gives the tensor product of the supplied matrices through this entry formula. Zero dimensions are allowed: if some dk=0d_k=0dk​=0, the row and column index set is empty. For r=0r=0r=0, it is a one-by-one matrix whose sole entry is the empty product 111.

QAlgorithms.Papers.Independent.Advance50.P38.unitTensorFactors

For any natural number rrr, any family of natural dimensions dkd_kdk​ for 0≤k<r0\le k<r0≤k<r, and any family of complex vectors zk:{0,…,dk−1}→Cz_k:\{0,\ldots,d_k-1\}\to\mathbb Czk​:{0,…,dk​−1}→C, the defined predicate holds exactly when

∀k∈{0,…,r−1},∑j=0dk−1∣zk(j)∣2=1.\forall k\in\{0,\ldots,r-1\},\qquad \sum_{j=0}^{d_k-1}|z_k(j)|^2=1.∀k∈{0,…,r−1},j=0∑dk​−1​∣zk​(j)∣2=1.

When r=0r=0r=0, this condition is vacuous. If any dk=0d_k=0dk​=0, the corresponding sum is 000, so the predicate cannot hold.

QAlgorithms.Papers.Independent.Advance50.P38.unitaryAscentStep

For any natural number nnn, including 000, arbitrary complex n×nn\times nn×n matrices A,C,UA,C,UA,C,U, and any real number aaa, put B=UAU†B=UAU^\daggerB=UAU† and D=BC†−C†BD=BC^\dagger-C^\dagger BD=BC†−C†B. Define

unitaryAscentStep⁡(A,C,U,a)=exp⁡ ⁣(−a2(D−D†))U,\operatorname{unitaryAscentStep}(A,C,U,a) =\exp\!\left(-\frac a2(D-D^\dagger)\right)U,unitaryAscentStep(A,C,U,a)=exp(−2a​(D−D†))U,

using the matrix exponential and conjugate transpose †\dagger†. No unitarity assumption on UUU or sign restriction on aaa is part of this definition. For n=0n=0n=0, the result is the unique empty matrix.

QAlgorithms.Papers.Independent.Advance50.P38.unitaryGradientField

For any natural number nnn, including 000, and arbitrary complex n×nn\times nn×n matrices A,C,UA,C,UA,C,U, put B=UAU†B=UAU^\daggerB=UAU† and D=BC†−C†BD=BC^\dagger-C^\dagger BD=BC†−C†B. The defined matrix is

unitaryGradientField⁡(A,C,U)=−12(D−D†)U.\operatorname{unitaryGradientField}(A,C,U) =-\frac12(D-D^\dagger)U.unitaryGradientField(A,C,U)=−21​(D−D†)U.

Here †\dagger† denotes conjugate transpose; no unitarity, trace, or nonzero assumptions are imposed on the inputs. For n=0n=0n=0, the result is the unique empty matrix.

QAlgorithms.Papers.Independent.Advance50.P38.vInner

For any finite type ι\iotaι, equipped with a finite enumeration, and any functions x,y:ι→Cx,y:\iota\to\mathbb Cx,y:ι→C, this defines the complex number

∑i∈ιxi‾ yi.\sum_{i\in\iota}\overline{x_i}\,y_i.i∈ι∑​xi​​yi​.

No normalization is required. If ι\iotaι is empty, the sum is 000.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 29, 2026

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

  • Endorsed by mikedeng1 · Nov 8, 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