math / data /lean /OAI /Probability /FreeIsing /Martingales /PredictableMeshApproximation.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
9.8 kB
import Mathlib
namespace OAI
noncomputable section
open MeasureTheory Filter Set
open scoped NNReal Topology
namespace Problem367.PredictableMesh
def point (n k : β„•) : ℝβ‰₯0 := (k : ℝβ‰₯0) / (n + 1 : β„•)
def left (n : β„•) (t : ℝβ‰₯0) : ℝβ‰₯0 :=
point n (⌈(n + 1 : β„•) * tβŒ‰β‚Š - 1)
@[simp] theorem point_zero (n : β„•) : point n 0 = 0 := by simp [point]
@[simp] theorem left_zero (n : β„•) : left n 0 = 0 := by simp [left]
theorem point_strictMono (n : β„•) : StrictMono (point n) := by
intro i j hij
exact div_lt_div_of_pos_right (by exact_mod_cast hij) (by positivity)
theorem left_eq_of_mem_Ioc {n k : β„•} {t : ℝβ‰₯0}
(ht : t ∈ Ioc (point n k) (point n (k + 1))) :
left n t = point n k := by
have hN : (0 : ℝβ‰₯0) < (n + 1 : β„•) := by positivity
have hc : ⌈(n + 1 : β„•) * tβŒ‰β‚Š = k + 1 := by
apply (Nat.ceil_eq_iff (Nat.succ_ne_zero k)).2
constructor
Β· have := (div_lt_iffβ‚€ hN).1 ht.1
simpa only [mul_comm, Nat.succ_sub_one] using this
Β· have := (le_div_iffβ‚€ hN).1 ht.2
simpa only [mul_comm, Nat.succ_sub_one] using this
change point n (⌈(n + 1 : β„•) * tβŒ‰β‚Š - 1) = point n k
rw [hc, Nat.add_sub_cancel]
theorem mem_mesh_Ioc {n : β„•} {t : ℝβ‰₯0} (ht : 0 < t) :
t ∈ Ioc (left n t)
(point n (⌈(n + 1 : β„•) * tβŒ‰β‚Š - 1 + 1)) := by
have hN : (0 : ℝβ‰₯0) < (n + 1 : β„•) := by positivity
have hc : 1 ≀ ⌈(n + 1 : β„•) * tβŒ‰β‚Š :=
Nat.one_le_ceil_iff.mpr (mul_pos hN ht)
have hh := (Nat.ceil_eq_iff (show ⌈(n + 1 : β„•) * tβŒ‰β‚Š β‰  0 by omega)).mp rfl
constructor
Β· apply (div_lt_iffβ‚€ hN).2
simpa only [mul_comm] using hh.1
Β· dsimp [point]
rw [Nat.sub_add_cancel hc]
apply (le_div_iffβ‚€ hN).2
simpa only [mul_comm] using hh.2
theorem left_le (n : β„•) (t : ℝβ‰₯0) : left n t ≀ t := by
by_cases ht : t = 0
Β· simp [ht]
Β· exact (mem_mesh_Ioc (n := n) (pos_iff_ne_zero.mpr ht)).1.le
theorem le_left_add_width (n : β„•) (t : ℝβ‰₯0) :
t ≀ left n t + 1 / (n + 1 : β„•) := by
by_cases ht : t = 0
Β· simp [ht]
Β· have h := (mem_mesh_Ioc (n := n) (pos_iff_ne_zero.mpr ht)).2
simpa only [point, left, Nat.cast_add, Nat.cast_one, add_div] using h
theorem tendsto_left (t : ℝβ‰₯0) : Tendsto (fun n => left n t) atTop (𝓝 t) := by
apply NNReal.tendsto_coe.mp
apply tendsto_iff_norm_sub_tendsto_zero.mpr
apply squeeze_zero (fun n => norm_nonneg _)
(fun n => show β€–(left n t : ℝ) - (t : ℝ)β€– ≀ 1 / ((n : ℝ) + 1) from ?_)
tendsto_one_div_add_atTop_nhds_zero_nat
have hl : (left n t : ℝ) ≀ (t : ℝ) := left_le n t
have hu := le_left_add_width n t
have hu' : (t : ℝ) ≀ (left n t : ℝ) + 1 / ((n : ℝ) + 1) := by
exact_mod_cast hu
rw [Real.norm_eq_abs, abs_of_nonpos (sub_nonpos.mpr hl)]
linarith
theorem measurable_left (n : β„•) : Measurable (left n) := by
exact (measurable_of_countable (fun k : β„• => point n (k - 1))).comp
((measurable_const.mul measurable_id).nat_ceil)
def sample {Ξ© : Type*} (u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ) (n : β„•) (t : ℝβ‰₯0) (Ο‰ : Ξ©) : ℝ :=
u (left n t) Ο‰
theorem sample_tendsto {Ξ© : Type*} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : βˆ€ Ο‰, Continuous (fun t => u t Ο‰)) (t : ℝβ‰₯0) (Ο‰ : Ξ©) :
Tendsto (fun n => sample u n t Ο‰) atTop (𝓝 (u t Ο‰)) :=
(hu Ο‰).continuousAt.tendsto.comp (tendsto_left t)
theorem sample_stronglyAdapted {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (n : β„•) : StronglyAdapted F (sample u n) :=
fun t => (hu (left n t)).mono (F.mono (left_le n t))
theorem sample_isStronglyPredictable {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (n : β„•) : IsStronglyPredictable F (sample u n) := by
apply Measurable.stronglyMeasurable
intro s hs
have heq : (Function.uncurry (sample u n)) ⁻¹' s =
({0} Γ—Λ’ (u 0 ⁻¹' s)) βˆͺ
⋃ k : β„•, (Ioc (point n k) (point n (k + 1))) Γ—Λ’ (u (point n k) ⁻¹' s) := by
ext ⟨t, Ο‰βŸ©
simp only [mem_preimage, Function.uncurry_apply_pair, mem_union, mem_prod,
mem_singleton_iff, mem_iUnion]
constructor
Β· intro h
by_cases ht : t = 0
· exact Or.inl ⟨ht, by simpa [ht, sample] using h⟩
Β· exact Or.inr ⟨⌈(n + 1 : β„•) * tβŒ‰β‚Š - 1,
mem_mesh_Ioc (pos_iff_ne_zero.mpr ht), h⟩
· rintro (⟨ht, h⟩ | ⟨k, ht, h⟩)
Β· simpa [ht, sample] using h
Β· simpa only [sample, left_eq_of_mem_Ioc ht] using h
rw [heq]
apply MeasurableSet.union
Β· exact measurableSet_predictable_singleton_bot_prod ((hu 0).measurable hs)
Β· exact MeasurableSet.iUnion fun k =>
measurableSet_predictable_Ioc_prod _ _ ((hu (point n k)).measurable hs)
theorem isStronglyPredictable_of_continuous {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰)) :
IsStronglyPredictable F u := by
apply stronglyMeasurable_of_tendsto atTop (f := fun n => Function.uncurry (sample u n))
(fun n => sample_isStronglyPredictable hu n)
exact tendsto_pi_nhds.mpr fun p => sample_tendsto hc p.1 p.2
theorem stronglyMeasurable_uncurry {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰)) :
StronglyMeasurable (Function.uncurry u) :=
stronglyMeasurable_uncurry_of_continuous_of_stronglyMeasurable hc
(fun t => (hu t).mono (F.le t))
theorem stronglyMeasurable_sample {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰)) (n : β„•) :
StronglyMeasurable (Function.uncurry (sample u n)) :=
(stronglyMeasurable_uncurry hu hc).comp_measurable
(((measurable_left n).comp measurable_fst).prodMk measurable_snd)
theorem memLp_uncurry {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰))
(Ξ½ : Measure ℝβ‰₯0) (P : Measure Ξ©) [IsFiniteMeasure Ξ½] [IsFiniteMeasure P]
(C : ℝ) (hb : βˆ€ t Ο‰, |u t Ο‰| ≀ C) :
MemLp (Function.uncurry u) 2 (Ξ½.prod P) :=
MemLp.of_bound (stronglyMeasurable_uncurry hu hc).aestronglyMeasurable C
(Filter.Eventually.of_forall fun p => by simpa only [Real.norm_eq_abs, Function.uncurry] using hb p.1 p.2)
theorem memLp_sample {Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰))
(Ξ½ : Measure ℝβ‰₯0) (P : Measure Ξ©) [IsFiniteMeasure Ξ½] [IsFiniteMeasure P]
(C : ℝ) (hb : βˆ€ t Ο‰, |u t Ο‰| ≀ C) (n : β„•) :
MemLp (Function.uncurry (sample u n)) 2 (Ξ½.prod P) :=
MemLp.of_bound (stronglyMeasurable_sample hu hc n).aestronglyMeasurable C
(Filter.Eventually.of_forall fun p => by
simpa only [Real.norm_eq_abs, Function.uncurry, sample] using hb (left n p.1) p.2)
theorem tendsto_integral_sq_sample_sub
{A Ξ© : Type*} [MeasurableSpace A] [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰))
(Ξ½ : Measure A) (P : Measure Ξ©) [IsFiniteMeasure Ξ½] [IsFiniteMeasure P]
(Ο„ : A β†’ ℝβ‰₯0) (hΟ„ : Measurable Ο„)
(C : ℝ) (hC : 0 ≀ C) (hb : βˆ€ t Ο‰, |u t Ο‰| ≀ C) :
Tendsto (fun n => ∫ p : A Γ— Ξ©,
(sample u n (Ο„ p.1) p.2 - u (Ο„ p.1) p.2) ^ 2 βˆ‚Ξ½.prod P) atTop (𝓝 0) := by
have hcoord : Measurable (fun p : A Γ— Ξ© => (Ο„ p.1, p.2)) :=
(hΟ„.comp measurable_fst).prodMk measurable_snd
have huM := (stronglyMeasurable_uncurry hu hc).comp_measurable hcoord
have hsM (n : β„•) := (stronglyMeasurable_sample hu hc n).comp_measurable hcoord
have hlim := tendsto_integral_of_dominated_convergence
(ΞΌ := Ξ½.prod P) (F := fun n p =>
(sample u n (Ο„ p.1) p.2 - u (Ο„ p.1) p.2) ^ 2)
(f := fun _ => (0 : ℝ)) (fun _ => (2 * C) ^ 2)
(fun n => ((hsM n).sub huM).pow 2 |>.aestronglyMeasurable)
(integrable_const _) ?_ ?_
Β· simpa only [integral_zero] using hlim
Β· intro n
exact Filter.Eventually.of_forall fun p => by
have hn : |sample u n (Ο„ p.1) p.2 - u (Ο„ p.1) p.2| ≀ 2 * C := by
calc
_ ≀ |sample u n (Ο„ p.1) p.2| + |u (Ο„ p.1) p.2| := abs_sub _ _
_ ≀ 2 * C := by
dsimp [sample]
linarith [hb (left n (Ο„ p.1)) p.2, hb (Ο„ p.1) p.2]
simpa only [Real.norm_eq_abs, abs_sq, sq_abs] using
(sq_le_sqβ‚€ (abs_nonneg _) (mul_nonneg (by norm_num) hC)).mpr hn
Β· exact Filter.Eventually.of_forall fun p => by
simpa only [sub_self, zero_pow (by decide : 2 β‰  0)] using
((sample_tendsto hc (Ο„ p.1) p.2).sub
(tendsto_const_nhds (x := u (Ο„ p.1) p.2))).pow 2
theorem tendsto_time_integral_sq_sample_sub
{Ξ© : Type*} [mΞ© : MeasurableSpace Ξ©]
{F : Filtration ℝβ‰₯0 mΞ©} {u : ℝβ‰₯0 β†’ Ξ© β†’ ℝ}
(hu : StronglyAdapted F u) (hc : βˆ€ Ο‰, Continuous (fun t => u t Ο‰))
(P : Measure Ξ©) [IsFiniteMeasure P] (T C : ℝ)
(hC : 0 ≀ C) (hb : βˆ€ t Ο‰, |u t Ο‰| ≀ C) :
Tendsto (fun n => ∫ p : ℝ Γ— Ξ©,
(sample u n p.1.toNNReal p.2 - u p.1.toNNReal p.2) ^ 2
βˆ‚(volume.restrict (Icc 0 T)).prod P) atTop (𝓝 0) :=
tendsto_integral_sq_sample_sub hu hc (volume.restrict (Icc 0 T)) P
Real.toNNReal (by fun_prop) C hC hb
end Problem367.PredictableMesh
end
end OAI