math / data /lean /OAI /Probability /Ballisticity /Estimates /CellSchedule.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
10.4 kB
import Mathlib
import OAI.Probability.Ballisticity.Estimates.Cell
namespace OAI
section
open scoped BigOperators
namespace DirectionalTransience
def cellWidth (w m i : β„•) : β„• := 16^(m-i)*w
def cellOpportunity (v w m i : β„•) : β„• :=
if i < m then v-2*cellWidth w m i else v+w
lemma cellWidth_zero (w m : β„•) : cellWidth w m 0=16^m*w := by simp [cellWidth]
lemma cellWidth_last (w m : β„•) : cellWidth w m m=w := by simp [cellWidth]
lemma cellWidth_antitone (w m : β„•) : Antitone (cellWidth w m) := by
intro i j hij
apply Nat.mul_le_mul_right
exact Nat.pow_le_pow_right (by norm_num) (Nat.sub_le_sub_left hij m)
lemma cellWidth_pos {w : β„•} (hw : 0 < w) (m i : β„•) : 0 < cellWidth w m i := by
unfold cellWidth; positivity
lemma cellWidth_min (w m i : β„•) : w ≀ cellWidth w m i := by
unfold cellWidth
have h : 1 ≀ 16^(m-i) := one_le_powβ‚€ (by norm_num)
simpa only [one_mul] using Nat.mul_le_mul_right w h
lemma cellWidth_step (w m i : β„•) (hi : i < m) :
cellWidth w m i=16*cellWidth w m (i+1) := by
have he : m-i=(m-(i+1))+1 := by omega
unfold cellWidth
rw [he,pow_succ]
ring
lemma cellWidth_shift (w m i j : β„•) (hij : i+j ≀ m) :
cellWidth w m i=16^j*cellWidth w m (i+j) := by
have he : m-i=j+(m-(i+j)) := by omega
unfold cellWidth
rw [he,pow_add]
ring
lemma cellOpportunity_last (v w m : β„•) : cellOpportunity v w m m=v+w := by
simp [cellOpportunity]
lemma cellOpportunity_le_end (v w m i : β„•) : cellOpportunity v w m i ≀ v+w := by
unfold cellOpportunity
split
Β· omega
Β· rfl
lemma cellOpportunity_monotone (v w m : β„•) : Monotone (cellOpportunity v w m) := by
intro i j hij
by_cases hj : j < m
Β· have hi : i < m := lt_of_le_of_lt hij hj
simp only [cellOpportunity,ite_eq_left hi,ite_eq_left hj]
exact Nat.sub_le_sub_left (Nat.mul_le_mul_left 2 (cellWidth_antitone w m hij)) v
Β· simp only [cellOpportunity,ite_eq_right hj]
exact cellOpportunity_le_end v w m i
lemma cell_seed_endpoint (v w m i : β„•) (hv : 2*cellWidth w m 0 ≀ v) (hi : i < m) :
cellOpportunity v w m i+cellWidth w m i=v-cellWidth w m i := by
have hw := Nat.mul_le_mul_left 2 (cellWidth_antitone w m (Nat.zero_le i))
simp only [cellOpportunity,ite_eq_left hi]
omega
lemma cell_seed_before_next (v w m i : β„•) (hv : 2*cellWidth w m 0 ≀ v) (hi : i < m) :
cellOpportunity v w m i+cellWidth w m i ≀ cellOpportunity v w m (i+1) := by
rw [cell_seed_endpoint v w m i hv hi]
by_cases hn : i+1 < m
Β· simp only [cellOpportunity,ite_eq_left hn]
apply Nat.sub_le_sub_left
rw [cellWidth_step w m i hi]
omega
Β· simp only [cellOpportunity,ite_eq_right hn]
omega
lemma cell_step_length (v w m i : β„•) (hv : 2*cellWidth w m 0 ≀ v) (hi : i < m) :
cellOpportunity v w m (i+1)-cellOpportunity v w m i ≀ 3*cellWidth w m i := by
have hw := Nat.mul_le_mul_left 2 (cellWidth_antitone w m (Nat.zero_le i))
have hmin := cellWidth_min w m i
have hend := cellOpportunity_le_end v w m (i+1)
simp only [cellOpportunity,ite_eq_left hi]
split <;> omega
def cellEarlyHeight (v w m i s : β„•) : β„• :=
cellOpportunity v w m (i+min s (m-i))-(cellOpportunity v w m i+cellWidth w m i)
def cellLateHeight (v w m i s j : β„•) : β„• :=
if i+s+j < m then
cellOpportunity v w m (i+s+j+1)-cellOpportunity v w m (i+s+j) else 0
lemma cellEarly_endpoint (v w m i s : β„•) (hv : 2*cellWidth w m 0 ≀ v)
(hi : i < m) (hs : 0 < s) :
cellOpportunity v w m i+cellWidth w m i+cellEarlyHeight v w m i s=
cellOpportunity v w m (i+min s (m-i)) := by
unfold cellEarlyHeight
have hmin : 1 ≀ min s (m-i) := by omega
have hh := cellOpportunity_monotone v w m (show i+1 ≀ i+min s (m-i) by omega)
have ht := cell_seed_before_next v w m i hv hi
omega
lemma cellEarlyHeight_bound (v w m i s : β„•) (hv : 2*cellWidth w m 0 ≀ v)
(hi : i < m) : cellEarlyHeight v w m i s ≀ 3*cellWidth w m i := by
unfold cellEarlyHeight
rw [cell_seed_endpoint v w m i hv hi]
have hmin := cellWidth_min w m i
have hh := cellOpportunity_le_end v w m (i+min s (m-i))
have hw := Nat.mul_le_mul_left 2 (cellWidth_antitone w m (Nat.zero_le i))
omega
lemma cellLateHeight_bound (v w m i s j : β„•) (hv : 2*cellWidth w m 0 ≀ v) :
cellLateHeight v w m i s j*16^(s+j) ≀ 3*cellWidth w m i := by
unfold cellLateHeight
split
Β· rename_i h
have hh := Nat.mul_le_mul_right (16^(s+j)) (cell_step_length v w m (i+s+j) hv h)
have he := cellWidth_shift w m i (s+j) (by omega)
calc
_ ≀ 3*cellWidth w m (i+(s+j))*16^(s+j) := by simpa only [Nat.add_assoc] using hh
_ = 3*cellWidth w m i := by rw [he]; ring
Β· simp
lemma cellLate_endpoint (v w m i s n : β„•) (_ : 2*cellWidth w m 0 ≀ v)
(hn : i+s+n ≀ m) :
cellOpportunity v w m (i+s)+(βˆ‘ j∈Finset.range n,cellLateHeight v w m i s j)=
cellOpportunity v w m (i+s+n) := by
induction n with
| zero => simp
| succ n ih =>
have hin : i+s+n < m := by omega
have hp := ih (by omega)
rw [Finset.sum_range_succ,←Nat.add_assoc,hp]
simp only [cellLateHeight,ite_eq_left hin]
have hh := cellOpportunity_monotone v w m (show i+s+n ≀ i+s+n+1 by omega)
have he : i+s+(n+1)=i+s+n+1 := by omega
rw [he]
omega
end DirectionalTransience
end
section
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal BigOperators Classical
namespace DirectionalTransience
noncomputable def cellRadius {d : β„•} (Ξ½ : Measure (Row d)) (e f : Direction d)
(C : ℝ) (w m i : β„•) : ℝ :=
fluctuationRadius (independentConditionedPairLaw Ξ½ (realPosition (step e)))
(commonIncrementProcess (realPosition (step e)) f 0) ((cellWidth w m i:ℝ)/C)
lemma cellRadius_pos {d : β„•} (Ξ½ : Measure (Row d)) (e f : Direction d)
(C : ℝ) (w m i : β„•) : 0 < cellRadius Ξ½ e f C w m i := fluctuationRadius_pos _ _ _
noncomputable def cellRestart {d k : β„•} (e : Direction d) (a : ℝ)
(Ο€ : Environment d β†’ LayerTupleProfile (k:=k) e a) (v w m i : β„•)
(Ο‰ : Environment d) : LayerTupleProfile (k:=k) e (a+cellOpportunity v w m i) :=
fullTupleProfile e a (cellOpportunity v w m i) (Ο€ Ο‰) Ο‰
lemma cellRestart_measurable {d k : β„•} (e : Direction d) (a : ℝ)
(Ο€ : Environment d β†’ LayerTupleProfile (k:=k) e a)
(hΟ€ : @Measurable _ _ (rowSigma (BelowHeight (realPosition (step e)) a)) _ Ο€)
(v w m i : β„•) :
@Measurable _ _ (rowSigma (BelowHeight (realPosition (step e)) (a+cellOpportunity v w m i))) _
(cellRestart e a Ο€ v w m i) := fullTupleProfile_measurable e a _ Ο€ hΟ€
noncomputable def scheduledCellFailure {d k : β„•} (Ξ½ : Measure (Row d))
(e f : Direction d) (hef : e.1 β‰  f.1) (a C c gβ‚€ g₁ A : ℝ) (hc : 0 < c)
(Ο€ : Environment d β†’ LayerTupleProfile (k:=k) e a) (v w m s i n : β„•) : Set (Environment d) :=
if i < m ∧ 0 < n ∧ n ≀ m-i then
consumedCellFailure
(cellSeedMass e f (a+cellOpportunity v w m i) (c*cellRadius Ξ½ e f C w m i)
(cellWidth w m i) (cellRestart e a Ο€ v w m i))
(cellEarlyMass e f hef (a+cellOpportunity v w m i) (c*cellRadius Ξ½ e f C w m i)
(cellWidth w m i) (cellEarlyHeight v w m i s) (cellRestart e a Ο€ v w m i))
(cellLateMass e f hef (a+cellOpportunity v w m i) c (cellRadius Ξ½ e f C w m i)
hc (cellRadius_pos Ξ½ e f C w m i) (cellWidth w m i) (cellEarlyHeight v w m i s) s
(cellLateHeight v w m i s) (cellRestart e a Ο€ v w m i)) gβ‚€ g₁ (A*k) s (m-i) n
else βˆ…
def cellFiltration {d : β„•} (e : Direction d) (a : ℝ) (v w m : β„•) :
Filtration β„• (inferInstance : MeasurableSpace (Environment d)) where
seq i := rowSigma (BelowHeight (realPosition (step e)) (a+cellOpportunity v w m i))
mono' i j hij := by
have hh : (cellOpportunity v w m i : ℝ) ≀ cellOpportunity v w m j :=
by exact_mod_cast cellOpportunity_monotone v w m hij
apply rowSigma_mono
intro x hx
change dot (realPosition x) (realPosition (step e)) < a+cellOpportunity v w m i at hx
change dot (realPosition x) (realPosition (step e)) < a+cellOpportunity v w m j
linarith only [hx,hh]
le' _ := rowSigma_le _
lemma scheduledCellFailure_measurable {d k : β„•} (Ξ½ : Measure (Row d))
(e f : Direction d) (hef : e.1 β‰  f.1) (a C c gβ‚€ g₁ A : ℝ) (hc : 0 < c)
(Ο€ : Environment d β†’ LayerTupleProfile (k:=k) e a)
(hΟ€ : @Measurable _ _ (rowSigma (BelowHeight (realPosition (step e)) a)) _ Ο€)
(v w m s : β„•) (hv : 2*cellWidth w m 0 ≀ v) (hs : 0 < s) (i n : β„•) :
MeasurableSet[cellFiltration e a v w m (i+n)]
(scheduledCellFailure Ξ½ e f hef a C c gβ‚€ g₁ A hc Ο€ v w m s i n) := by
unfold scheduledCellFailure
split
Β· rename_i h
rcases h with ⟨hi,hn,hnm⟩
change MeasurableSet[rowSigma (BelowHeight (realPosition (step e)) (a+cellOpportunity v w m (i+n)))] _
apply actual_cell_failure_measurable e f hef _ c _ hc _ _ _ s (m-i) n _ _
(cellRestart_measurable e a Ο€ hΟ€ v w m i) gβ‚€ g₁ A (a+cellOpportunity v w m (i+n))
Β· intro _
have hh := (cell_seed_before_next v w m i hv hi).trans
(cellOpportunity_monotone v w m (show i+1 ≀ i+n by omega))
have hh' : (cellOpportunity v w m i:ℝ)+cellWidth w m i ≀ cellOpportunity v w m (i+n) :=
by exact_mod_cast hh
linarith only [hh']
Β· intro h
have hmin : min s (m-i) ≀ n := by rcases h with h|⟨h,_⟩ <;> omega
have hh := cellOpportunity_monotone v w m (show i+min s (m-i) ≀ i+n by omega)
rw [←cellEarly_endpoint v w m i s hv hi hs] at hh
have hh' : (cellOpportunity v w m i:ℝ)+cellWidth w m i+cellEarlyHeight v w m i s ≀
cellOpportunity v w m (i+n) := by exact_mod_cast hh
linarith only [hh']
Β· intro hsn hnm'
have hmin : min s (m-i)=s := min_eq_left (by omega)
have hearly := cellEarly_endpoint v w m i s hv hi hs
rw [hmin] at hearly
have hlate := cellLate_endpoint v w m i s (n-s) hv (by omega)
have heq : i+s+(n-s)=i+n := by omega
rw [heq,←hearly] at hlate
have hh : (cellOpportunity v w m i:ℝ)+cellWidth w m i+cellEarlyHeight v w m i s+
((βˆ‘ j∈Finset.range (n-s),cellLateHeight v w m i s j):β„•)=cellOpportunity v w m (i+n) :=
by exact_mod_cast hlate
linarith only [hh]
Β· exact @MeasurableSet.empty _ (cellFiltration e a v w m (i+n))
end DirectionalTransience
end
end OAI