Download data/lean/OAI/NumberTheory/GaussianMoat/WindowBatch.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.04 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/GaussianMoat/WindowBatch.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/GaussianMoat/WindowBatch.lean
-
curl -L -o WindowBatch.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/GaussianMoat/WindowBatch.lean
7.04 kB
| import OAI.NumberTheory.GaussianMoat.CommonBlocks | |
| namespace OAI | |
| namespace GaussianMoat | |
| open scoped BigOperators Classical | |
| open Filter | |
| lemma eventually_length_smoothing : | |
| βαΆ X : β in atTop, β p L N : β, | |
| 0<p β pβ€2*Real.exp (21/20*X) β 0β€L β Lβ€Real.exp (21/50*X) β | |
| Real.exp (20*X)β€N β Lβ€N β§ L/(N+1)β€((1/4)/p)/2 := by | |
| have hh := eventually_mul_exp_le_exp (a := 147/100) (b := 20) (by norm_num) 16 | |
| filter_upwards [hh,eventually_ge_atTop (1:β)] with X hh hX | |
| intro p L N hp hp' hL hL' hN | |
| have hNpos : 0<N+1 := by linarith only [hN,Real.exp_pos (20*X)] | |
| have hm := mul_le_mul hp' hL' hL (by positivity : 0β€2*Real.exp (21/20*X)) | |
| rw [mul_assoc,βReal.exp_add,show 21/20*X+21/50*X=147/100*X by ring] at hm | |
| refine β¨hL'.trans ((Real.exp_le_exp.mpr (by linarith only [hX])).trans hN),?_β© | |
| apply (div_le_iffβ hNpos).mpr | |
| have he : ((1/4:β)/p)/2=(1/8)/p := by ring | |
| rw [he] | |
| apply (mul_le_mul_iff_leftβ hp).mp | |
| have heq : (1/8/p)*(N+1)*p=(N+1)/8 := by field_simp | |
| rw [heq] | |
| nlinarith only [hm,hh,hN] | |
| theorem eventually_window_batch {D a Ξ΄ : β} {K : β} | |
| (hD : 1β€D) (ha : 0<a) (ha1 : aβ€1) (haΞ΄ : 2*aβ€Ξ΄) | |
| (hgap : aβ€(2:β)^K*topCoefficient a) (W w : β) (hw : w<W) : | |
| βαΆ m : β in atTop, β J : β β Finset β, | |
| (β i<W, β jβJ i, ((100:β)^i*Real.exp m)β€j*Real.log 2 β§ | |
| j*Real.log 2β€21/20*((100:β)^i*Real.exp m) β§ | |
| Ξ΄*(2:β)^j/Real.log ((2:β)^(j+1))β€(PrimeLogMass.dyadicBatch j).card) β | |
| (β iβJ w, β jβJ w, i<j β i+Kβ€j) β | |
| β jβJ w, β E : β, Eβ€(topCoefficient a/4)*(2:β)^j/10000 β | |
| Nonempty (BatchCertificate D (commonBlocks a m W J) (windowSmoothing W m) | |
| (dyadicSieve j) (batchWordLength j) E | |
| ((topCoefficient a/4)/(10000000*Real.log ((2:β)^j)))) := by | |
| have hΞ΄ : 0<Ξ΄ := by linarith only [ha,haΞ΄] | |
| have hc : 0<topCoefficient a/4 := by exact div_pos (topCoefficient_pos ha) (by norm_num) | |
| have ht := windowScale_tendsto w | |
| have hΞ΅ : 0 < min (1/1024:β) (Real.exp (-100)/(512*640000)) := by positivity | |
| have herr := eventually_accurate_error (2*(100:β)^w) hΞ΅ | |
| filter_upwards [eventually_window_bands hD ha.le ha1 hΞ΄ W w hw, | |
| eventually_window_tail_bounds hD ha.le ha1 W w hw, | |
| ht.eventually (eventually_window_top hD ha haΞ΄ hgap), | |
| ht.eventually (eventually_integer_batch_bounds hD), | |
| ht.eventually eventually_coverage_hazard,ht.eventually eventually_coverage_data_cost, | |
| ht.eventually (eventually_package_displacement hc), | |
| ht.eventually eventually_length_smoothing,herr,ht.eventually (eventually_ge_atTop (1600:β))] | |
| with m hbands htail htop hint hhazard hccost hpcost hsmooth herr hX | |
| intro J hJ hsep j hj E hE | |
| let X : β := (100:β)^w*Real.exp m | |
| let s := dyadicSieve j | |
| have hdata := hJ w hw j hj | |
| have hne : s.primes.Nonempty := dyadic_dense_nonempty hΞ΄ hdata.2.2 | |
| have hpj := dyadic_prime_bounds j | |
| have hm := dyadic_mean_bounds (by linarith only [hX]) hne hdata.1 hdata.2.1 | |
| have hTpos : (0:β)<2^j := by positivity | |
| have hT : Real.exp Xβ€(2:β)^j := by | |
| rw [βReal.exp_log hTpos,Real.log_pow] | |
| exact Real.exp_le_exp.mpr hdata.1 | |
| have hprime : β i : s.SignedIndex, Real.exp Xβ€(s.signedPrime i:β) β§ | |
| (s.signedPrime i:β)β€2*Real.exp (21/20*X) := by | |
| intro i | |
| have hp := hpj _ (s.enumeration i.2).property | |
| refine β¨hT.trans hp.1,hp.2.trans ?_β© | |
| apply mul_le_mul_of_nonneg_left _ (by norm_num) | |
| rw [βReal.exp_log hTpos,Real.log_pow] | |
| exact Real.exp_le_exp.mpr hdata.2.1 | |
| obtain β¨pre,hpreβ© := windowBlocks_split a m J hw | |
| obtain β¨hband,hbsizeβ© := htop (J w) pre hsep (hJ w hw) j hj | |
| obtain β¨qtopβ© := hband | |
| obtain β¨hmid,hbot,hbmidβ© := hbands J hJ j hj | |
| obtain β¨qmidβ© := hmid | |
| obtain β¨qbotβ© := hbot | |
| obtain β¨_,_,_,hbotcost,hrestcostβ© := htail J (fun i hi k hk => (hJ i hi k hk).2.1) | |
| have herrors : (91*accurateGrid m)*s.meanLogβ€ min (1/1024:β) (Real.exp (-100)/(512*640000)) := by | |
| have hh := mul_le_mul_of_nonneg_left hm.2 (by have := accurateGrid_pos m; positivity : 0β€91*accurateGrid m) | |
| exact hh.trans (by simpa only [mul_assoc] using herr) | |
| have hcoverage := coverage_from_scalar_guards s D X (windowSmoothing W m) | |
| (middleBlocks a m w J) (accurateBlock m (1/20)) _ _ _ qmid qbot | |
| (by linarith only [hm.1]) (by have := windowSmoothing_pos W m; omega) | |
| (by linarith only [hX]) hprime | |
| (herrors.trans (min_le_right _ _)) (herrors.trans (min_le_left _ _)) | |
| (hccost _ _ hbotcost hbmid) (fun i => hhazard _ ((Real.exp_pos X).trans_le (hprime i).1) (hprime i).2) | |
| obtain β¨hn,hshort,hnL,hnL',hnmax,hLmaxβ© := hint j hdata.1 hdata.2.1 | |
| have hN : Real.exp (20*X)β€(windowSmoothing W m:β) := by | |
| apply le_trans _ (windowSmoothing_bounds W m).1 | |
| apply Real.exp_le_exp.mpr | |
| have hh := mul_le_mul_of_nonneg_right (pow_le_pow_rightβ (by norm_num : (1:β)β€100) hw.le) (Real.exp_nonneg (m:β)) | |
| dsimp only [X] | |
| nlinarith only [hh] | |
| have hNLength : batchWordLength jβ€windowSmoothing W m := by | |
| have h := hsmooth ((2:β)^j) (batchWordLength j) (windowSmoothing W m) hTpos | |
| (by | |
| have hh : (2:β)^jβ€Real.exp (21/20*X) := by | |
| rw [βReal.exp_log hTpos,Real.log_pow] | |
| exact Real.exp_le_exp.mpr hdata.2.1 | |
| linarith only [hh,Real.exp_nonneg (21/20*X)]) | |
| (Nat.cast_nonneg _) hLmax hN | |
| exact_mod_cast h.1 | |
| refine β¨{ | |
| pre := pre++topBlocks a (J w) | |
| rest := middleBlocks a m w J++accurateBlock m (1/20) | |
| schedule := by simp only [commonBlocks,middleBlocks,hpre,List.append_assoc] | |
| T := (2:β)^j | |
| nonempty := hne | |
| prime_scale := hpj | |
| large := by linarith only [hT,Real.add_one_le_exp X,hX] | |
| mean := hm.1 | |
| b := bandSize s topParameter (a*(2:β)^j) topIterations | |
| n := packageRepetitions j | |
| Ο := 1/4 | |
| A := X/400 | |
| Ξ· := 1/100 | |
| Ξ΄ := 1/10000 | |
| u := fun i => (s.signedPrime i:β)*Real.exp (-X/200) | |
| band := qtop | |
| coverage := hcoverage | |
| cap := qtop.size_cap (by linarith only [hm.1]) | |
| repetitions := hn | |
| length := batchWordLength_pos j | |
| floor := by norm_num | |
| gain := by linarith only [hX] | |
| exceptions := fun i => by positivity | |
| short := fun i => hshort.trans_le (hpj _ (s.enumeration i.2).property).1 | |
| smooth_length := hNLength | |
| smooth_error := fun i => (hsmooth _ _ _ ((Real.exp_pos X).trans_le (hprime i).1) | |
| (hprime i).2 (Nat.cast_nonneg _) hLmax hN).2 | |
| list := ?_ | |
| rate := ?_ | |
| }β© | |
| Β· intro i | |
| have hh := package_list_arithmetic hX hT ((Real.exp_pos X).trans_le (hprime i).1) | |
| (hpj _ (s.enumeration i.2).property).2 hnL | |
| dsimp only [s] at hh | |
| convert hh using 1; congr 2; ring_nf | |
| Β· apply package_rate_arithmetic (by linarith only [hX]) hTpos hc | |
| (by simpa only [Real.log_pow] using hdata.1) | |
| (by simpa only [Real.log_pow] using hdata.2.1) hm.2 | |
| (by convert hbsize using 1; ring) hnL' | |
| (hpcost _ _ _ (Nat.cast_nonneg _) hnmax hrestcost hT) hE | |
| end GaussianMoat | |
| end OAI | |