math / data /lean /OAI /Probability /FreeIsing /Stochastic /RandomRiemannCompensator.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
10.2 kB
import OAI.Probability.FreeIsing.Energy.EnergyRiemannApproximation
namespace OAI
noncomputable section
open MeasureTheory Filter Set
open scoped Topology ENNReal NNReal
namespace Problem367.RandomRiemann
def partitionSum (f : ℝ β†’ ℝ) (Ο„ : β„• β†’ ℝ) (n : β„•) : ℝ :=
βˆ‘ i ∈ Finset.range n, (Ο„ (i + 1) - Ο„ i) * f (Ο„ i)
theorem abs_partitionSum_le {f : ℝ β†’ ℝ} {Ο„ : β„• β†’ ℝ} (hΟ„ : Monotone Ο„)
(n : β„•) {C : ℝ} (hb : βˆ€ i < n, |f (Ο„ i)| ≀ C) :
|partitionSum f Ο„ n| ≀ C * (Ο„ n - Ο„ 0) := by
calc
_ ≀ βˆ‘ i ∈ Finset.range n, |(Ο„ (i + 1) - Ο„ i) * f (Ο„ i)| :=
Finset.abs_sum_le_sum_abs _ _
_ ≀ βˆ‘ i ∈ Finset.range n, C * (Ο„ (i + 1) - Ο„ i) := by
apply Finset.sum_le_sum
intro i hi
rw [abs_mul, abs_of_nonneg (sub_nonneg.mpr (hΟ„ (Nat.le_succ i)))]
nlinarith [mul_le_mul_of_nonneg_left (hb i (Finset.mem_range.mp hi))
(sub_nonneg.mpr (hΟ„ (Nat.le_succ i)))]
_ = _ := by rw [← Finset.mul_sum, Finset.sum_range_sub]
theorem partition_error_le {f : ℝ β†’ ℝ} (hf : Continuous f)
{Ο„ : β„• β†’ ℝ} (hΟ„ : Monotone Ο„) (n : β„•) {Ξ΅ : ℝ}
(hmod : βˆ€ i < n, βˆ€ x ∈ Icc (Ο„ i) (Ο„ (i + 1)), |f (Ο„ i) - f x| ≀ Ξ΅) :
|partitionSum f Ο„ n - ∫ x in Ο„ 0..Ο„ n, f x| ≀ Ξ΅ * (Ο„ n - Ο„ 0) := by
have hsplit := intervalIntegral.sum_integral_adjacent_intervals
(ΞΌ := volume) (a := Ο„) (n := n) (fun i _ => hf.intervalIntegrable _ _)
have heq : partitionSum f Ο„ n - (∫ x in Ο„ 0..Ο„ n, f x) =
βˆ‘ i ∈ Finset.range n, ∫ x in Ο„ i..Ο„ (i + 1), f (Ο„ i) - f x := by
rw [partitionSum, ← hsplit, ← Finset.sum_sub_distrib]
apply Finset.sum_congr rfl
intro i hi
rw [intervalIntegral.integral_sub intervalIntegrable_const (hf.intervalIntegrable _ _),
intervalIntegral.integral_const, smul_eq_mul]
rw [heq]
calc
_ ≀ βˆ‘ i ∈ Finset.range n, |∫ x in Ο„ i..Ο„ (i + 1), f (Ο„ i) - f x| :=
Finset.abs_sum_le_sum_abs _ _
_ ≀ βˆ‘ i ∈ Finset.range n, Ξ΅ * (Ο„ (i + 1) - Ο„ i) := by
apply Finset.sum_le_sum
intro i hi
have hle := hΟ„ (Nat.le_succ i)
have h := intervalIntegral.norm_integral_le_of_norm_le_const
(a := Ο„ i) (b := Ο„ (i + 1)) (C := Ξ΅)
(f := fun x => f (Ο„ i) - f x) (fun x hx => ?_)
Β· simpa only [Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr hle)] using h
Β· rw [uIoc_of_le hle] at hx
exact hmod i (Finset.mem_range.mp hi) x ⟨hx.1.le, hx.2⟩
_ = _ := by rw [← Finset.mul_sum, Finset.sum_range_sub]
def stoppedPoint (T t : ℝ) (n i : β„•) : ℝ := min t (EnergyRiemann.point T n i)
def stoppedSum (f : ℝ β†’ ℝ) (T t : ℝ) (n : β„•) : ℝ :=
βˆ‘ i ∈ Finset.range n,
(stoppedPoint T t n (i + 1) - stoppedPoint T t n i) * f (EnergyRiemann.point T n i)
theorem stoppedPoint_mono {T : ℝ} (hT : 0 ≀ T) (t : ℝ) (n : β„•) :
Monotone (stoppedPoint T t n) := fun _ _ hij =>
min_le_min_left t (EnergyRiemann.point_mono hT n hij)
theorem stoppedPoint_zero (T : ℝ) {t : ℝ} (ht : 0 ≀ t) (n : β„•) :
stoppedPoint T t n 0 = 0 := by simp [stoppedPoint, ht]
theorem stoppedPoint_end (T t : ℝ) {n : β„•} (hn : 0 < n) :
stoppedPoint T t n n = min t T := by rw [stoppedPoint, EnergyRiemann.point_end T hn]
theorem stoppedPoint_step_le {T : ℝ} (hT : 0 ≀ T) (t : ℝ) (n i : β„•) :
stoppedPoint T t n (i + 1) - stoppedPoint T t n i ≀ T / n := by
have hle := EnergyRiemann.point_mono hT n (Nat.le_succ i)
have hstep := EnergyRiemann.point_step T n i
unfold stoppedPoint
by_cases hi : EnergyRiemann.point T n i ≀ t
Β· rw [min_eq_right hi]
exact (sub_le_sub_right (min_le_right t _) _).trans_eq hstep
Β· have ht : t ≀ EnergyRiemann.point T n i := le_of_not_ge hi
rw [min_eq_left ht, min_eq_left (ht.trans hle), sub_self]
positivity
theorem stoppedSum_eq_partitionSum {T : ℝ} (hT : 0 ≀ T)
(f : ℝ β†’ ℝ) (t : ℝ) (n : β„•) :
stoppedSum f T t n = partitionSum f (stoppedPoint T t n) n := by
apply Finset.sum_congr rfl
intro i hi
by_cases hit : EnergyRiemann.point T n i ≀ t
Β· simp only [stoppedPoint, min_eq_right hit]
Β· have ht : t ≀ EnergyRiemann.point T n i := le_of_not_ge hit
have ht' := ht.trans (EnergyRiemann.point_mono hT n (Nat.le_succ i))
simp only [stoppedPoint, min_eq_left ht, min_eq_left ht', sub_self, zero_mul]
theorem abs_stoppedSum_le {T t C : ℝ} (hT : 0 ≀ T) (ht : 0 ≀ t)
{f : ℝ β†’ ℝ} (hb : βˆ€ x, |f x| ≀ C) (n : β„•) :
|stoppedSum f T t n| ≀ C * min t T := by
by_cases hn : n = 0
Β· subst n
simp only [stoppedSum, Finset.range_zero, Finset.sum_empty, abs_zero]
exact mul_nonneg ((abs_nonneg (f 0)).trans (hb 0)) (le_min ht hT)
Β· rw [stoppedSum_eq_partitionSum hT]
simpa only [stoppedPoint_zero T ht, stoppedPoint_end T t (Nat.pos_of_ne_zero hn), sub_zero]
using abs_partitionSum_le (stoppedPoint_mono hT t n) n (fun i _ => hb _)
theorem tendsto_stoppedSum {f : ℝ β†’ ℝ} (hf : Continuous f)
{T t : ℝ} (hT : 0 ≀ T) (ht : 0 ≀ t) :
Tendsto (stoppedSum f T t) atTop (𝓝 (∫ x in (0 : ℝ)..min t T, f x)) := by
apply Metric.tendsto_atTop.mpr
intro Ξ΅ hΞ΅
let Ξ· := Ξ΅ / (T + 1)
have hΞ· : 0 < Ξ· := div_pos hΞ΅ (by linarith)
have hUC := isCompact_Icc.uniformContinuousOn_of_continuous
(s := Icc (0 : ℝ) T) hf.continuousOn
obtain ⟨δ, hδ, hδmod⟩ := Metric.uniformContinuousOn_iff.mp hUC η hη
have hwidth : Tendsto (fun n : β„• => T / (n : ℝ)) atTop (𝓝 0) :=
tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop
have hev : βˆ€αΆ  n : β„• in atTop, T / (n : ℝ) < Ξ΄ := hwidth.eventually (gt_mem_nhds hΞ΄)
obtain ⟨N, hN⟩ := (hev.and (eventually_ge_atTop 1)).exists_forall_of_atTop
refine ⟨N, ?_⟩
intro n hn
obtain ⟨hmesh, hnpos⟩ := hN n hn
have hn' : 0 < n := hnpos
have hmem (i : β„•) (hi : i ≀ n) : stoppedPoint T t n i ∈ Icc (0 : ℝ) T := by
constructor
Β· rw [← stoppedPoint_zero T ht n]
exact stoppedPoint_mono hT t n (Nat.zero_le i)
Β· exact (stoppedPoint_mono hT t n hi).trans
((stoppedPoint_end T t hn').le.trans (min_le_right t T))
have he := partition_error_le hf (stoppedPoint_mono hT t n) n (Ξ΅ := Ξ·) ?_
Β· rw [stoppedPoint_zero T ht, stoppedPoint_end T t hn',
← stoppedSum_eq_partitionSum hT] at he
change |stoppedSum f T t n - ∫ x in (0 : ℝ)..min t T, f x| < Ξ΅
calc
_ ≀ Ξ· * (min t T - 0) := he
_ ≀ Ξ· * T := by gcongr; simp
_ < Ξ΅ := by
dsimp [Ξ·]
rw [div_mul_eq_mul_div]
apply (div_lt_iffβ‚€ (by linarith : 0 < T + 1)).mpr
nlinarith
Β· intro i hi x hx
have hleft := hmem i hi.le
have hright := hmem (i + 1) (Nat.succ_le_of_lt hi)
have hxT : x ∈ Icc (0 : ℝ) T := ⟨hleft.1.trans hx.1, hx.2.trans hright.2⟩
have hdist : dist (stoppedPoint T t n i) x < Ξ΄ := by
rw [Real.dist_eq, abs_of_nonpos (sub_nonpos.mpr hx.1)]
have hstep := stoppedPoint_step_le hT t n i
linarith [hx.2]
exact (hΞ΄mod _ hleft x hxT hdist).le
theorem tendsto_stoppedSum_L1
{Ξ© : Type*} [MeasurableSpace Ξ©] {ΞΌ : Measure Ξ©} [IsFiniteMeasure ΞΌ]
{H : ℝ β†’ Ξ© β†’ ℝ} (hm : βˆ€ t, AEStronglyMeasurable (H t) ΞΌ)
(hc : βˆ€α΅ Ο‰ βˆ‚ΞΌ, Continuous (fun t => H t Ο‰))
{C T t : ℝ} (hb : βˆ€α΅ Ο‰ βˆ‚ΞΌ, βˆ€ s, |H s Ο‰| ≀ C)
(hT : 0 ≀ T) (ht : 0 ≀ t) :
Tendsto (fun n => eLpNorm
((fun Ο‰ => stoppedSum (fun s => H s Ο‰) T t n) -
(fun Ο‰ => ∫ s in (0 : ℝ)..min t T, H s Ο‰)) 1 ΞΌ) atTop (𝓝 0) := by
have hmeas (n : β„•) : AEStronglyMeasurable
(fun Ο‰ => stoppedSum (fun s => H s Ο‰) T t n) ΞΌ := by
unfold stoppedSum
apply Finset.aestronglyMeasurable_fun_sum
intro i hi
exact (hm _).const_mul _
have hbound (n : β„•) : βˆ€α΅ Ο‰ βˆ‚ΞΌ,
β€–stoppedSum (fun s => H s Ο‰) T t nβ€– ≀ C * min t T := by
filter_upwards [hb] with ω hω
exact abs_stoppedSum_le hT ht hω n
have hlim : βˆ€α΅ Ο‰ βˆ‚ΞΌ, Tendsto (fun n => stoppedSum (fun s => H s Ο‰) T t n)
atTop (𝓝 (∫ s in (0 : ℝ)..min t T, H s Ο‰)) := by
filter_upwards [hc] with ω hω
exact tendsto_stoppedSum hω hT ht
have h := tendsto_lintegral_norm_of_dominated_convergence hmeas
(integrable_const (C * min t T)).hasFiniteIntegral hbound hlim
have hlimitMeas := aestronglyMeasurable_of_tendsto_ae atTop hmeas hlim
simpa only [eLpNorm_one_eq_lintegral_enorm ((hmeas _).sub hlimitMeas),
Pi.sub_apply, ← ofReal_norm] using h
theorem tendsto_stoppedSquareSum_L1
{Ξ© : Type*} [MeasurableSpace Ξ©] {ΞΌ : Measure Ξ©} [IsFiniteMeasure ΞΌ]
{H : ℝ β†’ Ξ© β†’ ℝ} (hm : βˆ€ t, AEStronglyMeasurable (H t) ΞΌ)
(hc : βˆ€α΅ Ο‰ βˆ‚ΞΌ, Continuous (fun t => H t Ο‰))
{C T t : ℝ} (hC : 0 ≀ C) (hb : βˆ€α΅ Ο‰ βˆ‚ΞΌ, βˆ€ s, |H s Ο‰| ≀ C)
(hT : 0 ≀ T) (ht : 0 ≀ t) :
Tendsto (fun n => eLpNorm
((fun Ο‰ => stoppedSum (fun s => (H s Ο‰) ^ 2) T t n) -
(fun Ο‰ => ∫ s in (0 : ℝ)..min t T, (H s Ο‰) ^ 2)) 1 ΞΌ) atTop (𝓝 0) := by
apply tendsto_stoppedSum_L1 (fun t => (hm t).pow 2)
(hc.mono (fun ω hω => hω.pow 2)) (C := C ^ 2) _ hT ht
filter_upwards [hb] with ω hω
intro s
simpa only [Pi.pow_apply, abs_sq, sq_abs] using
(sq_le_sq₀ (abs_nonneg (H s ω)) hC).mpr (hω s)
theorem tendsto_stoppedSquareSum_L1_nnreal
{Ξ© : Type*} [MeasurableSpace Ξ©] {ΞΌ : Measure Ξ©} [IsFiniteMeasure ΞΌ]
{H : ℝβ‰₯0 β†’ Ξ© β†’ ℝ} (hm : βˆ€ t, AEStronglyMeasurable (H t) ΞΌ)
(hc : βˆ€α΅ Ο‰ βˆ‚ΞΌ, Continuous (fun t => H t Ο‰))
{C : ℝ} (hC : 0 ≀ C) (hb : βˆ€α΅ Ο‰ βˆ‚ΞΌ, βˆ€ s, |H s Ο‰| ≀ C)
(T t : ℝβ‰₯0) :
Tendsto (fun n => eLpNorm
((fun Ο‰ => stoppedSum (fun s => (H s.toNNReal Ο‰) ^ 2) T t n) -
(fun Ο‰ => ∫ s in (0 : ℝ)..min (t : ℝ) T, (H s.toNNReal Ο‰) ^ 2)) 1 ΞΌ)
atTop (𝓝 0) := by
apply tendsto_stoppedSquareSum_L1 (fun s => hm s.toNNReal) _ hC _ T.coe_nonneg t.coe_nonneg
· filter_upwards [hc] with ω hω
exact hω.comp (by fun_prop)
· filter_upwards [hb] with ω hω
exact fun s => hω s.toNNReal
end Problem367.RandomRiemann
end
end OAI