Exact Lean source
MatrixRegularization
formalization/Cloning/MatrixRegularization.lean
Source hash: f98534611f0a7dd7c6c2e2a1e1c67a6e33365be4d3e0f0e1e929581681143b04
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
definition
Cloning.MatrixRegularization.regularizetheorem Cloning.MatrixRegularization.regularize_posSemideftheorem Cloning.MatrixRegularization.regularize_posDeftheorem Cloning.MatrixRegularization.le_regularizetheorem Cloning.MatrixRegularization.regularize_tracetheorem Cloning.MatrixRegularization.regularize_trace_retheorem Cloning.MatrixRegularization.continuous_regularizetheorem Cloning.MatrixRegularization.tendsto_regularize_zerotheorem Cloning.MatrixRegularization.tendsto_regularize_postheorem Cloning.MatrixRegularization.sqrt_isUnittheorem Cloning.MatrixRegularization.sqrt_mul_invtheorem Cloning.MatrixRegularization.sqrt_inv_multheorem Cloning.MatrixRegularization.sqrt_inv_posDeftheorem Cloning.MatrixRegularization.sqrt_inv_conjTransposetheorem Cloning.MatrixRegularization.sqrt_inv_squaretheorem Cloning.MatrixRegularization.sqrt_inv_sandwichtheorem Cloning.MatrixRegularization.tendsto_trace_sqrttheorem Cloning.MatrixRegularization.tendsto_trace_sqrt_regularize1import Cloning.MatrixFidelityBounds
2import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.Order
3
4/-!
5# Positive-definite regularization of positive complex matrices
6
7The regularization is the concrete matrix `A + ε I`. Its positivity, strict
8positivity, traces, limits, and inverse square-root identities are proved here.
9-/
10
11noncomputable section
12
13open scoped BigOperators Matrix MatrixOrder ComplexOrder
14open Matrix Filter
15open Cloning.MatrixFidelity
16
17namespace Cloning.MatrixRegularization
18
19set_option backward.isDefEq.respectTransparency false
20
21variable {n : Type*} [Fintype n] [DecidableEq n]
22
23/-- Addition of scalar white noise to a positive matrix. -/
24def regularize (A : Matrix n n ℂ) (ε : ℝ) : Matrix n n ℂ := A + ε • 1
25
26omit [Fintype n] in
27theorem regularize_posSemidef {A : Matrix n n ℂ} (hA : A.PosSemidef)
28 {ε : ℝ} (hε : 0 ≤ ε) : (regularize A ε).PosSemidef :=
29 hA.add (Matrix.PosSemidef.one.smul hε)
30
31omit [Fintype n] in
32theorem regularize_posDef {A : Matrix n n ℂ} (hA : A.PosSemidef)
33 {ε : ℝ} (hε : 0 < ε) : (regularize A ε).PosDef :=
34 Matrix.PosDef.posSemidef_add hA (Matrix.PosDef.one.smul hε)
35
36omit [Fintype n] in
37theorem le_regularize (A : Matrix n n ℂ) {ε : ℝ} (hε : 0 ≤ ε) :
38 A ≤ regularize A ε := by
39 exact le_add_of_nonneg_right (Matrix.PosSemidef.one.smul hε).nonneg
40
41theorem regularize_trace (A : Matrix n n ℂ) (ε : ℝ) :
42 (regularize A ε).trace = A.trace + (ε : ℂ) * (Fintype.card n : ℂ) := by
43 simp [regularize, Matrix.trace_add, Matrix.trace_smul, Matrix.trace_one]
44
45theorem regularize_trace_re (A : Matrix n n ℂ) (ε : ℝ) :
46 (regularize A ε).trace.re = A.trace.re + ε * (Fintype.card n : ℝ) := by
47 rw [regularize_trace]
48 simp
49
50omit [Fintype n] in
51theorem continuous_regularize (A : Matrix n n ℂ) : Continuous (regularize A) := by
52 unfold regularize
53 fun_prop
54
55omit [Fintype n] in
56theorem tendsto_regularize_zero (A : Matrix n n ℂ) :
57 Tendsto (regularize A) (nhds 0) (nhds A) := by
58 simpa [regularize] using (continuous_regularize A).tendsto 0
59
60omit [Fintype n] in
61theorem tendsto_regularize_pos (A : Matrix n n ℂ) :
62 Tendsto (regularize A) (nhdsWithin 0 (Set.Ioi 0)) (nhds A) :=
63 (tendsto_regularize_zero A).mono_left inf_le_left
64
65/-- The positive square root of a positive-definite matrix is invertible. -/
66theorem sqrt_isUnit {A : Matrix n n ℂ} (hA : A.PosDef) : IsUnit (CFC.sqrt A) :=
67 hA.isStrictlyPositive.sqrt.posDef.isUnit
68
69theorem sqrt_mul_inv {A : Matrix n n ℂ} (hA : A.PosDef) :
70 CFC.sqrt A * (CFC.sqrt A)⁻¹ = 1 :=
71 Matrix.mul_nonsing_inv _ ((Matrix.isUnit_iff_isUnit_det (CFC.sqrt A)).mp (sqrt_isUnit hA))
72
73theorem sqrt_inv_mul {A : Matrix n n ℂ} (hA : A.PosDef) :
74 (CFC.sqrt A)⁻¹ * CFC.sqrt A = 1 :=
75 Matrix.nonsing_inv_mul _ ((Matrix.isUnit_iff_isUnit_det (CFC.sqrt A)).mp (sqrt_isUnit hA))
76
77theorem sqrt_inv_posDef {A : Matrix n n ℂ} (hA : A.PosDef) :
78 ((CFC.sqrt A)⁻¹).PosDef := hA.isStrictlyPositive.sqrt.posDef.inv
79
80theorem sqrt_inv_conjTranspose (A : Matrix n n ℂ) :
81 ((CFC.sqrt A)⁻¹)ᴴ = (CFC.sqrt A)⁻¹ := by
82 rw [Matrix.conjTranspose_nonsing_inv, sqrt_conjTranspose]
83
84theorem sqrt_inv_square {A : Matrix n n ℂ} (hA : A.PosSemidef) :
85 (CFC.sqrt A)⁻¹ * (CFC.sqrt A)⁻¹ = A⁻¹ := by
86 rw [← sq, Matrix.inv_pow', CFC.sq_sqrt A hA.nonneg]
87
88/-- Inverse square roots undo the positive sandwich of a positive-definite matrix. -/
89theorem sqrt_inv_sandwich {A : Matrix n n ℂ} (hA : A.PosDef) :
90 (CFC.sqrt A)⁻¹ * A * (CFC.sqrt A)⁻¹ = 1 := by
91 calc
92 (CFC.sqrt A)⁻¹ * A * (CFC.sqrt A)⁻¹ =
93 (CFC.sqrt A)⁻¹ * (CFC.sqrt A * CFC.sqrt A) * (CFC.sqrt A)⁻¹ := by
94 rw [sqrt_mul_self hA.posSemidef]
95 _ = ((CFC.sqrt A)⁻¹ * CFC.sqrt A) * (CFC.sqrt A * (CFC.sqrt A)⁻¹) := by
96 simp only [Matrix.mul_assoc]
97 _ = 1 := by rw [sqrt_inv_mul hA, sqrt_mul_inv hA, Matrix.one_mul]
98
99/-- A general limit lemma for the trace of the positive square root along the
100positive cone. It is useful when removing a positive-definite regularization. -/
101theorem tendsto_trace_sqrt {ι : Type*} {l : Filter ι} {A : Matrix n n ℂ}
102 {f : ι → Matrix n n ℂ} (hA : A.PosSemidef)
103 (hf : Tendsto f l (nhds A)) (hpos : ∀ᶠ i in l, (f i).PosSemidef) :
104 Tendsto (fun i => (CFC.sqrt (f i)).trace.re) l (nhds (CFC.sqrt A).trace.re) := by
105 have hin : Tendsto f l (nhdsWithin A {X : Matrix n n ℂ | X.PosSemidef}) :=
106 tendsto_nhdsWithin_iff.mpr ⟨hf, hpos⟩
107 have hs : Tendsto (CFC.sqrt : Matrix n n ℂ → Matrix n n ℂ)
108 (nhdsWithin A {X : Matrix n n ℂ | X.PosSemidef}) (nhds (CFC.sqrt A)) :=
109 continuousOn_matrix_sqrt A hA
110 have ht : Continuous (fun X : Matrix n n ℂ => X.trace.re) := by
111 unfold Matrix.trace
112 fun_prop
113 exact ht.continuousAt.tendsto.comp (hs.comp hin)
114
115theorem tendsto_trace_sqrt_regularize {A : Matrix n n ℂ} (hA : A.PosSemidef) :
116 Tendsto (fun ε => (CFC.sqrt (regularize A ε)).trace.re)
117 (nhdsWithin 0 (Set.Ioi 0)) (nhds (CFC.sqrt A).trace.re) := by
118 apply tendsto_trace_sqrt hA (tendsto_regularize_pos A)
119 filter_upwards [self_mem_nhdsWithin] with ε hε
120 exact regularize_posSemidef hA hε.le
121
122end Cloning.MatrixRegularization