Download data/lean/OAI/Probability/FKMaps/BridgeLimit.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 46.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FKMaps/BridgeLimit.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FKMaps/BridgeLimit.lean
-
curl -L -o BridgeLimit.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FKMaps/BridgeLimit.lean
46.8 kB
| import OAI.Probability.FKMaps.Offspring | |
| namespace OAI | |
| noncomputable section | |
| open Set Filter MeasureTheory ProbabilityTheory | |
| open scoped Topology BigOperators ENNReal NNReal | |
| namespace FKCRT.TreeCoding | |
| local instance : MeasurableSpace C(unitInterval, ā) := borel _ | |
| local instance : BorelSpace C(unitInterval, ā) := āØrflā© | |
| def bridgePath {Ī© : Type*} (B : āā„0 ā Ī© ā ā) (Ļ : Ī©) : C(unitInterval, ā) := | |
| brownianPath B Ļ - B 1 Ļ ā¢ āØfun t => (t:ā), continuous_subtype_valā© | |
| lemma bridgePath_aemeasurable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B μ) : | |
| AEMeasurable (bridgePath B) μ := | |
| (brownianPath_aemeasurable hB).sub ((hB.aemeasurable 1).smul aemeasurable_const) | |
| lemma bridgePath_ae_eq {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B μ) : | |
| āįµ Ļ āμ, ā t : unitInterval, | |
| bridgePath B Ļ t = B āØ(t:ā),t.property.1ā© Ļ - (t:ā)*B 1 Ļ := by | |
| filter_upwards [brownianPath_ae_eq hB] with Ļ hĻ | |
| intro t | |
| simp only [bridgePath, ContinuousMap.sub_apply, ContinuousMap.smul_apply, | |
| ContinuousMap.coe_mk, smul_eq_mul, hĻ, mul_comm] | |
| lemma bridge_joint_gaussian {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsPreBrownianReal B μ) : | |
| IsGaussianProcess (Sum.elim | |
| (fun (t : unitInterval) Ļ => B āØ(t:ā),t.property.1ā© Ļ-(t:ā)*B 1 Ļ) | |
| (fun (_ : Unit) Ļ => B 1 Ļ)) μ := by | |
| classical | |
| apply hB.isGaussianProcess.of_isGaussianProcess | |
| intro s | |
| cases s with | |
| | inl t => | |
| let u : āā„0 := āØ(t:ā),t.property.1ā© | |
| refine āØ{u,1}, | |
| { toFun x := x āØu, by simpā© - (t:ā) * x āØ1, by simpā© | |
| map_add' x y := by simp only [Pi.add_apply]; ring | |
| map_smul' c x := by simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply]; ring }, ?_ā© | |
| intro Ļ | |
| rfl | |
| | inr t => | |
| refine āØ{1}, | |
| { toFun x := x āØ1, by simpā© | |
| map_add' := by simp | |
| map_smul' := by simp }, ?_ā© | |
| intro Ļ | |
| rfl | |
| lemma bridge_covariance_endpoint {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsPreBrownianReal B μ) (t : unitInterval) : | |
| cov[fun Ļ => B āØ(t:ā),t.property.1ā© Ļ-(t:ā)*B 1 Ļ, B 1; μ] = 0 := by | |
| have := hB.isGaussianProcess.isProbabilityMeasure | |
| let u : āā„0 := āØ(t:ā), unitInterval.nonneg tā© | |
| change cov[fun Ļ => B u Ļ - (t:ā) * B 1 Ļ, B 1; μ] = 0 | |
| rw [covariance_fun_sub_left (hB.isGaussianProcess.hasGaussianLaw_eval _).memLp_two | |
| ((hB.isGaussianProcess.hasGaussianLaw_eval _).memLp_two.const_mul _) | |
| (hB.isGaussianProcess.hasGaussianLaw_eval _).memLp_two, | |
| covariance_const_mul_left, hB.covariance_eval, hB.covariance_eval] | |
| simp only [min_self, NNReal.coe_one, mul_one] | |
| change min (t:ā) (1:ā) - (t:ā) = 0 | |
| rw [min_eq_left t.property.2, sub_self] | |
| lemma bridge_process_indep_endpoint {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsPreBrownianReal B μ) : | |
| IndepFun (fun Ļ (t : unitInterval) => | |
| B āØ(t:ā),t.property.1ā© Ļ-(t:ā)*B 1 Ļ) (B 1) μ := by | |
| have h := (bridge_joint_gaussian hB).indepFun_of_covariance_eq_zero | |
| (fun t => (hB.aemeasurable _).sub ((hB.aemeasurable 1).const_mul _)) | |
| (fun _ => hB.aemeasurable 1) (fun t _ => bridge_covariance_endpoint hB t) | |
| exact h.comp measurable_id (measurable_pi_apply ()) | |
| lemma indepFun_of_measurableEmbedding_left {Ī© E F G : Type*} | |
| [MeasurableSpace Ī©] [MeasurableSpace E] [MeasurableSpace F] [MeasurableSpace G] | |
| {μ : Measure Ī©} {X : Ī© ā E} {Y : Ī© ā F} {f : E ā G} | |
| (hf : MeasurableEmbedding f) (h : IndepFun (f ā X) Y μ) : IndepFun X Y μ := by | |
| simp only [IndepFun, Kernel.IndepFun] at h ⢠| |
| rw [ā MeasurableSpace.comap_comp, hf.comap_eq] at h | |
| exact h | |
| lemma bridgePath_indep_endpoint {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B μ) : | |
| IndepFun (bridgePath B) (B 1) μ := by | |
| let D := TopologicalSpace.denseSeq unitInterval | |
| let f : C(unitInterval,ā) ā (ā ā ā) := fun g n => g (D n) | |
| have hf : MeasurableEmbedding f := by | |
| apply Continuous.measurableEmbedding | |
| Ā· apply continuous_pi | |
| intro n | |
| fun_prop | |
| Ā· intro a b hab | |
| apply ContinuousMap.ext | |
| exact congrFun ((TopologicalSpace.denseRange_denseSeq unitInterval).equalizer | |
| a.continuous b.continuous hab) | |
| apply indepFun_of_measurableEmbedding_left hf | |
| have h := (bridge_process_indep_endpoint hB.toIsPreBrownianReal).comp | |
| (Ļ := fun a : unitInterval ā ā => fun n : ā => a (D n)) | |
| (by fun_prop) measurable_id | |
| apply h.congr ?_ (Filter.EventuallyEq.rfl) | |
| filter_upwards [bridgePath_ae_eq hB] with Ļ hĻ | |
| funext n | |
| exact (hĻ (D n)).symm | |
| lemma gaussian_softCutoff_pos {ε : ā} (hε : 0 < ε) : | |
| 0 < ā« x, softCutoff ε x āgaussianReal 0 1 := by | |
| rw [integral_pos_iff_support_of_nonneg (softCutoff_nonneg ε) | |
| (softCutoff_integrable aemeasurable_id hε), softCutoff_support hε, pos_iff_ne_zero] | |
| intro h | |
| have hv := gaussianReal_absolutelyContinuous' 0 (v := 1) (by norm_num) h | |
| rw [Real.volume_Ioo, ENNReal.ofReal_eq_zero] at hv | |
| linarith | |
| lemma brownian_softCutoff_pos {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsPreBrownianReal B μ) {ε : ā} (hε : 0 < ε) : | |
| 0 < ā« Ļ, softCutoff ε (B 1 Ļ) āμ := by | |
| change 0 < ā« Ļ, (softCutoff ε ā B 1) Ļ āμ | |
| rw [(hB.hasLaw_eval 1).integral_comp (softCutoff_continuous ε).aestronglyMeasurable] | |
| exact gaussian_softCutoff_pos hε | |
| lemma brownian_dist_bridge_le {Ī© : Type*} (B : āā„0 ā Ī© ā ā) (Ļ : Ī©) : | |
| dist (brownianPath B Ļ) (bridgePath B Ļ) ⤠|B 1 Ļ| := by | |
| rw [dist_eq_norm] | |
| change ābrownianPath B Ļ - | |
| (brownianPath B Ļ - B 1 Ļ ā¢ (āØfun t : unitInterval => (t:ā),continuous_subtype_valā© : C(unitInterval,ā)))ā ⤠_ | |
| rw [sub_sub_cancel, norm_smul,Real.norm_eq_abs] | |
| apply mul_le_of_le_one_right (abs_nonneg _) | |
| apply (ContinuousMap.norm_le _ (by norm_num : (0:ā) ⤠1)).mpr | |
| intro t | |
| simp only [ContinuousMap.coe_mk, Real.norm_eq_abs, abs_of_nonneg t.property.1] | |
| exact t.property.2 | |
| theorem brownian_soft_bridge_bound {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| [IsProbabilityMeasure μ] {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B μ) | |
| {F : C(unitInterval,ā) ā ā} {M : ā} {L : āā„0} | |
| (hFM : ā f, |F f| ⤠M) (hF : LipschitzWith L F) {ε : ā} (hε : 0 < ε) : | |
| |(ā« Ļ, F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āμ) / | |
| (ā« Ļ, softCutoff ε (B 1 Ļ) āμ) - | |
| ā« Ļ, F (bridgePath B Ļ) āμ| ⤠(L:ā)*ε := by | |
| have hM : 0 ⤠M := (abs_nonneg (F 0)).trans (hFM 0) | |
| have hX := brownianPath_aemeasurable hB | |
| have hY := bridgePath_aemeasurable hB | |
| have hg := softCutoff_integrable (hB.aemeasurable 1) hε | |
| have hFg (Z : Ī© ā C(unitInterval,ā)) (hZ : AEMeasurable Z μ) : | |
| Integrable (fun Ļ => F (Z Ļ)*softCutoff ε (B 1 Ļ)) μ := by | |
| apply (hg.norm.const_mul M).mono' | |
| ((hF.continuous.aestronglyMeasurable.comp_aemeasurable hZ).mul hg.aestronglyMeasurable) | |
| filter_upwards [] with Ļ | |
| change āF (Z Ļ)*softCutoff ε (B 1 Ļ)ā ⤠M*āsoftCutoff ε (B 1 Ļ)ā | |
| simp only [Real.norm_eq_abs,abs_mul] | |
| exact mul_le_mul_of_nonneg_right (hFM _) (abs_nonneg _) | |
| have hdiff : Integrable (fun Ļ => | |
| (F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ)) μ := by | |
| have h := (hFg _ hX).sub (hFg _ hY) | |
| apply h.congr | |
| filter_upwards [] with Ļ | |
| change F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) - | |
| F (bridgePath B Ļ)*softCutoff ε (B 1 Ļ) = _ | |
| ring | |
| have heq := (bridgePath_indep_endpoint hB).integral_fun_comp_mul_comp | |
| hY (hB.aemeasurable 1) hF.continuous.aestronglyMeasurable | |
| (softCutoff_continuous ε).aestronglyMeasurable | |
| have hb : |ā« Ļ, (F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ) āμ| ⤠| |
| (L:ā)*ε * ā« Ļ, softCutoff ε (B 1 Ļ) āμ := by | |
| calc | |
| _ ⤠⫠Ļ, |(F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ)| āμ := by | |
| simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm | |
| (fun Ļ => (F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ)) | |
| _ ⤠⫠Ļ, ((L:ā)*ε)*softCutoff ε (B 1 Ļ) āμ := by | |
| apply integral_mono_ae hdiff.norm (hg.const_mul _) | |
| filter_upwards [] with Ļ | |
| change |(F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ)| ⤠_ | |
| rw [abs_mul,abs_of_nonneg (softCutoff_nonneg _ _)] | |
| by_cases hgĻ : softCutoff ε (B 1 Ļ) = 0 | |
| Ā· simp only [hgĻ,mul_zero,le_refl] | |
| apply mul_le_mul_of_nonneg_right _ (softCutoff_nonneg _ _) | |
| have heĻ : |B 1 Ļ| < ε := (softCutoff_pos_iff hε).mp | |
| (lt_of_le_of_ne (softCutoff_nonneg _ _) (Ne.symm hgĻ)) | |
| calc | |
| _ ⤠(L:ā)*dist (brownianPath B Ļ) (bridgePath B Ļ) := by | |
| simpa only [Real.dist_eq] using hF.dist_le_mul (brownianPath B Ļ) (bridgePath B Ļ) | |
| _ ⤠(L:ā)*ε := mul_le_mul_of_nonneg_left | |
| ((brownian_dist_bridge_le B Ļ).trans heĻ.le) L.coe_nonneg | |
| _ = _ := integral_const_mul _ _ | |
| rw [show (ā« Ļ, (F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ) āμ) = | |
| (ā« Ļ, F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āμ) - | |
| (ā« Ļ, F (bridgePath B Ļ) āμ)*(ā« Ļ, softCutoff ε (B 1 Ļ) āμ) by | |
| rw [show (fun Ļ => (F (brownianPath B Ļ)-F (bridgePath B Ļ))*softCutoff ε (B 1 Ļ)) = | |
| (fun Ļ => F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) - | |
| F (bridgePath B Ļ)*softCutoff ε (B 1 Ļ)) by funext Ļ; ring, | |
| integral_sub (hFg _ hX) (hFg _ hY),heq]] at hb | |
| have hpos := brownian_softCutoff_pos hB.toIsPreBrownianReal hε | |
| have hform : | |
| (ā« Ļ, F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āμ) / | |
| (ā« Ļ, softCutoff ε (B 1 Ļ) āμ) - (ā« Ļ, F (bridgePath B Ļ) āμ) = | |
| ((ā« Ļ, F (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āμ) - | |
| (ā« Ļ, F (bridgePath B Ļ) āμ)*(ā« Ļ, softCutoff ε (B 1 Ļ) āμ)) / | |
| (ā« Ļ, softCutoff ε (B 1 Ļ) āμ) := by | |
| rw [sub_div,mul_div_cancel_rightā _ hpos.ne'] | |
| rw [hform,abs_div,abs_of_pos hpos] | |
| exact (div_le_iffā hpos).mpr hb | |
| lemma integral_tendsto_of_tendstoInDistribution | |
| {ι E Ī©' : Type*} {Ī© : ι ā Type*} [ā i, MeasurableSpace (Ī© i)] [MeasurableSpace Ī©'] | |
| [TopologicalSpace E] [MeasurableSpace E] [BorelSpace E] | |
| {μ : ā i, Measure (Ī© i)} {ν : Measure Ī©'} [ā i, IsProbabilityMeasure (μ i)] | |
| [IsProbabilityMeasure ν] {l : Filter ι} {X : ā i, Ī© i ā E} {Y : Ī©' ā E} | |
| (h : TendstoInDistribution X l Y μ ν) {F : E ā ā} | |
| (hF : Continuous F) {M : ā} (hM : ā x, |F x| ⤠M) : | |
| Tendsto (fun i => ā« Ļ, F (X i Ļ) āμ i) l (š (ā« Ļ, F (Y Ļ) āν)) := by | |
| let f : BoundedContinuousFunction E ā := BoundedContinuousFunction.ofNormedAddCommGroup F hF M hM | |
| have hh := ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp h.tendsto f | |
| change Tendsto (fun i => ā« x, f x ā(μ i).map (X i)) l | |
| (š (ā« x, f x āν.map Y)) at hh | |
| simp_rw [integral_map (h.forall_aemeasurable _) f.continuous.aestronglyMeasurable, | |
| integral_map h.aemeasurable_limit f.continuous.aestronglyMeasurable] at hh | |
| exact hh | |
| theorem soft_weighted_tendsto | |
| {ι E Ī©' : Type*} {Ī© : ι ā Type*} [ā i, MeasurableSpace (Ī© i)] [MeasurableSpace Ī©'] | |
| [TopologicalSpace E] [MeasurableSpace E] [BorelSpace E] | |
| {μ : ā i, Measure (Ī© i)} {ν : Measure Ī©'} [ā i, IsProbabilityMeasure (μ i)] | |
| [IsProbabilityMeasure ν] {l : Filter ι} {X : ā i, Ī© i ā E} {Y : Ī©' ā E} | |
| (h : TendstoInDistribution X l Y μ ν) {F g : E ā ā} | |
| (hF : Continuous F) (hg : Continuous g) {M ε : ā} | |
| (hM : ā x, |F x| ⤠M) (hε : 0 < ε) | |
| (hD : 0 < ā« Ļ, softCutoff ε (g (Y Ļ)) āν) : | |
| Tendsto (fun i => (ā« Ļ, F (X i Ļ)*softCutoff ε (g (X i Ļ)) āμ i) / | |
| (ā« Ļ, softCutoff ε (g (X i Ļ)) āμ i)) l | |
| (š ((ā« Ļ, F (Y Ļ)*softCutoff ε (g (Y Ļ)) āν) / | |
| (ā« Ļ, softCutoff ε (g (Y Ļ)) āν))) := by | |
| apply Tendsto.div _ _ hD.ne' | |
| · apply integral_tendsto_of_tendstoInDistribution h (hF.mul ((softCutoff_continuous ε).comp hg)) (M := M) | |
| intro x | |
| change |F x * softCutoff ε (g x)| ⤠M | |
| rw [abs_mul,abs_of_nonneg (softCutoff_nonneg ε _)] | |
| exact (mul_le_of_le_one_right (abs_nonneg _) (softCutoff_le_one hε _)).trans (hM x) | |
| · exact integral_tendsto_of_tendstoInDistribution h ((softCutoff_continuous ε).comp hg) (M := 1) | |
| (fun x => by change |softCutoff ε (g x)| ⤠1; rw [abs_of_nonneg (softCutoff_nonneg ε _)]; exact softCutoff_le_one hε _) | |
| lemma tendsto_of_soft_windows {A : ā ā ā} {S : ā ā ā ā ā} {b : ā} {T : ā ā ā} | |
| {C D : ā} (hC : 0 ⤠C) (hD : 0 ⤠D) | |
| (hd : ā ε > 0, ā Ī“ > 0, āį¶ n in atTop, |A n-S ε n| ⤠C*ε+Ī“) | |
| (hs : ā ε > 0, Tendsto (S ε) atTop (š (T ε))) | |
| (ht : ā ε > 0, |T ε-b| ⤠D*ε) : Tendsto A atTop (š b) := by | |
| rw [Metric.tendsto_nhds] | |
| intro Ī· hĪ· | |
| let ε := η/(4*(C+D+1)) | |
| have hε : 0 < ε := by dsimp [ε]; positivity | |
| have hbound : (C+D)*ε ⤠η/4 := by | |
| dsimp [ε] | |
| rw [ā mul_div_assoc, div_le_iffā (by positivity : 0 < 4*(C+D+1))] | |
| nlinarith | |
| have hmid := (Metric.tendsto_nhds.mp (hs ε hε)) (η/4) (by positivity) | |
| filter_upwards [hd ε hε (η/4) (by positivity),hmid] with n hn hm | |
| rw [Real.dist_eq] at hm ⢠| |
| have hā := abs_sub_le (A n) (S ε n) b | |
| have hā := abs_sub_le (S ε n) (T ε) b | |
| have hā := ht ε hε | |
| nlinarith | |
| lemma CriticalEvenOffspring.iid_endpoint_positive (p : CriticalEvenOffspring) (n : ā) : | |
| 0 < (p.iidLaw (2*n+1)).real {d | totalStep d = -1} := by | |
| have hlen : 2*n+1 = n+(n+1) := by omega | |
| rw [hlen] | |
| let d : Fin (n+(n+1)) ā ā := (iidSplit n (n+1)).symm (fun _ => 2,fun _ => 0) | |
| have hd : iidSplit n (n+1) d = (fun _ => 2,fun _ => 0) := | |
| (iidSplit n (n+1)).apply_symm_apply _ | |
| have htotal : totalStep d = -1 := by | |
| rw [totalStep_split,hd] | |
| simp [totalStep] | |
| have hval (i : Fin (n+(n+1))) : d i=2 ⨠d i=0 := by | |
| refine Fin.addCases (fun j => ?_) (fun j => ?_) i | |
| Ā· exact Or.inl (congrFun (congrArg Prod.fst hd) j) | |
| Ā· exact Or.inr (congrFun (congrArg Prod.snd hd) j) | |
| have hsing : 0 < (p.iidLaw (n+(n+1))) {d} := by | |
| rw [iidLaw,Measure.pi_singleton] | |
| apply pos_iff_ne_zero.mpr | |
| apply Finset.prod_ne_zero_iff.mpr | |
| intro i _ | |
| apply ne_of_gt | |
| rw [p.law_singleton,ENNReal.ofReal_pos] | |
| rcases hval i with h|h | |
| Ā· simpa only [h] using p.two_pos | |
| Ā· simpa only [h] using p.zero_pos | |
| have hpos : 0 < (p.iidLaw (n+(n+1))) {d | totalStep d = -1} := by | |
| apply hsing.trans_le | |
| exact measure_mono (Set.singleton_subset_iff.mpr htotal) | |
| exact ENNReal.toReal_pos hpos.ne' (measure_ne_top _ _) | |
| def CriticalEvenOffspring.iidBridgeLaw (p : CriticalEvenOffspring) (n : ā) : | |
| Measure (Fin (2*n+1) ā ā) := cond (p.iidLaw (2*n+1)) {d | totalStep d = -1} | |
| instance (p : CriticalEvenOffspring) (n : ā) : IsProbabilityMeasure (p.iidBridgeLaw n) := by | |
| apply cond_isProbabilityMeasure | |
| exact fun h => (p.iid_endpoint_positive n).ne' (by simp [measureReal_def,h]) | |
| def CriticalEvenOffspring.bridgeConstant (p : CriticalEvenOffspring) : ā := | |
| Real.sqrt (2*Real.pi)/(p.sigma*Real.pi) | |
| lemma CriticalEvenOffspring.bridgeConstant_pos (p : CriticalEvenOffspring) : | |
| 0 < p.bridgeConstant := div_pos (Real.sqrt_pos.mpr (mul_pos (by norm_num) Real.pi_pos)) | |
| (mul_pos p.sigma_pos Real.pi_pos) | |
| lemma CriticalEvenOffspring.iid_endpoint_limit (p : CriticalEvenOffspring) : | |
| Tendsto (fun n : ā => Real.sqrt ((2*n+1:ā):ā) * | |
| (p.iidLaw (2*n+1)).real {d | totalStep d = -1}) atTop (š p.bridgeConstant) := by | |
| obtain āØE,hE,hEt,hbā© := p.uniform_local_limit | |
| have hN : Tendsto (fun n : ā => 2*n+1) atTop atTop := | |
| tendsto_atTop_mono (fun n => by dsimp; omega) tendsto_id | |
| have h2 : Tendsto (fun n : ā => 2*n) atTop atTop := | |
| tendsto_atTop_mono (fun n => by dsimp; omega) tendsto_id | |
| have hden : Tendsto (fun n : ā => p.sigma*Real.sqrt ((2*n+1:ā):ā)) atTop atTop := | |
| (Real.tendsto_sqrt_atTop.comp (tendsto_natCast_atTop_atTop.comp hN)).const_mul_atTop p.sigma_pos | |
| have hx : Tendsto (fun n : ā => (-1:ā)/(p.sigma*Real.sqrt ((2*n+1:ā):ā))) atTop (š 0) := | |
| tendsto_const_nhds.div_atTop hden | |
| have harg : Tendsto (fun n : ā => -((-1:ā)/(p.sigma*Real.sqrt ((2*n+1:ā):ā)))^2/2) atTop (š 0) := by | |
| simpa only [zero_pow (by norm_num : (2:ā)ā 0),neg_zero,zero_div] using (hx.pow 2).neg.div_const 2 | |
| have hp := ((Real.continuous_exp.tendsto 0).comp harg).const_mul p.bridgeConstant | |
| rw [Real.exp_zero,mul_one] at hp | |
| let A : ā ā ā := fun n => Real.sqrt ((2*n+1:ā):ā) * | |
| (p.iidLaw (2*n+1)).real {d | totalStep d = -1} | |
| let G : ā ā ā := fun n => p.bridgeConstant * | |
| Real.exp (-((-1:ā)/(p.sigma*Real.sqrt ((2*n+1:ā):ā)))^2/2) | |
| have herr : ā n, |A n-G n| ⤠E (2*n) := by | |
| intro n | |
| have hpar : Even (((2*n+1:ā):ā¤)+(-1)) := by | |
| refine āØ(n:ā¤),?_ā© | |
| push_cast | |
| ring | |
| have hh := hb (2*n) (-1) hpar | |
| simpa only [A,G,bridgeConstant,Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat,Nat.cast_one, | |
| Int.cast_neg,Int.cast_one] using hh | |
| have he : Tendsto (fun n => A n-G n) atTop (š 0) := by | |
| apply (tendsto_zero_iff_abs_tendsto_zero _).mpr | |
| exact squeeze_zero (fun _ => abs_nonneg _) herr (hEt.comp h2) | |
| have hadd := he.add (show Tendsto G atTop (š p.bridgeConstant) from hp) | |
| simpa only [sub_add_cancel,zero_add] using hadd | |
| lemma bridge_soft_numeric {M E B Ļ S T P K ε : ā} | |
| (hM : 0 ⤠M) (hE : 0 ⤠E) (hB : 0 < B) (hĻ : 0 < Ļ) | |
| (hS : 0 < S) (hT : 0 < T) (hK : 0 < K) (hε : 0 ⤠ε) | |
| (hden : B/2 ⤠S*P) (hratio : S ⤠K*T) : | |
| 2*M*((2*E+B*(1+ε*(Ļ*S))/(Ļ*T))/T)/P ⤠| |
| (4*M*K/B)*(2*E+(B/Ļ)/T)+4*M*K^2*ε := by | |
| have hP : 0 < P := (mul_pos_iff_of_pos_left hS).mp ((half_pos hB).trans_le hden) | |
| have hTP : 0 < T*P := mul_pos hT hP | |
| have hi : 1/(T*P) ⤠2*K/B := by | |
| rw [div_le_div_iffā hTP hB] | |
| have hh := mul_le_mul_of_nonneg_right hratio hP.le | |
| nlinarith | |
| have hn : 2*E+B*(1+ε*(Ļ*S))/(Ļ*T) ⤠2*E+(B/Ļ)/T+B*ε*K := by | |
| have hh : S/T ⤠K := (div_le_iffā hT).mpr hratio | |
| have hm := mul_le_mul_of_nonneg_left hh (mul_nonneg hB.le hε) | |
| have he : B*(1+ε*(Ļ*S))/(Ļ*T) = (B/Ļ)/T+B*ε*(S/T) := by | |
| field_simp | |
| rw [he] | |
| linarith | |
| have hn0 : 0 ⤠2*E+B*(1+ε*(Ļ*S))/(Ļ*T) := by positivity | |
| calc | |
| _ = (2*M)*(2*E+B*(1+ε*(Ļ*S))/(Ļ*T))*(1/(T*P)) := by ring | |
| _ ⤠(2*M)*(2*E+B*(1+ε*(Ļ*S))/(Ļ*T))*(2*K/B) := | |
| mul_le_mul_of_nonneg_left hi (mul_nonneg (by positivity) hn0) | |
| _ ⤠(2*M)*(2*E+(B/Ļ)/T+B*ε*K)*(2*K/B) := by | |
| exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hn (by positivity)) (by positivity) | |
| _ = _ := by field_simp [hB.ne']; ring | |
| lemma exists_bridge_cutoff (t : unitInterval) (ht : (t:ā) < 1) : | |
| ā k : ā, 2 ⤠k ā§ (k:ā)*(t:ā) ⤠(k:ā)-1 := by | |
| obtain āØn,hnā© := exists_nat_one_div_lt (sub_pos.mpr ht) | |
| let k := n+2 | |
| have hk : 2 ⤠k := by omega | |
| have hnk : 1/(k:ā) ⤠1/((n:ā)+1) := by | |
| apply one_div_le_one_div_of_le (by positivity) | |
| dsimp [k] | |
| push_cast | |
| linarith | |
| have hh : 1/(k:ā) < 1-(t:ā) := hnk.trans_lt hn | |
| have hkr : 0 < (k:ā) := by exact_mod_cast (show 0 < k by omega) | |
| have hx := (div_lt_iffā hkr).mp hh | |
| refine āØk,hk,?_ā© | |
| nlinarith | |
| lemma bridge_split_parameters {t : unitInterval} {k N : ā} | |
| (hk : 2 ⤠k) (ht : (k:ā)*(t:ā) ⤠(k:ā)-1) (hN : k ⤠N) : | |
| (N-N/k)+(N/k-1+1)=N ā§ | |
| (N:ā)*(t:ā) ⤠(N-N/k:ā) ā§ | |
| Real.sqrt (N:ā) ⤠(k:ā)*Real.sqrt ((N/k-1+1:ā):ā) := by | |
| have hk0 : 0 < k := by omega | |
| have hkr : 0 < (k:ā) := by positivity | |
| have hq : 1 ⤠N/k := (Nat.le_div_iff_mul_le hk0).mpr (by simpa using hN) | |
| have hqN : N/k ⤠N := Nat.div_le_self N k | |
| have hqr : N/k-1+1=N/k := by omega | |
| refine āØby omega,?_,?_ā© | |
| Ā· have hmul : (k:ā)*((N/k:ā):ā) ⤠N := by | |
| exact_mod_cast Nat.mul_div_le N k | |
| have htN := mul_le_mul_of_nonneg_left ht (Nat.cast_nonneg N (α := ā)) | |
| have hm : ((N-N/k:ā):ā) = (N:ā)-((N/k:ā):ā) := Nat.cast_sub hqN | |
| rw [hm] | |
| nlinarith | |
| Ā· rw [hqr] | |
| have hlt : N < k*(N/k+1) := by | |
| have hh := Nat.mod_lt N hk0 | |
| have he := Nat.mod_add_div N k | |
| nlinarith | |
| have hh : N ⤠2*k*(N/k) := by nlinarith | |
| have hNR : (N:ā) ⤠2*(k:ā)*((N/k:ā):ā) := by exact_mod_cast hh | |
| have hkr2 : (2:ā) ⤠k := by exact_mod_cast hk | |
| have hq0 : (0:ā) ⤠((N/k:ā):ā) := by positivity | |
| have hsq := Real.sq_sqrt (Nat.cast_nonneg N (α := ā)) | |
| have hsq' := Real.sq_sqrt hq0 | |
| have hKsq : (2*(k:ā)) ⤠(k:ā)^2 := by nlinarith | |
| have hNN := hNR.trans (mul_le_mul_of_nonneg_right hKsq hq0) | |
| have hpos : 0 ⤠(k:ā)*Real.sqrt ((N/k:ā):ā) := by positivity | |
| nlinarith [Real.sqrt_nonneg (N:ā)] | |
| lemma bridge_suffix_tendsto {k : ā} (hk : 0 < k) : | |
| Tendsto (fun n : ā => (2*n+1)/k-1) atTop atTop := by | |
| apply tendsto_atTop.2 | |
| intro b | |
| filter_upwards [eventually_ge_atTop (k*(b+2))] with n hn | |
| have hq : b+2 ⤠(2*n+1)/k := (Nat.le_div_iff_mul_le hk).mpr (by nlinarith) | |
| omega | |
| theorem CriticalEvenOffspring.stopped_soft_error (p : CriticalEvenOffspring) | |
| (t : unitInterval) (ht : (t:ā)<1) {F : C(unitInterval,ā) ā ā} {M : ā} | |
| (hM : 0 ⤠M) (hF : ā f, |F f| ⤠M) : | |
| ā C : ā, 0 ⤠C ā§ ā ε > 0, ā Ī“ > 0, āį¶ n in atTop, | |
| |(ā« d, F (stopPath t (p.iidWalk (2*n+1) d)) āp.iidBridgeLaw n) - | |
| (ā« d, F (stopPath t (p.iidWalk (2*n+1) d))* | |
| softCutoff ε (p.iidWalk (2*n+1) d 1) āp.iidLaw (2*n+1)) / | |
| (ā« d, softCutoff ε (p.iidWalk (2*n+1) d 1) āp.iidLaw (2*n+1))| ⤠C*ε+Ī“ := by | |
| obtain āØk,hk,hktā© := exists_bridge_cutoff t ht | |
| obtain āØE,hE,hEt,hbā© := p.prefix_soft_bound | |
| let r : ā ā ā := fun n => (2*n+1)/k-1 | |
| have hr : Tendsto r atTop atTop := bridge_suffix_tendsto (by omega) | |
| have hT : Tendsto (fun n => Real.sqrt ((r n+1:ā):ā)) atTop atTop := | |
| Real.tendsto_sqrt_atTop.comp (tendsto_natCast_atTop_atTop.comp (tendsto_add_atTop_nat 1 |>.comp hr)) | |
| have hres : Tendsto (fun n => (4*M*(k:ā)/p.bridgeConstant)* | |
| (2*E (r n)+(p.bridgeConstant/p.sigma)/Real.sqrt ((r n+1:ā):ā))) atTop (š 0) := by | |
| have hh := ((hEt.comp hr).const_mul 2).add | |
| (hT.const_div_atTop (p.bridgeConstant/p.sigma)) | |
| simpa only [mul_zero,add_zero,Function.comp_apply] using hh.const_mul (4*M*(k:ā)/p.bridgeConstant) | |
| refine āØ4*M*(k:ā)^2,by positivity,?_ā© | |
| intro ε hε Γ hΓ | |
| have hN : Tendsto (fun n : ā => 2*n+1) atTop atTop := | |
| tendsto_atTop_mono (fun n => by dsimp;omega) tendsto_id | |
| have hscale : Tendsto (fun n : ā => ε*(p.sigma*Real.sqrt ((2*n+1:ā):ā))) atTop atTop := | |
| ((Real.tendsto_sqrt_atTop.comp (tendsto_natCast_atTop_atTop.comp hN)).const_mul_atTop | |
| p.sigma_pos).const_mul_atTop hε | |
| have hden := p.iid_endpoint_limit.eventually (eventually_ge_nhds | |
| (show p.bridgeConstant/2 < p.bridgeConstant by linarith [p.bridgeConstant_pos])) | |
| have hsmall := hres.eventually (eventually_lt_nhds hΓ) | |
| filter_upwards [hN.eventually (eventually_ge_atTop k),hscale.eventually (eventually_gt_atTop 1), | |
| hden,hsmall] with n hn hw hp he | |
| let m := (2*n+1)-(2*n+1)/k | |
| obtain āØhlen,htm,hratioā© := bridge_split_parameters hk hkt hn | |
| change m+(r n+1)=2*n+1 at hlen | |
| change ((2*n+1:ā):ā)*(t:ā) ⤠m at htm | |
| change Real.sqrt ((2*n+1:ā):ā) ⤠(k:ā)*Real.sqrt ((r n+1:ā):ā) at hratio | |
| have htm' : ((m+(r n+1):ā):ā)*(t:ā) ⤠m := by simpa only [hlen] using htm | |
| have hpar : Even (((m+(r n+1):ā):ā¤)-1) := by | |
| rw [hlen] | |
| refine āØ(n:ā¤),?_ā© | |
| push_cast | |
| ring | |
| have hw' : 1 < ε*(p.sigma*Real.sqrt (m+(r n+1))) := by | |
| simpa only [Nat.cast_add,Nat.cast_one] using (show 1 < ε*(p.sigma*Real.sqrt ((m+(r n+1):ā):ā)) from hlen āø hw) | |
| have hp' : 0 < (p.iidLaw (m+(r n+1))).real {d | totalStep d = -1} := by | |
| rw [hlen] | |
| exact p.iid_endpoint_positive n | |
| have hh := hb m (r n) ε hε hpar hw' hp' | |
| (fun a => F (p.prefixWalk m (r n+1) t a)) M hM (fun a => hF _) | |
| simp_rw [p.prefixWalk_eq m (r n+1) htm'] at hh | |
| have hcast : (m:ā)+((r n:ā)+1)=((2*n+1:ā):ā) := by exact_mod_cast hlen | |
| rw [hcast] at hh | |
| rw [hlen] at hh | |
| simp_rw [ā p.iidWalk_endpoint (by omega : 0 < 2*n+1)] at hh | |
| have hcast' : (r n:ā)+1=((r n+1:ā):ā) := by norm_cast | |
| rw [hcast'] at hh | |
| change |_ - _| ⤠2*M*((2*E (r n)+p.bridgeConstant* | |
| (1+ε*(p.sigma*Real.sqrt ((2*n+1:ā):ā)))/ | |
| (p.sigma*Real.sqrt ((r n+1:ā):ā)))/Real.sqrt ((r n+1:ā):ā)) / | |
| (p.iidLaw (2*n+1)).real {d | totalStep d = -1} at hh | |
| apply hh.trans | |
| have hnumb := bridge_soft_numeric hM (hE (r n)) p.bridgeConstant_pos p.sigma_pos | |
| (Real.sqrt_pos.mpr (by positivity : 0 < ((2*n+1:ā):ā))) | |
| (Real.sqrt_pos.mpr (by positivity : 0 < ((r n+1:ā):ā))) | |
| (by exact_mod_cast (show 0 < k by omega)) hε.le hp hratio | |
| exact hnumb.trans (by linarith) | |
| theorem CriticalEvenOffspring.stopped_bridge_integral_limit (p : CriticalEvenOffspring) | |
| {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν] | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) | |
| (t : unitInterval) (ht : (t:ā)<1) {F : C(unitInterval,ā) ā ā} | |
| {M : ā} {L : āā„0} (hFM : ā f, |F f| ⤠M) (hF : LipschitzWith L F) : | |
| Tendsto (fun n => ā« d, F (stopPath t (p.iidWalk (2*n+1) d)) āp.iidBridgeLaw n) | |
| atTop (š (ā« Ļ, F (stopPath t (bridgePath B Ļ)) āν)) := by | |
| have hM : 0 ⤠M := (abs_nonneg (F 0)).trans (hFM 0) | |
| obtain āØC,hC,heā© := p.stopped_soft_error t ht hM hFM | |
| let G : C(unitInterval,ā) ā ā := F ā stopPath t | |
| have hG : LipschitzWith L G := by | |
| simpa only [mul_one] using hF.comp (stopPath_lipschitz t) | |
| have hGM : ā f, |G f| ⤠M := fun f => hFM _ | |
| have hN : Tendsto (fun n : ā => 2*n+1) atTop atTop := | |
| tendsto_atTop_mono (fun n => by dsimp;omega) tendsto_id | |
| have hclt := p.iidWalk_CLT hB | |
| have hodd : TendstoInDistribution (fun n => p.iidWalk (2*n+1)) atTop | |
| (brownianPath B) (fun n => p.iidLaw (2*n+1)) ν := | |
| āØfun n => hclt.forall_aemeasurable (2*n+1),hclt.aemeasurable_limit,hclt.tendsto.comp hNā© | |
| have hep : (fun Ļ => brownianPath B Ļ 1) =įµ[ν] (fun Ļ => B 1 Ļ) := by | |
| filter_upwards [brownianPath_ae_eq hB] with Ļ hĻ | |
| exact hĻ 1 | |
| have hden (ε : ā) : (ā« Ļ, softCutoff ε (brownianPath B Ļ 1) āν) = | |
| ā« Ļ, softCutoff ε (B 1 Ļ) āν := | |
| integral_congr_ae (hep.fun_comp (softCutoff ε)) | |
| have hnum (ε : ā) : (ā« Ļ, G (brownianPath B Ļ)*softCutoff ε (brownianPath B Ļ 1) āν) = | |
| ā« Ļ, G (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āν := by | |
| apply integral_congr_ae | |
| filter_upwards [hep] with Ļ hĻ | |
| rw [hĻ] | |
| apply tendsto_of_soft_windows hC L.coe_nonneg he | |
| (T := fun ε => (ā« Ļ, G (brownianPath B Ļ)*softCutoff ε (B 1 Ļ) āν) / | |
| (ā« Ļ, softCutoff ε (B 1 Ļ) āν)) | |
| · intro ε hε | |
| have hh := soft_weighted_tendsto hodd hG.continuous | |
| (show Continuous (fun f : C(unitInterval,ā) => f 1) from by fun_prop) hGM hε | |
| (show 0 < ā« Ļ, softCutoff ε (brownianPath B Ļ 1) āν from by | |
| rw [hden]; exact brownian_softCutoff_pos hB.toIsPreBrownianReal hε) | |
| rw [hnum,hden] at hh | |
| exact hh | |
| · intro ε hε | |
| exact brownian_soft_bridge_bound hB hGM hG hε | |
| theorem CriticalEvenOffspring.stopped_bridge_CLT (p : CriticalEvenOffspring) | |
| {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν] | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) | |
| (t : unitInterval) (ht : (t:ā)<1) : | |
| TendstoInDistribution (fun n d => stopPath t (p.iidWalk (2*n+1) d)) atTop | |
| (fun Ļ => stopPath t (bridgePath B Ļ)) p.iidBridgeLaw ν := by | |
| have hX (n : ā) : AEMeasurable (fun d => stopPath t (p.iidWalk (2*n+1) d)) (p.iidBridgeLaw n) := | |
| ((continuous_stopPath t).measurable.comp (p.iidWalk_measurable _)).aemeasurable | |
| have hY : AEMeasurable (fun Ļ => stopPath t (bridgePath B Ļ)) ν := | |
| (continuous_stopPath t).measurable.comp_aemeasurable (bridgePath_aemeasurable hB) | |
| refine āØhX,hY,?_ā© | |
| apply tendsto_iff_forall_lipschitz_integral_tendsto.mpr | |
| rintro F āØM,hMā© āØL,hLā© | |
| change Tendsto (fun n => ā« f, F f ā(p.iidBridgeLaw n).map (fun d => stopPath t (p.iidWalk (2*n+1) d))) | |
| atTop (š (ā« f, F f āν.map (fun Ļ => stopPath t (bridgePath B Ļ)))) | |
| simp_rw [integral_map (hX _) hL.continuous.aestronglyMeasurable, | |
| integral_map hY hL.continuous.aestronglyMeasurable] | |
| apply p.stopped_bridge_integral_limit hB t ht (M := |F 0|+M) (L := L) _ hL | |
| intro f | |
| have hh := hM f 0 | |
| rw [Real.dist_eq] at hh | |
| linarith [abs_sub_abs_le_abs_sub (F f) (F 0)] | |
| lemma hat_reverse (N : ā) (i : Fin (N+1)) (t : unitInterval) : | |
| hat N i.rev.val (unitInterval.symm t) = hat N i.val t := by | |
| change max 0 (1-|(N:ā)*(1-(t:ā))-(i.rev.val:ā)|) = _ | |
| have hi : i.rev.val=N-i.val := by simp [Fin.val_rev] | |
| have hile : i.val ⤠N := Nat.le_of_lt_succ i.isLt | |
| rw [hi,Nat.cast_sub hile] | |
| have he : (N:ā)*(1-(t:ā))-((N:ā)-i.val) = -((N:ā)*(t:ā)-i.val) := by ring | |
| rw [he,abs_neg] | |
| rfl | |
| lemma interpolation_reverse (N : ā) (a : Fin (N+1) ā ā) (c : ā) | |
| (t : unitInterval) : | |
| interpolation N (fun i => c-a i.rev) t = c-interpolation N a (unitInterval.symm t) := by | |
| rw [interpolation_apply,interpolation_apply] | |
| have hs : (ā i : Fin (N+1), a i*hat N i.val (unitInterval.symm t)) = | |
| ā i : Fin (N+1), a i.rev*hat N i.val t := by | |
| rw [ā Equiv.sum_comp Fin.revPerm (fun i : Fin (N+1) => a i*hat N i.val (unitInterval.symm t))] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp only [Fin.revPerm_apply,hat_reverse] | |
| rw [hs] | |
| simp_rw [sub_mul] | |
| rw [Finset.sum_sub_distrib,ā Finset.mul_sum,hat_sum,mul_one] | |
| lemma reverse_partial_sum (N : ā) (x : Fin N ā ā) (i : Fin (N+1)) : | |
| (ā j : Fin N, if j.val < i.val then x j.rev else 0) = | |
| (ā j : Fin N, x j)-(ā j : Fin N, if j.val < i.rev.val then x j else 0) := by | |
| rw [ā Equiv.sum_comp Fin.revPerm (fun j : Fin N => if j.val < i.val then x j.rev else 0), | |
| ā Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| simp only [Fin.revPerm_apply,Fin.rev_rev] | |
| have hi : i.rev.val=N-i.val := by simp [Fin.val_rev] | |
| have hj : j.rev.val=N-1-j.val := by simp [Fin.val_rev];omega | |
| have hb : j.rev.val < i.val ā ¬ j.val < i.rev.val := by rw [hi,hj];omega | |
| by_cases h : j.val < i.rev.val <;> simp only [hb,h,not_true_eq_false,not_false_eq_true,ite_true,ite_false,sub_self,sub_zero] | |
| lemma interpolation_increments_reverse (N : ā) (x : Fin N ā ā) (a : ā) | |
| (t : unitInterval) : | |
| interpolation N (fun i => (ā j : Fin N, if j.val < i.val then x j.rev else 0)/a) t = | |
| (ā j : Fin N, x j)/a - | |
| interpolation N (fun i => (ā j : Fin N, if j.val < i.val then x j else 0)/a) | |
| (unitInterval.symm t) := by | |
| simp_rw [reverse_partial_sum,sub_div] | |
| exact interpolation_reverse N (fun i : Fin (N+1) => (ā j : Fin N, if j.val < i.val then x j else 0)/a) ((ā j : Fin N, x j)/a) t | |
| lemma measurePreserving_cond {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} | |
| {e : Ī© ā Ī©} (he : MeasurePreserving e μ μ) {s : Set Ī©} | |
| (hs : MeasurableSet s) (hes : e ā»Ā¹' s=s) : | |
| MeasurePreserving e (cond μ s) (cond μ s) := by | |
| refine āØhe.measurable,?_ā© | |
| apply Measure.ext | |
| intro A hA | |
| rw [Measure.map_apply he.measurable hA,cond_apply hs,cond_apply hs] | |
| congr 1 | |
| calc | |
| μ (s ā© e ā»Ā¹' A) = μ (e ā»Ā¹' (s ā© A)) := by rw [Set.preimage_inter,hes] | |
| _ = μ (s ⩠A) := he.measure_preimage (hs.inter hA).nullMeasurableSet | |
| def reverseArray (N : ā) : (Fin N ā ā) āįµ (Fin N ā ā) := | |
| MeasurableEquiv.piCongrLeft (fun _ : Fin N => ā) Fin.revPerm | |
| lemma reverseArray_apply (N : ā) (d : Fin N ā ā) (i : Fin N) : | |
| reverseArray N d i = d i.rev := by | |
| simpa only [Fin.revPerm_apply,Fin.rev_rev,reverseArray] using | |
| MeasurableEquiv.piCongrLeft_apply_apply Fin.revPerm (β := fun _ : Fin N => ā) d i.rev | |
| lemma reverseArray_preserving (μ : Measure ā) [SigmaFinite μ] (N : ā) : | |
| MeasurePreserving (reverseArray N) (Measure.pi (fun _ : Fin N => μ)) | |
| (Measure.pi (fun _ : Fin N => μ)) := | |
| measurePreserving_piCongrLeft (fun _ : Fin N => μ) Fin.revPerm | |
| lemma reverseArray_sum (N : ā) (d : Fin N ā ā) (f : ā ā ā¤) : | |
| (ā i : Fin N, f (reverseArray N d i)) = ā i : Fin N, f (d i) := by | |
| simpa only [reverseArray_apply,Fin.revPerm_apply] using Equiv.sum_comp Fin.revPerm (fun i : Fin N => f (d i)) | |
| lemma reverseArray_cond_preserving (μ : Measure ā) [SigmaFinite μ] (N : ā) | |
| (f : ā ā ā¤) (j : ā¤) : | |
| MeasurePreserving (reverseArray N) | |
| (cond (Measure.pi (fun _ : Fin N => μ)) {d | (ā i : Fin N, f (d i))=j}) | |
| (cond (Measure.pi (fun _ : Fin N => μ)) {d | (ā i : Fin N, f (d i))=j}) := by | |
| apply measurePreserving_cond (reverseArray_preserving μ N) (by measurability) | |
| ext d | |
| simp only [Set.mem_preimage,Set.mem_ofPred_eq,reverseArray_sum] | |
| lemma stopPath_one (f : C(unitInterval,ā)) : stopPath 1 f=f := by | |
| ext s | |
| rw [stopPath_apply,min_eq_left (show s ⤠(1:unitInterval) from s.property.2)] | |
| lemma stopPath_zero (f : C(unitInterval,ā)) : stopPath 0 f=ContinuousMap.const _ (f 0) := by | |
| ext s | |
| simp [stopPath_apply] | |
| lemma continuous_stopPath_time (f : C(unitInterval,ā)) : Continuous (fun t => stopPath t f) := by | |
| apply ContinuousMap.continuous_of_continuous_uncurry | |
| exact f.continuous.comp (continuous_snd.min continuous_fst) | |
| lemma dist_stop_reverse_le (f g : C(unitInterval,ā)) (c : ā) | |
| (hfg : ā u, g u=c-f (unitInterval.symm u)) (t : unitInterval) : | |
| dist f (stopPath t f) ⤠2*āstopPath (unitInterval.symm t) gā := by | |
| apply (ContinuousMap.dist_le (by positivity)).mpr | |
| intro u | |
| have hval (v : unitInterval) (hv : v ⤠unitInterval.symm t) : | |
| |g v| ⤠āstopPath (unitInterval.symm t) gā := by | |
| have hh := ContinuousMap.norm_coe_le_norm (stopPath (unitInterval.symm t) g) v | |
| simpa only [stopPath_apply,min_eq_left hv,Real.norm_eq_abs] using hh | |
| rw [stopPath_apply,Real.dist_eq] | |
| by_cases hu : u ⤠t | |
| Ā· simp only [min_eq_left hu,sub_self,abs_zero] | |
| positivity | |
| · have htu : t ⤠u := le_of_not_ge hu | |
| rw [min_eq_right htu] | |
| have hv := hval (unitInterval.symm u) ((unitInterval.symm_le_symm).mpr htu) | |
| have ht' := hval (unitInterval.symm t) le_rfl | |
| have hdiff : f u-f t = g (unitInterval.symm t)-g (unitInterval.symm u) := by | |
| rw [hfg,hfg,unitInterval.symm_symm,unitInterval.symm_symm] | |
| ring | |
| rw [hdiff] | |
| exact (abs_sub _ _).trans (by linarith) | |
| def earlyTime (j : ā) : unitInterval := | |
| āØ1/((j:ā)+2),by constructor <;> (try positivity); apply (div_le_one (by positivity)).mpr; linarith [Nat.cast_nonneg j (α := ā)]ā© | |
| lemma earlyTime_pos (j : ā) : (0:ā)<earlyTime j := by dsimp [earlyTime];positivity | |
| lemma earlyTime_lt_one (j : ā) : (earlyTime j:ā)<1 := by | |
| dsimp [earlyTime] | |
| apply (div_lt_one (by positivity)).mpr | |
| linarith [Nat.cast_nonneg j (α := ā)] | |
| lemma earlyTime_tendsto : Tendsto earlyTime atTop (š 0) := by | |
| apply tendsto_subtype_rng.mpr | |
| change Tendsto (fun j : ā => 1/((j:ā)+2)) atTop (š 0) | |
| exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).const_div_atTop 1 | |
| lemma lateTime_tendsto : Tendsto (fun j => unitInterval.symm (earlyTime j)) atTop (š 1) := by | |
| simpa only [unitInterval.symm_zero,Function.comp_def] using unitInterval.continuous_symm.tendsto 0 |>.comp earlyTime_tendsto | |
| lemma norm_stop_early_tendsto (f : C(unitInterval,ā)) (hf : f 0=0) : | |
| Tendsto (fun j => āstopPath (earlyTime j) fā) atTop (š 0) := by | |
| have h := ((continuous_stopPath_time f).tendsto 0 |>.comp earlyTime_tendsto).norm | |
| simpa only [stopPath_zero,hf,ContinuousMap.const_zero,norm_zero,Function.comp_def] using h | |
| lemma stop_late_tendsto (f : C(unitInterval,ā)) : | |
| Tendsto (fun j => stopPath (unitInterval.symm (earlyTime j)) f) atTop (š f) := by | |
| simpa only [stopPath_one,Function.comp_def] using (continuous_stopPath_time f).tendsto 1 |>.comp lateTime_tendsto | |
| def freezeGauge (M : ā) (L : āā„0) (f : C(unitInterval,ā)) : ā := | |
| min (2*M) (2*(L:ā)*āfā) | |
| lemma freezeGauge_continuous (M : ā) (L : āā„0) : Continuous (freezeGauge M L) := by | |
| unfold freezeGauge | |
| fun_prop | |
| lemma freezeGauge_nonneg {M : ā} (hM : 0 ⤠M) (L : āā„0) (f : C(unitInterval,ā)) : | |
| 0 ⤠freezeGauge M L f := by unfold freezeGauge;positivity | |
| lemma freezeGauge_abs_le {M : ā} (hM : 0 ⤠M) (L : āā„0) (f : C(unitInterval,ā)) : | |
| |freezeGauge M L f| ⤠2*M := by | |
| rw [abs_of_nonneg (freezeGauge_nonneg hM L f)] | |
| exact min_le_left _ _ | |
| lemma integral_reverse_freeze_bound {Ī© : Type*} [MeasurableSpace Ī©] | |
| {μ : Measure Ī©} [IsProbabilityMeasure μ] {e : Ī© āįµ Ī©} | |
| (he : MeasurePreserving e μ μ) {X : Ī© ā C(unitInterval,ā)} | |
| (hX : AEMeasurable X μ) (c : Ī© ā ā) | |
| (hrev : ā Ļ u, X (e Ļ) u=c Ļ-X Ļ (unitInterval.symm u)) | |
| {F : C(unitInterval,ā) ā ā} {M : ā} {L : āā„0} | |
| (hFM : ā f, |F f| ⤠M) (hF : LipschitzWith L F) (t : unitInterval) : | |
| |(ā« Ļ, F (X Ļ) āμ)-(ā« Ļ, F (stopPath t (X Ļ)) āμ)| ⤠| |
| ā« Ļ, freezeGauge M L (stopPath (unitInterval.symm t) (X Ļ)) āμ := by | |
| have hM : 0 ⤠M := (abs_nonneg (F 0)).trans (hFM 0) | |
| have hi (Z : Ī© ā C(unitInterval,ā)) (hZ : AEMeasurable Z μ) : Integrable (fun Ļ => F (Z Ļ)) μ := | |
| Integrable.of_bound (hF.continuous.measurable.comp_aemeasurable hZ).aestronglyMeasurable M | |
| (ae_of_all μ (fun Ļ => hFM _)) | |
| have hstop : AEMeasurable (fun Ļ => stopPath t (X Ļ)) μ := | |
| (continuous_stopPath t).measurable.comp_aemeasurable hX | |
| have hg : Integrable (fun Ļ => freezeGauge M L (stopPath (unitInterval.symm t) (X (e Ļ)))) μ := by | |
| apply Integrable.of_bound _ (2*M) (ae_of_all μ (fun Ļ => freezeGauge_abs_le hM L _)) | |
| exact ((freezeGauge_continuous M L).measurable.comp_aemeasurable | |
| ((continuous_stopPath _).measurable.comp_aemeasurable | |
| (hX.comp_quasiMeasurePreserving he.quasiMeasurePreserving))).aestronglyMeasurable | |
| rw [ā integral_sub (hi _ hX) (hi _ hstop)] | |
| apply (show |ā« Ļ, F (X Ļ)-F (stopPath t (X Ļ)) āμ| ⤠| |
| ā« Ļ, |F (X Ļ)-F (stopPath t (X Ļ))| āμ by | |
| simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm | |
| (fun Ļ => F (X Ļ)-F (stopPath t (X Ļ)))).trans | |
| calc | |
| _ ⤠⫠Ļ, freezeGauge M L (stopPath (unitInterval.symm t) (X (e Ļ))) āμ := by | |
| apply integral_mono ((hi _ hX).sub (hi _ hstop)).norm hg | |
| intro Ļ | |
| change |F (X Ļ)-F (stopPath t (X Ļ))| ⤠| |
| min (2*M) (2*(L:ā)*āstopPath (unitInterval.symm t) (X (e Ļ))ā) | |
| apply le_min | |
| Ā· linarith [abs_sub (F (X Ļ)) (F (stopPath t (X Ļ))),hFM (X Ļ),hFM (stopPath t (X Ļ))] | |
| Ā· have hb := dist_stop_reverse_le (X Ļ) (X (e Ļ)) (c Ļ) (hrev Ļ) t | |
| have hl := hF.dist_le_mul (X Ļ) (stopPath t (X Ļ)) | |
| rw [Real.dist_eq] at hl | |
| calc | |
| _ ⤠(L:ā)*dist (X Ļ) (stopPath t (X Ļ)) := hl | |
| _ ⤠(L:ā)*(2*āstopPath (unitInterval.symm t) (X (e Ļ))ā) := | |
| mul_le_mul_of_nonneg_left hb L.coe_nonneg | |
| _ = _ := by ring | |
| _ = _ := he.integral_comp' (fun Ļ => freezeGauge M L (stopPath (unitInterval.symm t) (X Ļ))) | |
| lemma early_gauge_integral_tendsto {Ī© : Type*} [MeasurableSpace Ī©] | |
| {μ : Measure Ī©} [IsProbabilityMeasure μ] {X : Ī© ā C(unitInterval,ā)} | |
| (hX : AEMeasurable X μ) (hz : āįµ Ļ āμ, X Ļ 0=0) {M : ā} (hM : 0 ⤠M) (L : āā„0) : | |
| Tendsto (fun j => ā« Ļ, freezeGauge M L (stopPath (earlyTime j) (X Ļ)) āμ) atTop (š 0) := by | |
| have hh := tendsto_integral_of_dominated_convergence (fun _ : Ī© => 2*M) | |
| (F := fun j Ļ => freezeGauge M L (stopPath (earlyTime j) (X Ļ))) (f := fun _ => 0) | |
| (fun j => ((freezeGauge_continuous M L).measurable.comp_aemeasurable | |
| ((continuous_stopPath _).measurable.comp_aemeasurable hX)).aestronglyMeasurable) | |
| (integrable_const _) (fun j => ae_of_all μ (fun Ļ => freezeGauge_abs_le hM L _)) (by | |
| filter_upwards [hz] with Ļ hĻ | |
| have h := tendsto_const_nhds.min ((norm_stop_early_tendsto (X Ļ) hĻ).const_mul (2*(L:ā))) (f := fun _ : ā => 2*M) | |
| simpa only [freezeGauge,mul_zero,min_eq_right (by positivity : 0 ⤠2*M)] using h) | |
| simpa only [integral_zero] using hh | |
| lemma late_integral_tendsto {Ī© : Type*} [MeasurableSpace Ī©] | |
| {μ : Measure Ī©} [IsProbabilityMeasure μ] {X : Ī© ā C(unitInterval,ā)} | |
| (hX : AEMeasurable X μ) {F : C(unitInterval,ā) ā ā} (hF : Continuous F) | |
| {M : ā} (hFM : ā f, |F f| ⤠M) : | |
| Tendsto (fun j => ā« Ļ, F (stopPath (unitInterval.symm (earlyTime j)) (X Ļ)) āμ) atTop | |
| (š (ā« Ļ, F (X Ļ) āμ)) := by | |
| exact tendsto_integral_of_dominated_convergence (fun _ : Ī© => M) | |
| (fun j => (hF.measurable.comp_aemeasurable | |
| ((continuous_stopPath _).measurable.comp_aemeasurable hX)).aestronglyMeasurable) | |
| (integrable_const _) (fun j => ae_of_all μ (fun Ļ => hFM _)) | |
| (ae_of_all μ (fun Ļ => (hF.tendsto (X Ļ)).comp (stop_late_tendsto (X Ļ)))) | |
| lemma CriticalEvenOffspring.iidWalk_reverse (p : CriticalEvenOffspring) (N : ā) | |
| (d : Fin N ā ā) (t : unitInterval) : | |
| p.iidWalk N (reverseArray N d) t = | |
| (ā j : Fin N, p.standardStep (d j))/Real.sqrt N- | |
| p.iidWalk N d (unitInterval.symm t) := by | |
| unfold iidWalk | |
| simp_rw [reverseArray_apply] | |
| exact interpolation_increments_reverse N (fun j => p.standardStep (d j)) (Real.sqrt N) t | |
| lemma CriticalEvenOffspring.bridge_reverse_preserving (p : CriticalEvenOffspring) (n : ā) : | |
| MeasurePreserving (reverseArray (2*n+1)) (p.iidBridgeLaw n) (p.iidBridgeLaw n) := | |
| reverseArray_cond_preserving p.law.toMeasure (2*n+1) (fun k => (k:ā¤)-1) (-1) | |
| lemma bridgePath_zero_ae {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) : | |
| āįµ Ļ āν, bridgePath B Ļ 0=0 := by | |
| filter_upwards [bridgePath_ae_eq hB,hB.eval_zero_ae_eq_zero] with Ļ hĻ hz | |
| rw [hĻ] | |
| change B 0 Ļ-(0:ā)*B 1 Ļ=0 | |
| simp [hz] | |
| theorem CriticalEvenOffspring.bridge_integral_limit (p : CriticalEvenOffspring) | |
| {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν] | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) | |
| {F : C(unitInterval,ā) ā ā} {M : ā} {L : āā„0} | |
| (hFM : ā f, |F f| ⤠M) (hF : LipschitzWith L F) : | |
| Tendsto (fun n => ā« d, F (p.iidWalk (2*n+1) d) āp.iidBridgeLaw n) atTop | |
| (š (ā« Ļ, F (bridgePath B Ļ) āν)) := by | |
| have hM : 0 ⤠M := (abs_nonneg (F 0)).trans (hFM 0) | |
| let A : ā ā ā := fun n => ā« d, F (p.iidWalk (2*n+1) d) āp.iidBridgeLaw n | |
| let S : ā ā ā ā ā := fun j n => ā« d, | |
| F (stopPath (unitInterval.symm (earlyTime j)) (p.iidWalk (2*n+1) d)) āp.iidBridgeLaw n | |
| let b : ā := ā« Ļ, F (bridgePath B Ļ) āν | |
| let a : ā ā ā := fun j => ā« Ļ, | |
| F (stopPath (unitInterval.symm (earlyTime j)) (bridgePath B Ļ)) āν | |
| let R : ā ā ā ā ā := fun j n => ā« d, | |
| freezeGauge M L (stopPath (earlyTime j) (p.iidWalk (2*n+1) d)) āp.iidBridgeLaw n | |
| let r : ā ā ā := fun j => ā« Ļ, | |
| freezeGauge M L (stopPath (earlyTime j) (bridgePath B Ļ)) āν | |
| have hlate (j : ā) : ((unitInterval.symm (earlyTime j):unitInterval):ā)<1 := by | |
| rw [unitInterval.coe_symm_eq] | |
| linarith [earlyTime_pos j] | |
| have hS (j : ā) : Tendsto (S j) atTop (š (a j)) := | |
| p.stopped_bridge_integral_limit hB _ (hlate j) hFM hF | |
| have hR (j : ā) : Tendsto (R j) atTop (š (r j)) := by | |
| exact integral_tendsto_of_tendstoInDistribution (p.stopped_bridge_CLT hB _ (earlyTime_lt_one j)) | |
| (freezeGauge_continuous M L) (freezeGauge_abs_le hM L) | |
| have hr : Tendsto r atTop (š 0) := | |
| early_gauge_integral_tendsto (bridgePath_aemeasurable hB) (bridgePath_zero_ae hB) hM L | |
| have ha : Tendsto a atTop (š b) := | |
| late_integral_tendsto (bridgePath_aemeasurable hB) hF.continuous hFM | |
| have he (j n : ā) : |A n-S j n| ⤠R j n := by | |
| have hh := integral_reverse_freeze_bound (p.bridge_reverse_preserving n) | |
| (p.iidWalk_measurable (2*n+1)).aemeasurable | |
| (fun d => (ā i : Fin (2*n+1), p.standardStep (d i))/Real.sqrt ((2*n+1:ā):ā)) | |
| (p.iidWalk_reverse (2*n+1)) hFM hF (unitInterval.symm (earlyTime j)) | |
| simpa only [unitInterval.symm_symm] using hh | |
| change Tendsto A atTop (š b) | |
| rw [Metric.tendsto_nhds] | |
| intro ε hε | |
| obtain āØj,hj,hjaā© := ((Metric.tendsto_nhds.mp hr (ε/4) (by positivity)).and | |
| (Metric.tendsto_nhds.mp ha (ε/4) (by positivity))).exists | |
| rw [Real.dist_eq,sub_zero] at hj | |
| rw [Real.dist_eq] at hja | |
| have hSn := Metric.tendsto_nhds.mp (hS j) (ε/4) (by positivity) | |
| have hRn := (hR j).eventually (eventually_lt_nhds (show r j < r j+ε/4 by linarith)) | |
| filter_upwards [hSn,hRn] with n hn hnr | |
| rw [Real.dist_eq] at hn ⢠| |
| have hā := abs_sub_le (A n) (S j n) b | |
| have hā := abs_sub_le (S j n) (a j) b | |
| have hā := he j n | |
| linarith [le_abs_self (r j)] | |
| theorem CriticalEvenOffspring.iidBridge_CLT (p : CriticalEvenOffspring) | |
| {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν] | |
| {B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) : | |
| TendstoInDistribution (fun n => p.iidWalk (2*n+1)) atTop | |
| (bridgePath B) p.iidBridgeLaw ν := by | |
| have hX (n : ā) : AEMeasurable (p.iidWalk (2*n+1)) (p.iidBridgeLaw n) := | |
| (p.iidWalk_measurable _).aemeasurable | |
| have hY := bridgePath_aemeasurable hB | |
| refine āØhX,hY,?_ā© | |
| apply tendsto_iff_forall_lipschitz_integral_tendsto.mpr | |
| rintro F āØM,hMā© āØL,hLā© | |
| change Tendsto (fun n => ā« f, F f ā(p.iidBridgeLaw n).map (p.iidWalk (2*n+1))) atTop | |
| (š (ā« f, F f āν.map (bridgePath B))) | |
| simp_rw [integral_map (hX _) hL.continuous.aestronglyMeasurable, | |
| integral_map hY hL.continuous.aestronglyMeasurable] | |
| apply p.bridge_integral_limit hB (M := |F 0|+M) (L := L) _ hL | |
| intro f | |
| have hh := hM f 0 | |
| rw [Real.dist_eq] at hh | |
| linarith [abs_sub_abs_le_abs_sub (F f) (F 0)] | |
| end FKCRT.TreeCoding | |
| end | |
| end OAI | |