Download data/lean/OAI/MathematicalPhysics/PEPSSubvolume/Diagonal.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.51 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/PEPSSubvolume/Diagonal.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/PEPSSubvolume/Diagonal.lean
-
curl -L -o Diagonal.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/PEPSSubvolume/Diagonal.lean
9.51 kB
| import Mathlib | |
| import OAI.MathematicalPhysics.PEPSFilters.LocalOperators | |
| import OAI.MathematicalPhysics.PEPSSubvolume.Transition | |
| namespace OAI | |
| /-! Spectral diagonal gradients of actual maximizing filters. -/ | |
| noncomputable section | |
| open scoped BigOperators ComplexOrder | |
| open scoped BigOperators ComplexOrder Matrix.Norms.L2Operator | |
| open scoped BigOperators | |
| open scoped Topology | |
| open Filter | |
| open scoped MatrixOrder | |
| open PolynomialPEPS.PinnedEntropy | |
| namespace PolynomialPEPS.Subvolume.DiagonalStationarity | |
| open scoped BigOperators ComplexOrder Matrix.Norms.L2Operator | |
| open PolynomialPEPS.Subvolume.SpectralCurve PolynomialPEPS.Subvolume.KernelNormalization | |
| open PolynomialPEPS.Subvolume.UnitaryStationarity | |
| variable {ΞΉ E : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| [NormedAddCommGroup E] [InnerProductSpace β E] | |
| def tiltCost (e h : ΞΉ β β) (p t : β) : β := | |
| β i, (e i)^p * Real.exp (p*t*h i) | |
| omit [DecidableEq ΞΉ] in | |
| theorem tiltCost_zero (e h : ΞΉ β β) (p : β) (hs : β i, (e i)^p = 1) : | |
| tiltCost e h p 0 = 1 := by simpa [tiltCost] using hs | |
| omit [DecidableEq ΞΉ] in | |
| theorem tiltCost_pos (e h : ΞΉ β β) (p t : β) | |
| (he : β i, 0 β€ e i) (hs : β i, (e i)^p = 1) : | |
| 0 < tiltCost e h p t := by | |
| have ha : β i, 0 < (e i)^p := by | |
| by_contra hn | |
| push Not at hn | |
| have hz : β i, (e i)^p β€ 0 := Finset.sum_nonpos (fun i _ => hn i) | |
| linarith | |
| obtain β¨i,hiβ© := ha | |
| apply Finset.sum_pos' | |
| Β· intro j _ | |
| exact mul_nonneg (Real.rpow_nonneg (he j) _) (Real.exp_pos _).le | |
| Β· exact β¨i,Finset.mem_univ i,mul_pos hi (Real.exp_pos _)β© | |
| omit [DecidableEq ΞΉ] in | |
| theorem tiltCost_power (e h : ΞΉ β β) (p t : β) (he : β i, 0 β€ e i) : | |
| β i, (e i*Real.exp (t*h i))^p = tiltCost e h p t := by | |
| unfold tiltCost | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| rw [Real.mul_rpow (he i) (Real.exp_pos _).le,β Real.exp_mul] | |
| congr 2 | |
| ring | |
| omit [DecidableEq ΞΉ] in | |
| theorem tiltCost_derivative (e h : ΞΉ β β) (p : β) : | |
| HasDerivAt (tiltCost e h p) (p*β i, (e i)^p*h i) 0 := by | |
| have hD (i : ΞΉ) : HasDerivAt (fun t : β => (e i)^p*Real.exp (p*t*h i)) | |
| ((e i)^p*(p*h i)) 0 := by | |
| simpa using (((hasDerivAt_id (0:β)).const_mul p).mul_const (h i)).exp.const_mul ((e i)^p) | |
| have he : (β i, (e i)^p*(p*h i)) = p*β i, (e i)^p*h i := by | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| ring | |
| have hf : tiltCost e h p = β i, (fun t : β => (e i)^p * Real.exp (p*t*h i)) := by | |
| ext t | |
| simp [tiltCost] | |
| rw [hf] | |
| simpa +instances only [he] using! | |
| HasDerivAt.sum (u := Finset.univ) (fun i _ => hD i) | |
| omit [DecidableEq ΞΉ] in | |
| theorem tiltScale_derivative (e h : ΞΉ β β) (p : β) (hp : p β 0) | |
| (hs : β i, (e i)^p = 1) : | |
| HasDerivAt (fun t => scale (tiltCost e h p t) p) (-β i, (e i)^p*h i) 0 := by | |
| have hD := (tiltCost_derivative e h p).rpow_const (p := -(1/p)) | |
| (Or.inl (by rw [tiltCost_zero e h p hs]; norm_num)) | |
| unfold scale | |
| convert hD using 1 | |
| rw [tiltCost_zero e h p hs,Real.one_rpow] | |
| field_simp | |
| theorem diagonal_moment (T : Matrix ΞΉ ΞΉ β ββ[β] E) | |
| (U : unitary (Matrix ΞΉ ΞΉ β)) (e : ΞΉ β β) (he : β i, 0 β€ e i) | |
| (p : β) (hp : p β 0) (hs : β i, (e i)^p = 1) | |
| (hb : β d : ΞΉ β β, (β i, 0 β€ d i) β (β i, (d i)^p = 1) β | |
| βT (spectralHom U (fun i => (d i : β)))β β€ | |
| βT (spectralHom U (fun i => (e i : β)))β) | |
| (h : ΞΉ β β) : | |
| (inner β (T (spectralHom U (fun i => (e i : β)))) | |
| (T (spectralHom U (fun i => (e i*h i : β))))).re = | |
| βT (spectralHom U (fun i => (e i : β)))β^2 * β i, (e i)^p*h i := by | |
| let F := spectralHom U (fun i => (e i : β)) | |
| let l : Matrix ΞΉ ΞΉ β βL[β] β := (innerSL β (T F)).comp T.toContinuousLinearMap | |
| have hM : F*spectralHom U (fun i => (h i : β)) = | |
| spectralHom U (fun i => (e i*h i : β)) := by | |
| rw [β map_mul] | |
| rfl | |
| have hD := (hasDerivAt_curve_zero U h).const_mul F | |
| have hDl : HasDerivAt (fun z : β => l (F*curve U h z)) | |
| (l (spectralHom U (fun i => (e i*h i : β)))) 0 := by | |
| have hD' := l.hasFDerivAt.comp_hasDerivAt 0 hD | |
| rw [hM] at hD' | |
| simpa +instances only [Function.comp_def] using! hD' | |
| have h0 : l (F*curve U h 0) = inner β (T F) (T F) := by simp [l] | |
| have hDg := (tiltScale_derivative e h p hp hs).mul hDl.real_of_complex | |
| have hG0 : scale (tiltCost e h p 0) p = 1 := by | |
| simp [tiltCost_zero e h p hs,scale] | |
| have hm : IsLocalMax (fun t : β => | |
| scale (tiltCost e h p t) p * (l (F*curve U h (t:β))).re) 0 := by | |
| apply Filter.Eventually.of_forall | |
| intro t | |
| let d : ΞΉ β β := fun i => scale (tiltCost e h p t) p * (e i*Real.exp (t*h i)) | |
| have hS := tiltCost_pos e h p t he hs | |
| have hd : β i, 0 β€ d i := fun i => mul_nonneg (scale_pos _ _ hS).le | |
| (mul_nonneg (he i) (Real.exp_pos _).le) | |
| have hsum : β i, (d i)^p = 1 := power_sum _ | |
| (fun i => mul_nonneg (he i) (Real.exp_pos _).le) _ _ hS hp | |
| (tiltCost_power e h p t he) | |
| have heq : spectralHom U (fun i => (d i : β)) = | |
| (scale (tiltCost e h p t) p : β) β’ (F*curve U h (t:β)) := by | |
| rw [show F*curve U h (t:β) = spectralHom U | |
| (fun i => (e i:β)*Complex.exp ((t:β)*(h i:β))) by exact (spectralHom U).map_mul _ _ |>.symm, | |
| β map_smul] | |
| apply congrArg (spectralHom U) | |
| ext i | |
| simp [d,Complex.ofReal_mul,Complex.ofReal_exp] | |
| have hb' := real_inner_le_of_norm_le (T F) _ (hb d hd hsum) | |
| rw [heq,map_smul,inner_smul_right] at hb' | |
| dsimp only | |
| simp only [Complex.ofReal_zero,hG0,h0,one_mul] | |
| simpa +instances only [Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] using! hb' | |
| have hz := hm.hasDerivAt_eq_zero hDg | |
| simp only [Complex.ofReal_zero,hG0,h0,one_mul] at hz | |
| have hnorm : (inner β (T F) (T F)).re = βT Fβ^2 := by | |
| change RCLike.re (inner β (T F) (T F)) = βT Fβ^2 | |
| exact (norm_sq_eq_re_inner (π := β) (T F)).symm | |
| rw [hnorm] at hz | |
| change -(β i, (e i)^p*h i) * βT Fβ^2 + | |
| (inner β (T F) (T (spectralHom U (fun i => (e i*h i:β))))).re = 0 at hz | |
| dsimp only [F] at hz β’ | |
| nlinarith only [hz] | |
| end PolynomialPEPS.Subvolume.DiagonalStationarity | |
| namespace PolynomialPEPS.Subvolume.ActualDiagonal | |
| open scoped BigOperators ComplexOrder Matrix.Norms.L2Operator | |
| open PolynomialPEPS.Subvolume.OptimizerGauge PolynomialPEPS.Subvolume.ActualTransition | |
| open PolynomialPEPS.Subvolume.SpectralCurve PolynomialPEPS.Subvolume.DiagonalStationarity | |
| variable {L q : β} | |
| theorem spectral_positive {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| (U : unitary (Matrix ΞΉ ΞΉ β)) (e : ΞΉ β β) (he : β i, 0 β€ e i) : | |
| (spectralHom U (fun i => (e i:β))).PosSemidef := by | |
| exact (Matrix.PosSemidef.diagonal (fun i => Complex.nonneg_iff.mpr β¨he i,rflβ©)).mul_mul_conjTranspose_same | |
| (U : Matrix ΞΉ ΞΉ β) | |
| theorem optimizer_diagonal_moment (hq : 0 < q) | |
| (X : β β Finset (Vertex L)) (hX : Monotone X) | |
| (a : β β β) (Ο : State L q) (n : β) | |
| (F : (j : β) β LocalPositiveFilter q (X j)) | |
| (hF : IsFilterOptimizer Ο (fun j : Fin n => a j.val) (fun j : Fin n => F j.val)) | |
| (k : β) (hk : k < n) (hp : 2/a k β 0) | |
| (U : unitary (Matrix (RegionConfiguration q (X k)) (RegionConfiguration q (X k)) β)) | |
| (e h : RegionConfiguration q (X k) β β) (he : β i, 0 β€ e i) | |
| (hrep : (F k).matrix = spectralHom U (fun i => (e i : β))) : | |
| let A : β β Operator L q := fun j => liftLocal (X j) (F j).matrix | |
| let v : State L q := asMap (L := L) (q := q) (orderedPrefix A n) Ο | |
| (inner β v (replacementOutput A (X k) Ο k n hk | |
| (spectralHom U (fun i => (e i*h i : β))))).re = | |
| βvβ^2 * β i, (e i)^(2/a k)*h i := by | |
| dsimp only | |
| let A : β β Operator L q := fun j => liftLocal (X j) (F j).matrix | |
| let T := replacementOutput A (X k) Ο k n hk | |
| let v : State L q := asMap (L := L) (q := q) (orderedPrefix A n) Ο | |
| have ht : T (F k).matrix = v := by | |
| change asMap (L := L) (q := q) (orderedPrefix (Function.update A k (A k)) n) Ο = v | |
| rw [Function.update_eq_self] | |
| have hfv : filteredVector (fun j : Fin n => F j.val) Ο = v := by | |
| unfold filteredVector | |
| rw [PhysicalCurve.orderedFilterProduct_eq_prefix] | |
| have hs : β i, (e i)^(2/a k) = 1 := by | |
| have hs := hF.1 β¨k,hkβ© | |
| unfold filterTracePower NestedFilter.tracePower at hs | |
| have hs' := sum_eigenvalues_spectralHom U e (spectral_positive U e he).isHermitian | |
| (fun t => t^(2/a k)) | |
| have heig := (F k).positive.isHermitian.eigenvalues_eq_eigenvalues_iff | |
| (spectral_positive U e he).isHermitian | |
| have heq := heig.mpr (congrArg Matrix.charpoly hrep) | |
| rw [heq] at hs | |
| exact hs'.symm.trans hs | |
| have hb (d : RegionConfiguration q (X k) β β) (hd : β i, 0 β€ d i) | |
| (hsd : β i, (d i)^(2/a k) = 1) : | |
| βT (spectralHom U (fun i => (d i:β)))β β€ βT (spectralHom U (fun i => (e i:β)))β := by | |
| let G : LocalPositiveFilter q (X k) := β¨_,spectral_positive U d hdβ© | |
| have hG : filterTracePower G (2/a k) = 1 := by | |
| exact (sum_eigenvalues_spectralHom U d G.positive.isHermitian (fun t => t^(2/a k))).trans hsd | |
| have hb := one_replacement_bound hq X hX a Ο n F hF k hk 1 G hG | |
| rw [β hrep,ht,β hfv] | |
| simpa +instances only [OneMemClass.coe_one,one_mul] using! hb | |
| have hm := diagonal_moment T U e he (2/a k) hp hs hb h | |
| rw [β hrep,ht] at hm | |
| exact hm | |
| end PolynomialPEPS.Subvolume.ActualDiagonal | |
| end | |
| end OAI | |