Download data/lean/OAI/Probability/FreeIsing/Energy/RowEnergyL1.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 15.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Energy/RowEnergyL1.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Energy/RowEnergyL1.lean
-
curl -L -o RowEnergyL1.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Energy/RowEnergyL1.lean
15.1 kB
| import OAI.Probability.FreeIsing.Energy.DiscrepancyRowEnergy | |
| namespace OAI | |
| noncomputable section | |
| open MeasureTheory Filter | |
| open scoped Topology | |
| namespace Problem367.RowEnergyL1 | |
| private lemma abs_sq_sub_sq_le_young (x y : ā) {Ī“ : ā} (hĪ“ : 0 < Ī“) : | |
| |x ^ 2 - y ^ 2| ⤠(1 + 1 / Γ) * (x - y) ^ 2 + Γ * y ^ 2 := by | |
| have ha : |x ^ 2 - y ^ 2| ⤠(x - y) ^ 2 + 2 * |x - y| * |y| := by | |
| calc | |
| _ = |(x - y) ^ 2 + 2 * (x - y) * y| := by congr 1; ring | |
| _ ⤠|(x - y) ^ 2| + |2 * (x - y) * y| := abs_add_le _ _ | |
| _ = _ := by rw [abs_of_nonneg (sq_nonneg _), abs_mul, abs_mul]; norm_num | |
| have hsq := sq_nonneg (|x - y| - Ī“ * |y|) | |
| rw [sub_sq, mul_pow, sq_abs, sq_abs] at hsq | |
| have hdiv : Γ * (1 / Γ) = 1 := mul_one_div_cancel hΓ.ne' | |
| have hYoung : 2 * |x - y| * |y| ⤠(1 / Γ) * (x - y) ^ 2 + Γ * y ^ 2 := by | |
| apply (mul_le_mul_iff_rightā hĪ“).mp | |
| rw [mul_add, ā mul_assoc Ī“ (1 / Ī“), hdiv, one_mul] | |
| nlinarith | |
| linarith | |
| theorem abs_tsum_sq_sub_le {ι : Type*} {a b : ι ā ā} | |
| (ha : Summable (fun i => (a i) ^ 2)) | |
| (hb : Summable (fun i => (b i) ^ 2)) {Ī“ : ā} (hĪ“ : 0 < Ī“) : | |
| |(ā' i, (a i) ^ 2) - ā' i, (b i) ^ 2| ⤠| |
| (1 + 1 / Ī“) * (ā' i, (a i - b i) ^ 2) + Ī“ * ā' i, (b i) ^ 2 := by | |
| have hd := DiscrepancyEnergy.summable_sq_sub ha hb | |
| have habs : Summable (fun i => |(a i) ^ 2 - (b i) ^ 2|) := (ha.sub hb).abs | |
| rw [ā ha.tsum_sub hb] | |
| calc | |
| |(ā' i, ((a i) ^ 2 - (b i) ^ 2))| ⤠| |
| ā' i, |(a i) ^ 2 - (b i) ^ 2| := by | |
| simpa only [Real.norm_eq_abs] using | |
| (norm_tsum_le_tsum_norm (f := fun i => (a i) ^ 2 - (b i) ^ 2) | |
| (by simpa only [Real.norm_eq_abs] using habs)) | |
| _ ⤠ā' i, ((1 + 1 / Ī“) * (a i - b i) ^ 2 + Ī“ * (b i) ^ 2) := | |
| habs.tsum_le_tsum (fun i => abs_sq_sub_sq_le_young (a i) (b i) hΓ) | |
| ((hd.mul_left _).add (hb.mul_left _)) | |
| _ = _ := by rw [Summable.tsum_add (hd.mul_left _) (hb.mul_left _), | |
| tsum_mul_left, tsum_mul_left] | |
| variable {Ω ι : Type*} [MeasurableSpace Ω] [Countable ι] {μ : Measure Ω} | |
| theorem tendsto_integral_abs_tsum_sq_sub | |
| {N : Type*} {l : Filter N} {a : N ā ι ā Ī© ā ā} {b : ι ā Ī© ā ā} | |
| (ha : ā n i, MemLp (a n i) 2 μ) (hb : ā i, MemLp (b i) 2 μ) | |
| (haSum : ā n, Summable (fun i => ā« Ļ, (a n i Ļ) ^ 2 āμ)) | |
| (hbSum : Summable (fun i => ā« Ļ, (b i Ļ) ^ 2 āμ)) | |
| (hlim : Tendsto (fun n => ā' i, ā« Ļ, (a n i Ļ - b i Ļ) ^ 2 āμ) | |
| l (š 0)) : | |
| Tendsto (fun n => ā« Ļ, |(ā' i, (a n i Ļ) ^ 2) - ā' i, (b i Ļ) ^ 2| āμ) | |
| l (š 0) := by | |
| have hA n := DiscrepancyEnergy.sq_row_integrable_of_summable_integrals | |
| (fun i => (ha n i).integrable_sq) (haSum n) | |
| have hB := DiscrepancyEnergy.sq_row_integrable_of_summable_integrals | |
| (fun i => (hb i).integrable_sq) hbSum | |
| have hD n := DiscrepancyEnergy.integrable_sq_difference_row | |
| (fun i => (ha n i).aestronglyMeasurable) (fun i => (hb i).aestronglyMeasurable) | |
| (hA n).2 hB.2 ((hA n).1.and hB.1) | |
| have hDsum n := DiscrepancyEnergy.hasSum_integral_sq_row | |
| (fun i => ((ha n i).sub (hb i)).aestronglyMeasurable) | |
| (((hA n).1.and hB.1).mono (fun Ļ hĻ => | |
| DiscrepancyEnergy.summable_sq_sub hĻ.1 hĻ.2)) (hD n) | |
| have hDlim : Tendsto (fun n => ā« Ļ, ā' i, (a n i Ļ - b i Ļ) ^ 2 āμ) l (š 0) := by | |
| have heq (n : N) : (ā' i, ā« Ļ, (a n i Ļ - b i Ļ) ^ 2 āμ) = | |
| ā« Ļ, ā' i, (a n i Ļ - b i Ļ) ^ 2 āμ := by | |
| simpa only [Pi.sub_apply] using (hDsum n).tsum_eq | |
| simpa only [heq] using hlim | |
| let E : ā := ā« Ļ, ā' i, (b i Ļ) ^ 2 āμ | |
| have hE : 0 ⤠E := integral_nonneg (fun Ļ => tsum_nonneg (fun i => sq_nonneg _)) | |
| apply Metric.tendsto_nhds.mpr | |
| intro ε hε | |
| let Ī“ : ā := ε / (2 * (E + 1)) | |
| have hΓ : 0 < Γ := div_pos hε (by positivity) | |
| have hcoef : 0 < 1 + 1 / Ī“ := by positivity | |
| have hevent := hDlim.eventually (gt_mem_nhds | |
| (show 0 < ε / (2 * (1 + 1 / Γ)) by positivity)) | |
| filter_upwards [hevent] with n hn | |
| have hbound : (ā« Ļ, |(ā' i, (a n i Ļ) ^ 2) - ā' i, (b i Ļ) ^ 2| āμ) ⤠| |
| (1 + 1 / Ī“) * (ā« Ļ, ā' i, (a n i Ļ - b i Ļ) ^ 2 āμ) + Ī“ * E := by | |
| calc | |
| _ ⤠⫠Ļ, (1 + 1 / Ī“) * (ā' i, (a n i Ļ - b i Ļ) ^ 2) + | |
| Ī“ * (ā' i, (b i Ļ) ^ 2) āμ := by | |
| apply integral_mono_ae ((hA n).2.sub hB.2).abs | |
| (((hD n).const_mul _).add (hB.2.const_mul _)) | |
| filter_upwards [(hA n).1, hB.1] with Ļ hĻ hĻ' | |
| exact abs_tsum_sq_sub_le hĻ hĻ' hĪ“ | |
| _ = _ := by rw [integral_add ((hD n).const_mul _) (hB.2.const_mul _), | |
| integral_const_mul, integral_const_mul] | |
| have hfirst : (1 + 1 / Ī“) * (ā« Ļ, ā' i, (a n i Ļ - b i Ļ) ^ 2 āμ) < ε / 2 := by | |
| have hh := (lt_div_iffā (show 0 < 2 * (1 + 1 / Ī“) by positivity)).mp hn | |
| nlinarith | |
| have hsecond : Γ * E < ε / 2 := by | |
| dsimp [Ī“] | |
| rw [div_mul_eq_mul_div] | |
| apply (div_lt_iffā (show 0 < 2 * (E + 1) by positivity)).mpr | |
| nlinarith | |
| rw [Real.dist_eq, sub_zero, abs_of_nonneg (integral_nonneg (fun _ => abs_nonneg _))] | |
| linarith | |
| theorem tendsto_integral_abs_mul_sub | |
| {E : ā ā Ī© ā ā} {F : Ī© ā ā} {m : ā ā Ī© ā ā} {q : Ī© ā ā} {C : ā} | |
| (hE : ā n, Integrable (E n) μ) (hF : Integrable F μ) | |
| (hm : ā n, AEStronglyMeasurable (m n) μ) (hq : AEStronglyMeasurable q μ) | |
| (_hC : 0 ⤠C) (hmBound : ā n, āįµ Ļ āμ, |m n Ļ| ⤠C) | |
| (hqBound : āįµ Ļ āμ, |q Ļ| ⤠C) | |
| (hEconv : Tendsto (fun n => ā« Ļ, |E n Ļ - F Ļ| āμ) atTop (š 0)) | |
| (hmconv : āįµ Ļ āμ, Tendsto (fun n => m n Ļ) atTop (š (q Ļ))) : | |
| Tendsto (fun n => ā« Ļ, |m n Ļ * E n Ļ - q Ļ * F Ļ| āμ) atTop (š 0) := by | |
| have hDiffBound (n : ā) : āįµ Ļ āμ, ām n Ļ - q Ļā ⤠2 * C := by | |
| filter_upwards [hmBound n, hqBound] with Ļ hĻ hĻ' | |
| rw [Real.norm_eq_abs] | |
| exact (abs_sub _ _).trans (by linarith) | |
| have hDint (n : ā) : Integrable (fun Ļ => |(m n Ļ - q Ļ) * F Ļ|) μ := | |
| (hF.bdd_mul ((hm n).sub hq) (hDiffBound n)).abs | |
| have hDlim : Tendsto (fun n => ā« Ļ, |(m n Ļ - q Ļ) * F Ļ| āμ) atTop (š 0) := by | |
| have h := tendsto_integral_of_dominated_convergence (fun Ļ => (2 * C) * |F Ļ|) | |
| (fun n => (hDint n).aestronglyMeasurable) (hF.abs.const_mul (2 * C)) | |
| (fun n => ?_) (f := fun _ => (0 : ā)) ?_ | |
| Ā· simpa using h | |
| Ā· filter_upwards [hDiffBound n] with Ļ hĻ | |
| simpa only [Real.norm_eq_abs, abs_abs, abs_mul] using | |
| mul_le_mul_of_nonneg_right hĻ (abs_nonneg (F Ļ)) | |
| Ā· filter_upwards [hmconv] with Ļ hĻ | |
| simpa using ((hĻ.sub_const (q Ļ)).mul_const (F Ļ)).abs | |
| have hlim := (hEconv.const_mul C).add hDlim | |
| simp only [mul_zero, add_zero] at hlim | |
| apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds hlim | |
| (fun n => integral_nonneg (fun _ => abs_nonneg _)) | |
| intro n | |
| have hmBoundNorm : āįµ Ļ āμ, ām n Ļā ⤠C := by | |
| simpa only [Real.norm_eq_abs] using hmBound n | |
| have hqBoundNorm : āįµ Ļ āμ, āq Ļā ⤠C := by | |
| simpa only [Real.norm_eq_abs] using hqBound | |
| have hfirstInt : Integrable (fun Ļ => C * |E n Ļ - F Ļ|) μ := by | |
| simpa only [Pi.sub_apply] using ((hE n).sub hF).abs.const_mul C | |
| calc | |
| _ ⤠⫠Ļ, C * |E n Ļ - F Ļ| + |(m n Ļ - q Ļ) * F Ļ| āμ := by | |
| apply integral_mono_ae | |
| (((hE n).bdd_mul (hm n) hmBoundNorm).sub (hF.bdd_mul hq hqBoundNorm)).abs | |
| (hfirstInt.add (hDint n)) | |
| filter_upwards [hmBound n] with Ļ hĻ | |
| change |m n Ļ * E n Ļ - q Ļ * F Ļ| ⤠_ | |
| calc | |
| _ = |m n Ļ * (E n Ļ - F Ļ) + (m n Ļ - q Ļ) * F Ļ| := by | |
| congr 1 | |
| ring | |
| _ ⤠|m n Ļ * (E n Ļ - F Ļ)| + |(m n Ļ - q Ļ) * F Ļ| := abs_add_le _ _ | |
| _ ⤠_ := by | |
| rw [abs_mul] | |
| exact add_le_add (mul_le_mul_of_nonneg_right hĻ (abs_nonneg _)) le_rfl | |
| _ = _ := by rw [integral_add hfirstInt (hDint n), | |
| integral_const_mul] | |
| theorem tendsto_integral_abs_multiplier_tsum_sq_sub | |
| {a : ā ā ι ā Ī© ā ā} {b : ι ā Ī© ā ā} | |
| {m : ā ā Ī© ā ā} {q : Ī© ā ā} {C : ā} | |
| (ha : ā n i, MemLp (a n i) 2 μ) (hb : ā i, MemLp (b i) 2 μ) | |
| (haSum : ā n, Summable (fun i => ā« Ļ, (a n i Ļ) ^ 2 āμ)) | |
| (hbSum : Summable (fun i => ā« Ļ, (b i Ļ) ^ 2 āμ)) | |
| (hlim : Tendsto (fun n => ā' i, ā« Ļ, (a n i Ļ - b i Ļ) ^ 2 āμ) | |
| atTop (š 0)) | |
| (hm : ā n, AEStronglyMeasurable (m n) μ) (hq : AEStronglyMeasurable q μ) | |
| (hC : 0 ⤠C) (hmBound : ā n, āįµ Ļ āμ, |m n Ļ| ⤠C) | |
| (hqBound : āįµ Ļ āμ, |q Ļ| ⤠C) | |
| (hmconv : āįµ Ļ āμ, Tendsto (fun n => m n Ļ) atTop (š (q Ļ))) : | |
| Tendsto (fun n => ā« Ļ, | |
| |m n Ļ * (ā' i, (a n i Ļ) ^ 2) - q Ļ * (ā' i, (b i Ļ) ^ 2)| āμ) | |
| atTop (š 0) := by | |
| apply tendsto_integral_abs_mul_sub | |
| (fun n => (DiscrepancyEnergy.sq_row_integrable_of_summable_integrals | |
| (fun i => (ha n i).integrable_sq) (haSum n)).2) | |
| (DiscrepancyEnergy.sq_row_integrable_of_summable_integrals | |
| (fun i => (hb i).integrable_sq) hbSum).2 | |
| hm hq hC hmBound hqBound | |
| Ā· exact tendsto_integral_abs_tsum_sq_sub ha hb haSum hbSum hlim | |
| Ā· exact hmconv | |
| theorem integral_abs_timePrimitive_le [SFinite μ] | |
| {E : ā ā Ī© ā ā} {T t : ā} (ht : t ā Set.Icc 0 T) | |
| (hE : Integrable (fun p : ā Ć Ī© => E p.1 p.2) | |
| ((volume.restrict (Set.Ioc 0 T)).prod μ)) : | |
| (ā« Ļ, |ā« s in (0 : ā)..t, E s Ļ| āμ) ⤠| |
| ā« p : ā Ć Ī©, |E p.1 p.2| ā(volume.restrict (Set.Ioc 0 T)).prod μ := by | |
| have hmeasure : (volume.restrict (Set.Ioc 0 t)).prod μ ⤠| |
| (volume.restrict (Set.Ioc 0 T)).prod μ := | |
| Measure.prod_mono (Measure.restrict_mono_set _ (Set.Ioc_subset_Ioc_right ht.2)) le_rfl | |
| have hEt := hE.mono_measure hmeasure | |
| simp only [intervalIntegral.integral_of_le ht.1] | |
| calc | |
| _ ⤠⫠Ļ, (ā« s in Set.Ioc 0 t, |E s Ļ|) āμ := by | |
| apply integral_mono hEt.integral_prod_right.abs hEt.abs.integral_prod_right | |
| intro Ļ | |
| simpa only [Real.norm_eq_abs] using | |
| norm_integral_le_integral_norm (fun s => E s Ļ) | |
| _ = ā« p : ā Ć Ī©, |E p.1 p.2| ā(volume.restrict (Set.Ioc 0 t)).prod μ := | |
| (integral_prod_symm _ hEt.abs).symm | |
| _ ⤠_ := integral_mono_measure hmeasure | |
| (Eventually.of_forall (fun p => abs_nonneg (E p.1 p.2))) hE.abs | |
| theorem integral_abs_timePrimitive_sub_le [SFinite μ] | |
| {E F : ā ā Ī© ā ā} {T t : ā} (ht : t ā Set.Icc 0 T) | |
| (hE : Integrable (fun p : ā Ć Ī© => E p.1 p.2) | |
| ((volume.restrict (Set.Ioc 0 T)).prod μ)) | |
| (hF : Integrable (fun p : ā Ć Ī© => F p.1 p.2) | |
| ((volume.restrict (Set.Ioc 0 T)).prod μ)) : | |
| (ā« Ļ, |(ā« s in (0 : ā)..t, E s Ļ) - ā« s in (0 : ā)..t, F s Ļ| āμ) ⤠| |
| ā« p : ā Ć Ī©, |E p.1 p.2 - F p.1 p.2| | |
| ā(volume.restrict (Set.Ioc 0 T)).prod μ := by | |
| have hmeasure : (volume.restrict (Set.Ioc 0 t)).prod μ ⤠| |
| (volume.restrict (Set.Ioc 0 T)).prod μ := | |
| Measure.prod_mono (Measure.restrict_mono_set _ (Set.Ioc_subset_Ioc_right ht.2)) le_rfl | |
| have hEt := hE.mono_measure hmeasure | |
| have hFt := hF.mono_measure hmeasure | |
| calc | |
| _ = ā« Ļ, |ā« s in (0 : ā)..t, E s Ļ - F s Ļ| āμ := by | |
| apply integral_congr_ae | |
| filter_upwards [hEt.prod_left_ae, hFt.prod_left_ae] with Ļ hEĻ hFĻ | |
| simp only [intervalIntegral.integral_of_le ht.1] | |
| rw [integral_sub hEĻ hFĻ] | |
| _ ⤠_ := integral_abs_timePrimitive_le ht (hE.sub hF) | |
| theorem timePrimitive_sub_tendsto_uniform_L1 [SFinite μ] | |
| {N : Type*} {l : Filter N} {E : N ā ā ā Ī© ā ā} {F : ā ā Ī© ā ā} {T : ā} | |
| (hE : ā n, Integrable (fun p : ā Ć Ī© => E n p.1 p.2) | |
| ((volume.restrict (Set.Ioc 0 T)).prod μ)) | |
| (hF : Integrable (fun p : ā Ć Ī© => F p.1 p.2) | |
| ((volume.restrict (Set.Ioc 0 T)).prod μ)) | |
| (hlim : Tendsto (fun n => ā« p : ā Ć Ī©, |E n p.1 p.2 - F p.1 p.2| | |
| ā(volume.restrict (Set.Ioc 0 T)).prod μ) l (š 0)) : | |
| ā ε > (0 : ā), āį¶ n in l, ā t ā Set.Icc 0 T, | |
| (ā« Ļ, |(ā« s in (0 : ā)..t, E n s Ļ) - ā« s in (0 : ā)..t, F s Ļ| āμ) < ε := by | |
| intro ε hε | |
| filter_upwards [hlim.eventually (gt_mem_nhds hε)] with n hn | |
| intro t ht | |
| exact (integral_abs_timePrimitive_sub_le ht (hE n) hF).trans_lt hn | |
| theorem tendsto_integral_abs_mul_sub_of_tendstoInMeasure | |
| {E : ā ā Ī© ā ā} {F : Ī© ā ā} {m : ā ā Ī© ā ā} {q : Ī© ā ā} {C : ā} | |
| (hE : ā n, Integrable (E n) μ) (hF : Integrable F μ) | |
| (hm : ā n, AEStronglyMeasurable (m n) μ) (hq : AEStronglyMeasurable q μ) | |
| (hC : 0 ⤠C) (hmBound : ā n, āįµ Ļ āμ, |m n Ļ| ⤠C) | |
| (hqBound : āįµ Ļ āμ, |q Ļ| ⤠C) | |
| (hEconv : Tendsto (fun n => ā« Ļ, |E n Ļ - F Ļ| āμ) atTop (š 0)) | |
| (hmconv : TendstoInMeasure μ m atTop q) : | |
| Tendsto (fun n => ā« Ļ, |m n Ļ * E n Ļ - q Ļ * F Ļ| āμ) atTop (š 0) := by | |
| apply tendsto_of_subseq_tendsto | |
| intro ns hns | |
| obtain āØms, hms, hmaeā© := (hmconv.comp hns).exists_seq_tendsto_ae | |
| refine āØms, ?_ā© | |
| exact tendsto_integral_abs_mul_sub | |
| (fun n => hE (ns (ms n))) hF (fun n => hm (ns (ms n))) hq hC | |
| (fun n => hmBound (ns (ms n))) hqBound | |
| (hEconv.comp (hns.comp hms.tendsto_atTop)) hmae | |
| theorem tendstoInMeasure_of_integral_sq_sub | |
| {m : ā ā Ī© ā ā} {q : Ī© ā ā} | |
| (hm : ā n, MemLp (m n) 2 μ) (hq : MemLp q 2 μ) | |
| (hlim : Tendsto (fun n => ā« Ļ, (m n Ļ - q Ļ) ^ 2 āμ) atTop (š 0)) : | |
| TendstoInMeasure μ m atTop q := by | |
| apply tendstoInMeasure_of_tendsto_eLpNorm (p := 2) (by norm_num) | |
| have heq n : eLpNorm (m n - q) 2 μ = | |
| ENNReal.ofReal (Real.sqrt (ā« Ļ, (m n Ļ - q Ļ) ^ 2 āμ)) := by | |
| rw [MemLp.eLpNorm_eq_integral_rpow_norm (by norm_num) (by norm_num) | |
| ((hm n).sub hq)] | |
| simp only [ENNReal.toReal_ofNat, Pi.sub_apply, Real.rpow_two, Real.norm_eq_abs, | |
| sq_abs, Real.sqrt_eq_rpow, one_div] | |
| simp only [heq] | |
| simpa only [Function.comp_def, Real.sqrt_zero, ENNReal.ofReal_zero] using | |
| ENNReal.continuous_ofReal.continuousAt.tendsto.comp hlim.sqrt | |
| theorem tendsto_integral_abs_mul_sub_of_meanSquare | |
| {E : ā ā Ī© ā ā} {F : Ī© ā ā} {m : ā ā Ī© ā ā} {q : Ī© ā ā} {C : ā} | |
| (hE : ā n, Integrable (E n) μ) (hF : Integrable F μ) | |
| (hm : ā n, MemLp (m n) 2 μ) (hq : MemLp q 2 μ) | |
| (hC : 0 ⤠C) (hmBound : ā n, āįµ Ļ āμ, |m n Ļ| ⤠C) | |
| (hqBound : āįµ Ļ āμ, |q Ļ| ⤠C) | |
| (hEconv : Tendsto (fun n => ā« Ļ, |E n Ļ - F Ļ| āμ) atTop (š 0)) | |
| (hmconv : Tendsto (fun n => ā« Ļ, (m n Ļ - q Ļ) ^ 2 āμ) atTop (š 0)) : | |
| Tendsto (fun n => ā« Ļ, |m n Ļ * E n Ļ - q Ļ * F Ļ| āμ) atTop (š 0) := | |
| tendsto_integral_abs_mul_sub_of_tendstoInMeasure hE hF | |
| (fun n => (hm n).aestronglyMeasurable) hq.aestronglyMeasurable | |
| hC hmBound hqBound hEconv (tendstoInMeasure_of_integral_sq_sub hm hq hmconv) | |
| end Problem367.RowEnergyL1 | |
| end | |
| end OAI | |