Download data/lean/OAI/Probability/GammaPassage/CheapPath.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.82 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GammaPassage/CheapPath.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/GammaPassage/CheapPath.lean
-
curl -L -o CheapPath.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GammaPassage/CheapPath.lean
4.82 kB
| import OAI.Probability.GammaPassage.FiniteTails | |
| import OAI.Probability.FirstPassage.PathWitnesses | |
| namespace OAI | |
| namespace GammaFPP | |
| open MeasureTheory ProbabilityTheory PlanarFPP Finset | |
| open scoped ENNReal | |
| lemma trace_edge_length (p : Vertex) (ds : List Step) : | |
| ((trace p ds).map traversalEdge).length = ds.length := by | |
| induction ds generalizing p with | |
| | nil => rfl | |
| | cons d ds ih => | |
| simpa only [trace, List.map_cons, List.length_cons] using | |
| (congrArg Nat.succ (ih (p + d.delta))) | |
| lemma pathCost_trace_edge_sum (w : Edge β β) (p : Vertex) (ds : List Step) : | |
| pathCost w p ds = (((trace p ds).map traversalEdge).map w).sum := by | |
| induction ds generalizing p with | |
| | nil => rfl | |
| | cons d ds ih => simp only [pathCost, trace, List.map_cons, List.sum_cons, | |
| traversalEdge, ih] | |
| /-- Only a trail's traversal sum can be replaced by its distinct-edge set sum. -/ | |
| lemma pathCost_eq_distinct_edgeSum (w : Edge β β) (p : Vertex) (ds : List Step) | |
| (hn : ((trace p ds).map traversalEdge).Nodup) : | |
| pathCost w p ds = β e β ((trace p ds).map traversalEdge).toFinset, w e := by | |
| classical | |
| rw [pathCost_trace_edge_sum] | |
| exact (List.sum_toFinset w hn).symm | |
| variable {Ξ© : Type*} [MeasurableSpace Ξ©] {P : Measure Ξ©} | |
| variable {Ο : Edge β Ξ© β β} {shape rate : β} | |
| /-- Genuine Gamma lower tail for any fixed trail, with arbitrary real threshold. | |
| The positive parameter s uses the native MGF at theta=-s. -/ | |
| theorem GammaEnvironment.cheap_path_probability | |
| (h : GammaEnvironment shape rate P Ο) (hs : 0 < shape) (hr : 0 < rate) | |
| (s : β) (hsp : 0 < s) (p : Vertex) (ds : List Step) | |
| (hn : ((trace p ds).map traversalEdge).Nodup) (t : β) : | |
| P {Ο | pathCost (fun e => Ο e Ο) p ds β€ t} β€ | |
| (ENNReal.ofReal ((rate / (rate + s)) ^ shape)) ^ ds.length / | |
| ENNReal.ofReal (Real.exp (-s * t)) := by | |
| classical | |
| have hc : ((trace p ds).map traversalEdge).toFinset.card = ds.length := by | |
| rw [List.toFinset_card_of_nodup hn, trace_edge_length] | |
| have he (Ο : Ξ©) : edgeSum ((trace p ds).map traversalEdge).toFinset Ο Ο = | |
| pathCost (fun e => Ο e Ο) p ds := by | |
| exact (pathCost_eq_distinct_edgeSum (fun e => Ο e Ο) p ds hn).symm | |
| have hb := h.lower_tail_edgeSum hs hr (neg_neg_of_pos hsp) | |
| ((trace p ds).map traversalEdge).toFinset t | |
| simpa only [he, hc, sub_neg_eq_add] using hb | |
| /-- Conversion keeps the upper bound finite before passing to real probability. -/ | |
| theorem GammaEnvironment.cheap_path_probability_real | |
| (h : GammaEnvironment shape rate P Ο) (hs : 0 < shape) (hr : 0 < rate) | |
| (s : β) (hsp : 0 < s) (p : Vertex) (ds : List Step) | |
| (hn : ((trace p ds).map traversalEdge).Nodup) (t : β) : | |
| P.real {Ο | pathCost (fun e => Ο e Ο) p ds β€ t} β€ | |
| ((rate / (rate + s)) ^ shape) ^ ds.length * Real.exp (s * t) := by | |
| have hbase : 0 β€ (rate / (rate + s)) ^ shape := | |
| (Real.rpow_pos_of_pos (div_pos hr (add_pos hr hsp)) shape).le | |
| have hden : ENNReal.ofReal (Real.exp (-s * t)) β 0 := | |
| ENNReal.ofReal_ne_zero_iff.mpr (Real.exp_pos _) | |
| have hfin : (ENNReal.ofReal ((rate / (rate + s)) ^ shape)) ^ ds.length / | |
| ENNReal.ofReal (Real.exp (-s * t)) β β€ := | |
| ENNReal.div_ne_top (ENNReal.pow_ne_top ENNReal.ofReal_ne_top) hden | |
| have hb := ENNReal.toReal_mono hfin (h.cheap_path_probability hs hr s hsp p ds hn t) | |
| simp only [ENNReal.toReal_div, ENNReal.toReal_pow, | |
| ENNReal.toReal_ofReal hbase, ENNReal.toReal_ofReal (Real.exp_pos _).le] at hb | |
| change P.real _ β€ _ at hb | |
| rw [show -s * t = -(s * t) by ring, Real.exp_neg, div_inv_eq_mul] at hb | |
| exact hb | |
| /-- The probability that a finite family contains a cheap trail is bounded by | |
| its cardinality times the single-trail estimate. -/ | |
| theorem GammaEnvironment.cheap_path_family_probability | |
| (h : GammaEnvironment shape rate P Ο) (hs : 0 < shape) (hr : 0 < rate) | |
| (s : β) (hsp : 0 < s) (p : Vertex) (F : Finset (List Step)) (n : β) | |
| (hF : β ds β F, ((trace p ds).map traversalEdge).Nodup β§ ds.length = n) | |
| (t : β) : | |
| P {Ο | β ds β F, pathCost (fun e => Ο e Ο) p ds β€ t} β€ | |
| (F.card : ββ₯0β) * ((ENNReal.ofReal ((rate / (rate + s)) ^ shape)) ^ n / | |
| ENNReal.ofReal (Real.exp (-s * t))) := by | |
| classical | |
| have he : {Ο | β ds β F, pathCost (fun e => Ο e Ο) p ds β€ t} = | |
| β ds β F, {Ο | pathCost (fun e => Ο e Ο) p ds β€ t} := by | |
| ext Ο | |
| simp | |
| rw [he] | |
| refine (measure_biUnion_finset_le _ _).trans ?_ | |
| calc | |
| _ β€ β _ds β F, ((ENNReal.ofReal ((rate / (rate + s)) ^ shape)) ^ n / | |
| ENNReal.ofReal (Real.exp (-s * t))) := by | |
| apply Finset.sum_le_sum | |
| intro ds hds | |
| simpa only [(hF ds hds).2] using | |
| h.cheap_path_probability hs hr s hsp p ds (hF ds hds).1 t | |
| _ = _ := by simp | |
| end GammaFPP | |
| end OAI | |