Download data/lean/OAI/Probability/FirstPassage/BKExponentialQuantiles.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.79 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FirstPassage/BKExponentialQuantiles.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FirstPassage/BKExponentialQuantiles.lean
-
curl -L -o BKExponentialQuantiles.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FirstPassage/BKExponentialQuantiles.lean
4.79 kB
| import OAI.Probability.FirstPassage.BKQuantization | |
| import OAI.Probability.FirstPassage.FiniteEdgeEvents | |
| import Mathlib.MeasureTheory.Function.Floor | |
| namespace OAI | |
| namespace PlanarFPP | |
| open MeasureTheory ProbabilityTheory Set | |
| variable {Ξ© : Type*} [MeasurableSpace Ξ©] {P : Measure Ξ©} {Ο : Edge β Ξ© β β} | |
| lemma ExponentialEnvironment.edge_tail_real (h : ExponentialEnvironment P Ο) | |
| (e : Edge) (r : β) (hr : 0 β€ r) : P.real {Ο | r < Ο e Ο} = Real.exp (-r) := by | |
| let _ := h.probability | |
| have hm : P {Ο | Ο e Ο β€ r} = expMeasure 1 (Iic r) := by | |
| rw [β h.marginal e,Measure.map_apply (h.measurable e) measurableSet_Iic] | |
| rfl | |
| have hc : P.real {Ο | Ο e Ο β€ r} = 1-Real.exp (-r) := by | |
| change (P {Ο | Ο e Ο β€ r}).toReal = _ | |
| rw [hm,β measureReal_def,β cdf_eq_real,cdf_expMeasure_eq (by norm_num)] | |
| simp [hr] | |
| have he : {Ο | r < Ο e Ο} = {Ο | Ο e Ο β€ r}αΆ := by ext Ο; simp | |
| rw [he,measureReal_compl (measurableSet_le (h.measurable e) measurable_const),hc] | |
| simp | |
| theorem ExponentialEnvironment.survival_lt_real (h : ExponentialEnvironment P Ο) | |
| (e : Edge) (u : β) (hu : 0 β€ u) (hu1 : u β€ 1) : | |
| P.real {Ο | Real.exp (-Ο e Ο) < u} = u := by | |
| by_cases hz : u=0 | |
| Β· subst u | |
| have he : {Ο | Real.exp (-Ο e Ο) < 0} = β := by | |
| ext Ο; simp [not_lt.mpr (Real.exp_pos (-Ο e Ο)).le] | |
| rw [he]; simp | |
| Β· have hup : 0 < u := lt_of_le_of_ne hu (Ne.symm hz) | |
| have he : {Ο | Real.exp (-Ο e Ο) < u} = {Ο | -Real.log u < Ο e Ο} := by | |
| ext Ο | |
| rw [mem_ofPred_eq,mem_ofPred_eq,β Real.exp_log hup,Real.exp_lt_exp] | |
| simp only [Real.log_exp] | |
| constructor <;> intro hh <;> linarith | |
| rw [he,h.edge_tail_real e (-Real.log u) (neg_nonneg.mpr (Real.log_nonpos hu hu1))] | |
| simp [Real.exp_log hup] | |
| theorem ExponentialEnvironment.survival_bin_real (h : ExponentialEnvironment P Ο) | |
| (e : Edge) (a b : β) (ha : 0 β€ a) (hab : a β€ b) (hb : b β€ 1) : | |
| P.real {Ο | a β€ Real.exp (-Ο e Ο) β§ Real.exp (-Ο e Ο) < b} = b-a := by | |
| let _ := h.probability | |
| let A : Set Ξ© := {Ο | Real.exp (-Ο e Ο) < a} | |
| let B : Set Ξ© := {Ο | Real.exp (-Ο e Ο) < b} | |
| have hA : MeasurableSet A := measurableSet_lt (Real.measurable_exp.comp (h.measurable e).neg) measurable_const | |
| have hAB : A β B := fun Ο hΟ => lt_of_lt_of_le hΟ hab | |
| have he : {Ο | a β€ Real.exp (-Ο e Ο) β§ Real.exp (-Ο e Ο) < b} = B \ A := by | |
| ext Ο | |
| simp only [mem_ofPred_eq,mem_sdiff,A,B,not_lt] | |
| tauto | |
| rw [he,measureReal_sdiff hAB hA] | |
| exact congrArgβ (Β·-Β·) (h.survival_lt_real e b (ha.trans hab) hb) | |
| (h.survival_lt_real e a ha (hab.trans hb)) | |
| theorem ExponentialEnvironment.survival_rank_real (h : ExponentialEnvironment P Ο) | |
| (e : Edge) (m i : β) (hm : 0 < m) (hi : i < m) : | |
| P.real {Ο | β(m:β)*Real.exp (-Ο e Ο)ββ = i} = 1/(m:β) := by | |
| have hm' : (0:β) < m := by exact_mod_cast hm | |
| have he : {Ο | β(m:β)*Real.exp (-Ο e Ο)ββ = i} = | |
| {Ο | (i:β)/m β€ Real.exp (-Ο e Ο) β§ Real.exp (-Ο e Ο) < ((i:β)+1)/m} := by | |
| ext Ο | |
| rw [mem_ofPred_eq,mem_ofPred_eq,Nat.floor_eq_iff (by positivity)] | |
| rw [div_le_iffβ hm',lt_div_iffβ hm'] | |
| simp only [mul_comm] | |
| have hu : ((i:β)+1)/m β€ 1 := by | |
| rw [div_le_iffβ hm'] | |
| have hi' : (i:β)+1 β€ m := by exact_mod_cast (show i+1 β€ m by omega) | |
| simpa using hi' | |
| rw [he,h.survival_bin_real e ((i:β)/m) (((i:β)+1)/m) (by positivity) | |
| (div_le_div_of_nonneg_right (by linarith) hm'.le) hu] | |
| ring | |
| theorem ExponentialEnvironment.survival_ranks_joint_real (h : ExponentialEnvironment P Ο) | |
| (S : Finset Edge) (m : β) (hm : 0 < m) (i : Edge β β) (hi : β e β S, i e < m) : | |
| P.real {Ο | β e β S, β(m:β)*Real.exp (-Ο e Ο)ββ = i e} = (1/(m:β))^S.card := by | |
| let A : Edge β Set (Edge β β) := fun e => {w | β(m:β)*Real.exp (-w e)ββ = i e} | |
| have hA : β e β S, MeasurableSet (A e) := by | |
| intro e _ | |
| apply measurableSet_eq_fun _ measurable_const | |
| fun_prop | |
| have hAS : β e β S, DependsOnEdges (A e) {e} := by | |
| intro e _ w w' hw | |
| have he := hw e (Finset.mem_singleton_self e) | |
| simp only [A,mem_ofPred_eq,he] | |
| have hd : Set.Pairwise (βS : Set Edge) (fun e f => Disjoint ({e} : Finset Edge) {f}) := by | |
| intro e _ f _ hef | |
| simpa using hef | |
| have hj := disjoint_edge_events_inter_probability h S A (fun e => {e}) hA hAS hd | |
| have hr := congrArg ENNReal.toReal hj | |
| simp only [ENNReal.toReal_prod] at hr | |
| change P.real _ = β e β S, P.real _ at hr | |
| dsimp [A] at hr | |
| rw [hr] | |
| calc | |
| _ = β _e β S, (1/(m:β)) := by | |
| apply Finset.prod_congr rfl | |
| intro e he | |
| exact h.survival_rank_real e m (i e) hm (hi e he) | |
| _ = _ := by simp | |
| end PlanarFPP | |
| end OAI | |