Offline · exact source
Exact Lean source

PBWSymmetricFrameRateMatrix

formalization/Cloning/PBWSymmetricFrameRateMatrix.lean

Source hash: 5ac099641b7770e5b9d46f59a99ec8dab24e1e0abc09caed05bea0b87711e1d1

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.PBWSymmetricFrameRate
2import Mathlib.Analysis.InnerProductSpace.GramMatrix
3 
4/-! The polar construction is exactly the manuscript's matrix formula
5`(v_i) (sqrt(Gram(v)))⁻¹`, not a different orthogonalization. -/
6noncomputable section
7open scoped ComplexOrder MatrixOrder InnerProductSpace Topology BigOperators Matrix Matrix.Norms.L2Operator
8namespace Cloning.PBWSymmetricFrame
9open ContinuousLinearMap InnerProductSpace
10set_option backward.isDefEq.respectTransparency false
11set_option maxHeartbeats 800000
12variable {ι H : Type*} [Fintype ι] [DecidableEq ι]
13  [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
14 
15def symmetricFrame (v : ι→H) (i : ι) : H :=
16  ∑ j,((CFC.sqrt (Matrix.gram ℂ v))⁻¹) j i • v j
17 
18theorem toEuclideanCLM_gram (v : ι→H) :
19    (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) (Matrix.gram ℂ v)=
20      gram (synthesis (EuclideanSpace.basisFun ι ℂ) v) := by
21  apply ContinuousLinearMap.ext
22  intro x
23  have hj (j : ι) : (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) (Matrix.gram ℂ v)
24      (EuclideanSpace.basisFun ι ℂ j)=gram (synthesis (EuclideanSpace.basisFun ι ℂ) v)
25      (EuclideanSpace.basisFun ι ℂ j) := by
26    apply (EuclideanSpace.basisFun ι ℂ).repr.injective
27    ext i
28    rw [OrthonormalBasis.repr_apply_apply,OrthonormalBasis.repr_apply_apply,gram_entry]
29    rw [EuclideanSpace.basisFun_inner,EuclideanSpace.basisFun_apply]
30    change (Matrix.gram ℂ v *ᵥ (Pi.single j 1)) i=_
31    simp
32  rw [←(EuclideanSpace.basisFun ι ℂ).sum_repr' x]
33  simp only [map_sum,map_smul,hj]
34 
35theorem toEuclideanCLM_sqrt_gram (v : ι→H) :
36    (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) (CFC.sqrt (Matrix.gram ℂ v))=
37      CFC.sqrt (gram (synthesis (EuclideanSpace.basisFun ι ℂ) v)) := by
38  rw [CFC.sqrt_eq_cfc,CFC.sqrt_eq_cfc,←toEuclideanCLM_gram v]
39  exact StarAlgHomClass.map_cfc (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) NNReal.sqrt (Matrix.gram ℂ v)
40    (hφ := (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)).toAlgEquiv.toLinearEquiv.toContinuousLinearEquiv.continuous)
41    (ha := (Matrix.posSemidef_gram ℂ v).nonneg)
42    (hφa := by rw [toEuclideanCLM_gram]; exact gram_nonneg _)
43 
44private theorem map_inverse_of_isUnit {A B : Type*} [Ring A] [Ring B]
45    (e : A ≃+* B) (a : A) (ha : IsUnit a) :
46    e (Ring.inverse a)=Ring.inverse (e a) := by
47  have he : IsUnit (e a) := ha.map e
48  calc
49    e (Ring.inverse a)=e (Ring.inverse a)*(e a*Ring.inverse (e a)) := by
50      rw [Ring.mul_inverse_cancel _ he,mul_one]
51    _ = e (Ring.inverse a*a)*Ring.inverse (e a) := by rw [map_mul,mul_assoc]
52    _ = Ring.inverse (e a) := by rw [Ring.inverse_mul_cancel _ ha,map_one,one_mul]
53 
54theorem symmetricFrame_eq_frame (v : ι→H)
55    (hV : IsUnit (gram (synthesis (EuclideanSpace.basisFun ι ℂ) v))) :
56    symmetricFrame v=frame (EuclideanSpace.basisFun ι ℂ) v := by
57  let e := (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ))
58  have hg : IsUnit (Matrix.gram ℂ v) := by
59    have h := hV.map e.symm
60    rw [←toEuclideanCLM_gram v] at h
61    simpa only [e,StarAlgEquiv.symm_apply_apply] using h
62  have hs : IsUnit (CFC.sqrt (Matrix.gram ℂ v)) :=
63    (CFC.isUnit_sqrt_iff _ (Matrix.posSemidef_gram ℂ v).nonneg).mpr hg
64  have hi : e ((CFC.sqrt (Matrix.gram ℂ v))⁻¹)=
65      Ring.inverse (CFC.sqrt (gram (synthesis (EuclideanSpace.basisFun ι ℂ) v))) := by
66    rw [Matrix.nonsing_inv_eq_ringInverse]
67    have h := map_inverse_of_isUnit e.toRingEquiv _ hs
68    exact h.trans (congrArg Ring.inverse (toEuclideanCLM_sqrt_gram v))
69  funext i
70  rw [frame,polar,ContinuousLinearMap.comp_apply,←hi,synthesis_apply]
71  apply Finset.sum_congr rfl
72  intro j _
73  congr 1
74  rw [EuclideanSpace.basisFun_inner,EuclideanSpace.basisFun_apply]
75  change _=(((CFC.sqrt (Matrix.gram ℂ v))⁻¹)*ᵥ (Pi.single i 1)) j
76  simp
77 
78/-- Literal inverse-square-root orthonormalization, under an explicit small
79Gram error, with the same order of quantitative error. -/
80theorem symmetricFrame_properties (v : ι→H) (ε : ℝ)
81    (herr : ∀ i j,‖⟪v i,v j⟫_ℂ-(if i=j then 1 else 0 : ℂ)‖≤ε)
82    (hε : (Fintype.card ι : ℝ)^2*ε<1) :
83    Orthonormal ℂ (symmetricFrame v) ∧
84      Submodule.span ℂ (Set.range (symmetricFrame v))=Submodule.span ℂ (Set.range v) ∧
85      ∀ i,‖symmetricFrame v i-v i‖≤(Fintype.card ι : ℝ)^2*ε := by
86  have hV := gram_isUnit_of_error (EuclideanSpace.basisFun ι ℂ) v ε herr hε
87  rw [symmetricFrame_eq_frame v hV]
88  exact ⟨frame_orthonormal _ _ hV,span_frame _ _ hV,frame_error_le _ _ hV ε herr⟩
89 
90end Cloning.PBWSymmetricFrame