Download data/lean/OAI/NumberTheory/PrimeGaps/ProfileVariance.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 24.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/ProfileVariance.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PrimeGaps/ProfileVariance.lean
-
curl -L -o ProfileVariance.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/ProfileVariance.lean
24.9 kB
| import OAI.NumberTheory.PrimeGaps.Profiles | |
| namespace OAI | |
| namespace LargePrimeGaps | |
| open Filter | |
| open Set Filter MeasureTheory | |
| open scoped Topology ContDiff | |
| theorem centered_profile_integral {p : β β β} (hp : Continuous p) | |
| (hpc : HasCompactSupport p) (hpi : (β« u, p u) = 1) : | |
| (β« u, (u - β« v, v * p v) * p u) = 0 := by | |
| simp only [sub_mul] | |
| have hp0 : Integrable p := hp.integrable_of_hasCompactSupport hpc | |
| have hp1 : Integrable (fun u => u * p u) := | |
| (continuous_id.mul hp).integrable_of_hasCompactSupport hpc.mul_left | |
| rw [integral_sub hp1 (hp0.const_mul _), integral_const_mul, hpi] | |
| ring | |
| theorem coordinateSum_variance {p : β β β} (hp : Continuous p) | |
| (hpc : HasCompactSupport p) (hpi : (β« u, p u) = 1) (j : β) : | |
| (β« t : Fin j β β, (coordinateSum t - (j : β) * β« u, u * p u)^2 * | |
| productDensity p j t) = (j : β) * β« u, (u - β« v, v * p v)^2 * p u := by | |
| let m : β := β« u, u * p u | |
| have hexpand (t : Fin j β β) : | |
| (coordinateSum t - (j : β) * m)^2 * productDensity p j t = | |
| β i, β l, ((t i - m) * (t l - m)) * productDensity p j t := by | |
| have hs : coordinateSum t - (j : β) * m = β i : Fin j, (t i - m) := by | |
| simp [coordinateSum, Finset.sum_sub_distrib] | |
| rw [hs, pow_two, Finset.sum_mul] | |
| simp only [Finset.mul_sum, Finset.sum_mul] | |
| change (β« t : Fin j β β, (coordinateSum t - (j : β) * m)^2 * | |
| productDensity p j t) = (j : β) * β« u, (u - m)^2 * p u | |
| simp only [hexpand] | |
| have hint (i l : Fin j) : Integrable (fun t : Fin j β β => | |
| ((t i - m) * (t l - m)) * productDensity p j t) := | |
| poly_productDensity_integrable hp hpc (by fun_prop) | |
| rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun l _ => hint i l))] | |
| simp only [integral_finsetSum _ (fun l _ => hint _ l)] | |
| have hterm (i l : Fin j) : | |
| (β« t : Fin j β β, ((t i - m) * (t l - m)) * productDensity p j t) = | |
| if l = i then β« u, (u - m)^2 * p u else 0 := by | |
| split_ifs with hli | |
| Β· subst l | |
| simpa only [β pow_two] using | |
| (one_coordinate_productDensity_integral (f := fun u => (u-m)^2) hpi i) | |
| Β· rw [two_coordinate_productDensity_integral (f := fun u => u-m) hpi i l (Ne.symm hli), | |
| centered_profile_integral hp hpc hpi] | |
| norm_num | |
| simp only [hterm] | |
| simp [m] | |
| theorem scaledProfileDensity_continuous {g : β β β} (hg : Continuous g) (k : β) : | |
| Continuous (scaledProfileDensity g k) := by | |
| unfold scaledProfileDensity | |
| fun_prop | |
| theorem scaledProfileDensity_compact {g : β β β} (hg : HasCompactSupport g) | |
| {k : β} (hk : k β 0) : HasCompactSupport (scaledProfileDensity g k) := by | |
| have hh : HasCompactSupport (fun u => g (k*u)^2) := by | |
| have hh := (hg.comp_smul hk).mul_right (f' := fun u => g (k*u)) | |
| change HasCompactSupport (fun u => g (k*u) * g (k*u)) at hh | |
| simpa only [pow_two] using hh | |
| exact hh.mul_left | |
| theorem scaledProfileDensity_variance (g : β β β) {k : β} (hk : 0 < k) : | |
| (β« u, (u - (β« v, v * g v^2)/k)^2 * scaledProfileDensity g k u) = | |
| (β« u, (u - β« v, v * g v^2)^2 * g u^2) / k^2 := by | |
| let m : β := β« u, u * g u^2 | |
| calc | |
| _ = kβ»ΒΉ * β« u, (k*u - m)^2 * g (k*u)^2 := by | |
| rw [β integral_const_mul] | |
| apply integral_congr_ae | |
| filter_upwards [] with u | |
| dsimp only [scaledProfileDensity] | |
| change (u - m / k)^2 * (k * g (k*u)^2) = _ | |
| field_simp | |
| _ = _ := by | |
| rw [Measure.integral_comp_mul_left (fun u => (u-m)^2 * g u^2) k, | |
| abs_of_pos (inv_pos.mpr hk), smul_eq_mul] | |
| dsimp only [m] | |
| ring | |
| theorem concentrated_cutoff_mass {p chi : β β β} (hp : Continuous p) | |
| (hpc : HasCompactSupport p) (hpn : β u, 0 β€ p u) (hpi : (β« u, p u) = 1) | |
| (hchi : Continuous chi) (hchi0 : β s, 0 β€ chi s) (hchi1 : β s, chi s β€ 1) | |
| {beta d : β} (hd : 0 < d) (hflat : β s β€ beta, chi s = 1) | |
| (j : β) (hmean : (j : β) * (β« u, u*p u) + d β€ beta) : | |
| 1 - ((j : β) * β« u, (u - β« v, v*p v)^2 * p u) / d^2 β€ | |
| β« t : Fin j β β, productDensity p j t * chi (coordinateSum t)^2 := by | |
| let m : β := (j : β) * (β« u, u*p u) | |
| have hD := productDensity_integrable hp hpc j | |
| have hC : Integrable (fun t : Fin j β β => | |
| productDensity p j t * chi (coordinateSum t)^2) := by | |
| simpa only [mul_comm] using | |
| (poly_productDensity_integrable hp hpc | |
| (P := fun t : Fin j β β => chi (coordinateSum t)^2) (by | |
| unfold coordinateSum | |
| fun_prop)) | |
| have hV : Integrable (fun t : Fin j β β => | |
| (coordinateSum t - m)^2 * productDensity p j t) := | |
| poly_productDensity_integrable hp hpc (by unfold coordinateSum; fun_prop) | |
| have hle (t : Fin j β β) : | |
| productDensity p j t - productDensity p j t * chi (coordinateSum t)^2 β€ | |
| ((coordinateSum t - m)^2 * productDensity p j t) / d^2 := by | |
| have hDn := productDensity_nonneg hpn j t | |
| have hc0 := hchi0 (coordinateSum t) | |
| have hc1 := hchi1 (coordinateSum t) | |
| by_cases ht : coordinateSum t β€ beta | |
| Β· rw [hflat _ ht] | |
| simpa only [one_pow, mul_one, sub_self] using | |
| (div_nonneg (mul_nonneg (sq_nonneg _) hDn) (sq_nonneg d)) | |
| Β· have hdm : d β€ coordinateSum t - m := by dsimp only [m]; linarith | |
| have hd2 : 0 < d^2 := sq_pos_of_pos hd | |
| apply (le_div_iffβ hd2).mpr | |
| have hc2 : 0 β€ chi (coordinateSum t)^2 := sq_nonneg _ | |
| have hv2 : d^2 β€ (coordinateSum t - m)^2 := by nlinarith | |
| calc | |
| _ β€ productDensity p j t * d^2 := | |
| mul_le_mul_of_nonneg_right (sub_le_self _ (mul_nonneg hDn hc2)) hd2.le | |
| _ β€ _ := by nlinarith [mul_le_mul_of_nonneg_left hv2 hDn] | |
| have hint := integral_mono (hD.sub hC) (hV.div_const (d^2)) hle | |
| dsimp only [Pi.sub_apply] at hint | |
| rw [integral_sub hD hC, productDensity_integral hpi, integral_div] at hint | |
| change 1 - _ β€ (β« t : Fin j β β, | |
| (coordinateSum t - (j:β)*(β« u, u*p u))^2 * productDensity p j t) / d^2 at hint | |
| rw [coordinateSum_variance hp hpc hpi] at hint | |
| linarith | |
| theorem cutoff_mass_le_one {p chi : β β β} (hp : Continuous p) | |
| (hpc : HasCompactSupport p) (hpn : β u, 0 β€ p u) (hpi : (β« u, p u) = 1) | |
| (hchi : Continuous chi) (hchi0 : β s, 0 β€ chi s) (hchi1 : β s, chi s β€ 1) (j : β) : | |
| (β« t : Fin j β β, productDensity p j t * chi (coordinateSum t)^2) β€ 1 := by | |
| rw [β productDensity_integral hpi j] | |
| apply integral_mono | |
| Β· simpa only [mul_comm] using | |
| (poly_productDensity_integrable hp hpc | |
| (P := fun t : Fin j β β => chi (coordinateSum t)^2) (by | |
| unfold coordinateSum | |
| fun_prop)) | |
| Β· exact productDensity_integrable hp hpc j | |
| Β· intro t | |
| have hc0 := hchi0 (coordinateSum t) | |
| have hc1 := hchi1 (coordinateSum t) | |
| have hc2 : chi (coordinateSum t)^2 β€ 1 := by nlinarith | |
| simpa only [mul_one] using mul_le_mul_of_nonneg_left hc2 (productDensity_nonneg hpn j t) | |
| noncomputable def simplexCutoff (beta gamma : β) (s : β) : β := | |
| 1 - Real.smoothTransition ((s-beta)/(gamma-beta)) | |
| theorem simplexCutoff_smooth (beta gamma : β) : ContDiff β β (simplexCutoff beta gamma) := by | |
| unfold simplexCutoff | |
| exact contDiff_const.sub (Real.smoothTransition.contDiff.comp | |
| ((contDiff_id.sub contDiff_const).div_const _)) | |
| theorem simplexCutoff_nonneg (beta gamma s : β) : 0 β€ simplexCutoff beta gamma s := | |
| sub_nonneg.mpr (Real.smoothTransition.le_one _) | |
| theorem simplexCutoff_le_one (beta gamma s : β) : simplexCutoff beta gamma s β€ 1 := | |
| sub_le_self _ (Real.smoothTransition.nonneg _) | |
| theorem simplexCutoff_eq_one {beta gamma s : β} (hbg : beta < gamma) (hs : s β€ beta) : | |
| simplexCutoff beta gamma s = 1 := by | |
| unfold simplexCutoff | |
| rw [Real.smoothTransition.zero_of_nonpos (div_nonpos_of_nonpos_of_nonneg | |
| (sub_nonpos.mpr hs) (sub_pos.mpr hbg).le), sub_zero] | |
| theorem simplexCutoff_eq_zero {beta gamma s : β} (hbg : beta < gamma) (hs : gamma β€ s) : | |
| simplexCutoff beta gamma s = 0 := by | |
| unfold simplexCutoff | |
| rw [Real.smoothTransition.one_of_one_le ((le_div_iffβ (sub_pos.mpr hbg)).mpr (by linarith))] | |
| ring | |
| noncomputable def cutoffDeletion (g chi : β β β) (k s : β) : β := | |
| β« u, g u * chi (s+u/k) | |
| theorem cutoffDeletion_continuous {g chi : β β β} (hg : Continuous g) | |
| (hgc : HasCompactSupport g) (hchi : Continuous chi) (k : β) : | |
| Continuous (cutoffDeletion g chi k) := by | |
| rw [β continuousOn_univ] | |
| apply continuousOn_integral_of_compact_support hgc | |
| Β· exact (show Continuous (Function.uncurry fun s u : β => g u * chi (s+u/k)) by | |
| unfold Function.uncurry | |
| fun_prop).continuousOn | |
| Β· intro s u _ hu | |
| rw [image_eq_zero_of_notMem_tsupport hu, zero_mul] | |
| theorem cutoffDeletion_integrable {g chi : β β β} (hg : Continuous g) | |
| (hgc : HasCompactSupport g) (hchi : Continuous chi) (k s : β) : | |
| Integrable (fun u => g u * chi (s+u/k)) := | |
| (hg.mul (hchi.comp (by fun_prop))).integrable_of_hasCompactSupport hgc.mul_right | |
| theorem cutoffDeletion_nonneg {g chi : β β β} (hg : β u, 0 β€ g u) | |
| (hchi : β s, 0 β€ chi s) (k s : β) : 0 β€ cutoffDeletion g chi k s := | |
| integral_nonneg fun u => mul_nonneg (hg u) (hchi _) | |
| theorem cutoffDeletion_le_mass {g chi : β β β} (hg : Continuous g) | |
| (hgc : HasCompactSupport g) (hchi : Continuous chi) | |
| (hgn : β u, 0 β€ g u) (hchi1 : β s, chi s β€ 1) (k s : β) : | |
| cutoffDeletion g chi k s β€ β« u, g u := by | |
| apply integral_mono (cutoffDeletion_integrable hg hgc hchi k s) | |
| (hg.integrable_of_hasCompactSupport hgc) | |
| intro u | |
| simpa only [mul_one] using mul_le_mul_of_nonneg_left (hchi1 _) (hgn u) | |
| theorem cutoffDeletion_eq_mass {g chi : β β β} {k beta B s : β} (hk : 0 < k) | |
| (hB : β u β Function.support g, u β€ B) | |
| (hflat : β x β€ beta, chi x = 1) (hs : s β€ beta-B/k) : | |
| cutoffDeletion g chi k s = β« u, g u := by | |
| apply integral_congr_ae | |
| filter_upwards [] with u | |
| by_cases hu : g u = 0 | |
| Β· simp only [hu, zero_mul] | |
| Β· rw [hflat (s+u/k) ?_, mul_one] | |
| have hub := hB u hu | |
| have hud := (div_le_div_iff_of_pos_right hk).mpr hub | |
| linarith | |
| noncomputable def cancellationBracket (g chi : β β β) (lambda k : β) (j : β) (s : β) : β := | |
| chi s - (Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda) * cutoffDeletion g chi k s | |
| theorem cancellationBracket_continuous {g chi : β β β} (hg : Continuous g) | |
| (hgc : HasCompactSupport g) (hchi : Continuous chi) (lambda k : β) (j : β) : | |
| Continuous (cancellationBracket g chi lambda k j) := | |
| hchi.sub ((cutoffDeletion_continuous hg hgc hchi k).const_mul _) | |
| theorem cancellationBracket_abs_le_one {g chi : β β β} {lambda k : β} | |
| (hlambda : 0 < lambda) (hk : 0 < k) (hg : Continuous g) (hgc : HasCompactSupport g) | |
| (hgn : β u, 0 β€ g u) (hgi : (β« u, g u) = Real.sqrt lambda) | |
| (hchi : Continuous chi) (hchi0 : β s, 0 β€ chi s) (hchi1 : β s, chi s β€ 1) | |
| (j : β) (hjk : (j:β)+1 β€ k) (s : β) : | |
| |cancellationBracket g chi lambda k j s| β€ 1 := by | |
| have hlr : 0 < Real.sqrt lambda := Real.sqrt_pos.mpr hlambda | |
| have h0 := cutoffDeletion_nonneg hgn hchi0 k s | |
| have h1 := cutoffDeletion_le_mass hg hgc hchi hgn hchi1 k s | |
| rw [hgi] at h1 | |
| have ha0 : 0 β€ Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda := by positivity | |
| have ha1 : Real.sqrt (((j:β)+1)/k) β€ 1 := by | |
| apply (Real.sqrt_le_iff).mpr | |
| exact β¨by norm_num, by rw [one_pow]; exact (div_le_one hk).mpr hjkβ© | |
| have hprod : (Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda) * cutoffDeletion g chi k s β€ 1 := calc | |
| _ β€ (Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda) * Real.sqrt lambda := | |
| mul_le_mul_of_nonneg_left h1 ha0 | |
| _ = Real.sqrt (((j:β)+1)/k) := div_mul_cancelβ _ hlr.ne' | |
| _ β€ 1 := ha1 | |
| have hprodn := mul_nonneg ha0 h0 | |
| unfold cancellationBracket | |
| rw [abs_le] | |
| constructor <;> linarith [hchi0 s, hchi1 s] | |
| theorem cancellationBracket_flat {g chi : β β β} {lambda k beta B s : β} | |
| (hlambda : 0 < lambda) (hk : 0 < k) | |
| (hgi : (β« u, g u) = Real.sqrt lambda) | |
| (hB : β u β Function.support g, u β€ B) (hB0 : 0 β€ B) | |
| (hflat : β x β€ beta, chi x = 1) (hs : s β€ beta-B/k) (j : β) : | |
| cancellationBracket g chi lambda k j s = 1 - Real.sqrt (((j:β)+1)/k) := by | |
| unfold cancellationBracket | |
| rw [cutoffDeletion_eq_mass hk hB hflat hs, hgi, | |
| hflat s (by linarith [div_nonneg hB0 hk.le]), | |
| div_mul_cancelβ _ (Real.sqrt_pos.mpr hlambda).ne'] | |
| theorem concentrated_function_sq {p b : β β β} (hp : Continuous p) | |
| (hpc : HasCompactSupport p) (hpn : β u, 0 β€ p u) (hpi : (β« u, p u) = 1) | |
| (hb : Continuous b) (hb1 : β s, |b s| β€ 1) | |
| {beta d eta : β} (hd : 0 < d) (heta : 0 β€ eta) | |
| (hflat : β s β€ beta, b s^2 β€ eta) (j : β) | |
| (hmean : (j : β) * (β« u, u*p u) + d β€ beta) : | |
| (β« t : Fin j β β, productDensity p j t * b (coordinateSum t)^2) β€ | |
| eta + ((j : β) * β« u, (u - β« v, v*p v)^2 * p u) / d^2 := by | |
| let m : β := (j : β) * (β« u, u*p u) | |
| have hD := productDensity_integrable hp hpc j | |
| have hC : Integrable (fun t : Fin j β β => | |
| productDensity p j t * b (coordinateSum t)^2) := by | |
| simpa only [mul_comm] using | |
| (poly_productDensity_integrable hp hpc | |
| (P := fun t : Fin j β β => b (coordinateSum t)^2) (by | |
| unfold coordinateSum | |
| fun_prop)) | |
| have hV : Integrable (fun t : Fin j β β => | |
| (coordinateSum t - m)^2 * productDensity p j t) := | |
| poly_productDensity_integrable hp hpc (by unfold coordinateSum; fun_prop) | |
| have hle (t : Fin j β β) : | |
| productDensity p j t * b (coordinateSum t)^2 β€ | |
| eta * productDensity p j t + | |
| ((coordinateSum t - m)^2 * productDensity p j t) / d^2 := by | |
| have hDn := productDensity_nonneg hpn j t | |
| have hvn : 0 β€ ((coordinateSum t-m)^2 * productDensity p j t) / d^2 := by positivity | |
| by_cases ht : coordinateSum t β€ beta | |
| Β· have hb2 := hflat _ ht | |
| nlinarith [mul_le_mul_of_nonneg_left hb2 hDn] | |
| Β· have hdm : d β€ coordinateSum t - m := by dsimp only [m]; linarith | |
| have hd2 : 0 < d^2 := sq_pos_of_pos hd | |
| have hv2 : d^2 β€ (coordinateSum t - m)^2 := by nlinarith | |
| have hDle : productDensity p j t β€ | |
| ((coordinateSum t - m)^2 * productDensity p j t) / d^2 := by | |
| apply (le_div_iffβ hd2).mpr | |
| nlinarith [mul_le_mul_of_nonneg_left hv2 hDn] | |
| have hb2 : b (coordinateSum t)^2 β€ 1 := by | |
| have := abs_le.mp (hb1 (coordinateSum t)) | |
| nlinarith | |
| nlinarith [mul_le_mul_of_nonneg_left hb2 hDn, mul_nonneg heta hDn] | |
| have hint := integral_mono hC ((hD.const_mul eta).add (hV.div_const (d^2))) hle | |
| dsimp only [Pi.add_apply] at hint | |
| rw [integral_add (hD.const_mul eta) (hV.div_const (d^2)), integral_const_mul, | |
| productDensity_integral hpi, mul_one, integral_div] at hint | |
| change _ β€ eta + (β« t : Fin j β β, | |
| (coordinateSum t - (j:β)*(β« u, u*p u))^2 * productDensity p j t) / d^2 at hint | |
| rwa [coordinateSum_variance hp hpc hpi] at hint | |
| theorem profile_first_moment_nonneg {g : β β β} | |
| (hs : Function.support g β Ioi 0) : 0 β€ β« u, u * g u^2 := by | |
| apply integral_nonneg | |
| intro u | |
| by_cases hu : g u = 0 | |
| Β· simp only [hu, zero_pow (by decide : 2 β 0), mul_zero, Pi.zero_apply, le_refl] | |
| Β· exact mul_nonneg (hs hu).le (sq_nonneg _) | |
| theorem scaled_level_moment_bound {g : β β β} {k : β} (hk : 0 < k) | |
| (hm : 0 β€ β« u, u*g u^2) (j : β) (hjk : (j:β) β€ k) : | |
| (j:β) * (β« u, u * scaledProfileDensity g k u) β€ β« u, u*g u^2 := by | |
| rw [scaledProfileDensity_moment g hk] | |
| have : (j:β) / k β€ 1 := (div_le_one hk).mpr hjk | |
| have h := mul_le_mul_of_nonneg_right this hm | |
| simpa only [div_mul_eq_mul_div, mul_div_assoc, one_mul] using h | |
| theorem scaled_level_variance_bound {g : β β β} {k : β} (hk : 0 < k) | |
| (j : β) (hjk : (j:β) β€ k) : | |
| (j:β) * (β« u, (u-β« v, v * scaledProfileDensity g k v)^2 * | |
| scaledProfileDensity g k u) β€ (β« u, (u-β« v, v*g v^2)^2 * g u^2)/k := by | |
| rw [scaledProfileDensity_moment g hk, scaledProfileDensity_variance g hk] | |
| have hv : 0 β€ β« u, (u-β« v, v*g v^2)^2 * g u^2 := | |
| integral_nonneg fun u => mul_nonneg (sq_nonneg _) (sq_nonneg _) | |
| have hdiv : (j:β) / k^2 β€ 1/k := by | |
| apply (div_le_div_iffβ (sq_pos_of_pos hk) hk).mpr | |
| nlinarith | |
| have h := mul_le_mul_of_nonneg_right hdiv hv | |
| simpa only [div_mul_eq_mul_div, mul_div_assoc, one_mul] using h | |
| theorem scaled_cutoff_mass_bounds {g chi : β β β} {k beta : β} | |
| (hk : 0 < k) (hg : Continuous g) (hgc : HasCompactSupport g) | |
| (hgs : Function.support g β Ioi 0) (hg2 : (β« u, g u^2) = 1) | |
| (hchi : Continuous chi) (hchi0 : β s, 0 β€ chi s) (hchi1 : β s, chi s β€ 1) | |
| (hflat : β s β€ beta, chi s = 1) (hmu : (β« u, u*g u^2) < beta) | |
| (j : β) (hjk : (j:β) β€ k) : | |
| let d := beta - β« u, u*g u^2 | |
| let v := β« u, (u-β« v, v*g v^2)^2 * g u^2 | |
| 1-v/(k*d^2) β€ (β« t : Fin j β β, | |
| productDensity (scaledProfileDensity g k) j t * chi (coordinateSum t)^2) β§ | |
| (β« t : Fin j β β, | |
| productDensity (scaledProfileDensity g k) j t * chi (coordinateSum t)^2) β€ 1 := by | |
| dsimp only | |
| have hp := scaledProfileDensity_continuous hg k | |
| have hpc := scaledProfileDensity_compact hgc hk.ne' | |
| have hpn : β u, 0 β€ scaledProfileDensity g k u := fun u => mul_nonneg hk.le (sq_nonneg _) | |
| have hpi := scaledProfileDensity_integral hk hg2 | |
| constructor | |
| Β· have hb := concentrated_cutoff_mass hp hpc hpn hpi hchi hchi0 hchi1 | |
| (sub_pos.mpr hmu) hflat j (by | |
| have := scaled_level_moment_bound hk (profile_first_moment_nonneg hgs) j hjk | |
| linarith) | |
| have hv := scaled_level_variance_bound (g := g) hk j hjk | |
| have hd2 : 0 < (beta - β« u, u*g u^2)^2 := sq_pos_of_pos (sub_pos.mpr hmu) | |
| have hdiv := div_le_div_of_nonneg_right hv hd2.le | |
| have heq : (β« u, (u-β« v, v*g v^2)^2 * g u^2)/k/(beta-β« u, u*g u^2)^2 = | |
| (β« u, (u-β« v, v*g v^2)^2 * g u^2)/(k*(beta-β« u, u*g u^2)^2) := by rw [div_div] | |
| rw [heq] at hdiv | |
| linarith | |
| Β· exact cutoff_mass_le_one hp hpc hpn hpi hchi hchi0 hchi1 j | |
| theorem one_sub_sqrt_level_sq {k r : β} (hk : 0 < k) (hr : 0 β€ r) | |
| (j : β) (hupper : (j:β)+1 β€ k) (hlower : k-r β€ (j:β)+1) : | |
| (1-Real.sqrt (((j:β)+1)/k))^2 β€ (r/k)^2 := by | |
| have hx : 0 β€ ((j:β)+1)/k := by positivity | |
| have hx1 : ((j:β)+1)/k β€ 1 := (div_le_one hk).mpr hupper | |
| have hs : Real.sqrt (((j:β)+1)/k)^2 = ((j:β)+1)/k := Real.sq_sqrt hx | |
| have hs0 := Real.sqrt_nonneg (((j:β)+1)/k) | |
| have hs1 : Real.sqrt (((j:β)+1)/k) β€ 1 := (Real.sqrt_le_iff).mpr β¨by norm_num, by simpa using hx1β© | |
| have hxs : ((j:β)+1)/k β€ Real.sqrt (((j:β)+1)/k) := by nlinarith | |
| have hl : 1-r/k β€ ((j:β)+1)/k := by | |
| have := (div_le_div_iff_of_pos_right hk).mpr hlower | |
| rw [sub_div, div_self hk.ne'] at this | |
| exact this | |
| have hrk : 0 β€ r/k := div_nonneg hr hk.le | |
| nlinarith | |
| theorem scaled_cancellation_integral_bound {g chi : β β β} | |
| {lambda k r beta B : β} (hlambda : 0 < lambda) (hk : 0 < k) (hr : 0 β€ r) | |
| (hg : Continuous g) (hgc : HasCompactSupport g) | |
| (hgs : Function.support g β Ioi 0) (hgn : β u, 0 β€ g u) | |
| (hg2 : (β« u, g u^2) = 1) (hg1 : (β« u, g u) = Real.sqrt lambda) | |
| (hB : β u β Function.support g, u β€ B) (hB0 : 0 β€ B) | |
| (hchi : Continuous chi) (hchi0 : β s, 0 β€ chi s) (hchi1 : β s, chi s β€ 1) | |
| (hflat : β s β€ beta, chi s = 1) (hmu : (β« u, u*g u^2) < beta) | |
| (hBk : B/k β€ (beta - β« u, u*g u^2)/2) | |
| (j : β) (hupper : (j:β)+1 β€ k) (hlower : k-r β€ (j:β)+1) : | |
| let d := beta - β« u, u*g u^2 | |
| let v := β« u, (u-β« v, v*g v^2)^2 * g u^2 | |
| (β« t : Fin j β β, productDensity (scaledProfileDensity g k) j t * | |
| cancellationBracket g chi lambda k j (coordinateSum t)^2) β€ | |
| (r/k)^2 + 4*v/(k*d^2) := by | |
| dsimp only | |
| let d : β := beta - β« u, u*g u^2 | |
| have hd : 0 < d := sub_pos.mpr hmu | |
| have hp := scaledProfileDensity_continuous hg k | |
| have hpc := scaledProfileDensity_compact hgc hk.ne' | |
| have hpn : β u, 0 β€ scaledProfileDensity g k u := fun u => mul_nonneg hk.le (sq_nonneg _) | |
| have hpi := scaledProfileDensity_integral hk hg2 | |
| have hb := concentrated_function_sq hp hpc hpn hpi | |
| (cancellationBracket_continuous hg hgc hchi lambda k j) | |
| (cancellationBracket_abs_le_one hlambda hk hg hgc hgn hg1 hchi hchi0 hchi1 j hupper) | |
| (beta := beta-B/k) (d := d/2) (div_pos hd (by norm_num)) (sq_nonneg (r/k)) | |
| (fun s hs => by | |
| rw [cancellationBracket_flat hlambda hk hg1 hB hB0 hflat hs j] | |
| exact one_sub_sqrt_level_sq hk hr j hupper hlower) j (by | |
| have := scaled_level_moment_bound hk (profile_first_moment_nonneg hgs) j (by linarith) | |
| dsimp only [d] | |
| linarith) | |
| have hv := scaled_level_variance_bound (g := g) hk j (by linarith) | |
| have hdiv := div_le_div_of_nonneg_right hv (sq_nonneg (d/2)) | |
| have heq (v : β) : v/k/(d/2)^2 = 4*v/(k*d^2) := by | |
| field_simp | |
| norm_num | |
| rw [heq] at hdiv | |
| exact hb.trans (add_le_add (le_refl _) hdiv) | |
| noncomputable def alpha (lambda : β) (j : β) : β := lambda^j / j.factorial | |
| theorem alpha_pos {lambda : β} (hlambda : 0 < lambda) (j : β) : 0 < alpha lambda j := | |
| div_pos (pow_pos hlambda j) (by exact_mod_cast Nat.factorial_pos j) | |
| theorem alpha_succ (lambda : β) (j : β) : | |
| alpha lambda (j+1) = alpha lambda j * lambda / ((j:β)+1) := by | |
| unfold alpha | |
| rw [pow_succ, Nat.factorial_succ] | |
| push_cast | |
| rw [div_mul_eq_mul_div, div_div, mul_comm (j.factorial:β)] | |
| theorem sqrt_alpha_succ_ratio {lambda k : β} (hlambda : 0 < lambda) (hk : 0 < k) (j : β) : | |
| Real.sqrt (alpha lambda j) * (Real.sqrt k / k) / | |
| Real.sqrt (alpha lambda (j+1)) = Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda := by | |
| have ha := alpha_pos hlambda j | |
| have ha1 := alpha_pos hlambda (j+1) | |
| have hlr := Real.sqrt_pos.mpr hlambda | |
| have hkr := Real.sqrt_pos.mpr hk | |
| have har := Real.sqrt_pos.mpr ha | |
| have ha1r := Real.sqrt_pos.mpr ha1 | |
| have hj : 0 < (j:β)+1 := by positivity | |
| have hs : (Real.sqrt (((j:β)+1)/k))^2 = ((j:β)+1)/k := | |
| Real.sq_sqrt (div_nonneg hj.le hk.le) | |
| have heq : (Real.sqrt (alpha lambda j) * (Real.sqrt k / k) / | |
| Real.sqrt (alpha lambda (j+1)))^2 = | |
| (Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda)^2 := by | |
| rw [div_pow, mul_pow, div_pow, Real.sq_sqrt ha.le, Real.sq_sqrt hk.le, | |
| Real.sq_sqrt ha1.le, div_pow, hs, Real.sq_sqrt hlambda.le, alpha_succ] | |
| field_simp [ha.ne', hk.ne', hlambda.ne', hj.ne'] | |
| have hleft : 0 β€ Real.sqrt (alpha lambda j) * (Real.sqrt k / k) / | |
| Real.sqrt (alpha lambda (j+1)) := by positivity | |
| have hright : 0 β€ Real.sqrt (((j:β)+1)/k) / Real.sqrt lambda := by positivity | |
| nlinarith | |
| theorem productProfile_snoc (g : β β β) (k : β) (j : β) (t : Fin j β β) (u : β) : | |
| productProfile g k (j+1) (Fin.snoc t u) = productProfile g k j t * Real.sqrt k * g (k*u) := by | |
| unfold productProfile | |
| rw [Fin.prod_univ_castSucc] | |
| simp only [Fin.snoc_castSucc, Fin.snoc_last] | |
| ring | |
| theorem coordinateSum_snoc (j : β) (t : Fin j β β) (u : β) : | |
| coordinateSum (Fin.snoc t u) = coordinateSum t + u := by | |
| unfold coordinateSum | |
| rw [Fin.sum_univ_castSucc] | |
| simp only [Fin.snoc_castSucc, Fin.snoc_last] | |
| noncomputable def levelFunction (g chi : β β β) (lambda k r : β) | |
| (j : β) (t : Fin j β β) : β := | |
| ((-1:β)^j / (Real.sqrt r * Real.sqrt (alpha lambda j))) * | |
| productProfile g k j t * chi (coordinateSum t) | |
| noncomputable def deleteCoordinate {j : β} (f : (Fin (j+1) β β) β β) | |
| (t : Fin j β β) : β := β« u : β, f (Fin.snoc t u) | |
| theorem levelFunction_delete {g chi : β β β} {lambda k r : β} | |
| (hk : 0 < k) (j : β) (t : Fin j β β) : | |
| deleteCoordinate (levelFunction g chi lambda k r (j+1)) t = | |
| ((-1:β)^(j+1) / (Real.sqrt r * Real.sqrt (alpha lambda (j+1)))) * | |
| productProfile g k j t * (Real.sqrt k / k) * cutoffDeletion g chi k (coordinateSum t) := by | |
| unfold deleteCoordinate levelFunction | |
| simp only [productProfile_snoc, coordinateSum_snoc] | |
| let A := ((-1:β)^(j+1) / (Real.sqrt r * Real.sqrt (alpha lambda (j+1)))) * | |
| productProfile g k j t * Real.sqrt k | |
| have heq : (fun u => ((-1:β)^(j+1) / (Real.sqrt r * Real.sqrt (alpha lambda (j+1)))) * | |
| (productProfile g k j t * Real.sqrt k * g (k*u)) * chi (coordinateSum t+u)) = | |
| fun u => A * (g (k*u) * chi (coordinateSum t+(k*u)/k)) := by | |
| funext u | |
| dsimp only [A] | |
| rw [mul_div_cancel_leftβ _ hk.ne'] | |
| ring | |
| rw [heq, integral_const_mul] | |
| rw [Measure.integral_comp_mul_left (fun u => g u * chi (coordinateSum t+u/k)) k, | |
| abs_of_pos (inv_pos.mpr hk), smul_eq_mul] | |
| unfold cutoffDeletion | |
| dsimp only [A] | |
| ring | |
| end LargePrimeGaps | |
| end OAI | |