Offline · exact source
Exact Lean source

MatrixFidelitySymmetry

formalization/Cloning/MatrixFidelitySymmetry.lean

Source hash: 38c978bf377779d343e3cab9250d21f11c05970e57cce28e3105bf9af176943f

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.MatrixFidelityTraceBound
2import Cloning.MatrixFidelityEmbedding
3 
4/-! # Symmetry of concrete finite-dimensional root fidelity
5 
6Invertible matrices admit an explicit polar isometry. Trace invariance under
7that isometry identifies the two square-root Gram traces. Positive-definite
8regularization then removes invertibility without changing matrix dimension.
9-/
10 
11noncomputable section
12open scoped BigOperators Matrix MatrixOrder ComplexOrder Topology
13open Matrix Filter
14 
15namespace Cloning.MatrixFidelity
16 
17set_option autoImplicit false
18set_option backward.isDefEq.respectTransparency false
19set_option maxHeartbeats 800000
20 
21variable {n : Type*} [Fintype n] [DecidableEq n]
22 
23/-- The two Gram matrices of an invertible square matrix have the same
24square-root trace, proved using its explicit polar isometry. -/
25theorem trace_sqrt_conjTranspose_mul_eq_of_isUnit
26    (X : Matrix n n ℂ) (hX : IsUnit X) :
27    (CFC.sqrt (Xᴴ * X)).trace = (CFC.sqrt (X * Xᴴ)).trace := by
28  let C := CFC.sqrt (Xᴴ * X)
29  let V := C⁻¹
30  let U := X * V
31  have hY : (Xᴴ * X).PosSemidef := Matrix.posSemidef_conjTranspose_mul_self X
32  have hXu : IsUnit Xᴴ := isUnit_star.mpr hX
33  have hCu : IsUnit C := (CFC.isUnit_sqrt_iff (Xᴴ * X) hY.nonneg).mpr (hXu.mul hX)
34  have hCd := (Matrix.isUnit_iff_isUnit_det C).mp hCu
35  have hCV : C * V = 1 := Matrix.mul_nonsing_inv C hCd
36  have hVC : V * C = 1 := Matrix.nonsing_inv_mul C hCd
37  have hCstar : Cᴴ = C := sqrt_conjTranspose (Xᴴ * X)
38  have hVstar : Vᴴ = V := by
39    dsimp [V]
40    rw [Matrix.conjTranspose_nonsing_inv, hCstar]
41  have hCC : C * C = Xᴴ * X := sqrt_mul_self hY
42  have hUstar : Uᴴ = V * Xᴴ := by
43    dsimp [U]
44    rw [Matrix.conjTranspose_mul, hVstar]
45  have hU : Uᴴ * U = 1 := by
46    rw [hUstar]
47    dsimp [U]
48    calc
49      (V * Xᴴ) * (X * V) = V * (Xᴴ * X) * V := by simp only [Matrix.mul_assoc]
50      _ = V * (C * C) * V := by rw [hCC]
51      _ = (V * C) * (C * V) := by simp only [Matrix.mul_assoc]
52      _ = 1 := by rw [hVC, hCV, one_mul]
53  have hconj : U * (Xᴴ * X) * Uᴴ = X * Xᴴ := by
54    rw [hUstar]
55    dsimp [U]
56    calc
57      (X * V) * (Xᴴ * X) * (V * Xᴴ) =
58          X * (V * (C * C) * V) * Xᴴ := by rw [hCC]; simp only [Matrix.mul_assoc]
59      _ = X * ((V * C) * (C * V)) * Xᴴ := by simp only [Matrix.mul_assoc]
60      _ = X * Xᴴ := by rw [hVC, hCV, one_mul, mul_one]
61  have hs := sqrt_isometric_embedding U hU hY
62  rw [hconj] at hs
63  rw [hs, Matrix.trace_mul_comm, ← Matrix.mul_assoc, hU, one_mul]
64 
65/-- Symmetry when both positive matrices are invertible. -/
66theorem fidelity_symm_of_isUnit {A B : Matrix n n ℂ}
67    (hA : A.PosSemidef) (hB : B.PosSemidef) (hAu : IsUnit A) (hBu : IsUnit B) :
68    fidelity A B = fidelity B A := by
69  let X := CFC.sqrt A * CFC.sqrt B
70  have hX : IsUnit X :=
71    ((CFC.isUnit_sqrt_iff A hA.nonneg).mpr hAu).mul
72      ((CFC.isUnit_sqrt_iff B hB.nonneg).mpr hBu)
73  have hXY : Xᴴ * X = CFC.sqrt B * A * CFC.sqrt B := by
74    dsimp [X]
75    rw [Matrix.conjTranspose_mul, sqrt_conjTranspose, sqrt_conjTranspose]
76    calc
77      (CFC.sqrt B * CFC.sqrt A) * (CFC.sqrt A * CFC.sqrt B) =
78          CFC.sqrt B * (CFC.sqrt A * CFC.sqrt A) * CFC.sqrt B := by
79        simp only [Matrix.mul_assoc]
80      _ = _ := by rw [sqrt_mul_self hA]
81  have hYX : X * Xᴴ = CFC.sqrt A * B * CFC.sqrt A := by
82    dsimp [X]
83    rw [Matrix.conjTranspose_mul, sqrt_conjTranspose, sqrt_conjTranspose]
84    calc
85      (CFC.sqrt A * CFC.sqrt B) * (CFC.sqrt B * CFC.sqrt A) =
86          CFC.sqrt A * (CFC.sqrt B * CFC.sqrt B) * CFC.sqrt A := by
87        simp only [Matrix.mul_assoc]
88      _ = _ := by rw [sqrt_mul_self hB]
89  have ht := trace_sqrt_conjTranspose_mul_eq_of_isUnit X hX
90  rw [hXY, hYX] at ht
91  exact congrArg Complex.re ht
92 
93/-- Joint convergence of concrete root fidelity along positive matrix
94sequences in a fixed finite dimension. -/
95theorem tendsto_fidelity
96    {A B : Matrix n n ℂ} (hA : A.PosSemidef) (hB : B.PosSemidef)
97    {Aseq Bseq : ℕ → Matrix n n ℂ}
98    (hAseq : ∀ k, (Aseq k).PosSemidef) (hBseq : ∀ k, (Bseq k).PosSemidef)
99    (hAlim : Tendsto Aseq atTop (𝓝 A)) (hBlim : Tendsto Bseq atTop (𝓝 B)) :
100    Tendsto (fun k => fidelity (Aseq k) (Bseq k)) atTop (𝓝 (fidelity A B)) := by
101  have hin : Tendsto Bseq atTop (𝓝[{X | X.PosSemidef}] B) :=
102    tendsto_nhdsWithin_iff.mpr ⟨hBlim, Filter.Eventually.of_forall hBseq⟩
103  have hsqrt : Tendsto (CFC.sqrt : Matrix n n ℂ → Matrix n n ℂ)
104      (𝓝[{X | X.PosSemidef}] B) (𝓝 (CFC.sqrt B)) :=
105    continuousOn_matrix_sqrt B hB
106  have hS : Tendsto (fun k => CFC.sqrt (Bseq k)) atTop (𝓝 (CFC.sqrt B)) :=
107    hsqrt.comp hin
108  have hprod : Tendsto
109      (fun k => CFC.sqrt (Bseq k) * Aseq k * CFC.sqrt (Bseq k))
110      atTop (𝓝 (CFC.sqrt B * A * CFC.sqrt B)) := (hS.mul hAlim).mul hS
111  exact Cloning.MatrixRegularization.tendsto_trace_sqrt
112    (sandwich_posSemidef hA B) hprod
113    (Filter.Eventually.of_forall (fun k => sandwich_posSemidef (hAseq k) (Bseq k)))
114 
115/-- Symmetry of actual root fidelity for arbitrary positive matrices.
116No invertibility or trace normalization is required. -/
117theorem fidelity_symm {A B : Matrix n n ℂ}
118    (hA : A.PosSemidef) (hB : B.PosSemidef) : fidelity A B = fidelity B A := by
119  let ε : ℕ → ℝ := fun k => 1 / ((k : ℝ) + 1)
120  have hε (k : ℕ) : 0 < ε k := by
121    dsimp [ε]
122    positivity
123  let Aseq := fun k => Cloning.MatrixRegularization.regularize A (ε k)
124  let Bseq := fun k => Cloning.MatrixRegularization.regularize B (ε k)
125  have hAseq (k : ℕ) : (Aseq k).PosDef :=
126    Cloning.MatrixRegularization.regularize_posDef hA (hε k)
127  have hBseq (k : ℕ) : (Bseq k).PosDef :=
128    Cloning.MatrixRegularization.regularize_posDef hB (hε k)
129  have hAlim : Tendsto Aseq atTop (𝓝 A) :=
130    (Cloning.MatrixRegularization.tendsto_regularize_zero A).comp
131      tendsto_one_div_add_atTop_nhds_zero_nat
132  have hBlim : Tendsto Bseq atTop (𝓝 B) :=
133    (Cloning.MatrixRegularization.tendsto_regularize_zero B).comp
134      tendsto_one_div_add_atTop_nhds_zero_nat
135  have hlimAB := tendsto_fidelity hA hB (fun k => (hAseq k).posSemidef)
136    (fun k => (hBseq k).posSemidef) hAlim hBlim
137  have hlimBA := tendsto_fidelity hB hA (fun k => (hBseq k).posSemidef)
138    (fun k => (hAseq k).posSemidef) hBlim hAlim
139  have heq : (fun k => fidelity (Aseq k) (Bseq k)) =
140      (fun k => fidelity (Bseq k) (Aseq k)) := by
141    funext k
142    exact fidelity_symm_of_isUnit (hAseq k).posSemidef (hBseq k).posSemidef
143      (hAseq k).isUnit (hBseq k).isUnit
144  rw [heq] at hlimAB
145  exact tendsto_nhds_unique hlimAB hlimBA
146 
147end Cloning.MatrixFidelity