Download data/lean/OAI/NumberTheory/PrimeGaps/Detectors.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 23.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/Detectors.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PrimeGaps/Detectors.lean
-
curl -L -o Detectors.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PrimeGaps/Detectors.lean
23.1 kB
Lean 4 Β· 29
declarations fullstatements
| import OAI.NumberTheory.PrimeGaps.EqualityPatterns | |
| namespace OAI | |
| namespace LargePrimeGaps | |
| open Filter | |
| open Set Filter MeasureTheory | |
| open scoped Topology ContDiff | |
| open Asymptotics | |
| open Asymptotics | |
| open Asymptotics | |
| open scoped Classical | |
| open scoped ContDiff | |
| open Topology | |
| open scoped Convolution ContDiff Pointwise | |
| theorem pattern_singular_sum {ΞΉ : Type*} [Fintype ΞΉ] (r : Setoid ΞΉ) (h : β) (a : β€) : | |
| (β bβpatternClass (Ξ±:=Fin h) r, | |
| singularSeries (Finset.univ.image fun i => a+(b i:β))) = | |
| β nβdistinctBox (s:=Fintype.card (Quotient r)) (h:=h) (fun _ => a), | |
| singularSeries (Finset.univ.image (boxTuple (fun _ => a) n)) := by | |
| classical | |
| conv_lhs => rw [βFinset.sum_coe_sort] | |
| conv_rhs => rw [βFinset.sum_coe_sort] | |
| apply Fintype.sum_equiv (patternTupleEquiv r h a) | |
| intro b | |
| rw [patternTupleEquiv_image r h a b] | |
| theorem ker_comp_injective {ΞΉ Ξ± Ξ² : Type*} (b : ΞΉ β Ξ±) (f : Ξ± β Ξ²) (hf : Function.Injective f) : | |
| Setoid.ker (fβb)=Setoid.ker b := by | |
| apply Setoid.ext | |
| intro i j | |
| exact hf.eq_iff | |
| theorem numericPattern_int_ker {ΞΉ : Type*} [Fintype ΞΉ] (r : Setoid ΞΉ) : | |
| Setoid.ker (fun i => (numericPattern r i:β€))=r := by | |
| have h := ker_comp_injective (numericPattern r) (fun n : β => (n:β€)) (by intro m n hm; exact_mod_cast (show (m:β€)=(n:β€) from hm)) | |
| exact h.trans (numericPattern_ker r) | |
| theorem shiftFamily_eq_of_ker {ΞΉ : Type*} [Fintype ΞΉ] (b c : ΞΉ β β€) | |
| (h : Setoid.ker b=Setoid.ker c) : shiftFamily b=shiftFamily c := by | |
| classical | |
| ext S | |
| simp only [shiftFamily,mem_fiberSubsetFamily_image] | |
| have hc (i j : ΞΉ) : b i=b j β c i=c j := by | |
| change (Setoid.ker b) i j β (Setoid.ker c) i j | |
| rw [h] | |
| constructor <;> rintro β¨hS,heβ© | |
| Β· exact β¨hS,fun i hi j hj => (hc i j).mp (he i hi j hj)β© | |
| Β· exact β¨hS,fun i hi j hj => (hc i j).mpr (he i hi j hj)β© | |
| noncomputable def equalityPatternFamily {ΞΉ : Type*} [Fintype ΞΉ] (r : Setoid ΞΉ) : | |
| Finset (Finset ΞΉ) := shiftFamily (fun i => (numericPattern r i:β€)) | |
| theorem equalityPatternFamily_sign_sum {ΞΉ : Type*} [Fintype ΞΉ] (r : Setoid ΞΉ) : | |
| (β SβequalityPatternFamily r,(-1:β€)^S.card)=-(Fintype.card (Quotient r):β€) := by | |
| classical | |
| rw [equalityPatternFamily,shiftFamily_sign_sum] | |
| have he : (Finset.univ.image fun i => (numericPattern r i:β€))= | |
| Finset.univ.image (fun j : Fin (Fintype.card (Quotient r)) => (j.val:β€)) := by | |
| ext v | |
| simp only [Finset.mem_image,Finset.mem_univ,true_and] | |
| constructor | |
| Β· rintro β¨i,rflβ© | |
| exact β¨Fintype.equivFin (Quotient r) (Quotient.mk r i),rflβ© | |
| Β· rintro β¨j,rflβ© | |
| obtain β¨i,hiβ© := Quotient.mk_surjective ((Fintype.equivFin (Quotient r)).symm j) | |
| refine β¨i,?_β© | |
| simp only [numericPattern,hi,Equiv.apply_symm_apply] | |
| rw [he,Finset.card_image_of_injective] | |
| Β· simp only [Finset.card_univ,Fintype.card_fin] | |
| Β· intro i j hij | |
| apply Fin.ext | |
| exact_mod_cast (show (i.val:β€)=(j.val:β€) from hij) | |
| theorem translated_shiftFamily {ΞΉ : Type*} [Fintype ΞΉ] {h : β} | |
| (r : Setoid ΞΉ) (a : β) (b : ΞΉ β Fin h) (hb : bβpatternClass r) : | |
| shiftFamily (fun i => ((a+(b i).val:β):β€))=equalityPatternFamily r := by | |
| apply shiftFamily_eq_of_ker | |
| rw [numericPattern_int_ker] | |
| have hi : Function.Injective (fun x : Fin h => ((a+x.val:β):β€)) := by | |
| intro i j hij | |
| apply Fin.ext | |
| have hh : a+i.val=a+j.val := by exact_mod_cast (show ((a+i.val:β):β€)=((a+j.val:β):β€) from hij) | |
| exact Nat.add_left_cancel hh | |
| exact (ker_comp_injective b _ hi).trans ((mem_patternClass r b).mp hb) | |
| theorem divisorSum_fin_zero (X M : β) (F : (Fin 0 β β) β β) (b : Fin 0 β β) : | |
| divisorSum X F M b=F 0 := by | |
| classical | |
| have h : Fintype.piFinset (fun i => (M+b i).divisors)={(0 : Fin 0 β β)} := by | |
| ext d | |
| simp [funext_iff] | |
| rw [divisorSum,h,Finset.sum_singleton] | |
| simp only [divisorCoefficient,Fin.prod_univ_zero,one_mul] | |
| congr 1 | |
| ext i | |
| exact Fin.elim0 i | |
| theorem divisorSum_singleton_at_prime {X M b : β} (hX : 2β€X) (hM : X<M+b) | |
| (hp : Nat.Prime (M+b)) (G : (Fin 1 β β) β β) {rho : β} | |
| (hrho : rho<1) (hbudget : HasBudget G rho) : | |
| divisorSum X G M (fun _ => b)=G 0 := by | |
| have ht : (fun _ : Fin 1 => b)=Fin.snoc (0 : Fin 0 β β) b := by ext i; fin_cases i; rfl | |
| rw [ht,divisorSum_prime_delete hX hM hp G hrho hbudget,divisorSum_fin_zero] | |
| congr 1 | |
| theorem theta_div_log_le_upper {X M b Y : β} (hX : 2β€X) (hY : M+bβ€Y) (hYP : 1β€Y) : | |
| theta (M+b)/Real.log Xβ€Real.log Y/Real.log X := by | |
| apply div_le_div_of_nonneg_right _ (log_pos_of_two_le hX).le | |
| by_cases hp : Nat.Prime (M+b) | |
| Β· rw [theta,ite_eq_left hp] | |
| exact Real.log_le_log (by exact_mod_cast hp.pos) (by exact_mod_cast hY) | |
| Β· rw [theta,ite_eq_right hp] | |
| exact Real.log_nonneg (by exact_mod_cast hYP) | |
| theorem singleton_divisor_majorant {X M b Y : β} (hX : 2β€X) (hM : X<M+b) | |
| (hY : M+bβ€Y) (hYP : 1β€Y) (G : (Fin 1 β β) β β) {rho : β} | |
| (hrho : rho<1) (hbudget : HasBudget G rho) (hG : G 0=1) : | |
| theta (M+b)/Real.log Xβ€(Real.log Y/Real.log X)*divisorSum X G M (fun _ => b)^2 := by | |
| by_cases hp : Nat.Prime (M+b) | |
| Β· rw [divisorSum_singleton_at_prime hX hM hp G hrho hbudget,hG,one_pow,mul_one] | |
| exact theta_div_log_le_upper hX hY hYP | |
| Β· rw [theta,ite_eq_right hp,zero_div] | |
| exact mul_nonneg (div_nonneg (Real.log_nonneg (by exact_mod_cast hYP)) | |
| (log_pos_of_two_le hX).le) (sq_nonneg _) | |
| theorem sum_square_diagonal_offdiag {Ξ± : Type*} [DecidableEq Ξ±] | |
| (B : Finset Ξ±) (f : Ξ± β β) : | |
| (β bβB,f b)^2=(β bβB,f b^2)+β bβB,β cβB.erase b,f b*f c := by | |
| rw [pow_two,Finset.sum_mul_sum,βFinset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro b hb | |
| rw [βFinset.sum_erase_add B (fun c => f b*f c) hb] | |
| ring | |
| theorem detector_square_majorant {X M Y : β} (hX : 2β€X) (hYP : 1β€Y) | |
| (B : Finset β) (hM : β bβB, X<M+b) (hY : β bβB, M+bβ€Y) | |
| (G : (Fin 1 β β) β β) {rho : β} | |
| (hrho : rho<1) (hbudget : HasBudget G rho) (hG : G 0=1) : | |
| detector X B M^2β€(Real.log Y/Real.log X)*detector X B M+ | |
| (Real.log Y/Real.log X)^2*β bβB,β cβB.erase b, | |
| divisorSum X G M (fun _ => b)^2*divisorSum X G M (fun _ => c)^2 := by | |
| classical | |
| let t := fun b => theta (M+b)/Real.log X | |
| let q := Real.log Y/Real.log X | |
| let D := fun b => divisorSum X G M (fun _ => b) | |
| have ht (b : β) : 0β€t b := div_nonneg (theta_nonneg _) (log_pos_of_two_le hX).le | |
| have hq : 0β€q := div_nonneg (Real.log_nonneg (by exact_mod_cast hYP)) (log_pos_of_two_le hX).le | |
| have he : detector X B M=β bβB,t b := by rw [detector,Finset.sum_div] | |
| have hupper (b : β) (hb : bβB) : t bβ€q := theta_div_log_le_upper hX (hY b hb) hYP | |
| have hmajor (b : β) (hb : bβB) : t bβ€q*(D b)^2 := | |
| singleton_divisor_majorant hX (hM b hb) (hY b hb) hYP G hrho hbudget hG | |
| rw [he,sum_square_diagonal_offdiag,Finset.mul_sum,Finset.mul_sum] | |
| apply add_le_add | |
| Β· apply Finset.sum_le_sum | |
| intro b hb | |
| simpa only [pow_two] using mul_le_mul_of_nonneg_right (hupper b hb) (ht b) | |
| Β· apply Finset.sum_le_sum | |
| intro b hb | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro c hc | |
| have hcB := Finset.mem_of_mem_erase hc | |
| have hh := mul_le_mul (hmajor b hb) (hmajor c hcB) (ht c) | |
| (mul_nonneg hq (sq_nonneg (D b))) | |
| dsimp [q,D] at hh | |
| nlinarith | |
| noncomputable def patternBoxShifts {n s h : β} (p : Fin n β Fin s) | |
| (a : Fin s β β) (u : Fin s β Fin h) : Fin n β β := | |
| fun i => a (p i)+(u (p i):β) | |
| theorem patternBoxShifts_family {n s h : β} (p : Fin n β Fin s) | |
| (a : Fin s β β) (u : Fin s β Fin h) | |
| (hu : uβdistinctBox (fun j => (a j:β€))) : | |
| shiftFamily (fun i => (patternBoxShifts p a u i:β€))= | |
| shiftFamily (fun i => ((p i).val:β€)) := by | |
| apply shiftFamily_eq_of_ker | |
| apply Setoid.ext | |
| intro i j | |
| have hi := (Finset.mem_filter.mp hu).2 | |
| change ((patternBoxShifts p a u i:β€)=(patternBoxShifts p a u j:β€)) β | |
| ((p i).val:β€)=((p j).val:β€) | |
| have he (i : Fin n) : (patternBoxShifts p a u i:β€)=boxTuple (fun j => (a j:β€)) u (p i) := by | |
| simp only [patternBoxShifts,boxTuple,Nat.cast_add] | |
| rw [he,he,hi.eq_iff] | |
| constructor | |
| Β· intro h; rw [h] | |
| Β· intro h; apply Fin.ext; exact_mod_cast h | |
| theorem patternBoxShifts_image {n s h : β} (p : Fin n β Fin s) | |
| (hp : Function.Surjective p) (a : Fin s β β) (u : Fin s β Fin h) : | |
| (Finset.univ.image fun i => (patternBoxShifts p a u i:β€))= | |
| Finset.univ.image (boxTuple (fun j => (a j:β€)) u) := by | |
| classical | |
| ext x | |
| simp only [Finset.mem_image,Finset.mem_univ,true_and] | |
| constructor | |
| Β· rintro β¨i,rflβ© | |
| exact β¨p i,by simp only [boxTuple,patternBoxShifts,Nat.cast_add]β© | |
| Β· rintro β¨j,rflβ© | |
| obtain β¨i,rflβ© := hp j | |
| exact β¨i,by simp only [boxTuple,patternBoxShifts,Nat.cast_add]β© | |
| theorem surjective_shiftFamily_sign_sum {n s : β} (p : Fin n β Fin s) | |
| (hp : Function.Surjective p) : | |
| (β SβshiftFamily (fun i => ((p i).val:β€)),(-1:β€)^S.card)=-(s:β€) := by | |
| classical | |
| rw [shiftFamily_sign_sum] | |
| have he : (Finset.univ.image fun i => ((p i).val:β€))= | |
| Finset.univ.image (fun j : Fin s => (j.val:β€)) := by | |
| ext x | |
| simp only [Finset.mem_image,Finset.mem_univ,true_and] | |
| constructor | |
| Β· rintro β¨i,rflβ©; exact β¨p i,rflβ© | |
| Β· rintro β¨j,rflβ©; obtain β¨i,rflβ© := hp j; exact β¨i,rflβ© | |
| rw [he,Finset.card_image_of_injective] | |
| Β· simp only [Finset.card_univ,Fintype.card_fin] | |
| Β· intro i j hij; apply Fin.ext; exact_mod_cast (show (i.val:β€)=(j.val:β€) from hij) | |
| theorem box_sum_scaled_norm_le {s h : β} (a : Fin s β β€) | |
| (f g : (Fin s β Fin h) β β) {L E : β} (hL : 0<L) (hE : 0β€E) | |
| (herr : β uβdistinctBox a, β(L:β)^s*f u-g uββ€E) : | |
| β(β uβdistinctBox a,f u)-(β uβdistinctBox a,g u)/(L:β)^sββ€((h:β)/L)^s*E := by | |
| classical | |
| have hb : ββ uβdistinctBox a,((L:β)^s*f u-g u)ββ€(h:β)^s*E := by | |
| calc | |
| _ β€ β _uβdistinctBox (h:=h) a,E := norm_sum_le_of_le _ herr | |
| _ = ((distinctBox (h:=h) a).card:β)*E := by simp | |
| _ β€ (h:β)^s*E := by | |
| apply mul_le_mul_of_nonneg_right _ hE | |
| have hc := Finset.card_le_card (show distinctBox (h:=h) aβFinset.univ from Finset.subset_univ _) | |
| simpa only [Finset.card_univ,Fintype.card_fun,Fintype.card_fin,Nat.cast_pow] using | |
| (show ((distinctBox (h:=h) a).card:β)β€(Fintype.card (Fin s β Fin h):β) from by exact_mod_cast hc) | |
| rw [Finset.sum_sub_distrib,βFinset.mul_sum] at hb | |
| have hLc : (L:β)β 0 := by exact_mod_cast ne_of_gt hL | |
| have he : (β uβdistinctBox a,f u)-(β uβdistinctBox a,g u)/(L:β)^s= | |
| ((L:β)^s*(β uβdistinctBox a,f u)-β uβdistinctBox a,g u)/(L:β)^s := by | |
| field_simp [hLc] | |
| rw [he,norm_div,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hL] | |
| apply (div_le_iffβ (pow_pos hL _)).mpr | |
| apply le_trans hb | |
| apply le_of_eq | |
| rw [div_pow] | |
| field_simp | |
| theorem box_sum_errors_tendsto_zero (s : β) (H : β β β) (a : β β Fin s β β€) | |
| (L E : β β β) (lam : β) | |
| (f g : (X : β) β (Fin s β Fin (H X)) β β) | |
| (hL : βαΆ X in atTop,0<L X) | |
| (hHL : Tendsto (fun X => (H X:β)/L X) atTop (π lam)) | |
| (hE : Tendsto E atTop (π 0)) | |
| (herr : βαΆ X in atTop, β uβdistinctBox (a X),β(L X:β)^s*f X u-g X uββ€E X) : | |
| Tendsto (fun X => (β uβdistinctBox (a X),f X u)- | |
| (β uβdistinctBox (a X),g X u)/(L X:β)^s) atTop (π 0) := by | |
| apply squeeze_zero_norm' (a:=fun X => ((H X:β)/L X)^s*|E X|) | |
| Β· filter_upwards [hL,herr] with X hLX hX | |
| exact box_sum_scaled_norm_le (a X) (f X) (g X) hLX (abs_nonneg _) (fun u hu => | |
| (hX u hu).trans (le_abs_self _)) | |
| Β· simpa only [abs_zero,mul_zero] using (hHL.pow s).mul hE.abs | |
| theorem natural_boxDiameterBound {s h K : β} (a : Fin s β β) (ha : β j,a jβ€K*h) : | |
| boxDiameterBound (h:=h) (fun j => (a j:β€)) ((K+1)*h) := by | |
| intro u i j | |
| dsimp [boxTuple] | |
| have hi := (u i).isLt | |
| have hj := (u j).isLt | |
| have hai := ha i | |
| have haj := ha j | |
| have hk : K*h+h=(K+1)*h := by ring | |
| omega | |
| theorem unmarked_box_pattern_limit {n s K : β} {lam : β} (hlam : 0<lam) | |
| (p : Fin (n+1) β Fin s) (hp : Function.Surjective p) | |
| (a : β β Fin s β β) | |
| (ha : βαΆ X : β in atTop, β j,a X jβ€K*blockLength lam X) | |
| (F : (Fin (n+1) β β) β β) (rho : β) | |
| (hrho : 0β€rho) (hrho1 : rho<1) (hbudget : HasBudget F rho) | |
| (hF : HasCompactSupport (fun v : EuclideanSpace β (Fin (n+1)) => (F v.ofLp:β))) | |
| (hFs : ContDiff β β (fun v : EuclideanSpace β (Fin (n+1)) => (F v.ofLp:β))) | |
| (M : β) (hM : 0β€M) (hbound : β v, (β i,0β€v i) β |F v|β€M) : | |
| Tendsto (fun X : β => β uβdistinctBox (h:=blockLength lam X) (fun j => (a X j:β€)), | |
| (average X (fun m => divisorSum X F m (patternBoxShifts p (a X) u)):β)) atTop | |
| (π ((lam:β)^s*kernelConstant | |
| (sourceFourier (fourierCoordinateSum (Fin (n+1))) | |
| (fun v => (F v.ofLp:β)) hF hFs) (shiftFamily (fun i => ((p i).val:β€))))) := by | |
| classical | |
| let B := shiftFamily (fun i => ((p i).val:β€)) | |
| let c := kernelConstant (sourceFourier (fourierCoordinateSum (Fin (n+1))) | |
| (fun v => (F v.ofLp:β)) hF hFs) B | |
| let H := blockLength lam | |
| let az := fun X j => (a X j:β€) | |
| let f := fun X (u : Fin s β Fin (H X)) => | |
| (average X (fun m => divisorSum X F m (patternBoxShifts p (a X) u)):β) | |
| let g := fun X (u : Fin s β Fin (H X)) => | |
| (singularSeries (Finset.univ.image (boxTuple (az X) u)):β)*c | |
| obtain β¨E,hE,herrβ© := unmarked_average_uniform_asymptotic F rho hrho hrho1 hbudget | |
| hF hFs M hM hbound B (shiftFamily_nonempty _) s 2 (by omega) | |
| (surjective_shiftFamily_sign_sum p hp) | |
| have herror : βαΆ X in atTop, β uβdistinctBox (az X), | |
| β(Real.log X:β)^s*f X u-g X uββ€E X := by | |
| filter_upwards [herr,ha,blockLength_densityCutoff_eventually hlam.le (2*(K+1))] | |
| with X hX haX hcut | |
| intro u hu | |
| have hb (i : Fin (n+1)) : patternBoxShifts p (a X) u iβ€(K+1)*H X := by | |
| have hi := (u (p i)).isLt | |
| have hh := haX (p i) | |
| dsimp [H] at hi | |
| dsimp [patternBoxShifts,H] | |
| rw [Nat.add_mul,one_mul] | |
| omega | |
| have hz := hX (patternBoxShifts p (a X) u) (patternBoxShifts_family p (a X) u hu) | |
| ((K+1)*H X) hb (by simpa only [Nat.mul_assoc] using hcut) | |
| rw [patternBoxShifts_image p hp] at hz | |
| exact hz | |
| have hL : βαΆ X : β in atTop,0<Real.log X := by | |
| filter_upwards [eventually_ge_atTop 2] with X hX | |
| exact log_pos_of_two_le hX | |
| have hHL := blockLength_ratio_tendsto hlam.le | |
| have he := box_sum_errors_tendsto_zero s H az (fun X => Real.log X) E lam f g hL hHL hE herror | |
| have hmean : Tendsto (fun X => singularBoxMean (h:=H X) (az X)) atTop (π 1) := by | |
| apply uniform_singularBoxMean_tendsto s (K:=K+1) (by omega) H az (blockLength_tendsto hlam) | |
| filter_upwards [ha] with X hX | |
| exact natural_boxDiameterBound (a X) hX | |
| have hmain : Tendsto (fun X => (β uβdistinctBox (az X),g X u)/(Real.log X:β)^s) | |
| atTop (π ((lam:β)^s*c)) := by | |
| have hh := ((Complex.continuous_ofReal.continuousAt.tendsto.comp hHL).pow s).mul | |
| (Complex.continuous_ofReal.continuousAt.tendsto.comp hmean) | |
| have hh' := hh.mul_const c | |
| simp only [Complex.ofReal_one,mul_one] at hh' | |
| apply hh'.congr' | |
| filter_upwards [hL,(blockLength_tendsto hlam).eventually_ge_atTop 1] with X hLX hHX | |
| have hHC : ((H X:β):β)β 0 := by exact_mod_cast (show H Xβ 0 by dsimp [H]; omega) | |
| have hLC : (Real.log X:β)β 0 := by exact_mod_cast ne_of_gt hLX | |
| change (((H X:β)/(Real.log X):β):β)^s * (singularBoxMean (h:=H X) (az X):β)*c = | |
| (β uβdistinctBox (az X),g X u)/(Real.log X:β)^s | |
| simp only [g,βFinset.sum_mul,βComplex.ofReal_sum,singularBoxMean, | |
| Complex.ofReal_div,Complex.ofReal_pow,Complex.ofReal_natCast] | |
| rw [div_pow] | |
| field_simp | |
| have h := he.add hmain | |
| simp only [sub_add_cancel,zero_add] at h | |
| exact h | |
| theorem average_mono {X : β} (f g : β β β) | |
| (h : β mβFinset.Ioc X (2*X),f mβ€g m) : average X fβ€average X g := by | |
| exact div_le_div_of_nonneg_right (Finset.sum_le_sum h) (Nat.cast_nonneg X) | |
| theorem average_add (X : β) (f g : β β β) : | |
| average X (fun m => f m+g m)=average X f+average X g := by | |
| rw [average,Finset.sum_add_distrib,add_div] | |
| rfl | |
| theorem average_const_mul (X : β) (c : β) (f : β β β) : | |
| average X (fun m => c*f m)=c*average X f := by | |
| simp only [average,βFinset.mul_sum,mul_div_assoc] | |
| theorem average_finset_sum {Ξ± : Type*} (X : β) (S : Finset Ξ±) (f : Ξ± β β β β) : | |
| average X (fun m => β iβS,f i m)=β iβS,average X (f i) := by | |
| unfold average | |
| rw [Finset.sum_comm,Finset.sum_div] | |
| theorem weighted_detector_square_majorant {X Y : β} (hX : 2β€X) (hYP : 1β€Y) | |
| (B : Finset β) (hM : β m β Finset.Ioc X (2*X), β b β B, X < m+b) | |
| (hY : β m β Finset.Ioc X (2*X), β b β B, m+b β€ Y) | |
| (W : β β β) (hW : β mβFinset.Ioc X (2*X),0β€W m) | |
| (G : (Fin 1 β β) β β) {rho : β} | |
| (hrho : rho<1) (hbudget : HasBudget G rho) (hG : G 0=1) : | |
| average X (fun m => W m*detector X B m^2)β€ | |
| (Real.log Y/Real.log X)*average X (fun m => W m*detector X B m)+ | |
| (Real.log Y/Real.log X)^2*β bβB,β cβB.erase b, | |
| average X (fun m => W m*divisorSum X G m (fun _ => b)^2* | |
| divisorSum X G m (fun _ => c)^2) := by | |
| classical | |
| have hh := average_mono (X:=X) (fun m => W m*detector X B m^2) | |
| (fun m => W m*((Real.log Y/Real.log X)*detector X B m+ | |
| (Real.log Y/Real.log X)^2*β bβB,β cβB.erase b, | |
| divisorSum X G m (fun _ => b)^2*divisorSum X G m (fun _ => c)^2)) (by | |
| intro m hm | |
| exact mul_le_mul_of_nonneg_left (detector_square_majorant hX hYP B | |
| (hM m hm) (hY m hm) G hrho hbudget hG) (hW m hm)) | |
| have he : (fun m => W m*((Real.log Y/Real.log X)*detector X B m+ | |
| (Real.log Y/Real.log X)^2*β bβB,β cβB.erase b, | |
| divisorSum X G m (fun _ => b)^2*divisorSum X G m (fun _ => c)^2))= | |
| (fun m => (Real.log Y/Real.log X)*(W m*detector X B m)+ | |
| (Real.log Y/Real.log X)^2*(β bβB,β cβB.erase b, | |
| W m*divisorSum X G m (fun _ => b)^2*divisorSum X G m (fun _ => c)^2)) := by | |
| funext m | |
| have hs : (β bβB,β cβB.erase b, | |
| W m*divisorSum X G m (fun _ => b)^2*divisorSum X G m (fun _ => c)^2)= | |
| W m*(β bβB,β cβB.erase b, | |
| divisorSum X G m (fun _ => b)^2*divisorSum X G m (fun _ => c)^2) := by | |
| simp only [Finset.mul_sum,mul_assoc] | |
| rw [hs] | |
| ring | |
| rw [he,average_add,average_const_mul,average_const_mul, | |
| average_finset_sum] at hh | |
| simpa only [average_finset_sum] using hh | |
| theorem detector_log_ratio_tendsto {lam : β} (hlam : 0β€lam) : | |
| Tendsto (fun X : β => Real.log (2*X+2*blockLength lam X)/Real.log X) atTop (π 1) := by | |
| have hlog : Tendsto (fun X : β => Real.log (X:β)) atTop atTop := | |
| Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop | |
| have hinv : Tendsto (fun X : β => (Real.log (X:β))β»ΒΉ) atTop (π 0) := | |
| tendsto_inv_atTop_zero.comp hlog | |
| have hH : Tendsto (fun X : β => (blockLength lam X:β)/(X:β)) atTop (π 0) := by | |
| have hlogratio : Tendsto (fun X : β => Real.log (X:β)/(X:β)) atTop (π 0) := | |
| Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp tendsto_natCast_atTop_atTop | |
| apply squeeze_zero' (Eventually.of_forall (fun X => div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _))) | |
| Β· filter_upwards [eventually_ge_atTop 2] with X hX | |
| exact div_le_div_of_nonneg_right (blockLength_le_mul_log hlam hX) (Nat.cast_nonneg X) | |
| Β· simpa only [mul_div_assoc,mul_zero] using hlogratio.const_mul lam | |
| have harg : Tendsto (fun X : β => 2+2*(blockLength lam X:β)/(X:β)) atTop (π 2) := by | |
| simpa only [mul_zero,add_zero,mul_div_assoc] using tendsto_const_nhds.add (hH.const_mul 2) | |
| have hh := ((Real.continuousAt_log (by norm_num : (2:β)β 0)).tendsto.comp harg).mul hinv | |
| have hh' := (tendsto_const_nhds (x := (1:β))).add hh | |
| simp only [mul_zero,add_zero] at hh' | |
| apply hh'.congr' | |
| filter_upwards [eventually_ge_atTop 2] with X hX | |
| have hXP : 0<(X:β) := by exact_mod_cast (show 0<X by omega) | |
| have hL := log_pos_of_two_le hX | |
| have hA : 0<2+2*(blockLength lam X:β)/(X:β) := by positivity | |
| have he : (2*(X:β)+2*blockLength lam X)=(X:β)*(2+2*(blockLength lam X:β)/(X:β)) := by | |
| field_simp | |
| simp only [Function.comp_apply] | |
| rw [he,Real.log_mul hXP.ne' hA.ne',add_div,div_self hL.ne'] | |
| rfl | |
| theorem exists_normalized_singleton_profile {tau : β} (htau : 0<tau) : | |
| β f : (Fin 1 β β) β β, ContDiff β β f β§ HasCompactSupport f β§ | |
| tsupport fβpositiveSimplex 1 tau β§ (β v,0β€f v) β§ (β« v,f v)=1 := by | |
| have hopen : IsOpen (positiveSimplex 1 tau) := by | |
| have he : positiveSimplex 1 tau=(fun v : Fin 1 β β => v 0) β»ΒΉ' Ioo 0 tau := by | |
| ext v | |
| simp [positiveSimplex,coordinateSum,Fin.forall_fin_one] | |
| rw [he] | |
| exact isOpen_Ioo.preimage (continuous_apply 0) | |
| have hmem : (fun _ : Fin 1 => tau/2)βpositiveSimplex 1 tau := by | |
| simp only [positiveSimplex,Set.mem_ofPred_eq,coordinateSum,Fin.sum_univ_one] | |
| constructor | |
| Β· intro i; positivity | |
| Β· linarith | |
| obtain β¨f,hs,hc,hf,h01,h1β© := exists_contDiff_tsupport_subset (n:=(β€:ββ)) (hopen.mem_nhds hmem) | |
| have hn : β v,0β€f v := fun v => (h01 (Set.mem_range_self v)).1 | |
| let A := β« v,f v | |
| have hA : 0<A := integral_pos_of_integrable_nonneg_nonzero hf.continuous | |
| (hf.continuous.integrable_of_hasCompactSupport hc) hn (by rw [h1]; norm_num) | |
| let g := fun v => f v/A | |
| have hgc : HasCompactSupport g := hc.comp_left (g:=fun x : β => x/A) (by simp) | |
| have hgs : tsupport gβpositiveSimplex 1 tau := | |
| (tsupport_comp_subset (g:=fun x : β => x/A) (by simp) f).trans hs | |
| refine β¨g,hf.div_const A,hgc,hgs,fun v => div_nonneg (hn v) hA.le,?_β© | |
| rw [show g=(fun v => f v/A) from rfl,integral_div] | |
| exact div_self hA.ne' | |
| theorem exists_detector_profile {tau : β} (htau : 0<tau) : | |
| β f : (Fin 1 β β) β β, ContDiff β β f β§ HasCompactSupport f β§ | |
| tsupport fβpositiveSimplex 1 tau β§ | |
| HasBudget (cumulativeProfile tau f) tau β§ | |
| ContDiff β β (cumulativeProfile tau f) β§ | |
| HasCompactSupport (cumulativeProfile tau f) β§ | |
| cumulativeProfile tau f 0=1 := by | |
| obtain β¨f,hf,hc,hs,_hn,h1β© := exists_normalized_singleton_profile htau | |
| refine β¨f,hf,hc,hs,cumulativeProfile_budget tau f hs, | |
| cumulativeProfile_smooth tau f hc hf,cumulativeProfile_compact tau f hc,?_β© | |
| rw [cumulativeProfile_tail tau f hs 0 (fun _ => le_rfl)] | |
| rw [setIntegral_eq_integral_of_forall_compl_eq_zero,h1] | |
| intro v hv | |
| by_contra hne | |
| apply hv | |
| intro i | |
| exact (hs (subset_tsupport f hne)).1 i |>.le | |
| end LargePrimeGaps | |
| end OAI | |
Outline
- theorem
pattern_singular_sum27 - theorem
ker_comp_injective39 - theorem
numericPattern_int_ker45 - theorem
shiftFamily_eq_of_ker50 - def
equalityPatternFamily62 - theorem
equalityPatternFamily_sign_sum65 - theorem
translated_shiftFamily86 - theorem
divisorSum_fin_zero98 - theorem
divisorSum_singleton_at_prime110 - theorem
theta_div_log_le_upper118 - theorem
singleton_divisor_majorant127 - theorem
sum_square_diagonal_offdiag138 - theorem
detector_square_majorant147 - def
patternBoxShifts180 - theorem
patternBoxShifts_family184 - theorem
patternBoxShifts_image202 - theorem
surjective_shiftFamily_sign_sum216 - theorem
box_sum_scaled_norm_le232 - theorem
box_sum_errors_tendsto_zero258 - theorem
natural_boxDiameterBound273 - theorem
unmarked_box_pattern_limit284 - theorem
average_mono356 - theorem
average_add360 - theorem
average_const_mul365 - theorem
average_finset_sum369 - theorem
weighted_detector_square_majorant374 - theorem
detector_log_ratio_tendsto411 - theorem
exists_normalized_singleton_profile440 - theorem
exists_detector_profile467