Download data/lean/OAI/Analysis/HardSphere/Paths/LevelList.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/HardSphere/Paths/LevelList.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/HardSphere/Paths/LevelList.lean
-
curl -L -o LevelList.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/HardSphere/Paths/LevelList.lean
19 kB
| import Mathlib | |
| import OAI.Analysis.HardSphere.Paths.NearPotential | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal BigOperators Topology | |
| namespace HardSphere.DyadicSkeleton | |
| lemma refineStep_mem (a b x : Vertex) (hx : x β refineStep a b) : | |
| x 0 = b 0 β§ βj, |x j-b j| β€ |a j-b j| := by | |
| simp only [refineStep,List.mem_append,List.mem_singleton,List.mem_map] at hx | |
| rcases hx with (rfl|β¨c,hc,rflβ©)|β¨c,hc,rflβ© | |
| Β· refine β¨rfl,?_β© | |
| intro j | |
| fin_cases j <;> simp | |
| Β· refine β¨rfl,?_β© | |
| intro j | |
| fin_cases j | |
| Β· simp | |
| Β· exact axisSteps_near_final _ _ _ hc | |
| Β· simp | |
| Β· refine β¨rfl,?_β© | |
| intro j | |
| fin_cases j | |
| Β· simp | |
| Β· simp | |
| Β· exact axisSteps_near_final _ _ _ hc | |
| def levelList (n : β) (d : Fin 2 β β€) (Ο : Noise) : β β List Vertex | |
| | 0 => [baseVertex n d Ο 0] | |
| | t+1 => refineStep (baseVertex n d Ο t) (baseVertex n d Ο (t+1)) | |
| def occurrenceList (n : β) (d : Fin 2 β β€) (Ο : Noise) : List Vertex := | |
| (List.range (n+1)).flatMap (levelList n d Ο) | |
| lemma levelList_length (n : β) (hn : 0 < n) (d : Fin 2 β β€) | |
| (hd : βj, |d j| β€ n) (Ο : Noise) (t : β) (ht : t β€ n) : | |
| (levelList n d Ο t).length β€ 5 := by | |
| cases t with | |
| | zero => simp [levelList] | |
| | succ t => exact refineStep_length _ _ (baseVertex_step n hn d hd Ο t (by omega)) | |
| lemma levelList_mem (n : β) (hn : 0 < n) (d : Fin 2 β β€) | |
| (hd : βj, |d j| β€ n) (Ο : Noise) (t : β) (ht : t β€ n) | |
| (x : Vertex) (hx : x β levelList n d Ο t) : | |
| x 0 = (t:β€) β§ βj, |x j-baseVertex n d Ο t j| β€ 2 := by | |
| cases t with | |
| | zero => | |
| have he : x = baseVertex n d Ο 0 := by simpa only [levelList,List.mem_singleton] using hx | |
| subst x | |
| simp [baseVertex] | |
| | succ t => | |
| obtain β¨h0,hbβ© := refineStep_mem _ _ x hx | |
| refine β¨h0,fun j β¦ (hb j).trans ?_β© | |
| rw [abs_sub_comm] | |
| exact baseVertex_step n hn d hd Ο t (by omega) j | |
| lemma occurrenceList_initial (n : β) (d : Fin 2 β β€) (Ο : Noise) : | |
| (0:Vertex) β occurrenceList n d Ο := by | |
| apply List.mem_flatMap.mpr | |
| refine β¨0,by simp,?_β© | |
| simp [levelList,baseVertex_initial] | |
| lemma integer_step_lipschitz (f : β β β€) (H : β) (L : β€) | |
| (hstep : β i<H, |f (i+1)-f i|β€L) {i j : β} (hi : iβ€H) (hj : jβ€H) : | |
| |f i-f j|β€L*|(i:β€)-j| := by | |
| have hforward : β a b, aβ€b β bβ€H β |f b-f a|β€L*((b:β€)-a) := by | |
| intro a b hab hb | |
| induction b,hab using Nat.le_induction with | |
| | base => simp | |
| | @succ b hab ih => | |
| have h := hstep b (by omega) | |
| have hh := ih (by omega) | |
| calc | |
| |f (b+1)-f a| β€ |f (b+1)-f b|+|f b-f a| := abs_sub_le _ _ _ | |
| _ β€ L+L*((b:β€)-a) := add_le_add h hh | |
| _ = _ := by push_cast; ring | |
| rcases le_total i j with h|h | |
| Β· rw [abs_sub_comm (f i),abs_sub_comm (i:β€),abs_of_nonneg (by omega : 0β€(j:β€)-i)] | |
| exact hforward i j h hj | |
| Β· rw [abs_of_nonneg (by omega : 0β€(i:β€)-j)] | |
| exact hforward j i h hi | |
| lemma baseVertex_lipschitz (n : β) (hn : 0 < n) (d : Fin 2 β β€) | |
| (hd : βj, |d j| β€ n) (Ο : Noise) (s t : β) (hs : s β€ n) (ht : t β€ n) (j : Fin 3) : | |
| |baseVertex n d Ο s j-baseVertex n d Ο t j| β€ 2*|(s:β€)-t| := | |
| integer_step_lipschitz (fun u β¦ baseVertex n d Ο u j) n 2 | |
| (fun k hk β¦ baseVertex_step n hn d hd Ο k hk j) hs ht | |
| lemma real_sub_floor_le (x y : β) : |x-y| β€ |(βxβ:β)-(βyβ:β)|+1 := by | |
| have h1 := Int.floor_le x | |
| have h2 := Int.lt_floor_add_one x | |
| have h3 := Int.floor_le y | |
| have h4 := Int.lt_floor_add_one y | |
| have hl := neg_abs_le ((βxβ:β)-(βyβ:β)) | |
| have hu := le_abs_self ((βxβ:β)-(βyβ:β)) | |
| apply abs_le.mpr | |
| constructor <;> linarith | |
| lemma floor_sub_real_le (x y : β) : |(βxβ:β)-(βyβ:β)| β€ |x-y|+1 := by | |
| have h1 := Int.floor_le x | |
| have h2 := Int.lt_floor_add_one x | |
| have h3 := Int.floor_le y | |
| have h4 := Int.lt_floor_add_one y | |
| have hl := neg_abs_le (x-y) | |
| have hu := le_abs_self (x-y) | |
| apply abs_le.mpr | |
| constructor <;> linarith | |
| lemma same_time_position_bound (n t : β) (ht : t β€ n) (Ο Ο' : Noise) (j : Fin 2) : | |
| |position Ο j (min t (n-t))-position Ο' j (min t (n-t))| β€ (n:β)/2 := by | |
| have hu : 2*(min t (n-t)) β€ n := by omega | |
| have hu' : 2*((min t (n-t):β):β) β€ (n:β) := by exact_mod_cast hu | |
| calc | |
| _ β€ |position Ο j (min t (n-t))|+|position Ο' j (min t (n-t))| := abs_sub _ _ | |
| _ β€ ((min t (n-t):β):β)/2+((min t (n-t):β):β)/2 := | |
| add_le_add (position_abs_le Ο j _) (position_abs_le Ο' j _) | |
| _ β€ _ := by linarith | |
| lemma same_time_floor_bound (n t : β) (ht : t β€ n) (d : Fin 2 β β€) | |
| (Ο Ο' : Noise) (j : Fin 3) : | |
| |(baseVertex n d Ο t j:β)-(baseVertex n d Ο' t j:β)| β€ (n:β)/2+1 := by | |
| have hh (i : Fin 2) : |(βbaseTrans n d Ο t iβ:β)-(βbaseTrans n d Ο' t iβ:β)| β€ | |
| (n:β)/2+1 := by | |
| have h := floor_sub_real_le (baseTrans n d Ο t i) (baseTrans n d Ο' t i) | |
| have he : baseTrans n d Ο t i-baseTrans n d Ο' t i = | |
| position Ο i (min t (n-t))-position Ο' i (min t (n-t)) := by unfold baseTrans; ring | |
| rw [he] at h | |
| exact h.trans (add_le_add (same_time_position_bound n t ht Ο Ο' i) le_rfl) | |
| fin_cases j | |
| Β· change |(t:β)-(t:β)| β€ _ | |
| rw [sub_self,abs_zero] | |
| positivity | |
| Β· exact hh 0 | |
| Β· exact hh 1 | |
| def periodicProjection (K : β) (x : Vertex) : Fin 3 β AddCircle (K:β) := | |
| fun j β¦ ((x j:β) : AddCircle (K:β)) | |
| def periodicDistance (K : β) (x y : Vertex) : β := | |
| dist (periodicProjection K x) (periodicProjection K y) | |
| lemma periodicDistance_nonneg (K : β) (x y : Vertex) : 0 β€ periodicDistance K x y := dist_nonneg | |
| lemma periodicDistance_symm (K : β) (x y : Vertex) : | |
| periodicDistance K x y = periodicDistance K y x := dist_comm _ _ | |
| lemma periodicDistance_triangle (K : β) (x y z : Vertex) : | |
| periodicDistance K x z β€ periodicDistance K x y+periodicDistance K y z := dist_triangle _ _ _ | |
| lemma periodicDistance_le (K : β) (x y : Vertex) (r : β) (hr : 0 β€ r) | |
| (h : βj, |(x j:β)-(y j:β)| β€ r) : periodicDistance K x y β€ r := by | |
| apply (dist_pi_le_iff hr).mpr | |
| intro j | |
| change dist ((x j:β):AddCircle (K:β)) ((y j:β):AddCircle (K:β)) β€ r | |
| rw [dist_eq_norm,β QuotientAddGroup.mk_sub] | |
| exact QuotientAddGroup.norm_mk_le_norm.trans (by simpa only [Real.norm_eq_abs] using h j) | |
| lemma periodicDistance_coord (K : β) (hK : 0 < K) (x y : Vertex) (j : Fin 3) | |
| (h : |(x j:β)-(y j:β)| β€ (K:β)/2) : | |
| |(x j:β)-(y j:β)| β€ periodicDistance K x y := by | |
| have hK' : 0 < (K:β) := by exact_mod_cast hK | |
| have he : dist ((x j:β):AddCircle (K:β)) ((y j:β):AddCircle (K:β)) = | |
| |(x j:β)-(y j:β)| := by | |
| rw [dist_eq_norm,β QuotientAddGroup.mk_sub] | |
| exact (AddCircle.norm_coe_eq_abs_iff (K:β) (ne_of_gt hK')).mpr | |
| (by simpa only [abs_of_pos hK'] using h) | |
| rw [β he] | |
| exact dist_le_pi_dist (periodicProjection K x) (periodicProjection K y) j | |
| lemma periodicDistance_le_half (K : β) (hK : 0 < K) (x y : Vertex) : | |
| periodicDistance K x y β€ (K:β)/2 := by | |
| have hK' : 0 < (K:β) := by exact_mod_cast hK | |
| apply (dist_pi_le_iff (by positivity : 0 β€ (K:β)/2)).mpr | |
| intro j | |
| rw [dist_eq_norm] | |
| simpa only [abs_of_pos hK'] using AddCircle.norm_le_half_period (K:β) (x := | |
| periodicProjection K x j-periodicProjection K y j) (ne_of_gt hK') | |
| lemma same_time_deviation_le (K n : β) (hn : 0 < n) (hnK : 8*n β€ K) | |
| (d : Fin 2 β β€) (Ο Ο' : Noise) (t : β) (ht : t β€ n) : | |
| twoCopyDistance (min t (n-t)) (Ο,Ο') β€ | |
| periodicDistance K (baseVertex n d Ο t) (baseVertex n d Ο' t)+1 := by | |
| have hK : 0 < K := by omega | |
| have htrans (i : Fin 2) (j : Fin 3) | |
| (he : baseVertex n d Ο t j = βbaseTrans n d Ο t iβ) | |
| (he' : baseVertex n d Ο' t j = βbaseTrans n d Ο' t iβ) : | |
| |position Ο i (min t (n-t))-position Ο' i (min t (n-t))| β€ | |
| periodicDistance K (baseVertex n d Ο t) (baseVertex n d Ο' t)+1 := by | |
| have hp := periodicDistance_coord K hK (baseVertex n d Ο t) (baseVertex n d Ο' t) j | |
| ((same_time_floor_bound n t ht d Ο Ο' j).trans (by | |
| have hnr : (1:β) β€ (n:β) := by exact_mod_cast hn | |
| have hkr : 8*(n:β) β€ (K:β) := by exact_mod_cast hnK | |
| linarith)) | |
| rw [he,he'] at hp | |
| have hh := real_sub_floor_le (baseTrans n d Ο t i) (baseTrans n d Ο' t i) | |
| have heq : baseTrans n d Ο t i-baseTrans n d Ο' t i = | |
| position Ο i (min t (n-t))-position Ο' i (min t (n-t)) := by unfold baseTrans; ring | |
| rw [heq] at hh | |
| exact hh.trans (add_le_add hp le_rfl) | |
| exact max_le (htrans 0 1 rfl rfl) (htrans 1 2 rfl rfl) | |
| lemma occurrence_deviation_le (K n : β) (hn : 0 < n) (hnK : 8*n β€ K) | |
| (d : Fin 2 β β€) (hd : βj, |d j| β€ n) (Ο Ο' : Noise) | |
| (s t : β) (hs : s β€ n) (ht : t β€ n) (x y : Vertex) | |
| (hx : x β levelList n d Ο s) (hy : y β levelList n d Ο' t) : | |
| twoCopyDistance (min s (n-s)) (Ο,Ο') β€ 3*periodicDistance K x y+5 := by | |
| obtain β¨hx0,hxbβ© := levelList_mem n hn d hd Ο s hs x hx | |
| obtain β¨hy0,hybβ© := levelList_mem n hn d hd Ο' t ht y hy | |
| have hK : 0 < K := by omega | |
| have hst : |(s:β)-(t:β)| β€ periodicDistance K x y := by | |
| have h := periodicDistance_coord K hK x y 0 (by | |
| rw [hx0,hy0]; push_cast | |
| apply (abs_le.mpr β¨by | |
| have hn' : 8*(n:β) β€ (K:β) := by exact_mod_cast hnK | |
| have hs' : (s:β) β€ n := by exact_mod_cast hs | |
| have ht' : (t:β) β€ n := by exact_mod_cast ht | |
| have hsz : (0:β) β€ s := by positivity | |
| linarith,by | |
| have hn' : 8*(n:β) β€ (K:β) := by exact_mod_cast hnK | |
| have hs' : (s:β) β€ n := by exact_mod_cast hs | |
| have ht' : (t:β) β€ n := by exact_mod_cast ht | |
| have htz : (0:β) β€ t := by positivity | |
| linarithβ©)) | |
| simpa only [hx0,hy0,Int.cast_natCast] using h | |
| have hxb' : periodicDistance K (baseVertex n d Ο s) x β€ 2 := by | |
| apply periodicDistance_le _ _ _ 2 (by norm_num) | |
| intro j | |
| rw [abs_sub_comm] | |
| exact_mod_cast hxb j | |
| have hyb' : periodicDistance K y (baseVertex n d Ο' t) β€ 2 := by | |
| apply periodicDistance_le _ _ _ 2 (by norm_num) | |
| intro j | |
| exact_mod_cast hyb j | |
| have hbb : periodicDistance K (baseVertex n d Ο' t) (baseVertex n d Ο' s) β€ | |
| 2*periodicDistance K x y := by | |
| apply periodicDistance_le _ _ _ _ (mul_nonneg (by norm_num) (periodicDistance_nonneg _ _ _)) | |
| intro j | |
| have h : |(baseVertex n d Ο' t j:β)-(baseVertex n d Ο' s j:β)| β€ | |
| 2*|(t:β)-(s:β)| := by | |
| exact_mod_cast baseVertex_lipschitz n hn d hd Ο' t s ht hs j | |
| rw [abs_sub_comm (t:β)] at h | |
| linarith | |
| have htri1 := periodicDistance_triangle K (baseVertex n d Ο s) x y | |
| have htri2 := periodicDistance_triangle K (baseVertex n d Ο s) y (baseVertex n d Ο' t) | |
| have htri3 := periodicDistance_triangle K (baseVertex n d Ο s) | |
| (baseVertex n d Ο' t) (baseVertex n d Ο' s) | |
| have hdev := same_time_deviation_le K n hn hnK d Ο Ο' s hs | |
| linarith | |
| def distanceToList (K : β) (x : Vertex) (l : List Vertex) : β := | |
| l.foldr (fun y r β¦ min (periodicDistance K x y) r) ((K:β)/2) | |
| lemma distanceToList_nonneg (K : β) (x : Vertex) (l : List Vertex) : | |
| 0 β€ distanceToList K x l := by | |
| induction l with | |
| | nil => simp only [distanceToList,List.foldr_nil]; positivity | |
| | cons y l ih => exact le_min (periodicDistance_nonneg _ _ _) ih | |
| lemma distanceToList_le (K : β) (x y : Vertex) (l : List Vertex) (hy : y β l) : | |
| distanceToList K x l β€ periodicDistance K x y := by | |
| induction l with | |
| | nil => simp at hy | |
| | cons z l ih => | |
| rcases List.mem_cons.mp hy with rfl|hy | |
| Β· exact min_le_left _ _ | |
| Β· exact (min_le_right _ _).trans (ih hy) | |
| lemma distanceToList_attained (K : β) (hK : 0 < K) (x : Vertex) (l : List Vertex) | |
| (hne : l β []) : β y β l, distanceToList K x l = periodicDistance K x y := by | |
| induction l with | |
| | nil => exact False.elim (hne rfl) | |
| | cons z l ih => | |
| by_cases hl : l = [] | |
| Β· subst l | |
| refine β¨z,by simp,?_β© | |
| exact min_eq_left (periodicDistance_le_half K hK x z) | |
| Β· obtain β¨y,hy,heβ© := ih hl | |
| change β y β z::l, min (periodicDistance K x z) (distanceToList K x l) = _ | |
| rcases le_total (periodicDistance K x z) (distanceToList K x l) with h|h | |
| Β· exact β¨z,by simp,min_eq_left hβ© | |
| Β· exact β¨y,by simp [hy],(min_eq_right h).trans heβ© | |
| lemma occurrenceList_ne_nil (n : β) (d : Fin 2 β β€) (Ο : Noise) : | |
| occurrenceList n d Ο β [] := List.ne_nil_of_mem (occurrenceList_initial n d Ο) | |
| lemma distanceToList_deviation_le (K n : β) (hn : 0 < n) (hnK : 8*n β€ K) | |
| (d : Fin 2 β β€) (hd : βj, |d j| β€ n) (Ο Ο' : Noise) | |
| (s : β) (hs : s β€ n) (x : Vertex) (hx : x β levelList n d Ο s) : | |
| twoCopyDistance (min s (n-s)) (Ο,Ο') β€ | |
| 3*distanceToList K x (occurrenceList n d Ο')+5 := by | |
| obtain β¨y,hy,heβ© := distanceToList_attained K (by omega) x _ (occurrenceList_ne_nil n d Ο') | |
| obtain β¨t,ht,hyβ© := List.mem_flatMap.mp hy | |
| rw [List.mem_range] at ht | |
| rw [he] | |
| exact occurrence_deviation_le K n hn hnK d hd Ο Ο' s t hs (by omega) x y hx hy | |
| def foldIndex (n : β) (j : Fin (n+1)) : Fin (n/2+1) Γ Bool := | |
| if hj : j.val β€ n/2 then (β¨j.val, by omegaβ©, false) | |
| else (β¨n-j.val, by omegaβ©, true) | |
| lemma foldIndex_value (n : β) (j : Fin (n+1)) : | |
| (foldIndex n j).1.val = min j.val (n-j.val) := by | |
| unfold foldIndex | |
| split_ifs with h <;> simp only | |
| Β· omega | |
| Β· omega | |
| lemma foldIndex_injective (n : β) : Function.Injective (foldIndex n) := by | |
| intro i j h | |
| have hβ := congrArg (fun x : Fin (n/2+1) Γ Bool β¦ x.1.val) h | |
| have hβ := congrArg Prod.snd h | |
| unfold foldIndex at hβ hβ | |
| split_ifs at hβ hβ <;> simp_all only | |
| all_goals apply Fin.ext; omega | |
| lemma folded_sum_le (n : β) (f : β β β) (hf : β j, 0 β€ f j) : | |
| (β j β Finset.range (n+1), f (min j (n-j))) β€ | |
| 2 * β j β Finset.range (n/2+1), f j := by | |
| let g : Fin (n/2+1) Γ Bool β β := fun x β¦ f x.1.val | |
| have hs : (β x β Finset.univ.image (foldIndex n), g x) β€ β x, g x := by | |
| exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (fun x _ _ β¦ hf _) | |
| rw [Finset.sum_image (fun i _ j _ hij β¦ foldIndex_injective n hij)] at hs | |
| have hleft : (β i : Fin (n+1), g (foldIndex n i)) = | |
| β j β Finset.range (n+1), f (min j (n-j)) := by | |
| simp only [g, foldIndex_value] | |
| exact Fin.sum_univ_eq_sum_range (fun j β¦ f (min j (n-j))) (n+1) | |
| have hright : (β x : Fin (n/2+1) Γ Bool, g x) = | |
| 2 * β j β Finset.range (n/2+1), f j := by | |
| simp only [Fintype.sum_prod_type, Fintype.sum_bool, g, β two_mul, β Finset.mul_sum, | |
| Fin.sum_univ_eq_sum_range] | |
| simpa only [hleft, hright] using hs | |
| lemma nearPotential_eq_if (u : β) (R : β) (z : Noise Γ Noise) : | |
| nearPotential u (fun j β¦ position z.2 j u) R z.1 = | |
| if twoCopyDistance u z β€ R then 1 else 0 := by | |
| unfold nearPotential nearTest coordinateTest twoCopyDistance transverseDistance | |
| by_cases h0 : |position z.1 0 u-position z.2 0 u| β€ R <;> | |
| by_cases h1 : |position z.1 1 u-position z.2 1 u| β€ R <;> | |
| simp [h0,h1] | |
| lemma twoCopyDistance_swap (u : β) (z : Noise Γ Noise) : | |
| twoCopyDistance u z.swap = twoCopyDistance u z := by | |
| simp only [twoCopyDistance,transverseDistance,Prod.swap] | |
| rw [abs_sub_comm (position z.2 0 u),abs_sub_comm (position z.2 1 u)] | |
| lemma nearPotential_swap (u : β) (R : β) (Ο Ο' : Noise) : | |
| nearPotential u (fun j β¦ position Ο j u) R Ο' = | |
| nearPotential u (fun j β¦ position Ο' j u) R Ο := by | |
| rw [nearPotential_eq_if (z := (Ο',Ο)),nearPotential_eq_if (z := (Ο,Ο'))] | |
| rw [show twoCopyDistance u (Ο',Ο) = twoCopyDistance u (Ο,Ο') from | |
| twoCopyDistance_swap u (Ο,Ο')] | |
| def oneSideHit (K : β) (R : β) (l l' : List Vertex) : β := | |
| (l.map (fun x β¦ if distanceToList K x l' β€ R then 1 else 0)).sum | |
| def occurrenceHit (K : β) (R : β) (l l' : List Vertex) : β := | |
| oneSideHit K R l l'+oneSideHit K R l' l | |
| def occurrenceSoft (K : β) (B : β) (l l' : List Vertex) : β := | |
| (l.map (fun x β¦ Real.exp (-distanceToList K x l'/B))).sum | |
| lemma oneSideHit_nonneg (K : β) (R : β) (l l' : List Vertex) : | |
| 0 β€ oneSideHit K R l l' := by | |
| apply List.sum_nonneg | |
| intro a ha | |
| obtain β¨x,hx,rflβ© := List.mem_map.mp ha | |
| split_ifs <;> norm_num | |
| lemma occurrenceHit_nonneg (K : β) (R : β) (l l' : List Vertex) : | |
| 0 β€ occurrenceHit K R l l' := add_nonneg | |
| (oneSideHit_nonneg _ _ _ _) (oneSideHit_nonneg _ _ _ _) | |
| lemma level_sum_le (n : β) (hn : 0 < n) (d : Fin 2 β β€) | |
| (hd : βj, |d j| β€ n) (Ο : Noise) (f : Vertex β β) (g : β β β) | |
| (hg : βt, 0 β€ g t) | |
| (hfg : βt β€ n, βx β levelList n d Ο t, f x β€ g t) : | |
| ((occurrenceList n d Ο).map f).sum β€ | |
| 5*β t β Finset.range (n+1), g t := by | |
| have hlevel (t : β) (ht : t β€ n) : | |
| ((levelList n d Ο t).map f).sum β€ 5*g t := by | |
| calc | |
| _ β€ ((levelList n d Ο t).map (fun _ β¦ g t)).sum := by | |
| apply List.sum_le_sum | |
| intro x hx | |
| exact hfg t ht x hx | |
| _ = ((levelList n d Ο t).length:β)*g t := by simp [nsmul_eq_mul] | |
| _ β€ _ := mul_le_mul_of_nonneg_right (by | |
| exact_mod_cast levelList_length n hn d hd Ο t ht) (hg t) | |
| unfold occurrenceList | |
| rw [List.flatMap_def,List.map_flatten,List.sum_flatten] | |
| simp only [List.map_map] | |
| calc | |
| _ β€ ((List.range (n+1)).map (fun t β¦ 5*g t)).sum := by | |
| apply List.sum_le_sum | |
| intro t ht | |
| exact hlevel t (Nat.le_of_lt_succ (List.mem_range.mp ht)) | |
| _ = _ := by | |
| rw [List.sum_map_mul_left,β List.sum_toFinset g List.nodup_range,List.toFinset_range] | |
| lemma oneSideHit_le (K n : β) (hn : 0 < n) (hnK : 8*n β€ K) | |
| (d : Fin 2 β β€) (hd : βj, |d j| β€ n) (Ο Ο' : Noise) (R : β) : | |
| oneSideHit K R (occurrenceList n d Ο) (occurrenceList n d Ο') β€ | |
| 10*β u β Finset.range (n/2+1), | |
| nearPotential u (fun j β¦ position Ο' j u) (3*R+5) Ο := by | |
| have h := level_sum_le n hn d hd Ο | |
| (fun x β¦ if distanceToList K x (occurrenceList n d Ο') β€ R then 1 else 0) | |
| (fun t β¦ nearPotential (min t (n-t)) | |
| (fun j β¦ position Ο' j (min t (n-t))) (3*R+5) Ο) | |
| (fun _ β¦ nearPotential_nonneg _ _ _ _) (by | |
| intro t ht x hx | |
| split_ifs with h | |
| Β· rw [nearPotential_eq_if (z := (Ο,Ο'))] | |
| rw [ite_eq_left (by linarith [distanceToList_deviation_le K n hn hnK d hd Ο Ο' t ht x hx])] | |
| Β· exact nearPotential_nonneg _ _ _ _) | |
| have hf := folded_sum_le n | |
| (fun u β¦ nearPotential u (fun j β¦ position Ο' j u) (3*R+5) Ο) | |
| (fun _ β¦ nearPotential_nonneg _ _ _ _) | |
| change oneSideHit K R _ _ β€ _ at h | |
| linarith | |
| end HardSphere.DyadicSkeleton | |
| end | |
| end | |
| end OAI | |