Download data/lean/OAI/NumberTheory/PrimeGaps/BoxMeans.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/BoxMeans.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PrimeGaps/BoxMeans.lean
-
curl -L -o BoxMeans.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/BoxMeans.lean
19.4 kB
| import OAI.NumberTheory.PrimeGaps.SingularTails | |
| namespace OAI | |
| namespace LargePrimeGaps | |
| open Filter | |
| open Set Filter MeasureTheory | |
| open scoped Topology ContDiff | |
| noncomputable def distinctBox {s h : β} (a : Fin s β β€) : Finset (Fin s β Fin h) := | |
| Finset.univ.filter fun n => Function.Injective (boxTuple a n) | |
| noncomputable def truncatedBoxMean {s h : β} (a : Fin s β β€) (q : β) : β := | |
| (β n : Fin s β Fin h, siftedTuple (boxTuple a n) q)/(h:β)^s | |
| noncomputable def distinctTruncatedBoxMean {s h : β} (a : Fin s β β€) (q : β) : β := | |
| (β n β distinctBox (h:=h) a, siftedTuple (boxTuple a n) q)/(h:β)^s | |
| noncomputable def singularBoxMean {s h : β} (a : Fin s β β€) : β := | |
| (β n β distinctBox (h:=h) a, singularSeries (Finset.univ.image (boxTuple a n)))/(h:β)^s | |
| theorem siftedTuple_boxTuple {s h q : β} [NeZero q] (a : Fin s β β€) (n : Fin s β Fin h) : | |
| siftedTuple (boxTuple a n) q = normalizedSiftedCount (residueTuple (q:=q) a n) := by | |
| rw [siftedTuple_eq] | |
| congr 1 | |
| funext i | |
| simp only [boxTuple, residueTuple, Int.cast_add, Int.cast_natCast] | |
| theorem truncatedBoxMean_bounds {s h q : β} [NeZero q] (hh : 0<h) (hq : qβ€h) | |
| (a : Fin s β β€) : | |
| (1-(q:β)/h)^s β€ truncatedBoxMean (h:=h) a q β§ | |
| truncatedBoxMean (h:=h) a q β€ (1+(q:β)/h)^s := by | |
| have hhR : (0:β)<h := by exact_mod_cast hh | |
| have hqR : (q:β)β€h := by exact_mod_cast hq | |
| have hdiv : ((h/q:β):β)*(q:β) β€ h := by exact_mod_cast Nat.div_mul_le_self h q | |
| have hfloor : (h:β)-(q:β) β€ ((h/q:β):β)*(q:β) := by | |
| have he := Nat.div_add_mod h q | |
| have hm := Nat.mod_lt h (NeZero.pos q) | |
| have heR : ((h/q:β):β)*(q:β)+(h%q:β)=h := by | |
| exact_mod_cast (by simpa only [Nat.mul_comm] using he : h/q*q+h%q=h) | |
| have hmR : ((h%q:β):β)<q := by exact_mod_cast hm | |
| linarith | |
| have hb := residueTuple_sum_bounds (h:=h) a (@normalizedSiftedCount s q _) normalizedSiftedCount_nonneg | |
| rw [normalizedSiftedCount_sum] at hb | |
| simp_rw [β siftedTuple_boxTuple] at hb | |
| unfold truncatedBoxMean | |
| constructor | |
| Β· calc | |
| _ = ((h:β)-(q:β))^s/(h:β)^s := by rw [β div_pow]; congr 1; field_simp | |
| _ β€ (((h/q:β):β)*(q:β))^s/(h:β)^s := div_le_div_of_nonneg_right | |
| (pow_le_pow_leftβ (sub_nonneg.mpr hqR) hfloor s) (by positivity) | |
| _ β€ _ := by rw [mul_pow]; exact div_le_div_of_nonneg_right hb.1 (by positivity) | |
| Β· calc | |
| _ β€ (((h/q+1:β):β)*(q:β))^s/(h:β)^s := by | |
| rw [mul_pow]; exact div_le_div_of_nonneg_right hb.2 (by positivity) | |
| _ β€ ((h:β)+(q:β))^s/(h:β)^s := div_le_div_of_nonneg_right | |
| (pow_le_pow_leftβ (by positivity) (by push_cast; nlinarith) s) (by positivity) | |
| _ = _ := by rw [β div_pow]; congr 1; field_simp | |
| theorem distinctTruncatedBoxMean_nonneg {s h q : β} [NeZero q] (a : Fin s β β€) : | |
| 0 β€ distinctTruncatedBoxMean (h:=h) a q := by | |
| apply div_nonneg _ (by positivity) | |
| apply Finset.sum_nonneg | |
| intro n _ | |
| rw [siftedTuple_eq] | |
| exact normalizedSiftedCount_nonneg _ | |
| theorem distinctTruncatedBoxMean_le {s h q : β} [NeZero q] (a : Fin s β β€) : | |
| distinctTruncatedBoxMean (h:=h) a q β€ truncatedBoxMean (h:=h) a q := by | |
| apply div_le_div_of_nonneg_right _ (by positivity) | |
| apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) | |
| intro n _ _ | |
| rw [siftedTuple_eq] | |
| exact normalizedSiftedCount_nonneg _ | |
| theorem truncatedBoxMean_sub_distinct_le {s h q : β} [NeZero q] (hh : 0<h) | |
| (a : Fin s β β€) : | |
| truncatedBoxMean (h:=h) a q - distinctTruncatedBoxMean (h:=h) a q β€ | |
| (s:β)^2*(q:β)^s/(h:β) := by | |
| classical | |
| by_cases hs : s=0 | |
| Β· subst s | |
| have hall : distinctBox (h:=h) a = Finset.univ := by | |
| ext n | |
| simp [distinctBox, Function.Injective] | |
| simp [truncatedBoxMean, distinctTruncatedBoxMean, hall] | |
| have hhR : (0:β)<h := by exact_mod_cast hh | |
| have hsum := Finset.sum_filter_add_sum_filter_not (Finset.univ : Finset (Fin s β Fin h)) | |
| (fun n => Function.Injective (boxTuple a n)) (fun n => siftedTuple (boxTuple a n) q) | |
| have hb : (β n β Finset.univ.filter (fun n : Fin s β Fin h => Β¬Function.Injective (boxTuple a n)), | |
| siftedTuple (boxTuple a n) q) β€ (s:β)^2*(h:β)^(s-1)*(q:β)^s := by | |
| calc | |
| _ β€ ((Finset.univ.filter fun n : Fin s β Fin h => Β¬Function.Injective (boxTuple a n)).card:β) * | |
| (q:β)^s := by | |
| simpa only [nsmul_eq_mul] using Finset.sum_le_card_nsmul _ _ ((q:β)^s) (fun n _ => by | |
| rw [siftedTuple_eq] | |
| exact normalizedSiftedCount_le _) | |
| _ β€ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast boxTuple_nondistinct_count (h:=h) a) | |
| (by positivity) | |
| unfold truncatedBoxMean distinctTruncatedBoxMean distinctBox | |
| rw [β sub_div] | |
| calc | |
| _ β€ ((s:β)^2*(h:β)^(s-1)*(q:β)^s)/(h:β)^s := by | |
| apply div_le_div_of_nonneg_right _ (by positivity) | |
| linarith [hsum] | |
| _ = _ := by | |
| have hp : (h:β)^s=(h:β)^(s-1)*(h:β) := by | |
| rw [β pow_succ]; congr 1; omega | |
| rw [hp] | |
| field_simp | |
| noncomputable def boxTruncationError (s h q : β) : β := | |
| |(1-(q:β)/h)^s-1| + |(1+(q:β)/h)^s-1| + (s:β)^2*(q:β)^s/h | |
| theorem distinctTruncatedBoxMean_error {s h q : β} [NeZero q] (hh : 0<h) (hq : qβ€h) | |
| (a : Fin s β β€) : | |
| |distinctTruncatedBoxMean (h:=h) a q-1| β€ boxTruncationError s h q := by | |
| have hb := truncatedBoxMean_bounds hh hq a | |
| have hd := truncatedBoxMean_sub_distinct_le (q:=q) hh a | |
| have hle := distinctTruncatedBoxMean_le (q:=q) (h:=h) a | |
| unfold boxTruncationError | |
| apply abs_le.mpr | |
| constructor | |
| Β· have hl := neg_abs_le ((1-(q:β)/h)^s-1) | |
| have hpos := abs_nonneg ((1+(q:β)/h)^s-1) | |
| linarith | |
| Β· have hu := le_abs_self ((1+(q:β)/h)^s-1) | |
| have hpos := abs_nonneg ((1-(q:β)/h)^s-1) | |
| have hnn : 0β€(s:β)^2*(q:β)^s/h := by positivity | |
| linarith | |
| noncomputable def uniformSingularTailBound (s M y : β) : β := | |
| 2*((s:β)^2*(2:β)^s)/(y:β) + | |
| 4*(s:β)*((s*(s-1):β):β)*Real.log M/((y:β)*Real.log y) | |
| theorem singularTailBound_le_uniform {s M y : β} (a : Fin s β β€) | |
| (ha : Function.Injective a) (hy : 1<y) | |
| (hd : β i j, (a i-a j).natAbs β€ M) : | |
| singularTailBound (Finset.univ.image a) y β€ uniformSingularTailBound s M y := by | |
| have hc : (Finset.univ.image a).card=s := by | |
| rw [Finset.card_image_of_injective _ ha, Finset.card_univ, Fintype.card_fin] | |
| have hb := differenceProduct_le (Finset.univ.image a) (M:=M) (by | |
| intro x hx z hz | |
| obtain β¨i, _, rflβ© := Finset.mem_image.mp hx | |
| obtain β¨j, _, rflβ© := Finset.mem_image.mp hz | |
| exact hd i j) | |
| rw [hc] at hb | |
| have hl : Real.log (differenceProduct (Finset.univ.image a)) β€ | |
| ((s*(s-1):β):β)*Real.log M := by | |
| rw [β Real.log_pow] | |
| apply Real.log_le_log | |
| Β· exact_mod_cast differenceProduct_pos (Finset.univ.image a) | |
| Β· exact_mod_cast hb | |
| unfold singularTailBound uniformSingularTailBound | |
| rw [hc] | |
| apply add_le_add le_rfl | |
| calc | |
| _ β€ 4*(s:β)*(((s*(s-1):β):β)*Real.log M)/((y:β)*Real.log y) := | |
| div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hl (by positivity)) | |
| (mul_nonneg (by positivity) (Real.log_nonneg (by exact_mod_cast (show 1β€y by omega)))) | |
| _ = _ := by ring | |
| def boxDiameterBound {s h : β} (a : Fin s β β€) (M : β) : Prop := | |
| β (n : Fin s β Fin h) i j, (boxTuple a n i-boxTuple a n j).natAbs β€ M | |
| theorem uniformSingularTailBound_nonneg (s : β) {M y : β} (hM : 0<M) (hy : 1<y) : | |
| 0 β€ uniformSingularTailBound s M y := by | |
| have hlogM : 0β€Real.log (M:β) := Real.log_nonneg (by exact_mod_cast hM) | |
| have hlogy : 0β€Real.log (y:β) := Real.log_nonneg (by exact_mod_cast (show 1β€y by omega)) | |
| unfold uniformSingularTailBound | |
| positivity | |
| theorem singularBoxMean_sub_truncation {s h M y : β} (a : Fin s β β€) | |
| (hy : 1<y) (hys : 2*sβ€y) (hd : boxDiameterBound (h:=h) a M) | |
| (hB : uniformSingularTailBound s M yβ€1) : | |
| |singularBoxMean (h:=h) a-distinctTruncatedBoxMean (h:=h) a (primorial y)| β€ | |
| 2*uniformSingularTailBound s M y*distinctTruncatedBoxMean (h:=h) a (primorial y) := by | |
| classical | |
| let : NeZero (primorial y) := β¨(primorial_pos y).ne'β© | |
| have hpoint (n : Fin s β Fin h) (hn : nβdistinctBox a) : | |
| |singularSeries (Finset.univ.image (boxTuple a n))-siftedTuple (boxTuple a n) (primorial y)| β€ | |
| 2*uniformSingularTailBound s M y*siftedTuple (boxTuple a n) (primorial y) := by | |
| have hi := (Finset.mem_filter.mp hn).2 | |
| have hc : (Finset.univ.image (boxTuple a n)).card=s := by | |
| rw [Finset.card_image_of_injective _ hi, Finset.card_univ, Fintype.card_fin] | |
| have hut := singularTailBound_le_uniform (boxTuple a n) hi hy (hd n) | |
| have ht := singularTail_error (Finset.univ.image (boxTuple a n)) hy (by simpa only [hc] using hys) | |
| (hut.trans hB) | |
| have hp : 0 β€ siftedTuple (boxTuple a n) (primorial y) := by | |
| rw [siftedTuple_eq] | |
| exact normalizedSiftedCount_nonneg _ | |
| rw [singularSeries_eq_truncation_mul_tail _ hy (by simpa only [hc] using hys), | |
| β siftedTuple_primorial_eq _ hi, β primorial_eq_prod_primesLE] | |
| calc | |
| _ = siftedTuple (boxTuple a n) (primorial y)*|singularTail (Finset.univ.image (boxTuple a n)) y-1| := by | |
| rw [β mul_sub_one, abs_mul, abs_of_nonneg hp] | |
| _ β€ siftedTuple (boxTuple a n) (primorial y)*(2*uniformSingularTailBound s M y) := | |
| mul_le_mul_of_nonneg_left (ht.trans (mul_le_mul_of_nonneg_left hut (by norm_num))) hp | |
| _ = _ := by ring | |
| unfold singularBoxMean distinctTruncatedBoxMean | |
| rw [β sub_div, abs_div, abs_of_nonneg (by positivity : 0β€(h:β)^s), β Finset.sum_sub_distrib] | |
| calc | |
| _ β€ (β n β distinctBox a, |singularSeries (Finset.univ.image (boxTuple a n))- | |
| siftedTuple (boxTuple a n) (primorial y)|)/(h:β)^s := | |
| div_le_div_of_nonneg_right (Finset.abs_sum_le_sum_abs _ _) (by positivity) | |
| _ β€ (β n β distinctBox a, 2*uniformSingularTailBound s M y* | |
| siftedTuple (boxTuple a n) (primorial y))/(h:β)^s := | |
| div_le_div_of_nonneg_right (Finset.sum_le_sum hpoint) (by positivity) | |
| _ = _ := by rw [β Finset.mul_sum]; ring | |
| theorem singularBoxMean_error {s h M y : β} (a : Fin s β β€) (hh : 0<h) | |
| (hM : 0<M) (hy : 1<y) (hys : 2*sβ€y) (hd : boxDiameterBound (h:=h) a M) | |
| (hB : uniformSingularTailBound s M yβ€1) (hq : primorial yβ€h) : | |
| |singularBoxMean (h:=h) a-1| β€ boxTruncationError s h (primorial y) + | |
| 2*uniformSingularTailBound s M y*(1+(primorial y:β)/h)^s := by | |
| let : NeZero (primorial y) := β¨(primorial_pos y).ne'β© | |
| have hb := uniformSingularTailBound_nonneg s hM hy | |
| calc | |
| _ β€ |singularBoxMean (h:=h) a-distinctTruncatedBoxMean (h:=h) a (primorial y)| + | |
| |distinctTruncatedBoxMean (h:=h) a (primorial y)-1| := abs_sub_le _ _ _ | |
| _ β€ 2*uniformSingularTailBound s M y*distinctTruncatedBoxMean (h:=h) a (primorial y) + | |
| boxTruncationError s h (primorial y) := add_le_add | |
| (singularBoxMean_sub_truncation a hy hys hd hB) (distinctTruncatedBoxMean_error hh hq a) | |
| _ β€ 2*uniformSingularTailBound s M y*(1+(primorial y:β)/h)^s + | |
| boxTruncationError s h (primorial y) := add_le_add_left | |
| (mul_le_mul_of_nonneg_left ((distinctTruncatedBoxMean_le (q:=primorial y) a).trans (truncatedBoxMean_bounds hh hq a).2) | |
| (show 0 β€ 2*uniformSingularTailBound s M y from mul_nonneg (by norm_num) hb)) _ | |
| _ = _ := by ring | |
| noncomputable def singularCutoffScale (s : β) : β := 2*((s:β)+1)*Real.log 4 | |
| noncomputable def singularCutoff (s h : β) : β := βReal.log h/singularCutoffScale sββ | |
| theorem singularCutoffScale_pos (s : β) : 0<singularCutoffScale s := by | |
| unfold singularCutoffScale | |
| positivity | |
| theorem singularCutoff_tendsto (s : β) : Tendsto (singularCutoff s) atTop atTop := | |
| tendsto_nat_floor_atTop.comp (Tendsto.atTop_div_const (singularCutoffScale_pos s) | |
| (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop)) | |
| theorem singularCutoff_ratio_tendsto (s : β) : | |
| Tendsto (fun h : β => (singularCutoff s h:β)/Real.log h) atTop (π (1/singularCutoffScale s)) := by | |
| have hh := (tendsto_nat_floor_mul_div_atTop (a:=1/singularCutoffScale s) | |
| (one_div_nonneg.mpr (singularCutoffScale_pos s).le)).comp | |
| (Real.tendsto_log_atTop.comp (tendsto_natCast_atTop_atTop (R:=β))) | |
| simpa only [singularCutoff, one_div_mul_eq_div, Function.comp_def] using hh | |
| theorem log_div_singularCutoff_tendsto (s : β) : | |
| Tendsto (fun h : β => Real.log h/(singularCutoff s h:β)) atTop (π (singularCutoffScale s)) := by | |
| simpa only [inv_div, one_div, inv_inv] using (singularCutoff_ratio_tendsto s).invβ | |
| (one_div_ne_zero (singularCutoffScale_pos s).ne') | |
| theorem primorial_singularCutoff_power_bound (s : β) {h : β} (hh : 0<h) : | |
| (primorial (singularCutoff s h):β)^(s+1) β€ (h:β)^(1/2:β) := by | |
| have hhR : (0:β)<h := by exact_mod_cast hh | |
| have hlog : 0β€Real.log (h:β) := Real.log_nonneg (by exact_mod_cast hh) | |
| have hfloor := Nat.floor_le (div_nonneg hlog (singularCutoffScale_pos s).le) | |
| change (singularCutoff s h:β) β€ Real.log h/singularCutoffScale s at hfloor | |
| have hb := (le_div_iffβ (singularCutoffScale_pos s)).mp hfloor | |
| have hexp : ((singularCutoff s h:β)*((s:β)+1))*Real.log 4 β€ Real.log h*(1/2) := by | |
| unfold singularCutoffScale at hb | |
| nlinarith | |
| calc | |
| _ β€ ((4:β)^(singularCutoff s h))^(s+1) := pow_le_pow_leftβ (by positivity) | |
| (by exact_mod_cast primorial_le_four_pow (singularCutoff s h)) _ | |
| _ = Real.exp (((singularCutoff s h:β)*((s:β)+1))*Real.log 4) := by | |
| rw [β pow_mul, β Real.exp_log (by norm_num : (0:β)<4), β Real.exp_nat_mul] | |
| rw [Real.log_exp] | |
| push_cast | |
| congr 1 | |
| _ β€ _ := by rw [Real.rpow_def_of_pos hhR]; exact Real.exp_le_exp.mpr hexp | |
| theorem primorial_singularCutoff_ratio_tendsto (s r : β) (hr : r β€ s+1) : | |
| Tendsto (fun h : β => (primorial (singularCutoff s h):β)^r/(h:β)) atTop (π 0) := by | |
| have ht : Tendsto (fun h : β => (h:β)^(-(1/2:β))) atTop (π 0) := | |
| (tendsto_rpow_neg_atTop (by norm_num : (0:β)<1/2)).comp tendsto_natCast_atTop_atTop | |
| apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds ht | |
| Β· exact Filter.Eventually.of_forall fun h => by positivity | |
| Β· filter_upwards [eventually_ge_atTop 1] with h hh | |
| have hhR : (0:β)<h := by exact_mod_cast hh | |
| calc | |
| _ β€ (primorial (singularCutoff s h):β)^(s+1)/(h:β) := | |
| div_le_div_of_nonneg_right (by exact_mod_cast (Nat.pow_le_pow_right | |
| (primorial_pos (singularCutoff s h)) hr)) hhR.le | |
| _ β€ (h:β)^(1/2:β)/(h:β) := div_le_div_of_nonneg_right | |
| (primorial_singularCutoff_power_bound s (by omega)) hhR.le | |
| _ = _ := by | |
| have he := Real.rpow_sub hhR (1/2:β) 1 | |
| norm_num only [Real.rpow_one, show (1/2:β)-1=-(1/2) by norm_num] at he | |
| exact he.symm | |
| theorem primorial_singularCutoff_div_tendsto (s : β) : | |
| Tendsto (fun h : β => (primorial (singularCutoff s h):β)/(h:β)) atTop (π 0) := by | |
| simpa only [pow_one] using primorial_singularCutoff_ratio_tendsto s 1 (by omega) | |
| theorem log_mul_div_singularCutoff_tendsto (s : β) {K : β} (hK : 0<K) : | |
| Tendsto (fun h : β => Real.log (K*h:β)/(singularCutoff s h:β)) atTop (π (singularCutoffScale s)) := by | |
| have hy := tendsto_natCast_atTop_atTop (R:=β) |>.comp (singularCutoff_tendsto s) | |
| have hz : Tendsto (fun h : β => Real.log (K:β)/(singularCutoff s h:β)) atTop (π 0) := by | |
| simpa only [mul_zero, div_eq_mul_inv, Pi.inv_apply, Function.comp_apply] using hy.inv_tendsto_atTop.const_mul (Real.log (K:β)) | |
| have ht := hz.add (log_div_singularCutoff_tendsto s) | |
| rw [zero_add] at ht | |
| apply ht.congr' | |
| filter_upwards [eventually_ge_atTop 1] with h hh | |
| rw [Nat.cast_mul, Real.log_mul (by exact_mod_cast hK.ne') (by exact_mod_cast (show hβ 0 by omega)), add_div] | |
| theorem uniformSingularTailBound_tendsto (s : β) {K : β} (hK : 0<K) : | |
| Tendsto (fun h : β => uniformSingularTailBound s (K*h) (singularCutoff s h)) atTop (π 0) := by | |
| have hy := tendsto_natCast_atTop_atTop (R:=β) |>.comp (singularCutoff_tendsto s) | |
| have hl := Real.tendsto_log_atTop.comp hy | |
| have ht := (hy.inv_tendsto_atTop.const_mul (2*((s:β)^2*(2:β)^s))).add | |
| (((log_mul_div_singularCutoff_tendsto s hK).mul hl.inv_tendsto_atTop).const_mul | |
| (4*(s:β)*((s*(s-1):β):β))) | |
| simp only [mul_zero, add_zero] at ht | |
| convert ht using 1 | |
| ext h | |
| unfold uniformSingularTailBound | |
| simp only [div_eq_mul_inv, mul_inv_rev, Pi.inv_apply, Function.comp_apply] | |
| ring | |
| theorem boxTruncationError_tendsto (s : β) : | |
| Tendsto (fun h : β => boxTruncationError s h (primorial (singularCutoff s h))) atTop (π 0) := by | |
| have hq := primorial_singularCutoff_div_tendsto s | |
| have hl := ((tendsto_const_nhds (x:=(1:β)).sub hq).pow s).sub (tendsto_const_nhds (x:=(1:β))) | |
| have hu := ((tendsto_const_nhds (x:=(1:β)).add hq).pow s).sub (tendsto_const_nhds (x:=(1:β))) | |
| have hd := (primorial_singularCutoff_ratio_tendsto s s (by omega)).const_mul ((s:β)^2) | |
| have ht := (hl.abs.add hu.abs).add hd | |
| simp only [sub_zero, one_pow, sub_self, add_zero, abs_zero, mul_zero] at ht | |
| convert ht using 1 | |
| ext h | |
| unfold boxTruncationError | |
| ring | |
| noncomputable def singularBoxError (s K h : β) : β := | |
| boxTruncationError s h (primorial (singularCutoff s h)) + | |
| 2*uniformSingularTailBound s (K*h) (singularCutoff s h)* | |
| (1+(primorial (singularCutoff s h):β)/h)^s | |
| theorem singularBoxError_tendsto (s : β) {K : β} (hK : 0<K) : | |
| Tendsto (singularBoxError s K) atTop (π 0) := by | |
| have ht := (boxTruncationError_tendsto s).add | |
| (((uniformSingularTailBound_tendsto s hK).const_mul 2).mul | |
| ((tendsto_const_nhds (x:=(1:β))).add (primorial_singularCutoff_div_tendsto s) |>.pow s)) | |
| simp only [mul_zero, zero_mul, add_zero] at ht | |
| exact ht | |
| theorem singularBoxMean_error_eventually (s : β) {K : β} (hK : 0<K) : | |
| βαΆ h : β in atTop, β a : Fin s β β€, boxDiameterBound (h:=h) a (K*h) β | |
| |singularBoxMean (h:=h) a-1| β€ singularBoxError s K h := by | |
| have hB := (uniformSingularTailBound_tendsto s hK).eventually (gt_mem_nhds (by norm_num : (0:β)<1)) | |
| have hq := (primorial_singularCutoff_div_tendsto s).eventually (gt_mem_nhds (by norm_num : (0:β)<1)) | |
| filter_upwards [eventually_ge_atTop 1, (singularCutoff_tendsto s).eventually_ge_atTop 2, | |
| (singularCutoff_tendsto s).eventually_ge_atTop (2*s), hB, hq] with h hh hy hys hB hq | |
| intro a hd | |
| have hqh : primorial (singularCutoff s h) β€ h := by | |
| have hhR : (0:β)<h := by exact_mod_cast hh | |
| have ht := (div_lt_one hhR).mp hq | |
| exact_mod_cast ht.le | |
| exact singularBoxMean_error a (by omega) (Nat.mul_pos hK (by omega)) (by omega) hys hd hB.le hqh | |
| theorem singularBoxMean_uniform (s : β) {K : β} (hK : 0<K) {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| β hβ : β, β hβ₯hβ, β a : Fin s β β€, boxDiameterBound (h:=h) a (K*h) β | |
| |singularBoxMean (h:=h) a-1| < Ξ΅ := by | |
| have he := (singularBoxError_tendsto s hK).eventually (gt_mem_nhds hΞ΅) | |
| have hb := (singularBoxMean_error_eventually s hK).and he | |
| obtain β¨hβ, hhββ© := Filter.eventually_atTop.mp hb | |
| exact β¨hβ, fun h hh a hd => ((hhβ h hh).1 a hd).trans_lt (hhβ h hh).2β© | |
| end LargePrimeGaps | |
| end OAI | |