GaussianSignSpectral.lean
1module2public import SubentropyCertificates.GaussianGradientDefs3import all D5.S3.Quantum.Subentropy.GaussianQuadratic45/-! Spectral coordinates for the spatial sign integral and the Gaussian gradient. -/6@[expose] public section7noncomputable section8set_option backward.isDefEq.respectTransparency false9open Matrix MeasureTheory ProbabilityTheory Real Set10open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator BigOperators1112namespace SubentropyCertificates.ConditionalContinuity13open SubentropyCertificates.Representations14open SubentropyCertificates.DeterminantComparison15open SubentropyCertificates.ClassicalSSA16open D5.S3.Quantum.Subentropy.GaussianQuadratic1718variable {D : Type*} [Fintype D] [DecidableEq D]1920private abbrev matEval (i j : D) : Matrix D D ℂ →L[ℂ] ℂ :=21 LinearMap.toContinuousLinearMap22 { toFun := fun M ↦ M i j, map_add' := fun _ _ ↦ rfl, map_smul' := fun _ _ ↦ rfl }2324private abbrev spectralConj (U : Matrix.unitaryGroup D ℂ) :25 Matrix D D ℂ ≃L[ℝ] Matrix D D ℂ :=26 ((Unitary.conjStarAlgAut ℂ _ U).toAlgEquiv.toLinearEquiv.restrictScalars ℝ)27 |>.toContinuousLinearEquiv2829omit [DecidableEq D] in30private theorem circPreserving (e : V D ≃ₗᵢ[ℂ] V D) :31 MeasurePreserving e (circularGaussian D) (circularGaussian D) := by32 refine ⟨e.continuous.measurable, ?_⟩33 have hn : Measurable (normalizeGaussian (D := D)) := by unfold normalizeGaussian; fun_prop34 have hcomm : e ∘ normalizeGaussian = normalizeGaussian ∘ e := by35 funext z36 change e (((√2)⁻¹ : ℝ) • z) = ((√2)⁻¹ : ℝ) • e z37 exact (realIsometry e).map_smul _ _38 rw [circularGaussian, Measure.map_map e.continuous.measurable hn, hcomm,39 ← Measure.map_map hn e.continuous.measurable]40 exact congrArg (Measure.map normalizeGaussian) (stdGaussian_map (realIsometry e))4142private def flipCoord (i : D) : V D ≃ₗᵢ[ℂ] V D :=43 LinearIsometryEquiv.piLpCongrRight 244 (fun j : D ↦ if j = i then (LinearIsometryEquiv.neg ℂ : ℂ ≃ₗᵢ[ℂ] ℂ)45 else LinearIsometryEquiv.refl ℂ ℂ)4647private theorem flip_apply (i j : D) (z : V D) :48 flipCoord i z j = if j = i then -z j else z j := by49 change (if j = i then (LinearIsometryEquiv.neg ℂ : ℂ ≃ₗᵢ[ℂ] ℂ)50 else LinearIsometryEquiv.refl ℂ ℂ) (z j) = _51 split_ifs <;> rfl5253private theorem basis_action {M : Matrix D D ℂ} (h : M.IsHermitian) (z : V D) :54 ⇑(h.eigenvectorBasis.repr.symm z) = (h.eigenvectorUnitary : Matrix D D ℂ) *ᵥ (fun i ↦ z i) := by55 funext j56 rw [← OrthonormalBasis.sum_repr_symm]57 simp only [WithLp.ofLp_sum, Finset.sum_apply, PiLp.smul_apply, smul_eq_mul, mulVec, dotProduct,58 Matrix.IsHermitian.eigenvectorUnitary_apply]59 exact Finset.sum_congr rfl fun _ _ ↦ mul_comm _ _6061private theorem base_quad {M : Matrix D D ℂ} (h : M.IsHermitian) (z : V D) :62 quadraticForm M (h.eigenvectorBasis.repr.symm z) = diagonalEnergy h.eigenvalues z := by63 have hh := (spectral_transport h).1 z64 unfold gaussianQuadratic at hh65 change (inner ℂ _ _).re = _66 unfold diagonalEnergy67 linarith6869private theorem outer_transport {U : Matrix.unitaryGroup D ℂ} {y z : V D}70 (hy : ⇑y = (U : Matrix D D ℂ) *ᵥ (fun i ↦ z i)) :71 gaussianOuter y = spectralConj U (gaussianOuter z) := by72 change vecMulVec (fun i ↦ y i) (star (fun i ↦ y i)) =73 (U : Matrix D D ℂ) * gaussianOuter z * (U : Matrix D D ℂ).conjTranspose74 rw [hy, Matrix.star_mulVec, gaussianOuter, Matrix.mul_vecMulVec, Matrix.vecMulVec_mul]75 rfl767778private def scaleCoords (a : D → ℝ) (g : V D) : V D :=79 WithLp.toLp 2 (fun i ↦ (a i : ℂ) * g i)8081private def weightedOuter (w a : D → ℝ) (f : ℝ → ℝ) (g : V D) : Matrix D D ℂ :=82 f (diagonalEnergy w g) • gaussianOuter (scaleCoords a g)8384omit [DecidableEq D] in85private theorem weight_entry (w a : D → ℝ) (f : ℝ → ℝ) (g : V D) (i j : D) :86 weightedOuter w a f g i j =87 (f (diagonalEnergy w g) * a i * a j : ℝ) * (g i * star (g j) : ℂ) := by88 change ((f (diagonalEnergy w g) : ℂ) * (((a i : ℂ) * g i) * star ((a j : ℂ) * g j))) = _89 simp only [star_mul, Complex.star_def, Complex.conj_ofReal, Complex.ofReal_mul]90 ring9192private theorem phase_integral (w a : D → ℝ) (f : ℝ → ℝ) {i j : D} (hij : i ≠ j) :93 (∫ z, weightedOuter w a f z i j ∂circularGaussian D) = 0 := by94 let e := flipCoord i95 have henergy (z : V D) : diagonalEnergy w (e z) = diagonalEnergy w z := by96 apply Finset.sum_congr rfl97 intro k _98 rw [show e z k = _ from flip_apply i k z]99 split_ifs <;> simp100 have hx (g : V D) : weightedOuter w a f (e g) i j = -weightedOuter w a f g i j := by101 rw [weight_entry, weight_entry, henergy, show e g i = -g i by simp [e, flip_apply],102 show e g j = g j by simp [e, flip_apply, hij.symm], neg_mul, mul_neg]103 have h := (circPreserving e).integral_comp e.toHomeomorph.measurableEmbedding104 (fun z ↦ weightedOuter w a f z i j)105 simp only [hx, integral_neg] at h106 exact neg_eq_self.mp h107108private theorem weighted_integral (w a : D → ℝ) (f : ℝ → ℝ)109 (hi : Integrable (weightedOuter w a f) (circularGaussian D)) :110 (∫ z, weightedOuter w a f z ∂circularGaussian D) =111 diagonal (fun i ↦ ((∫ z, f (diagonalEnergy w z) * (a i)^2 * Complex.normSq (z i)112 ∂circularGaussian D : ℝ) : ℂ)) := by113 ext i j114 change matEval i j _ = _115 rw [← (matEval i j).integral_comp_comm hi]116 change (∫ z, weightedOuter w a f z i j ∂circularGaussian D) = _117 by_cases he : i = j118 · subst j119 rw [diagonal_apply_eq, ← integral_complex_ofReal]120 apply integral_congr_ae121 refine .of_forall fun z ↦ ?_122 change weightedOuter w a f z i i = _123 rw [weight_entry]124 simp only [sq, mul_assoc]125 simp only [Complex.ofReal_mul, Complex.normSq_eq_conj_mul_self, Complex.star_def]126 ring127 · rw [diagonal_apply_ne _ he, phase_integral w a f he]128129private theorem spectral_moment {M : Matrix D D ℂ} (h : M.IsHermitian)130 (F : V D → Matrix D D ℂ) (a : D → ℝ) (f : ℝ → ℝ)131 (hi : Integrable F (circularGaussian D))132 (hF : ∀ g, F (h.eigenvectorBasis.repr.symm g) =133 spectralConj h.eigenvectorUnitary (weightedOuter h.eigenvalues a f g)) :134 (∫ g, F g ∂circularGaussian D) =135 spectralConj h.eigenvectorUnitary (diagonal fun i ↦136 ((∫ z, f (diagonalEnergy h.eigenvalues z) * (a i)^2 * Complex.normSq (z i)137 ∂circularGaussian D : ℝ) : ℂ)) := by138 let e := h.eigenvectorBasis.repr.symm139 have he := circPreserving e140 have hcomp := (he.integrable_comp_emb e.toHomeomorph.measurableEmbedding).2 hi141 change Integrable (fun z ↦ F (h.eigenvectorBasis.repr.symm z)) _ at hcomp142 simp_rw [hF] at hcomp143 rw [← he.integral_comp e.toHomeomorph.measurableEmbedding F]144 change (∫ z, F (h.eigenvectorBasis.repr.symm z) ∂_) = _145 simp_rw [hF]146 rw [ContinuousLinearEquiv.integral_comp_comm,147 weighted_integral _ _ _ ((spectralConj h.eigenvectorUnitary).integrable_comp_iff.mp hcomp)]148149150private theorem diag_resolvent {M : Matrix D D ℂ} (hM : M.PosSemidef) {t : ℝ} (ht : 0 ≤ t) :151 signResolvent M t = spectralConj hM.isHermitian.eigenvectorUnitary152 (diagonal (fun i ↦ ((hM.isHermitian.eigenvalues i /153 (1 + t * hM.isHermitian.eigenvalues i) : ℝ) : ℂ))) := by154 let w := hM.isHermitian.eigenvalues155 let U := Unitary.conjStarAlgAut ℂ _ hM.isHermitian.eigenvectorUnitary156 let d (f : D → ℝ) := diagonal (fun i ↦ (f i : ℂ))157 have hbase : M = U (d w) := hM.isHermitian.spectral_theorem158 have hshift : 1 + t • M = U (d (fun i ↦ 1 + t*w i)) := by159 have hm : t • U (d w) = U (t • d w) := ((spectralConj _).map_smul t (d w)).symm160 rw [hbase, hm, ← map_one U, ← map_add]161 congr 1162 ext i j163 by_cases he : i = j164 · subst j165 simp [d, Complex.real_smul]166 · simp [d, he]167 let N := U (d (fun i ↦ w i / (1+t*w i)))168 have hid : N * (1 + t • M) = M := by169 rw [hshift, hbase]170 change U _ * U _ = U _171 rw [← map_mul]172 apply congrArg U173 simp only [d, diagonal_mul_diagonal, ← Complex.ofReal_mul]174 congr 1175 funext i176 have hn : 0 ≤ w i := hM.eigenvalues_nonneg _177 rw [div_mul_cancel₀ _ (by positivity)]178 change M * (1 + t • M)⁻¹ = N179 calc _ = (N * (1+t • M)) * (1+t • M)⁻¹ := congrArg (· * _) hid.symm180 _ = N := by rw [mul_assoc, Matrix.mul_nonsing_inv _ ((Matrix.isUnit_iff_isUnit_det _).mp181 (shifted_posDef hM ht).isUnit), Matrix.mul_one]182183/-- In the eigenbasis of M the determinant integral is diagonal, also at repeated184and zero eigenvalues. -/185theorem spatialSign_spectral {M : Matrix D D ℂ} (hM : M.PosSemidef) :186 let w := hM.isHermitian.eigenvalues187 spatialSign M = Unitary.conjStarAlgAut ℂ _ hM.isHermitian.eigenvectorUnitary188 (diagonal fun i ↦ ((∫ t in Ioi (0 : ℝ),189 (w i / (1 + t * w i)) * ∏ j, (1 + t * w j)⁻¹ : ℝ) : ℂ)) := by190 let w := hM.isHermitian.eigenvalues191 let U := spectralConj hM.isHermitian.eigenvectorUnitary192 let f (t : ℝ) (i : D) := (w i / (1 + t*w i)) * ∏ j, (1+t*w j)⁻¹193 let F (t : ℝ) := diagonal (fun i ↦ (f t i : ℂ))194 have hid : (fun t ↦ U (F t)) =ᵐ[volume.restrict (Ioi (0 : ℝ))] signKernel M := by195 filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht196 rw [signKernel, diag_resolvent hM ht.le, reciprocalDet_spectral hM.isHermitian]197 change U _ = _ • U _198 rw [← U.map_smul]199 apply congrArg U200 ext i j201 by_cases he : i = j202 · subst j203 simp [F, f, kernel, factor, w, Complex.real_smul, mul_comm]204 · simp [F, he]205 have hi : IntegrableOn F (Ioi 0) := U.integrable_comp_iff.mp206 ((signKernel_integrable hM).congr hid.symm)207 unfold spatialSign208 rw [← integral_congr_ae hid, ContinuousLinearEquiv.integral_comp_comm]209 apply congrArg U210 ext i j211 change matEval i j _ = _212 rw [← (matEval i j).integral_comp_comm hi]213 by_cases he : i = j214 · subst j215 change (∫ t in Ioi (0 : ℝ), F t i i) = _216 simp only [F, diagonal_apply_eq]217 exact integral_complex_ofReal (f := fun t ↦ f t i)218 · change (∫ t in Ioi (0 : ℝ), F t i j) = _219 simp only [F, diagonal_apply_ne _ he, integral_zero]220221/-- Spectral transport preserves almost sure properties of the quadratic form. -/222theorem quadraticForm_spectral_ae {M : Matrix D D ℂ} (h : M.IsHermitian) (p : ℝ → Prop) :223 (∀ᵐ g ∂circularGaussian D, p (quadraticForm M g)) ↔224 ∀ᵐ z ∂circularGaussian D, p (diagonalEnergy h.eigenvalues z) := by225 let e := h.eigenvectorBasis.repr.symm226 calc227 _ ↔ ∀ᵐ g ∂(circularGaussian D).map e, p (quadraticForm M g) := by rw [(circPreserving e).map_eq]228 _ ↔ ∀ᵐ z ∂circularGaussian D, p (quadraticForm M (e z)) :=229 e.toHomeomorph.measurableEmbedding.ae_map_iff230 _ ↔ _ := by simp only [e, base_quad]231232/-- The Gaussian mean of log(g* M g) in spectral coordinates. -/233theorem gaussianLogMean_spectral {M : Matrix D D ℂ} (hM : M.IsHermitian) :234 gaussianLogMean M = ∫ z, Real.log (diagonalEnergy hM.eigenvalues z) ∂circularGaussian D := by235 let e := hM.eigenvectorBasis.repr.symm236 unfold gaussianLogMean237 rw [← (circPreserving e).integral_comp e.toHomeomorph.measurableEmbedding]238 simp only [e, base_quad]239240/-- The derivative moment is diagonal in the eigenbasis, with the indicated weighted241exponential moments as entries. -/242theorem gaussianSlope_spectral {M : Matrix D D ℂ} (hM : M.IsHermitian)243 (hi : Integrable (fun g ↦ (1 + Real.log (quadraticForm M g)) • gaussianOuter g)244 (circularGaussian D)) :245 gaussianSlope M = Unitary.conjStarAlgAut ℂ _ hM.eigenvectorUnitary246 (diagonal fun i ↦ ((∫ z, (1 + Real.log (diagonalEnergy hM.eigenvalues z)) *247 Complex.normSq (z i) ∂circularGaussian D : ℝ) : ℂ)) := by248 have h := spectral_moment hM _ (fun _ ↦ 1) (fun t ↦ 1 + Real.log t) hi (by249 intro z250 rw [base_quad, outer_transport (basis_action hM z)]251 have hsc : scaleCoords (fun _ : D ↦ 1) z = z := by ext i; simp [scaleCoords]252 simp [weightedOuter, hsc])253 unfold gaussianSlope254 refine h.trans ?_255 apply congrArg (spectralConj hM.eigenvectorUnitary)256 simp only [one_pow, mul_one]257258259private theorem sqrt_action {M : Matrix D D ℂ} (hM : M.PosSemidef) (g : V D) :260 let h := hM.isHermitian261 ⇑(Matrix.toEuclideanLin (CFC.sqrt M) (h.eigenvectorBasis.repr.symm g)) =262 (h.eigenvectorUnitary : Matrix D D ℂ) *ᵥ ⇑(scaleCoords (fun i ↦ √(h.eigenvalues i)) g) := by263 let h := hM.isHermitian264 let U : Matrix D D ℂ := h.eigenvectorUnitary265 let s (i : D) := (√(h.eigenvalues i) : ℂ)266 have hs : CFC.sqrt M = U * diagonal s * U.conjTranspose := by267 rw [CFC.sqrt_eq_cfc, cfc_nnreal_eq_real _ M hM.nonneg, h.cfc_eq,268 Matrix.IsHermitian.cfc, Unitary.conjStarAlgAut_apply]269 simp only [s, Real.sqrt, RCLike.ofReal_eq_complex_ofReal]270 rfl271 have hunit : U.conjTranspose * U = 1 := Unitary.coe_star_mul_self h.eigenvectorUnitary272 change CFC.sqrt M *ᵥ ⇑(h.eigenvectorBasis.repr.symm g) = U *ᵥ _273 rw [basis_action, hs]274 change (U * diagonal s * U.conjTranspose) *ᵥ (U *ᵥ ⇑g) = U *ᵥ _275 rw [mulVec_mulVec, Matrix.mul_assoc (U * _) U.conjTranspose, hunit, Matrix.mul_one,276 ← mulVec_mulVec]277 apply congrArg (U *ᵥ ·)278 funext i279 exact Matrix.mulVec_diagonal _ _ _280281/-- Spectral expansion of the Gaussian expectation defining the spatial sign matrix. -/282theorem gaussianSign_spectral {M : Matrix D D ℂ} (hM : M.PosSemidef)283 (hi : Integrable (gaussianSign M) (circularGaussian D)) :284 let w := hM.isHermitian.eigenvalues285 (∫ g, gaussianSign M g ∂circularGaussian D) =286 Unitary.conjStarAlgAut ℂ _ hM.isHermitian.eigenvectorUnitary (diagonal fun i ↦287 ((∫ z, w i * Complex.normSq (z i) / diagonalEnergy w z ∂circularGaussian D : ℝ) : ℂ)) := by288 let h := hM.isHermitian289 have H := spectral_moment h _ (fun i ↦ √(h.eigenvalues i)) (fun t ↦ t⁻¹) hi (by290 intro g291 rw [gaussianSign, base_quad, outer_transport (sqrt_action hM g)]292 simp [weightedOuter])293 refine H.trans ?_294 apply congrArg (spectralConj h.eigenvectorUnitary)295 congr 1296 funext i297 apply congrArg Complex.ofReal298 apply integral_congr_ae299 refine .of_forall fun g ↦ ?_300 change _ * (√(h.eigenvalues i))^2 * _ = h.eigenvalues i * Complex.normSq (g i) /301 diagonalEnergy h.eigenvalues g302 rw [sq_sqrt (hM.eigenvalues_nonneg i), div_eq_mul_inv]303 ring304305end SubentropyCertificates.ConditionalContinuity306
Axioms used
Choose a statement to see which axioms its proof uses.