cfahlgren1/math / lean /OAI /NumberTheory /Jacobsthal /Estimates /FundamentalBlockEstimate.lean
cfahlgren1's picture
download
raw
24.7 kB
import Mathlib.Analysis.Complex.ExponentialBounds
import Mathlib.Analysis.SpecialFunctions.Log.Basic
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Tactic
import OAI.NumberTheory.Jacobsthal.Primes.PrimeDensityBlocks
namespace OAI
namespace Erdos970
section
namespace NumberTheoryLean.FundamentalBlockEstimate
open scoped BigOperators
theorem product_upper_estimate (B : Finset ℕ) (V U δ : ℕ → ℝ)
(hV : ∀ j ∈ B, 0 < V j) (hUlo : ∀ j ∈ B, V j ≤ U j)
(hUhi : ∀ j ∈ B, U j ≤ (1 + δ j) * V j) :
(∏ j ∈ B, V j) ≤ (∏ j ∈ B, U j) ∧
(∏ j ∈ B, U j) ≤ (∏ j ∈ B, V j) * Real.exp (∑ j ∈ B, δ j) := by
constructor
· exact Finset.prod_le_prod₀ (fun j hj => (hV j hj).le) hUlo
· calc
(∏ j ∈ B, U j) ≤ ∏ j ∈ B, V j * Real.exp (δ j) := by
apply Finset.prod_le_prod₀
· intro j hj
exact (hV j hj).le.trans (hUlo j hj)
· intro j hj
apply (hUhi j hj).trans
have h := Real.add_one_le_exp (δ j)
simpa only [mul_comm, add_comm] using mul_le_mul_of_nonneg_left h (hV j hj).le
_ = _ := by rw [Finset.prod_mul_distrib, ← Real.exp_sum]
theorem correction_upper_estimate (B : Finset ℕ) (V U G δ : ℕ → ℝ)
(hV : ∀ j ∈ B, 0 < V j) (hδ : ∀ j ∈ B, 0 ≤ δ j)
(hUlo : ∀ j ∈ B, V j ≤ U j) (hUhi : ∀ j ∈ B, U j ≤ (1 + δ j) * V j)
(hGhi : ∀ j ∈ B, G j ≤ δ j * V j) :
(∑ j ∈ B, G j * ∏ i ∈ B.erase j, U i) ≤
(∏ j ∈ B, V j) * (∑ j ∈ B, δ j) * Real.exp (∑ j ∈ B, δ j) := by
classical
have hVP : 0 < ∏ j ∈ B, V j := Finset.prod_pos hV
calc
_ ≤ ∑ j ∈ B, δ j * (∏ i ∈ B, V i) * Real.exp (∑ i ∈ B, δ i) := by
apply Finset.sum_le_sum
intro j hj
have hEraseV : ∀ i ∈ B.erase j, 0 < V i := fun i hi => hV i (Finset.mem_of_mem_erase hi)
have hEraseLo : ∀ i ∈ B.erase j, V i ≤ U i := fun i hi => hUlo i (Finset.mem_of_mem_erase hi)
have hEraseHi : ∀ i ∈ B.erase j, U i ≤ (1 + δ i) * V i :=
fun i hi => hUhi i (Finset.mem_of_mem_erase hi)
have hEraseU := (product_upper_estimate (B.erase j) V U δ hEraseV hEraseLo hEraseHi).2
have hEraseNonneg : 0 ≤ ∏ i ∈ B.erase j, U i :=
Finset.prod_nonneg fun i hi => (hEraseV i hi).le.trans (hEraseLo i hi)
have hS : (∑ i ∈ B.erase j, δ i) ≤ ∑ i ∈ B, δ i :=
Finset.sum_le_sum_of_subset_of_nonneg (Finset.erase_subset _ _) (fun i hi _ => hδ i hi)
calc
G j * (∏ i ∈ B.erase j, U i) ≤
(δ j * V j) * ((∏ i ∈ B.erase j, V i) * Real.exp (∑ i ∈ B.erase j, δ i)) :=
mul_le_mul (hGhi j hj) hEraseU hEraseNonneg (mul_nonneg (hδ j hj) (hV j hj).le)
_ = δ j * (∏ i ∈ B, V i) * Real.exp (∑ i ∈ B.erase j, δ i) := by
rw [← Finset.mul_prod_erase B V hj]
ring
_ ≤ _ := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hS) (mul_nonneg (hδ j hj) hVP.le)
_ = _ := by rw [← Finset.sum_mul, ← Finset.sum_mul]; ring
theorem exp_sub_one_le_self_mul_exp (S : ℝ) : Real.exp S - 1 ≤ S * Real.exp S := by
have h := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (-S)) (Real.exp_pos S).le
have hexp : Real.exp S * Real.exp (-S) = 1 := by rw [← Real.exp_add]; simp
rw [hexp] at h
nlinarith
theorem global_relative_error (B : Finset ℕ) (V U G δ : ℕ → ℝ)
(hV : ∀ j ∈ B, 0 < V j) (hδ : ∀ j ∈ B, 0 ≤ δ j)
(hUlo : ∀ j ∈ B, V j ≤ U j) (hUhi : ∀ j ∈ B, U j ≤ (1 + δ j) * V j)
(hGlo : ∀ j ∈ B, 0 ≤ G j) (hGhi : ∀ j ∈ B, G j ≤ δ j * V j) :
|(∏ j ∈ B, U j) / (∏ j ∈ B, V j) - 1| ≤
(∑ j ∈ B, δ j) * Real.exp (∑ j ∈ B, δ j) ∧
|((∏ j ∈ B, U j) - ∑ j ∈ B, G j * ∏ i ∈ B.erase j, U i) /
(∏ j ∈ B, V j) - 1| ≤
(∑ j ∈ B, δ j) * Real.exp (∑ j ∈ B, δ j) := by
have hVP : 0 < ∏ j ∈ B, V j := Finset.prod_pos hV
have hS : 0 ≤ ∑ j ∈ B, δ j := Finset.sum_nonneg hδ
have hE : 0 ≤ (∑ j ∈ B, δ j) * Real.exp (∑ j ∈ B, δ j) := mul_nonneg hS (Real.exp_pos _).le
have hUpper := product_upper_estimate B V U δ hV hUlo hUhi
have hCorr := correction_upper_estimate B V U G δ hV hδ hUlo hUhi hGhi
have hCorr0 : 0 ≤ ∑ j ∈ B, G j * ∏ i ∈ B.erase j, U i := by
apply Finset.sum_nonneg
intro j hj
apply mul_nonneg (hGlo j hj)
apply Finset.prod_nonneg
intro i hi
exact (hV i (Finset.mem_of_mem_erase hi)).le.trans (hUlo i (Finset.mem_of_mem_erase hi))
have hUpperQlo : 1 ≤ (∏ j ∈ B, U j) / (∏ j ∈ B, V j) :=
(le_div_iff₀ hVP).mpr (by simpa using hUpper.1)
have hUpperQhi : (∏ j ∈ B, U j) / (∏ j ∈ B, V j) ≤ Real.exp (∑ j ∈ B, δ j) :=
(div_le_iff₀ hVP).mpr (by nlinarith [hUpper.2])
have hExp := exp_sub_one_le_self_mul_exp (∑ j ∈ B, δ j)
constructor
· rw [abs_le]
constructor <;> nlinarith
· rw [abs_le]
have hLowerQlo : 1 - (∑ j ∈ B, δ j) * Real.exp (∑ j ∈ B, δ j) ≤
((∏ j ∈ B, U j) - ∑ j ∈ B, G j * ∏ i ∈ B.erase j, U i) / (∏ j ∈ B, V j) := by
apply (le_div_iff₀ hVP).mpr
nlinarith [hUpper.1]
have hLowerQhi : ((∏ j ∈ B, U j) - ∑ j ∈ B, G j * ∏ i ∈ B.erase j, U i) /
(∏ j ∈ B, V j) ≤ Real.exp (∑ j ∈ B, δ j) := by
apply (div_le_iff₀ hVP).mpr
nlinarith [hUpper.2]
constructor <;> nlinarith
noncomputable def baseError (m : ℕ) : ℝ := Real.exp (5 * 1532) / (2 : ℝ) ^ (2 * m + 1)
theorem baseError_nonneg (m : ℕ) : 0 ≤ baseError m := by unfold baseError; positivity
theorem baseError_add (m t : ℕ) : baseError (m + t) = baseError m * (1 / 4 : ℝ) ^ t := by
unfold baseError
have hidx : 2 * (m + t) + 1 = (2 * m + 1) + 2 * t := by omega
rw [hidx, pow_add, pow_mul, div_pow]
norm_num
field_simp
theorem sum_scheduled_error_le (m J : ℕ) :
(∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j)) ≤ 2 * baseError m := by
simp only [PrimeDensityBlocks.reverseOrder, baseError_add, ← Finset.mul_sum]
rw [Finset.sum_flip]
have hgeom : (∑ j ∈ Finset.range (J + 1), (1 / 4 : ℝ) ^ j) ≤ 2 := by
calc
_ ≤ ∑ j ∈ Finset.range (J + 1), (1 / 2 : ℝ) ^ j := by
apply Finset.sum_le_sum
intro j _
exact pow_le_pow_left₀ (by norm_num) (by norm_num) j
_ ≤ _ := sum_geometric_two_le _
simpa only [mul_comm] using mul_le_mul_of_nonneg_left hgeom (baseError_nonneg m)
theorem six_baseError_le_exp (m : ℕ) (hm : 20000 ≤ m) :
6 * baseError m ≤ Real.exp (-(m : ℝ) / 2) := by
have hlog2 : (1 / 2 : ℝ) ≤ Real.log 2 := by
have h := Real.one_sub_inv_le_log_of_pos (by norm_num : (0 : ℝ) < 2)
norm_num at h
exact h
have hmR : (20000 : ℝ) ≤ m := by exact_mod_cast hm
have hpow : (2 : ℝ) ^ (2 * m + 1) = Real.exp (((2 * m + 1 : ℕ) : ℝ) * Real.log 2) := by
rw [Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 2)]
have hsix : (6 : ℝ) ≤ Real.exp 5 := by
have h := Real.add_one_le_exp 5
norm_num at h
exact h
unfold baseError
calc
6 * (Real.exp (5 * 1532) / (2 : ℝ) ^ (2 * m + 1)) ≤
Real.exp 5 * (Real.exp (5 * 1532) / (2 : ℝ) ^ (2 * m + 1)) :=
mul_le_mul_of_nonneg_right hsix (by positivity)
_ = Real.exp (5 + 5 * 1532 - ((2 * m + 1 : ℕ) : ℝ) * Real.log 2) := by
rw [← mul_div_assoc, ← Real.exp_add, hpow, ← Real.exp_sub]
_ ≤ _ := by
apply Real.exp_le_exp.mpr
have hmul := mul_le_mul_of_nonneg_left hlog2 (Nat.cast_nonneg (2 * m + 1))
push_cast at hmul ⊢
nlinarith
theorem scheduled_global_error_le_exp (m J : ℕ) (hm : 20000 ≤ m) :
(∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j)) *
Real.exp (∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j)) ≤
Real.exp (-(m : ℝ) / 2) := by
have hS := sum_scheduled_error_le m J
have hS0 : 0 ≤ ∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j) :=
Finset.sum_nonneg fun _ _ => baseError_nonneg _
have hb := six_baseError_le_exp m hm
have he1 : Real.exp (-(m : ℝ) / 2) ≤ 1 := by
apply Real.exp_le_one_iff.mpr
have h := Nat.cast_nonneg (α := ℝ) m
linarith
have hS1 : (∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j)) ≤ 1 := by
nlinarith [baseError_nonneg m]
have hexp : Real.exp (∑ j ∈ Finset.range (J + 1), baseError (PrimeDensityBlocks.reverseOrder m J j)) ≤ 3 :=
(Real.exp_le_exp.mpr hS1).trans Real.exp_one_lt_three.le
calc
_ ≤ (2 * baseError m) * 3 := mul_le_mul hS hexp (Real.exp_pos _).le (mul_nonneg (by norm_num) (baseError_nonneg m))
_ = 6 * baseError m := by ring
_ ≤ _ := hb
noncomputable def blockEuler (P : Finset ℕ) (g : ℕ → ℝ) (j : ℕ) : ℝ :=
∏ p ∈ PrimeDensityBlocks.primeBlock P j, (1 - g p)
noncomputable def blockUpperDensity (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ) (j : ℕ) : ℝ :=
BonferroniDensity.densityPolynomial (2 * PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j)
(PrimeDensityBlocks.primeBlock P j) g
noncomputable def blockOverflowDensity (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ) (j : ℕ) : ℝ :=
BonferroniDensity.elementarySum (PrimeDensityBlocks.primeBlock P j) g
(2 * PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j + 1)
theorem actual_local_density_inputs (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ)
(hprime : ∀ p ∈ P, p.Prime) (hg0 : ∀ p ∈ P, 0 ≤ g p)
(hdim : ∀ p ∈ P, g p ≤ 2 / p) (htwo : 2 ∈ P → g 2 ≤ 1 / 2) (j : ℕ) :
0 < blockEuler P g j ∧
blockEuler P g j ≤ blockUpperDensity V m P g j ∧
blockUpperDensity V m P g j ≤
(1 + baseError (PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j)) * blockEuler P g j ∧
0 ≤ blockOverflowDensity V m P g j ∧
blockOverflowDensity V m P g j ≤
baseError (PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j) * blockEuler P g j := by
let Q := PrimeDensityBlocks.primeBlock P j
let t := PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j
have hQ0 : ∀ p ∈ Q, 0 ≤ g p := fun p hp => hg0 p (Finset.mem_inter.mp hp).1
have hcap := BonferroniDensity.prime_density_le_two_thirds P g hprime hdim htwo
have hQ2 : ∀ p ∈ Q, g p ≤ 2 / 3 := fun p hp => hcap p (Finset.mem_inter.mp hp).1
have hsum : (∑ p ∈ Q, g p) ≤ 1532 := PrimeDensityBlocks.primeBlock_density_sum_le P j g hdim
have heuler := BonferroniDensity.exp_neg_three_mul_le_eulerProduct Q g hQ0 hQ2 hsum
have hpos : 0 < ∏ p ∈ Q, (1 - g p) := (Real.exp_pos _).trans_le heuler
have hrel := BonferroniDensity.densityPolynomial_relative_error Q g hQ0 hQ2 (by norm_num) hsum t
have hbound := BonferroniDensity.densityPolynomial_bounds Q g hQ0 (fun p hp => by linarith [hQ2 p hp]) t
have htail := BonferroniDensity.relative_elementarySum_le_exponential Q g hQ0 hQ2 (by norm_num) hsum (2 * t + 1)
refine ⟨hpos, hbound.2, ?_, BonferroniDensity.elementarySum_nonneg Q g hQ0 _, ?_⟩
· change BonferroniDensity.densityPolynomial (2 * t) Q g ≤ (1 + baseError t) * (∏ p ∈ Q, (1 - g p))
apply (div_le_iff₀ hpos).mp
have h := (abs_le.mp hrel.1).2
change BonferroniDensity.densityPolynomial (2 * t) Q g / (∏ p ∈ Q, (1 - g p)) - 1 ≤ baseError t at h
linarith
· exact (div_le_iff₀ hpos).mp htail
noncomputable def actualUpperDensity (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ) : ℝ :=
∑ T ∈ P.powerset,
DisjointBlockExpansion.upperCoefficient (PrimeDensityBlocks.blockIndices V) (PrimeDensityBlocks.primeBlock P)
(PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V)) T * ∏ p ∈ T, g p
noncomputable def actualLowerDensity (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ) : ℝ :=
∑ T ∈ P.powerset, PrimeDensityBlocks.actualLowerCoefficient V m P T * ∏ p ∈ T, g p
theorem actual_global_density_error (V m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ)
(hm : 20000 ≤ m) (hprime : ∀ p ∈ P, p.Prime) (hsize : ∀ p ∈ P, p ≤ V)
(hg0 : ∀ p ∈ P, 0 ≤ g p) (hdim : ∀ p ∈ P, g p ≤ 2 / p)
(htwo : 2 ∈ P → g 2 ≤ 1 / 2) :
|actualUpperDensity V m P g / (∏ p ∈ P, (1 - g p)) - 1| ≤ Real.exp (-(m : ℝ) / 2) ∧
|actualLowerDensity V m P g / (∏ p ∈ P, (1 - g p)) - 1| ≤ Real.exp (-(m : ℝ) / 2) := by
let B := PrimeDensityBlocks.blockIndices V
let blocks := PrimeDensityBlocks.primeBlock P
let orders := PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V)
have hdis := PrimeDensityBlocks.primeBlock_pairwise V P
have hunion := PrimeDensityBlocks.primeBlock_union V P hprime hsize
have hloc := actual_local_density_inputs V m P g hprime hg0 hdim htwo
have hglob := global_relative_error B (blockEuler P g) (blockUpperDensity V m P g)
(blockOverflowDensity V m P g) (fun j => baseError (orders j))
(fun j _ => (hloc j).1) (fun j _ => baseError_nonneg _) (fun j _ => (hloc j).2.1)
(fun j _ => (hloc j).2.2.1) (fun j _ => (hloc j).2.2.2.1) (fun j _ => (hloc j).2.2.2.2)
have hError := scheduled_global_error_le_exp m (PrimeDensityBlocks.lastBlock V) hm
have hEuler : (∏ j ∈ B, blockEuler P g j) = ∏ p ∈ P, (1 - g p) := by
change (∏ j ∈ B, ∏ p ∈ blocks j, (1 - g p)) = _
rw [← Finset.prod_biUnion hdis, hunion]
have hUpper : actualUpperDensity V m P g = ∏ j ∈ B, blockUpperDensity V m P g j := by
have h := DisjointBlockExpansion.upperCoefficient_density B blocks hdis orders g
rw [hunion] at h
exact h
have hLower : actualLowerDensity V m P g =
(∏ j ∈ B, blockUpperDensity V m P g j) -
∑ j ∈ B, blockOverflowDensity V m P g j * ∏ i ∈ B.erase j, blockUpperDensity V m P g i := by
have h := DisjointBlockExpansion.lowerCoefficient_density B blocks hdis orders g
rw [hunion] at h
exact h
rw [hUpper, hLower, ← hEuler]
exact ⟨hglob.1.trans hError, hglob.2.trans hError⟩
noncomputable def actualUpperCoefficient (V m : ℕ) (P : Finset ℕ) (T : Finset ℕ) : ℝ :=
DisjointBlockExpansion.upperCoefficient (PrimeDensityBlocks.blockIndices V) (PrimeDensityBlocks.primeBlock P)
(PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V)) T
theorem actualUpperCoefficient_support (V m : ℕ) (P : Finset ℕ) (hV : 2 ≤ V)
(hprime : ∀ p ∈ P, p.Prime) (hsize : ∀ p ∈ P, p ≤ V)
{T : Finset ℕ} (hT : T ⊆ P) (hc : actualUpperCoefficient V m P T ≠ 0) :
Squarefree (∏ p ∈ T, p) ∧ (∏ p ∈ T, p) ≤ V ^ (12 * (m + 1)) := by
have hTu : T ⊆ (PrimeDensityBlocks.blockIndices V).biUnion (PrimeDensityBlocks.primeBlock P) := by
simpa only [PrimeDensityBlocks.primeBlock_union V P hprime hsize] using hT
have hbound := DisjointBlockExpansion.prime_product_support (PrimeDensityBlocks.blockIndices V)
(PrimeDensityBlocks.primeBlock P) (PrimeDensityBlocks.primeBlock_pairwise V P)
(fun j => 2 * PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V) j + 1)
(fun j => 2 ^ (2 ^ (j + 1))) (fun j _ => Nat.one_le_pow _ _ (by norm_num))
(fun j _ p hp => hprime p (Finset.mem_inter.mp hp).1)
(fun j _ p hp => (PrimeDensityBlocks.mem_geometricPrimes.mp (Finset.mem_inter.mp hp).2).2.1.le)
hTu (fun j hj => (DisjointBlockExpansion.upperCoefficient_card hc j hj).trans (Nat.le_succ _))
exact ⟨hbound.1, hbound.2.trans (PrimeDensityBlocks.supportHeight_product_le V m hV)⟩
def levelSubsets (P : Finset ℕ) (L : ℕ) : Finset (Finset ℕ) :=
P.powerset.filter fun T => (∏ p ∈ T, p) ≤ L
theorem coefficient_remainder_level_bound (P : Finset ℕ) (L : ℕ) (coeff E : Finset ℕ → ℝ)
(hc : ∀ T ∈ P.powerset, |coeff T| ≤ 1)
(hlevel : ∀ T ∈ P.powerset, coeff T ≠ 0 → (∏ p ∈ T, p) ≤ L) :
|∑ T ∈ P.powerset, coeff T * E T| ≤ ∑ T ∈ levelSubsets P L, |E T| := by
classical
apply (DisjointBlockExpansion.supported_remainder_bound P coeff E hc).trans
apply Finset.sum_le_sum_of_subset_of_nonneg
· intro T hT
obtain ⟨hTP, hnz⟩ := Finset.mem_filter.mp hT
exact Finset.mem_filter.mpr ⟨hTP, hlevel T hTP hnz⟩
· intro T _ _
exact abs_nonneg _
theorem additive_bounds_of_relative {D E ε : ℝ} (hE : 0 < E) (h : |D / E - 1| ≤ ε) :
E - E * ε ≤ D ∧ D ≤ E + E * ε := by
obtain ⟨hlo, hhi⟩ := abs_le.mp h
have hDlo : (1 - ε) * E ≤ D := (le_div_iff₀ hE).mp (by linarith)
have hDhi : D ≤ (1 + ε) * E := (div_le_iff₀ hE).mp (by linarith)
constructor <;> nlinarith
theorem finite_fundamental_lemma {α : Type*} (C : Finset α) (weight : α → ℝ)
(hweight : ∀ x ∈ C, 0 ≤ weight x) (hit : ℕ → α → Prop)
(V m : ℕ) (P : Finset ℕ) (X : ℝ) (g : ℕ → ℝ)
(hV : 2 ≤ V) (hm : 20000 ≤ m) (hX : 0 ≤ X)
(hprime : ∀ p ∈ P, p.Prime) (hsize : ∀ p ∈ P, p ≤ V)
(hg0 : ∀ p ∈ P, 0 ≤ g p) (hdim : ∀ p ∈ P, g p ≤ 2 / p)
(htwo : 2 ∈ P → g 2 ≤ 1 / 2) :
|(∑ x ∈ C, weight x * BonferroniBlocks.survives P (fun p => hit p x)) -
X * (∏ p ∈ P, (1 - g p))| ≤
X * (∏ p ∈ P, (1 - g p)) * Real.exp (-(m : ℝ) / 2) +
∑ T ∈ levelSubsets P (V ^ (12 * (m + 1))),
|BonferroniBlocks.intersectionRemainder C weight hit X g T| := by
let cU := actualUpperCoefficient V m P
let cL := PrimeDensityBlocks.actualLowerCoefficient V m P
let E := BonferroniBlocks.intersectionRemainder C weight hit X g
have hcap := BonferroniDensity.prime_density_le_two_thirds P g hprime hdim htwo
have hEuler : 0 < ∏ p ∈ P, (1 - g p) := Finset.prod_pos (fun p hp => by linarith [hcap p hp])
have hDensity := actual_global_density_error V m P g hm hprime hsize hg0 hdim htwo
have hUmain := additive_bounds_of_relative hEuler hDensity.1
have hLmain := additive_bounds_of_relative hEuler hDensity.2
have hRU := coefficient_remainder_level_bound P (V ^ (12 * (m + 1))) cU E
(fun T _ => DisjointBlockExpansion.upperCoefficient_abs_le _ _ _ _)
(fun T hT hnz => (actualUpperCoefficient_support V m P hV hprime hsize
(Finset.mem_powerset.mp hT) hnz).2)
have hRL := coefficient_remainder_level_bound P (V ^ (12 * (m + 1))) cL E
(fun T _ => DisjointBlockExpansion.lowerCoefficient_abs_le _ _ _ _)
(fun T hT hnz => (PrimeDensityBlocks.actualLowerCoefficient_support V m P hV hprime hsize
(Finset.mem_powerset.mp hT) hnz).2)
have hUdecomp := DisjointBlockExpansion.global_main_remainder C weight hit P cU X g
have hLdecomp := DisjointBlockExpansion.global_main_remainder C weight hit P cL X g
have hcounts := DisjointBlockExpansion.weighted_global_coefficient_bounds C weight hweight hit
(PrimeDensityBlocks.blockIndices V) (PrimeDensityBlocks.primeBlock P)
(PrimeDensityBlocks.primeBlock_pairwise V P)
(PrimeDensityBlocks.reverseOrder m (PrimeDensityBlocks.lastBlock V))
rw [PrimeDensityBlocks.primeBlock_union V P hprime hsize] at hcounts
change (∑ T ∈ P.powerset, cL T * BonferroniBlocks.intersectionMass C weight hit T) ≤ _ ∧
_ ≤ (∑ T ∈ P.powerset, cU T * BonferroniBlocks.intersectionMass C weight hit T) at hcounts
rw [hUdecomp, hLdecomp] at hcounts
change X * actualLowerDensity V m P g + (∑ T ∈ P.powerset, cL T * E T) ≤ _ ∧
_ ≤ X * actualUpperDensity V m P g + (∑ T ∈ P.powerset, cU T * E T) at hcounts
have hLo := mul_le_mul_of_nonneg_left hLmain.1 hX
have hHi := mul_le_mul_of_nonneg_left hUmain.2 hX
have hRLo := (abs_le.mp hRL).1
have hRHi := (abs_le.mp hRU).2
rw [abs_le]
constructor <;> nlinarith
def levelDivisors (P : Finset ℕ) (L : ℕ) : Finset ℕ :=
(∏ p ∈ P, p).divisors.filter fun d => d ≤ L
noncomputable def integerRemainder {α : Type*} (C : Finset α) (weight : α → ℝ)
(hit : ℕ → α → Prop) (X : ℝ) (g : ℕ → ℝ) (d : ℕ) : ℝ :=
BonferroniBlocks.intersectionRemainder C weight hit X g d.primeFactors
theorem remainder_sum_eq_divisors {α : Type*} (C : Finset α) (weight : α → ℝ)
(hit : ℕ → α → Prop) (X : ℝ) (g : ℕ → ℝ) (P : Finset ℕ) (L : ℕ)
(hprime : ∀ p ∈ P, p.Prime) :
(∑ T ∈ levelSubsets P L, |BonferroniBlocks.intersectionRemainder C weight hit X g T|) =
∑ d ∈ levelDivisors P L, |integerRemainder C weight hit X g d| := by
classical
have hsq : Squarefree (∏ p ∈ P, p) := IntervalBoundingSieve.squarefree_primeSet_product P hprime
have hPfac : (∏ p ∈ P, p).primeFactors = P := Nat.primeFactors_prod hprime
apply Finset.sum_bij (fun T _ => ∏ p ∈ T, p)
· intro T hT
obtain ⟨hTP, hTL⟩ := Finset.mem_filter.mp hT
apply Finset.mem_filter.mpr
exact ⟨Nat.mem_divisors.mpr
⟨Finset.prod_dvd_prod_of_subset T P id (Finset.mem_powerset.mp hTP), hsq.ne_zero⟩, hTL⟩
· intro T hT U hU hEq
exact DisjointBlockExpansion.prime_product_injective P hprime
(Finset.mem_filter.mp hT).1 (Finset.mem_filter.mp hU).1 hEq
· intro d hd
obtain ⟨hdP, hdL⟩ := Finset.mem_filter.mp hd
have hdiv := Nat.dvd_of_mem_divisors hdP
have hdsq := hsq.squarefree_of_dvd hdiv
have hsub : d.primeFactors ⊆ P := by
rw [← hPfac]
exact Nat.primeFactors_mono hdiv hsq.ne_zero
have hprod : (∏ p ∈ d.primeFactors, p) = d := Nat.prod_primeFactors_of_squarefree hdsq
exact ⟨d.primeFactors, Finset.mem_filter.mpr
⟨Finset.mem_powerset.mpr hsub, by simpa only [hprod] using hdL⟩, hprod⟩
· intro T hT
have hTP := Finset.mem_powerset.mp (Finset.mem_filter.mp hT).1
have hfac : (∏ p ∈ T, p).primeFactors = T := Nat.primeFactors_prod (fun p hp => hprime p (hTP hp))
simp only [integerRemainder, hfac]
theorem finite_fundamental_integer_level {α : Type*} (C : Finset α) (weight : α → ℝ)
(hweight : ∀ x ∈ C, 0 ≤ weight x) (hit : ℕ → α → Prop)
(V m : ℕ) (P : Finset ℕ) (X : ℝ) (g : ℕ → ℝ)
(hV : 2 ≤ V) (hm : 20000 ≤ m) (hX : 0 ≤ X)
(hprime : ∀ p ∈ P, p.Prime) (hsize : ∀ p ∈ P, p ≤ V)
(hg0 : ∀ p ∈ P, 0 ≤ g p) (hdim : ∀ p ∈ P, g p ≤ 2 / p)
(htwo : 2 ∈ P → g 2 ≤ 1 / 2) :
|(∑ x ∈ C, weight x * BonferroniBlocks.survives P (fun p => hit p x)) -
X * (∏ p ∈ P, (1 - g p))| ≤
X * (∏ p ∈ P, (1 - g p)) * Real.exp (-(m : ℝ) / 2) +
∑ d ∈ levelDivisors P (V ^ (12 * (m + 1))), |integerRemainder C weight hit X g d| := by
have h := finite_fundamental_lemma C weight hweight hit V m P X g hV hm hX hprime hsize hg0 hdim htwo
rw [remainder_sum_eq_divisors C weight hit X g P _ hprime] at h
exact h
theorem fundamental_integer_parameter {α : Type*} (C : Finset α) (weight : α → ℝ)
(hweight : ∀ x ∈ C, 0 ≤ weight x) (hit : ℕ → α → Prop)
(V s : ℕ) (P : Finset ℕ) (X : ℝ) (g : ℕ → ℝ)
(hV : 2 ≤ V) (hs : 240012 ≤ s) (hX : 0 ≤ X)
(hprime : ∀ p ∈ P, p.Prime) (hsize : ∀ p ∈ P, p ≤ V)
(hg0 : ∀ p ∈ P, 0 ≤ g p) (hdim : ∀ p ∈ P, g p ≤ 2 / p)
(htwo : 2 ∈ P → g 2 ≤ 1 / 2) :
|(∑ x ∈ C, weight x * BonferroniBlocks.survives P (fun p => hit p x)) -
X * (∏ p ∈ P, (1 - g p))| ≤
X * (∏ p ∈ P, (1 - g p)) * Real.exp (-(s : ℝ) / 48) +
∑ d ∈ levelDivisors P (V ^ s), |integerRemainder C weight hit X g d| := by
let m := s / 12 - 1
have hm : 20000 ≤ m := by dsimp [m]; omega
have hlevel : 12 * (m + 1) ≤ s := by dsimp [m]; omega
have hms : s ≤ 24 * m := by dsimp [m]; omega
have h := finite_fundamental_integer_level C weight hweight hit V m P X g hV hm hX hprime hsize hg0 hdim htwo
apply h.trans
apply add_le_add
· have hcap := BonferroniDensity.prime_density_le_two_thirds P g hprime hdim htwo
have hEuler : 0 ≤ ∏ p ∈ P, (1 - g p) := Finset.prod_nonneg (fun p hp => by linarith [hcap p hp])
apply mul_le_mul_of_nonneg_left _ (mul_nonneg hX hEuler)
apply Real.exp_le_exp.mpr
have hmsR : (s : ℝ) ≤ 24 * (m : ℝ) := by exact_mod_cast hms
linarith
· apply Finset.sum_le_sum_of_subset_of_nonneg
· intro d hd
obtain ⟨hdP, hdL⟩ := Finset.mem_filter.mp hd
exact Finset.mem_filter.mpr ⟨hdP, hdL.trans (Nat.pow_le_pow_right (by omega) hlevel)⟩
· intro d _ _
exact abs_nonneg _
end NumberTheoryLean.FundamentalBlockEstimate
end
end Erdos970
end OAI

Xet Storage Details

Size:
24.7 kB
·
Xet hash:
6abae7b1365b696b3a197383510a9f2e27814b3327fa8f6b8b70e6530d78a462

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.