Download data/lean/OAI/Probability/SKRatio/Entropy/Entropy.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Entropy/Entropy.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKRatio/Entropy/Entropy.lean
-
curl -L -o Entropy.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Entropy/Entropy.lean
19.5 kB
| import Mathlib | |
| import OAI.Probability.SKRatio.Calculus.SpectralLower | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators Topology Matrix | |
| open MeasureTheory Filter ContinuousLinearMap | |
| namespace SKRatio.FiniteLaw | |
| variable {Ξ± : Type*} [Fintype Ξ±] | |
| attribute [local instance] Classical.propDecidable | |
| def entropy (q f : Ξ± β β) : β := | |
| mean q (fun x => f x * Real.log (f x)) - mean q f * Real.log (mean q f) | |
| def relativeEntropy (p q : Ξ± β β) : β := β x, p x * Real.log (p x / q x) | |
| lemma mul_log_div (p q : β) (hq : q β 0) : | |
| p * Real.log (p/q) = p * Real.log p - p * Real.log q := by | |
| by_cases hp : p = 0 | |
| Β· simp [hp] | |
| Β· rw [Real.log_div hp hq, mul_sub] | |
| lemma relativeEntropy_nonneg (p q : Ξ± β β) (hp : β x, 0 β€ p x) | |
| (hq : β x, 0 < q x) (hp1 : β x, p x = 1) (hq1 : β x, q x = 1) : | |
| 0 β€ relativeEntropy p q := by | |
| have h (x : Ξ±) : p x-q x β€ p x*Real.log (p x/q x) := by | |
| have hl := mul_le_mul_of_nonneg_left | |
| (Real.self_sub_one_le_mul_log (div_nonneg (hp x) (hq x).le)) (hq x).le | |
| calc | |
| p x-q x = q x*(p x/q x-1) := by field_simp [ne_of_gt (hq x)] | |
| _ β€ q x*(p x/q x*Real.log (p x/q x)) := hl | |
| _ = p x*Real.log (p x/q x) := by field_simp [ne_of_gt (hq x)] | |
| have hs := Finset.sum_le_sum (s := Finset.univ) (fun x _ => h x) | |
| simpa only [Finset.sum_sub_distrib,hp1,hq1,sub_self,relativeEntropy] using hs | |
| lemma entropy_density (p q : Ξ± β β) (hq : β x, q x β 0) | |
| (hp1 : β x, p x = 1) : | |
| entropy q (fun x => p x/q x) = relativeEntropy p q := by | |
| have hm : mean q (fun x => p x/q x) = 1 := by | |
| simpa only [mean,mul_div_cancelβ _ (hq _)] using hp1 | |
| rw [entropy,hm,Real.log_one,mul_zero,sub_zero] | |
| unfold mean relativeEntropy | |
| exact Finset.sum_congr rfl (fun x _ => by field_simp [hq x]) | |
| lemma relativeEntropy_continuous (q : Ξ± β β) (hq : β x, q x β 0) : | |
| Continuous (fun p : Ξ± β β => relativeEntropy p q) := by | |
| simp only [relativeEntropy,mul_log_div _ _ (hq _)] | |
| exact continuous_finsetSum _ (fun x _ => | |
| (Real.continuous_mul_log.comp (continuous_apply x)).sub ((continuous_apply x).mul continuous_const)) | |
| lemma entropy_variational (p q a : Ξ± β β) (hp : β x, 0 β€ p x) | |
| (hq : β x, 0 < q x) (hp1 : β x, p x = 1) (hq1 : β x, q x = 1) : | |
| mean p a β€ relativeEntropy p q + Real.log (mean q (fun x => Real.exp (a x))) := by | |
| have : Nonempty Ξ± := by | |
| by_contra h | |
| have : IsEmpty Ξ± := not_nonempty_iff.mp h | |
| simp at hq1 | |
| let Z := mean q (fun x => Real.exp (a x)) | |
| have hZ : 0 < Z := Finset.sum_pos (fun x _ => mul_pos (hq x) (Real.exp_pos _)) Finset.univ_nonempty | |
| let r (x : Ξ±) := q x*Real.exp (a x)/Z | |
| have hr (x : Ξ±) : 0 < r x := div_pos (mul_pos (hq x) (Real.exp_pos _)) hZ | |
| have hr1 : β x, r x = 1 := by | |
| rw [show (β x, r x) = Z/Z by simp only [r,Z,mean,Finset.sum_div]] | |
| exact div_self (ne_of_gt hZ) | |
| have h := relativeEntropy_nonneg p r hp hr hp1 hr1 | |
| have he (x : Ξ±) : p x*Real.log (p x/r x) = | |
| p x*Real.log (p x/q x) - p x*a x + p x*Real.log Z := by | |
| rw [mul_log_div _ _ (ne_of_gt (hr x)),mul_log_div _ _ (ne_of_gt (hq x))] | |
| rw [show Real.log (r x) = Real.log (q x) + a x - Real.log Z by | |
| dsimp only [r] | |
| rw [Real.log_div (ne_of_gt (mul_pos (hq x) (Real.exp_pos _))) (ne_of_gt hZ), | |
| Real.log_mul (ne_of_gt (hq x)) (Real.exp_ne_zero _),Real.log_exp]] | |
| ring | |
| simp only [relativeEntropy,he,Finset.sum_add_distrib,Finset.sum_sub_distrib, | |
| β Finset.sum_mul,hp1,one_mul] at h | |
| dsimp only [mean,relativeEntropy,Z] at * | |
| linarith only [h] | |
| lemma event_entropy_bound (p q : Ξ± β β) (B : Set Ξ±) (hp : β x, 0 β€ p x) | |
| (hq : β x, 0 < q x) (hp1 : β x, p x = 1) (hq1 : β x, q x = 1) | |
| {a : β} (hsmall : mean q (fun x => if x β B then 1 else 0) β€ Real.exp (-a)) : | |
| a*mean p (fun x => if x β B then 1 else 0) β€ relativeEntropy p q+Real.log 2 := by | |
| classical | |
| have h := entropy_variational p q (fun x => if x β B then a else 0) hp hq hp1 hq1 | |
| have hm : mean q (fun x => Real.exp (if x β B then a else 0)) β€ 2 := by | |
| calc | |
| _ β€ β x, (q x + Real.exp a*(q x*(if x β B then 1 else 0))) := by | |
| apply Finset.sum_le_sum | |
| intro x _ | |
| by_cases hx : x β B <;> simp only [hx,βreduceIte,Real.exp_zero,mul_one,mul_zero] | |
| Β· nlinarith only [hq x] | |
| Β· simp | |
| _ = 1+Real.exp a*mean q (fun x => if x β B then 1 else 0) := by | |
| simp only [Finset.sum_add_distrib,β Finset.mul_sum,hq1,mean] | |
| _ β€ 1+Real.exp a*Real.exp (-a) := | |
| add_le_add le_rfl (mul_le_mul_of_nonneg_left hsmall (Real.exp_nonneg _)) | |
| _ = 2 := by rw [β Real.exp_add,add_neg_cancel,Real.exp_zero]; norm_num | |
| have hmpos : 0 < mean q (fun x => Real.exp (if x β B then a else 0)) := by | |
| have : Nonempty Ξ± := by | |
| by_contra h | |
| have : IsEmpty Ξ± := not_nonempty_iff.mp h | |
| simp at hp1 | |
| exact Finset.sum_pos (fun x _ => mul_pos (hq x) (Real.exp_pos _)) Finset.univ_nonempty | |
| have hlog := Real.log_le_log hmpos hm | |
| have he : mean p (fun x => if x β B then a else 0) = | |
| a*mean p (fun x => if x β B then 1 else 0) := by | |
| simp only [mean,Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| split_ifs <;> ring | |
| rw [he] at h | |
| linarith only [h,hlog] | |
| lemma hellinger_pointwise {p q : β} (hp : 0 β€ p) (hq : 0 < q) : | |
| 2*p-2*Real.sqrt p*Real.sqrt q β€ p*Real.log (p/q) := by | |
| rcases eq_or_lt_of_le hp with hp0 | hp0 | |
| Β· simp [β hp0] | |
| have hp' := Real.sqrt_pos.mpr hp0 | |
| have hq' := Real.sqrt_pos.mpr hq | |
| have hlog := Real.log_le_sub_one_of_pos (div_pos hq' hp') | |
| have h := mul_le_mul_of_nonneg_left hlog (by positivity : 0 β€ 2*p) | |
| have he : Real.log (Real.sqrt q/Real.sqrt p) = -(Real.log (p/q))/2 := by | |
| rw [Real.log_div (ne_of_gt hq') (ne_of_gt hp'),Real.log_sqrt hq.le,Real.log_sqrt hp, | |
| Real.log_div (ne_of_gt hp0) (ne_of_gt hq)] | |
| ring | |
| rw [he] at h | |
| have hr : p*(Real.sqrt q/Real.sqrt p) = Real.sqrt p*Real.sqrt q := by | |
| nth_rw 1 [β Real.sq_sqrt hp] | |
| field_simp | |
| nlinarith only [h,hr] | |
| lemma hellinger_le_entropy (p q : Ξ± β β) (hp : β x, 0 β€ p x) | |
| (hq : β x, 0 < q x) (hp1 : β x, p x = 1) (hq1 : β x, q x = 1) : | |
| (β x, (Real.sqrt (p x)-Real.sqrt (q x))^2) β€ relativeEntropy p q := by | |
| have h := Finset.sum_le_sum (s := Finset.univ) | |
| (fun x _ => hellinger_pointwise (hp x) (hq x)) | |
| have he (x : Ξ±) : (Real.sqrt (p x)-Real.sqrt (q x))^2 = | |
| p x+q x-2*Real.sqrt (p x)*Real.sqrt (q x) := by | |
| nlinarith only [Real.sq_sqrt (hp x),Real.sq_sqrt (hq x).le] | |
| simp only [he,Finset.sum_sub_distrib,Finset.sum_add_distrib,hp1,hq1] | |
| simpa only [Finset.sum_sub_distrib,β Finset.mul_sum,hp1,relativeEntropy, | |
| mul_one,show (1:β)+1=2 by norm_num] using h | |
| lemma totalVariation_square_le_entropy (p q : Ξ± β β) (hp : β x, 0 β€ p x) | |
| (hq : β x, 0 < q x) (hp1 : β x, p x = 1) (hq1 : β x, q x = 1) : | |
| totalVariation p q ^ 2 β€ relativeEntropy p q := by | |
| have hcs := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ | |
| (fun x => |Real.sqrt (p x)-Real.sqrt (q x)|) | |
| (fun x => Real.sqrt (p x)+Real.sqrt (q x)) | |
| have he (x : Ξ±) : |Real.sqrt (p x)-Real.sqrt (q x)| * | |
| (Real.sqrt (p x)+Real.sqrt (q x)) = |p x-q x| := by | |
| rw [β abs_of_nonneg (add_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _)),β abs_mul] | |
| congr 1 | |
| nlinarith only [Real.sq_sqrt (hp x),Real.sq_sqrt (hq x).le] | |
| have hrest : β x, (Real.sqrt (p x)+Real.sqrt (q x))^2 β€ 4 := by | |
| calc | |
| _ β€ β x, (2*p x+2*q x) := by | |
| apply Finset.sum_le_sum | |
| intro x _ | |
| nlinarith only [sq_nonneg (Real.sqrt (p x)-Real.sqrt (q x)), | |
| Real.sq_sqrt (hp x),Real.sq_sqrt (hq x).le] | |
| _ = 4 := by simp only [Finset.sum_add_distrib,β Finset.mul_sum,hp1,hq1]; norm_num | |
| simp only [he,sq_abs] at hcs | |
| have hb := mul_le_mul_of_nonneg_left hrest (Finset.sum_nonneg (s := Finset.univ) (fun x _ => sq_nonneg | |
| (Real.sqrt (p x)-Real.sqrt (q x)))) | |
| have hh := hellinger_le_entropy p q hp hq hp1 hq1 | |
| unfold totalVariation | |
| nlinarith only [hcs,hb,hh] | |
| end SKRatio.FiniteLaw | |
| namespace SKRatio.Calculus | |
| attribute [local instance] Classical.propDecidable | |
| lemma continuousKernel_balance {n : β} (g : Disorder n) (t : β) (x y : Spin n) : | |
| mass g 0 x*continuousKernel (coupling g) t x y = | |
| mass g 0 y*continuousKernel (coupling g) t y x := by | |
| have hs := semigroup_symmetric g t (fun z => if z = x then 1 else 0) | |
| (fun z => if z = y then 1 else 0) | |
| simpa only [stationaryInner,FiniteLaw.mean,ite_mul,one_mul,zero_mul,mul_ite, | |
| mul_one,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,βreduceIte,continuousKernel] | |
| using hs | |
| def transitionDensity {n : β} (g : Disorder n) (t : β) (x : Spin n) : Observables n := | |
| fun y => continuousKernel (coupling g) t x y/mass g 0 y | |
| lemma transitionDensity_eq_semigroup {n : β} (g : Disorder n) (t : β) (x : Spin n) : | |
| transitionDensity g t x = semigroup (coupling g) t | |
| (fun y => if y = x then (mass g 0 x)β»ΒΉ else 0) := by | |
| funext y | |
| rw [semigroup_eq_kernel] | |
| simp only [FiniteLaw.mean,mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,βreduceIte] | |
| dsimp only [transitionDensity] | |
| field_simp [ne_of_gt (mass_pos g 0 x),ne_of_gt (mass_pos g 0 y)] | |
| nlinarith only [continuousKernel_balance g t x y] | |
| lemma transitionDensity_pos {n : β} (g : Disorder n) {t : β} (ht : 0 < t) (x y : Spin n) : | |
| 0 < transitionDensity g t x y := div_pos (continuousKernel_pos g ht x y) (mass_pos g 0 y) | |
| lemma transitionDensity_mean {n : β} (g : Disorder n) (t : β) (x : Spin n) : | |
| FiniteLaw.mean (mass g 0) (transitionDensity g t x) = 1 := by | |
| simp only [FiniteLaw.mean,transitionDensity,mul_div_cancelβ _ (ne_of_gt (mass_pos g 0 _)), | |
| continuousKernel_sum] | |
| lemma transitionDensity_hasDerivAt {n : β} (g : Disorder n) (x : Spin n) (t : β) : | |
| HasDerivAt (fun t => transitionDensity g t x) | |
| (generator (coupling g) (transitionDensity g t x)) t := by | |
| simp_rw [transitionDensity_eq_semigroup] | |
| exact semigroup_apply_hasDerivAt' _ _ _ | |
| def transitionEntropy {n : β} (g : Disorder n) (x : Spin n) (t : β) : β := | |
| FiniteLaw.relativeEntropy (continuousKernel (coupling g) t x) (mass g 0) | |
| lemma transitionEntropy_eq {n : β} (g : Disorder n) (x : Spin n) (t : β) : | |
| transitionEntropy g x t = | |
| FiniteLaw.mean (mass g 0) (fun y => transitionDensity g t x y * | |
| Real.log (transitionDensity g t x y)) := by | |
| rw [transitionEntropy,β FiniteLaw.entropy_density _ _ (fun y => ne_of_gt (mass_pos g 0 y)) | |
| (continuousKernel_sum _ t x)] | |
| change FiniteLaw.entropy (mass g 0) (transitionDensity g t x) = _ | |
| simp only [FiniteLaw.entropy,transitionDensity_mean,Real.log_one,mul_zero,sub_zero] | |
| lemma transitionEntropy_continuous {n : β} (g : Disorder n) (x : Spin n) : | |
| Continuous (transitionEntropy g x) := by | |
| exact (FiniteLaw.relativeEntropy_continuous (mass g 0) (fun y => ne_of_gt (mass_pos g 0 y))).comp | |
| (continuous_pi (continuousKernel_continuous_time (coupling g) x)) | |
| lemma transitionEntropy_zero {n : β} (g : Disorder n) (x : Spin n) : | |
| transitionEntropy g x 0 = Real.log (1/mass g 0 x) := by | |
| simp [transitionEntropy,FiniteLaw.relativeEntropy,Matrix.one_apply,ite_mul,ite_div] | |
| lemma transitionEntropy_hasDerivAt {n : β} (g : Disorder n) (x : Spin n) | |
| {t : β} (ht : 0 < t) : | |
| HasDerivAt (transitionEntropy g x) | |
| (stationaryInner g (generator (coupling g) (transitionDensity g t x)) | |
| (fun y => Real.log (transitionDensity g t x y))) t := by | |
| have hd (y : Spin n) := hasDerivAt_pi.mp (transitionDensity_hasDerivAt g x t) y | |
| have hp (y : Spin n) := (Real.hasDerivAt_mul_log | |
| (ne_of_gt (transitionDensity_pos g ht x y))).comp t (hd y) | |
| have hm := (gibbsMeanCLM g).hasFDerivAt.comp_hasDerivAt t (hasDerivAt_pi.mpr hp) | |
| have he : (fun t => gibbsMeanCLM g (fun y => transitionDensity g t x y* | |
| Real.log (transitionDensity g t x y))) = transitionEntropy g x := by | |
| funext t | |
| rw [gibbsMeanCLM_apply,transitionEntropy_eq] | |
| change HasDerivAt (fun r => gibbsMeanCLM g | |
| (fun y => transitionDensity g r x y*Real.log (transitionDensity g r x y))) _ t at hm | |
| rw [he] at hm | |
| apply hm.congr_deriv | |
| have hz := gibbsMean_generator g (transitionDensity g t x) | |
| simp only [gibbsMeanCLM_apply,FiniteLaw.mean] at hz β’ | |
| simp only [stationaryInner,FiniteLaw.mean,add_mul,one_mul,mul_add,Finset.sum_add_distrib,hz, | |
| add_zero] | |
| exact Finset.sum_congr rfl (fun y _ => by ring) | |
| theorem transitionEntropy_decay {n : β} (g : Disorder n) {Ο : β} | |
| (hmlsi : β F : Observables n, (β y, 0 < F y) β FiniteLaw.mean (mass g 0) F = 1 β | |
| Ο*FiniteLaw.entropy (mass g 0) F β€ | |
| -stationaryInner g (generator (coupling g) F) (fun y => Real.log (F y))) | |
| (x : Spin n) {t : β} (ht : 0 β€ t) : | |
| transitionEntropy g x t β€ Real.exp (-Ο*t)*Real.log (1/mass g 0 x) := by | |
| let H (r : β) := Real.exp (Ο*r)*transitionEntropy g x r | |
| have hd (r : β) (hr : 0 < r) : HasDerivAt H | |
| (Real.exp (Ο*r)*(Ο*transitionEntropy g x r+ | |
| stationaryInner g (generator (coupling g) (transitionDensity g r x)) | |
| (fun y => Real.log (transitionDensity g r x y)))) r := by | |
| have h := (((hasDerivAt_id r).const_mul Ο).exp).mul (transitionEntropy_hasDerivAt g x hr) | |
| convert! h using 1 | |
| first | rfl | (simp only [id_eq]; ring) | |
| have hc : Continuous H := (Real.continuous_exp.comp (continuous_const.mul continuous_id)).mul | |
| (transitionEntropy_continuous g x) | |
| have hanti : AntitoneOn H (Set.Ici 0) := by | |
| apply antitoneOn_of_deriv_nonpos (convex_Ici _) hc.continuousOn | |
| Β· intro r hr | |
| rw [interior_Ici,Set.mem_Ioi] at hr | |
| exact (hd r hr).differentiableAt.differentiableWithinAt | |
| Β· intro r hr | |
| rw [interior_Ici,Set.mem_Ioi] at hr | |
| rw [(hd r hr).deriv] | |
| apply mul_nonpos_of_nonneg_of_nonpos (Real.exp_nonneg _) | |
| have h := hmlsi (transitionDensity g r x) (transitionDensity_pos g hr x) | |
| (transitionDensity_mean g r x) | |
| rw [FiniteLaw.entropy,transitionDensity_mean,Real.log_one,mul_zero,sub_zero, | |
| β transitionEntropy_eq] at h | |
| linarith only [h] | |
| have h := hanti (by simp) ht ht | |
| have hzero : H 0 = Real.log (1/mass g 0 x) := by simp [H,transitionEntropy_zero] | |
| rw [hzero] at h | |
| have hm := mul_le_mul_of_nonneg_left h (Real.exp_nonneg (-Ο*t)) | |
| calc | |
| _ = Real.exp (-Ο*t)*H t := by | |
| dsimp only [H] | |
| rw [β mul_assoc,β Real.exp_add,show -Ο*t+Ο*t=0 by ring,Real.exp_zero,one_mul] | |
| _ β€ _ := hm | |
| lemma abs_hamiltonian_le_norm {n : β} (g : Disorder n) (x : Spin n) : | |
| |hamiltonian g 0 x| β€ euclideanOpNorm (coupling g)*(n:β)/2 := by | |
| let X : EuclideanSpace β (Fin n) := WithLp.toLp 2 (fun i => spinValue (x i)) | |
| have hid : hamiltonian g 0 x = (1/2:β)*inner β X | |
| (Matrix.toEuclideanCLM (π := β) (n := Fin n) (coupling g) X) := by | |
| rw [Matrix.inner_toEuclideanCLM (coupling g : Matrix (Fin n) (Fin n) β) X X] | |
| simp only [hamiltonian,Pi.zero_apply,zero_mul,Finset.sum_const_zero,add_zero,dotProduct, | |
| Matrix.mulVec,Finset.mul_sum,X,mul_assoc] | |
| have hX : βXβ^2 = (n:β) := by | |
| simp [X,EuclideanSpace.real_norm_sq_eq,Independent.spinValue_sq] | |
| rw [hid,abs_mul,abs_of_nonneg (by norm_num : (0:β)β€1/2)] | |
| calc | |
| _ β€ (1/2:β)*(βXβ*βMatrix.toEuclideanCLM (π := β) (n := Fin n) (coupling g) Xβ) := | |
| mul_le_mul_of_nonneg_left (abs_real_inner_le_norm _ _) (by norm_num) | |
| _ β€ (1/2:β)*(βXβ*(euclideanOpNorm (coupling g)*βXβ)) := | |
| mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left | |
| ((Matrix.toEuclideanCLM (π := β) (n := Fin n) (coupling g)).le_opNorm X) | |
| (norm_nonneg X)) (by norm_num) | |
| _ = _ := by rw [β hX]; ring | |
| lemma log_inverse_mass_le {n : β} (g : Disorder n) (x : Spin n) : | |
| Real.log (1/mass g 0 x) β€ (n:β)*(Real.log 2+euclideanOpNorm (coupling g)) := by | |
| let b := euclideanOpNorm (coupling g)*(n:β)/2 | |
| have he (y : Spin n) : |hamiltonian g 0 y| β€ b := abs_hamiltonian_le_norm g y | |
| have hp : partition g 0 β€ (2:β)^n*Real.exp b := by | |
| calc | |
| _ β€ β y : Spin n, Real.exp b := Finset.sum_le_sum | |
| (fun y _ => Real.exp_le_exp.mpr ((le_abs_self _).trans (he y))) | |
| _ = _ := by simp [Spin] | |
| have hlog := Real.log_le_log (partition_pos g 0) hp | |
| rw [Real.log_mul (by positivity : (2:β)^n β 0) (Real.exp_ne_zero _), | |
| Real.log_pow,Real.log_exp] at hlog | |
| have hinv : Real.log (1/mass g 0 x) = Real.log (partition g 0)-hamiltonian g 0 x := by | |
| rw [mass,weight,one_div_div,Real.log_div (ne_of_gt (partition_pos g 0)) (Real.exp_ne_zero _), | |
| Real.log_exp] | |
| rw [hinv] | |
| have hl := (abs_le.mp (he x)).1 | |
| dsimp only [b] at hlog hl | |
| linarith only [hlog,hl] | |
| lemma continuousDistance_square_le_entropy {n : β} (g : Disorder n) {t H : β} | |
| (ht : 0 β€ t) (hH : β x, transitionEntropy g x t β€ H) : | |
| continuousDistance g t ^ 2 β€ H := by | |
| obtain β¨x, -, hxβ© := Finset.exists_mem_eq_sup' Finset.univ_nonempty | |
| (fun x : Spin n => totalVariation (continuousKernel (coupling g) t x) (mass g 0)) | |
| change (Finset.univ.sup' _ _)^2 β€ _ | |
| rw [hx] | |
| exact (FiniteLaw.totalVariation_square_le_entropy _ _ (continuousKernel_nonneg _ t ht x) | |
| (mass_pos g 0) (continuousKernel_sum _ t x) (sum_mass g 0)).trans (hH x) | |
| lemma continuousDistance_square_decay {n : β} (g : Disorder n) {Ο : β} | |
| (hmlsi : β F : Observables n, (β y, 0 < F y) β FiniteLaw.mean (mass g 0) F = 1 β | |
| Ο*FiniteLaw.entropy (mass g 0) F β€ | |
| -stationaryInner g (generator (coupling g) F) (fun y => Real.log (F y))) | |
| {t : β} (ht : 0 β€ t) : | |
| continuousDistance g t ^ 2 β€ | |
| Real.exp (-Ο*t)*(n:β)*(Real.log 2+euclideanOpNorm (coupling g)) := by | |
| apply continuousDistance_square_le_entropy g ht | |
| intro x | |
| exact (transitionEntropy_decay g hmlsi x ht).trans | |
| (by | |
| simpa only [mul_assoc] using mul_le_mul_of_nonneg_left | |
| (log_inverse_mass_le g x) (Real.exp_nonneg (-Ο*t))) | |
| theorem uniform_median_upper_of_mlsi | |
| (G : β n : β, Set (Disorder n)) {Ο K : β} (hΟ : 0 < Ο) | |
| (hnorm : β n, β g β G n, euclideanOpNorm (coupling g) β€ K) | |
| (hmlsi : β n, β g β G n, β F : Observables n, | |
| (β y, 0 < F y) β FiniteLaw.mean (mass g 0) F = 1 β | |
| Ο*FiniteLaw.entropy (mass g 0) F β€ | |
| -stationaryInner g (generator (coupling g) F) (fun y => Real.log (F y))) : | |
| βαΆ n : β in atTop, β g β G n, medianTime g β€ (2/Ο)*Real.log n := by | |
| have hvan := (dimensionDecay_tendsto_zero (by norm_num : (0:β)<1)).mul_const (Real.log 2+K) | |
| simp only [zero_mul] at hvan | |
| filter_upwards [hvan.eventually (gt_mem_nhds (by norm_num : (0:β)<1/4)), | |
| eventually_ge_atTop 1] with n hnsmall hn | |
| intro g hg | |
| have htime : 0 β€ (2/Ο)*Real.log n := mul_nonneg (by positivity) | |
| (Real.log_nonneg (by exact_mod_cast hn)) | |
| apply (medianTime_le_iff g htime).mpr | |
| have h := continuousDistance_square_decay g (hmlsi n g hg) htime | |
| have hcoeff : Real.exp (-Ο*((2/Ο)*Real.log n))*(n:β) = dimensionDecay 1 n := by | |
| have hed : -Ο*((2/Ο)*Real.log n) = -2*Real.log n := by field_simp | |
| rw [hed,mul_comm,β dimensionDecay,nat_mul_dimensionDecay (by omega)] | |
| norm_num | |
| rw [hcoeff] at h | |
| have hkn := mul_le_mul_of_nonneg_left (add_le_add_left (hnorm n g hg) (Real.log 2)) | |
| (dimensionDecay_pos 1 n).le | |
| have hnD := continuousDistance_nonneg g ((2/Ο)*Real.log n) | |
| nlinarith only [h,hkn,hnsmall,hnD] | |
| end SKRatio.Calculus | |
| end | |
| end | |
| end OAI | |