File size: 5,738 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
import OAI.Probability.FirstPassage.BKDyadicPaths
import Mathlib.Topology.Instances.Int
import Mathlib.Analysis.SpecialFunctions.Pow.Real

namespace OAI

namespace PlanarFPP
open Filter
open scoped Topology

noncomputable def roundedSurvival (t : ℕ) (r : ℝ) : ℝ :=
  (⌊(2:ℝ)^t * Real.exp (-r)⌋₊ : ℝ)/(2:ℝ)^t

noncomputable def roundedEdgeCost (t : ℕ) (r : ℝ) : ℝ :=
  -Real.log (roundedSurvival t r)

lemma roundedSurvival_nonneg (t : ℕ) (r : ℝ) : 0 ≤ roundedSurvival t r := by
  unfold roundedSurvival
  positivity

lemma roundedSurvival_le (t : ℕ) (r : ℝ) : roundedSurvival t r ≤ Real.exp (-r) := by
  rw [roundedSurvival,div_le_iff₀ (by positivity)]
  simpa only [mul_comm] using Nat.floor_le (show 0 ≤ (2:ℝ)^t*Real.exp (-r) by positivity)

lemma roundedSurvival_tendsto (r : ℝ) :
    Tendsto (fun t => roundedSurvival t r) atTop (𝓝 (Real.exp (-r))) := by
  have h := (tendsto_nat_floor_mul_div_atTop (Real.exp_pos (-r)).le).comp
    (tendsto_pow_atTop_atTop_of_one_lt (by norm_num : (1:ℝ)<2))
  simpa [roundedSurvival,Function.comp_def,mul_comm] using h

lemma roundedSurvival_eventually_pos (r : ℝ) :
    ∀ᶠ t in atTop, 0 < roundedSurvival t r :=
  (roundedSurvival_tendsto r).eventually (lt_mem_nhds (Real.exp_pos (-r)))

lemma roundedEdgeCost_ge (t : ℕ) (r : ℝ) (hp : 0 < roundedSurvival t r) :
    r ≤ roundedEdgeCost t r := by
  have h := Real.log_le_log hp (roundedSurvival_le t r)
  rw [Real.log_exp] at h
  unfold roundedEdgeCost
  linarith

lemma roundedEdgeCost_tendsto (r : ℝ) :
    Tendsto (fun t => roundedEdgeCost t r) atTop (𝓝 r) := by
  have h := ((Real.continuousAt_log (Real.exp_ne_zero (-r))).tendsto.comp
    (roundedSurvival_tendsto r)).neg
  simpa [roundedEdgeCost,Real.log_exp] using h

lemma rounded_pathCost_tendsto (w : Edge → ℝ) (p : Vertex) (ds : List Step) :
    Tendsto (fun t => pathCost (fun e => roundedEdgeCost t (w e)) p ds) atTop
      (𝓝 (pathCost w p ds)) := by
  induction ds generalizing p with
  | nil => exact tendsto_const_nhds
  | cons d ds ih => exact (roundedEdgeCost_tendsto (w (d.edge p))).add (ih _)

def RoundedPathGood (t : ℕ) (w : Edge → ℝ) (p : StrictPathWitness) : Prop :=
  (∀ e ∈ p.edges, 0 < roundedSurvival t (w e)) ∧
    pathCost (fun e => roundedEdgeCost t (w e)) p.start p.steps < p.bound

def StrictPathWitness.Good (w : Edge → ℝ) (p : StrictPathWitness) : Prop :=
  pathCost w p.start p.steps < p.bound

lemma RoundedPathGood.original {t : ℕ} {w : Edge → ℝ} {p : StrictPathWitness}
    (h : RoundedPathGood t w p) : p.Good w := by
  exact lt_of_le_of_lt (pathCost_le_of_edges p.start p.steps
    (fun e he => roundedEdgeCost_ge t (w e) (h.1 e he))) h.2

lemma StrictPathWitness.Good.eventually_rounded {w : Edge → ℝ} {p : StrictPathWitness}
    (h : p.Good w) : ∀ᶠ t in atTop, RoundedPathGood t w p := by
  have he : ∀ᶠ t in atTop, ∀ e ∈ p.edges, 0 < roundedSurvival t (w e) := by
    rw [Filter.eventually_all_finset]
    intro e _
    exact roundedSurvival_eventually_pos (w e)
  have hc := (rounded_pathCost_tendsto w p.start p.steps).eventually (gt_mem_nhds h)
  exact he.and hc

lemma strict_path_list_eventually_rounded (w : Edge → ℝ) (ps : List StrictPathWitness)
    (h : ∀ p ∈ ps, p.Good w) : ∀ᶠ t in atTop, ∀ p ∈ ps, RoundedPathGood t w p := by
  induction ps with
  | nil => simp
  | cons p ps ih =>
    have hp := (h p (List.mem_cons_self ..)).eventually_rounded
    have ht := ih (fun q hq => h q (List.mem_cons_of_mem _ hq))
    filter_upwards [hp,ht] with t hp ht q hq
    rcases List.mem_cons.mp hq with rfl | hq
    · exact hp
    · exact ht q hq

def StrictDisjointPaths (S : Finset Edge) (Fs : List (Set StrictPathWitness)) (w : Edge → ℝ) : Prop :=
  ∃ ps : List StrictPathWitness,
    List.Forall₂ (fun p F => p ∈ F ∧ p.edges ⊆ S ∧ p.Good w) ps Fs ∧
    ps.Pairwise (fun p q => Disjoint p.edges q.edges)

def RoundedDisjointPaths (S : Finset Edge) (Fs : List (Set StrictPathWitness))
    (t : ℕ) (w : Edge → ℝ) : Prop :=
  ∃ ps : List StrictPathWitness,
    List.Forall₂ (fun p F => p ∈ F ∧ p.edges ⊆ S ∧ RoundedPathGood t w p) ps Fs ∧
    ps.Pairwise (fun p q => Disjoint p.edges q.edges)

lemma RoundedDisjointPaths.original {S : Finset Edge} {Fs : List (Set StrictPathWitness)}
    {t : ℕ} {w : Edge → ℝ} (h : RoundedDisjointPaths S Fs t w) : StrictDisjointPaths S Fs w := by
  obtain ⟨ps,hps,hd⟩ := h
  refine ⟨ps,?_,hd⟩
  exact hps.imp (fun _ _ h => ⟨h.1,h.2.1,h.2.2.original⟩)

lemma StrictDisjointPaths.eventually_rounded {S : Finset Edge} {Fs : List (Set StrictPathWitness)}
    {w : Edge → ℝ} (h : StrictDisjointPaths S Fs w) :
    ∀ᶠ t in atTop, RoundedDisjointPaths S Fs t w := by
  obtain ⟨ps,hps,hd⟩ := h
  have hg : ∀ p ∈ ps, p.Good w := by
    clear hd
    induction hps with
    | nil => simp
    | cons hp hps ih =>
      intro q hq
      rcases List.mem_cons.mp hq with rfl | hq
      · exact hp.2.2
      · exact ih q hq
  filter_upwards [strict_path_list_eventually_rounded w ps hg] with t ht
  refine ⟨ps,?_,hd⟩
  clear hd hg
  induction hps with
  | nil => exact List.Forall₂.nil
  | @cons p F ps Fs hp hps ih =>
    exact List.Forall₂.cons ⟨hp.1,hp.2.1,ht p (List.mem_cons_self ..)⟩
      (ih (fun q hq => ht q (List.mem_cons_of_mem _ hq)))

theorem strict_disjoint_eventual_rounded_iff (S : Finset Edge) (Fs : List (Set StrictPathWitness))
    (w : Edge → ℝ) :
    StrictDisjointPaths S Fs w ↔ ∀ᶠ t in atTop, RoundedDisjointPaths S Fs t w := by
  constructor
  · exact StrictDisjointPaths.eventually_rounded
  · intro h
    obtain ⟨t,ht⟩ := h.exists
    exact ht.original

end PlanarFPP

end OAI