Download data/lean/OAI/Probability/SKBarriers/Dynamics/GreedyInvariant.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.37 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/GreedyInvariant.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKBarriers/Dynamics/GreedyInvariant.lean
-
curl -L -o GreedyInvariant.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/GreedyInvariant.lean
9.37 kB
| import Mathlib | |
| import OAI.Probability.SKBarriers.Dynamics.GreedyStep | |
| import OAI.Probability.SKBarriers.Dynamics.GreedyRecursion | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| namespace SK.Analytic | |
| theorem greedy_marker_windows {n : β} (hn : 0 < n) (ΞΌ : ProbabilityMeasure β) | |
| (pool : β β Finset (Config n)) (fallback : β β Config n) | |
| (hf : β j, fallback j β pool j) (base : β β Config n) (x : β β Config n) | |
| (r : β β β) (B H p m : β) (t Ο d b b' q : β) | |
| (hp : 0 < p) (hB : 0 < B) (hHB : H < B) (hH : β2/b^2ββ β€ H) | |
| (ht : 0 < t) (hΟ : 0 < Ο) (hd : 0 β€ d) (hb : 0 < b) | |
| (hpack : 3*t < b^2/2) (hcsmall : 3*t < b) (hEst : 6*p*Ο^20 < t) | |
| (hsmall' : 2*t+6*p*Ο^20+2*(n:β)^(-(1:β)/100) < b') | |
| (hsep' : 12*p*Ο^20+4*(n:β)^(-(1:β)/100) < 3*Ο) | |
| (hwidth : Ο^8 < t/2) | |
| (hsmall : 6*p*Ο^20+2*(n:β)^(-(1:β)/100)+Ο^20+d/2 < Ο^8) | |
| (hsep : 6*p*Ο^20+2*(n:β)^(-(1:β)/100)+Ο^20+3*d/2 β€ 2*Ο) | |
| (hd' : d/2 β€ Ο^20) (heta : 2*(n:β)^(-(1:β)/100) < 2*Ο^20) | |
| (hq : 2*t+6*p*Ο^20+2*(n:β)^(-(1:β)/100)+2*Ο^20 < q) | |
| (hr : β i < p, r i β Icc t (2*t)) | |
| (hspacing : β i j, i < j β j < p β 3*Ο β€ r j-r i) | |
| (hmass : β i < p, (ΞΌ : Measure β).real (Icc (r i-2*Ο^8) (r i+2*Ο^8)) β€ Ο^4) | |
| (hjump : β z k, k < m β |overlap z (x (k+1))-overlap z (x k)| β€ d) | |
| (hcoverage : β j < p, β v : β β Config n, (β i < j, v i β pool i) β | |
| β u β€ m, (β i, j/B*B β€ i β i < j β |overlap (v i) (x u)| β€ 3*t) β | |
| β w β pool j, q β€ overlap w (x u) β§ | |
| β i, j/B*B β€ i β i < j β |overlap (v i) w| β€ 3*t) | |
| (hsigned : β i j, i < j β j < p β β v β pool i, β w β pool j, β k β€ m, | |
| (![v,w,x k] : ReplicaConfig n 3) β signedLockingSet n q b) | |
| (hbank : β i k j, i < k β k < j β j < p β β v β pool i, β z β pool k, β w β pool j, | |
| (![z,v,w] : ReplicaConfig n 3) β signedLockingSet n b b' β§ | |
| (![z,v,flip w] : ReplicaConfig n 3) β signedLockingSet n b b') | |
| (hnarrow : β i j, i < j β j < p β β v β pool i, β w β pool j, β k β€ m, | |
| (![v,x k,w] : ReplicaConfig n 3) β narrowLockingSet n ΞΌ t Ο) | |
| (hpass : overlap (bankPick pool fallback B x t q 0 base 0) (x m) β€ 0) : | |
| β k β€ m, β a, a*B < p β | |
| |overlap (greedyReference base (bankPick pool fallback B x t q) x r b m (a*B)) (x k)-r (a*B)| β€ 6*p*Ο^20 := by | |
| classical | |
| let pick := bankPick pool fallback B x t q | |
| let S := greedyRun base pick x r b m | |
| have hΞ΅ : 0 < Ο^20 := pow_pos hΟ _ | |
| have hΞ· : 0 β€ 2*(n:β)^(-(1:β)/100) := by positivity | |
| have htwo : 2*t < q := by | |
| have hEp : 0 β€ 6*(p:β)*Ο^20 := by positivity | |
| linarith only [hq,hEp,hΞ΅,hΞ·] | |
| have hmem (j i : β) (hi : i < j) : (S j).refs i β pool i := by | |
| rw [show (S j).refs i=greedyReference base pick x r b m i from greedyRun_refs _ _ _ _ _ _ _ _ hi] | |
| exact bankPick_mem pool fallback hf B x t q i _ _ | |
| have hfirst := bankPick_spec pool fallback B x t q 0 base 0 | |
| (hcoverage 0 hp base (by intros; omega) 0 (by omega) (by intros; omega)) | |
| have hanchor (j : β) (hj : 0 < j) : q β€ overlap ((S j).refs 0) (x 0) := by | |
| rw [show (S j).refs 0=greedyReference base pick x r b m 0 from greedyRun_refs _ _ _ _ _ _ _ _ hj] | |
| exact hfirst.1 | |
| have HI : β j β€ p, (S j).time β€ m β§ BlockProtected B j (S j).kept β§ | |
| (β i β (S j).kept, |overlap ((S j).refs i) (x (S j).time)-r i| β€ 6*j*Ο^20) β§ | |
| (β i β (S j).kept, β k β (S j).kept, i < k β | |
| |overlap ((S j).refs i) ((S j).refs k)-r i| β€ 6*j*Ο^20) := by | |
| intro j hjp | |
| induction j with | |
| | zero => simp [S,greedyRun,BlockProtected] | |
| | succ j ih => | |
| have hjp' : j < p := by omega | |
| obtain β¨hΟ,hblock,hpath,hpairβ© := ih (by omega) | |
| have hEr : 6*(j:β)*Ο^20 β€ 6*p*Ο^20 := by gcongr | |
| have hA := greedyRun_range base pick x r b m j | |
| have hcand := hcoverage j hjp' (S j).refs (hmem j) (S j).time hΟ (by | |
| intro i hil hij | |
| have hlo : (j-1)/B*B β€ j/B*B := Nat.mul_le_mul_right B (Nat.div_le_div_right (Nat.sub_le j 1)) | |
| have himem := hblock.1 i (hlo.trans hil) hij | |
| have hh := hpath i himem | |
| have hri := hr i (hij.trans hjp') | |
| have hh' := abs_add_le (overlap ((S j).refs i) (x (S j).time)-r i) (r i) | |
| rw [sub_add_cancel,abs_of_pos (ht.trans_le hri.1)] at hh' | |
| linarith only [hh',hh,hri.2,hEr,hEst]) | |
| have hsel := bankPick_spec pool fallback B x t q j (S j).refs (S j).time hcand | |
| let w := pick j (S j).refs (S j).time | |
| have hw : w β pool j := bankPick_mem pool fallback hf B x t q j _ _ | |
| by_cases hj0 : j=0 | |
| Β· subst j | |
| have hband := firstCrossing_band (fun k => overlap w (x k)) (r 0) d m | |
| (by change r 0 < overlap (bankPick pool fallback B x t q 0 base 0) (x 0); linarith only [hfirst.1,(hr 0 hp).2,htwo]) | |
| (by change overlap (bankPick pool fallback B x t q 0 base 0) (x m) β€ r 0; linarith only [hpass,(hr 0 hp).1,ht]) | |
| (hjump w) | |
| dsimp [w, S, greedyRun] at hband | |
| change _ β€ m β§ _ β§ _ β§ _ | |
| simp only [S,greedyRun,zero_add,Nat.cast_one,mul_one] | |
| simp only [Finset.empty_sdiff,Finset.insert_empty,Finset.mem_singleton,ite_true] | |
| refine β¨hband.1,?_,?_,?_β© | |
| Β· constructor | |
| Β· intro i _ hi | |
| have : i=0 := by omega | |
| simpa only [Finset.mem_singleton] using this | |
| Β· intro k hk | |
| have : k*B=0 := by omega | |
| simpa only [Finset.mem_singleton] using this | |
| Β· intro i hi | |
| subst i | |
| simp only [Function.update_self] | |
| rw [abs_le] | |
| constructor <;> linarith only [hband.2.1,hband.2.2,hd',hΞ΅] | |
| Β· intro i hi k hk hik | |
| omega | |
| Β· have hj : 0 < j := Nat.pos_of_ne_zero hj0 | |
| have Hstep := greedy_locking_step hn ΞΌ (S j).refs w x (S j).kept r B H j (S j).time | |
| t Ο (6*j*Ο^20) d b b' q hj hB hHB hH ht hΟ (by positivity) hd hb hpack hcsmall | |
| (hEr.trans_lt hEst) (by linarith only [hsmall',hEr]) (by linarith only [hsep',hEr]) hwidth | |
| (by linarith only [hsmall,hEr]) (by linarith only [hsep,hEr]) hd' heta | |
| (by linarith only [hq,hEr]) (fun i hi => hr i (hi.trans_lt hjp')) | |
| (fun i k hik hk => hspacing i k hik (hk.trans_lt hjp')) (fun i hi => hmass i (hi.trans hjp')) | |
| hA hblock hpath hpair (hanchor j hj) hsel.1 | |
| (by | |
| intro hmod | |
| apply hsel.2 (j-1) _ (by omega) | |
| have hh : j%B+j/B*B=j := by simpa only [Nat.mul_comm B] using Nat.mod_add_div j B | |
| have hpos : 0 < j%B := Nat.pos_of_ne_zero hmod | |
| omega) | |
| (fun z k hk => hjump z k (hk.trans_le hΟ)) | |
| (fun i hi => hsigned i j (hA i hi) hjp' _ (hmem j i (hA i hi)) w hw _ hΟ) | |
| (fun i hi k hk hik => hbank i k j hik (hA k hk) hjp' _ (hmem j i (hA i hi)) _ (hmem j k (hA k hk)) w hw) | |
| (fun i hi k hk => hnarrow i j (hA i hi) hjp' _ (hmem j i (hA i hi)) w hw k (hk.trans hΟ)) | |
| obtain β¨hs,hcard,hprot,hzero,htime,hband,href,hnewpathβ© := Hstep | |
| have hinc : 6*(j:β)*Ο^20+2*(n:β)^(-(1:β)/100)+2*Ο^20 β€ 6*(j+1:β)*Ο^20 := by | |
| simp only [Nat.cast_add,Nat.cast_one] | |
| nlinarith only [heta,hΞ΅] | |
| have hmono : 6*(j:β)*Ο^20 β€ 6*(j+1:β)*Ο^20 := by | |
| simp only [Nat.cast_add,Nat.cast_one]; nlinarith only [hΞ΅] | |
| change _ β€ m β§ _ β§ _ β§ _ | |
| simp only [S,greedyRun,ite_eq_right hj0] | |
| refine β¨htime.trans hΟ,hprot,?_,?_β© | |
| Β· intro i hi | |
| rcases Finset.mem_insert.mp hi with he | hi | |
| Β· subst i | |
| rw [Function.update_self,abs_le] | |
| have hc : 2*Ο^20 β€ 6*(j+1:β)*Ο^20 := by | |
| have hjr : (0:β) β€ j := by positivity | |
| simp only [Nat.cast_add,Nat.cast_one]; nlinarith only [mul_nonneg hjr hΞ΅.le,hΞ΅] | |
| constructor <;> linarith only [hband.1,hband.2,hd',hc] | |
| Β· have him : i β (S j).kept := (Finset.mem_sdiff.mp hi).1 | |
| rw [Function.update_of_ne (ne_of_lt (hA i him))] | |
| exact (hnewpath i hi).trans hinc | |
| Β· intro i hi k hk hik | |
| have hil : i < j := by | |
| rcases Finset.mem_insert.mp hk with rfl | hk | |
| Β· exact hik | |
| Β· exact hik.trans (hA k (Finset.mem_sdiff.mp hk).1) | |
| have him : i β (S j).kept\(S j).kept.filter (fun i => b < |overlap ((S j).refs i) w|) := by | |
| exact (Finset.mem_insert.mp hi).resolve_left (ne_of_lt hil) | |
| rw [Function.update_of_ne (ne_of_lt hil)] | |
| rcases Finset.mem_insert.mp hk with rfl | hk | |
| Β· rw [Function.update_self] | |
| exact (href i him).trans (by linarith only [hinc,hΞ΅]) | |
| Β· have hkl := hA k (Finset.mem_sdiff.mp hk).1 | |
| rw [Function.update_of_ne (ne_of_lt hkl)] | |
| exact (hpair i (Finset.mem_sdiff.mp him).1 k (Finset.mem_sdiff.mp hk).1 hik).trans hmono | |
| obtain β¨hΟ,hprotected,hpath,_β© := HI p le_rfl | |
| refine β¨(S p).time,hΟ,?_β© | |
| intro a ha | |
| have hmem := hprotected.2 a ha | |
| rw [β greedyRun_refs base pick x r b m p (a*B) ha] | |
| exact hpath (a*B) hmem | |
| end SK.Analytic | |
| end | |
| end | |
| end OAI | |