File size: 6,493 Bytes
f61e547 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | import OAI.Probability.FirstPassage.PositiveMoment
import OAI.Probability.FirstPassage.Reversal
namespace OAI
namespace PlanarFPP
open MeasureTheory ProbabilityTheory Finset
open scoped ENNReal
def straightEdge (p : Vertex) (d : Step) (i : ℕ) : Edge :=
d.edge (p + (i : ℤ) • d.delta)
theorem straightEdge_injective (p : Vertex) (d : Step) :
Function.Injective (straightEdge p d) := by
intro i j h
cases d <;> simp [straightEdge, Step.edge, Step.delta, Prod.ext_iff] at h <;> omega
theorem straightEdge_succ (p : Vertex) (d : Step) (i : ℕ) :
straightEdge p d (i + 1) = straightEdge (p + d.delta) d i := by
unfold straightEdge
congr 1
simp [Nat.cast_add, add_smul, add_comm, add_assoc]
theorem pathCost_replicate (w : Edge → ℝ) (p : Vertex) (d : Step) (n : ℕ) :
pathCost w p (List.replicate n d) =
∑ i ∈ range n, w (straightEdge p d i) := by
induction n generalizing p with
| zero => simp [pathCost]
| succ n ih =>
rw [List.replicate_succ, pathCost, ih, sum_range_succ']
simp [straightEdge, Nat.cast_add, add_smul, add_assoc, add_comm]
theorem pathCost_replicate_edgeSet (w : Edge → ℝ) (p : Vertex) (d : Step) (n : ℕ) :
pathCost w p (List.replicate n d) =
∑ e ∈ (range n).image (straightEdge p d), w e := by
rw [sum_image (fun i _ j _ hij => straightEdge_injective p d hij)]
exact pathCost_replicate w p d n
variable {Ω : Type*} [MeasurableSpace Ω] {P : Measure Ω} {τ : Edge → Ω → ℝ}
theorem costly_straight_probability (h : ExponentialEnvironment P τ)
(p : Vertex) (d : Step) (n : ℕ) (t : ℝ) :
P {ω | t ≤ pathCost (fun e => τ e ω) p (List.replicate n d)} ≤
2 ^ n / ENNReal.ofReal (Real.exp (t / 2)) := by
simp only [pathCost_replicate_edgeSet]
have ht := costly_edge_set_probability h ((range n).image (straightEdge p d)) t
simpa only [card_image_of_injective _ (straightEdge_injective p d), card_range] using ht
theorem costly_straight_probability_real (h : ExponentialEnvironment P τ)
(p : Vertex) (d : Step) (n : ℕ) (t : ℝ) :
P.real {ω | t ≤ pathCost (fun e => τ e ω) p (List.replicate n d)} ≤
(2 : ℝ) ^ n * Real.exp (-t / 2) := by
have hr := ENNReal.toReal_mono (show (2 : ℝ≥0∞)^n /
ENNReal.ofReal (Real.exp (t/2)) ≠ ⊤ from
ENNReal.div_ne_top (by simp) (by positivity))
(costly_straight_probability h p d n t)
simp only [ENNReal.toReal_div, ENNReal.toReal_pow,
ENNReal.toReal_ofReal (Real.exp_pos _).le, ENNReal.toReal_ofNat] at hr
change P.real _ ≤ _ at hr
rw [show -t / 2 = -(t / 2) by ring, Real.exp_neg]
simpa only [div_eq_mul_inv] using hr
theorem costly_straight_excess_probability_real (h : ExponentialEnvironment P τ)
(p : Vertex) (d : Step) (n : ℕ) (t : ℝ) :
P.real {ω | 4 * (n : ℝ) + t ≤
pathCost (fun e => τ e ω) p (List.replicate n d)} ≤ Real.exp (-t / 2) := by
refine (costly_straight_probability_real h p d n (4 * n + t)).trans ?_
have htwo : (2 : ℝ) ≤ Real.exp 2 := by
have := Real.add_one_le_exp (2 : ℝ)
linarith
have hp : (2 : ℝ)^n ≤ Real.exp (2 * (n : ℝ)) := by
rw [mul_comm (2 : ℝ), Real.exp_nat_mul]
exact pow_le_pow_left₀ (by norm_num) htwo n
calc
(2 : ℝ)^n * Real.exp (-(4 * n + t) / 2) ≤
Real.exp (2 * (n : ℝ)) * Real.exp (-(4 * n + t) / 2) :=
mul_le_mul_of_nonneg_right hp (Real.exp_pos _).le
_ = Real.exp (-t / 2) := by rw [← Real.exp_add]; congr 1; ring
def coordinatePath (p q : Vertex) : List Step :=
horizontal (q.1 - p.1) ++ vertical (q.2 - p.2)
def latticeDistance (p q : Vertex) : ℕ :=
(q.1 - p.1).natAbs + (q.2 - p.2).natAbs
theorem coordinatePath_endpoint (p q : Vertex) : p + displacement (coordinatePath p q) = q := by
simp [coordinatePath, displacement_horizontal, displacement_vertical, Prod.ext_iff]
theorem costly_horizontal_excess_probability_real (h : ExponentialEnvironment P τ)
(p : Vertex) (a : ℤ) (t : ℝ) :
P.real {ω | 4 * (a.natAbs : ℝ) + t ≤
pathCost (fun e => τ e ω) p (horizontal a)} ≤ Real.exp (-t / 2) := by
by_cases ha : 0 ≤ a
· have he : a.toNat = a.natAbs := by omega
simpa only [horizontal, ite_eq_left ha, he] using
costly_straight_excess_probability_real h p Step.east a.toNat t
· have he : (-a).toNat = a.natAbs := by omega
simpa only [horizontal, ite_eq_right ha, he] using
costly_straight_excess_probability_real h p Step.west (-a).toNat t
theorem costly_vertical_excess_probability_real (h : ExponentialEnvironment P τ)
(p : Vertex) (a : ℤ) (t : ℝ) :
P.real {ω | 4 * (a.natAbs : ℝ) + t ≤
pathCost (fun e => τ e ω) p (vertical a)} ≤ Real.exp (-t / 2) := by
by_cases ha : 0 ≤ a
· have he : a.toNat = a.natAbs := by omega
simpa only [vertical, ite_eq_left ha, he] using
costly_straight_excess_probability_real h p Step.north a.toNat t
· have he : (-a).toNat = a.natAbs := by omega
simpa only [vertical, ite_eq_right ha, he] using
costly_straight_excess_probability_real h p Step.south (-a).toNat t
theorem costly_coordinatePath_probability_real (h : ExponentialEnvironment P τ)
(p q : Vertex) (t : ℝ) :
P.real {ω | 4 * (latticeDistance p q : ℝ) + t ≤
pathCost (fun e => τ e ω) p (coordinatePath p q)} ≤ 2 * Real.exp (-t / 4) := by
let _ := h.probability
let A := {ω | 4 * ((q.1-p.1).natAbs : ℝ) + t/2 ≤
pathCost (fun e => τ e ω) p (horizontal (q.1-p.1))}
let B := {ω | 4 * ((q.2-p.2).natAbs : ℝ) + t/2 ≤
pathCost (fun e => τ e ω) (p + displacement (horizontal (q.1-p.1)))
(vertical (q.2-p.2))}
have hs : {ω | 4 * (latticeDistance p q : ℝ) + t ≤
pathCost (fun e => τ e ω) p (coordinatePath p q)} ⊆ A ∪ B := by
intro ω hω
change _ ∨ _
by_contra hn
push Not at hn
simp only [Set.mem_ofPred_eq, coordinatePath, pathCost_append, latticeDistance, Nat.cast_add] at hω
simp only [A, B, Set.mem_ofPred_eq, not_le] at hn
linarith
refine (measureReal_mono hs).trans ((measureReal_union_le A B).trans ?_)
have ha := costly_horizontal_excess_probability_real h p (q.1-p.1) (t/2)
have hb := costly_vertical_excess_probability_real h
(p + displacement (horizontal (q.1-p.1))) (q.2-p.2) (t/2)
change P.real A + P.real B ≤ _
change P.real A ≤ _ at ha
change P.real B ≤ _ at hb
have he : -(t / 2) / 2 = -t / 4 := by ring
rw [he] at ha hb
linarith
end PlanarFPP
end OAI
|