The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V12. Number theory

Mathlib.NumberTheory.SelbergSieve

53 declarations. Mathlib docs · Source

The Selberg Sieve

We set up the working assumptions of the Selberg sieve, define the notion of an upper bound sieve and show that every upper bound sieve yields an upper bound on the size of the sifted set. We also define the Λ² sieve and prove that Λ² sieves are upper bound sieves. We then diagonalise the main term of the Λ² sieve.

We mostly follow the treatment outlined by Heath-Brown in the notes to an old graduate course. One minor notational difference is that we write $\nu(n)$ in place of $\frac{\omega(n)}{n}$.

Main statements

  • siftedSum_le_mainSum_errSum_of_UpperBoundSieve - Every upper bound sieve gives an upper bound on the size of the sifted set in terms of mainSum and errSum
  • upperMoebius_of_lambda_sq - Lambda squared weights produce upper bound sieves
  • lambdaSquared_mainSum_eq_diag_quad_form - The main sum of a Λ² sieve has a nice diagonalisation

References

  • [Heath-Brown, Lectures on sieves][heathbrown2002lecturessieves]
  • [Koukoulopoulos, The Distribution of Prime Numbers][MR3971232]

Lemmas about prodPrimes.

Lemmas about $\nu$.

Now follow some important identities involving selbergTerms

theorem SelbergSieve.mk.injEq E0 #

∀ (toBoundingSieve : BoundingSieve) (level : ℝ) (one_le_level : 1 ≤ level) (toBoundingSieve_1 : BoundingSieve)
  (level_1 : ℝ) (one_le_level_1 : 1 ≤ level_1),
  ({ toBoundingSieve := toBoundingSieve, level := level, one_le_level := one_le_level } =
      { toBoundingSieve := toBoundingSieve_1, level := level_1, one_le_level := one_le_level_1 }) =
    (toBoundingSieve = toBoundingSieve_1 ∧ level = level_1)

theorem BoundingSieve.mk.inj E1 #

∀ {support : Finset ℕ} {prodPrimes : ℕ} {prodPrimes_squarefree : Squarefree prodPrimes} {weights : ℕ → ℝ}
  {weights_nonneg : ∀ (n : ℕ), 0 ≤ weights n} {totalMass : ℝ} {nu : ArithmeticFunction ℝ}
  {nu_mult : nu.IsMultiplicative} {nu_pos_of_prime : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → 0 < nu p}
  {nu_lt_one_of_prime : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → nu p < 1} {support_1 : Finset ℕ} {prodPrimes_1 : ℕ}
  {prodPrimes_squarefree_1 : Squarefree prodPrimes_1} {weights_1 : ℕ → ℝ}
  {weights_nonneg_1 : ∀ (n : ℕ), 0 ≤ weights_1 n} {totalMass_1 : ℝ} {nu_1 : ArithmeticFunction ℝ}
  {nu_mult_1 : nu_1.IsMultiplicative} {nu_pos_of_prime_1 : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes_1 → 0 < nu_1 p}
  {nu_lt_one_of_prime_1 : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes_1 → nu_1 p < 1},
  { support := support, prodPrimes := prodPrimes, prodPrimes_squarefree := prodPrimes_squarefree, weights := weights,
        weights_nonneg := weights_nonneg, totalMass := totalMass, nu := nu, nu_mult := nu_mult,
        nu_pos_of_prime := nu_pos_of_prime, nu_lt_one_of_prime := nu_lt_one_of_prime } =
      { support := support_1, prodPrimes := prodPrimes_1, prodPrimes_squarefree := prodPrimes_squarefree_1,
        weights := weights_1, weights_nonneg := weights_nonneg_1, totalMass := totalMass_1, nu := nu_1,
        nu_mult := nu_mult_1, nu_pos_of_prime := nu_pos_of_prime_1, nu_lt_one_of_prime := nu_lt_one_of_prime_1 } →
    support = support_1 ∧ prodPrimes = prodPrimes_1 ∧ weights = weights_1 ∧ totalMass = totalMass_1 ∧ nu = nu_1

def BoundingSieve.ctorIdx E1 #

BoundingSieve → ℕ

theorem SelbergSieve.mk.inj E1 #

∀ {toBoundingSieve : BoundingSieve} {level : ℝ} {one_le_level : 1 ≤ level} {toBoundingSieve_1 : BoundingSieve}
  {level_1 : ℝ} {one_le_level_1 : 1 ≤ level_1},
  { toBoundingSieve := toBoundingSieve, level := level, one_le_level := one_le_level } =
      { toBoundingSieve := toBoundingSieve_1, level := level_1, one_le_level := one_le_level_1 } →
    toBoundingSieve = toBoundingSieve_1 ∧ level = level_1

theorem BoundingSieve.mk.injEq E0 #

∀ (support : Finset ℕ) (prodPrimes : ℕ) (prodPrimes_squarefree : Squarefree prodPrimes) (weights : ℕ → ℝ)
  (weights_nonneg : ∀ (n : ℕ), 0 ≤ weights n) (totalMass : ℝ) (nu : ArithmeticFunction ℝ)
  (nu_mult : nu.IsMultiplicative) (nu_pos_of_prime : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → 0 < nu p)
  (nu_lt_one_of_prime : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → nu p < 1) (support_1 : Finset ℕ) (prodPrimes_1 : ℕ)
  (prodPrimes_squarefree_1 : Squarefree prodPrimes_1) (weights_1 : ℕ → ℝ)
  (weights_nonneg_1 : ∀ (n : ℕ), 0 ≤ weights_1 n) (totalMass_1 : ℝ) (nu_1 : ArithmeticFunction ℝ)
  (nu_mult_1 : nu_1.IsMultiplicative) (nu_pos_of_prime_1 : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes_1 → 0 < nu_1 p)
  (nu_lt_one_of_prime_1 : ∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes_1 → nu_1 p < 1),
  ({ support := support, prodPrimes := prodPrimes, prodPrimes_squarefree := prodPrimes_squarefree, weights := weights,
        weights_nonneg := weights_nonneg, totalMass := totalMass, nu := nu, nu_mult := nu_mult,
        nu_pos_of_prime := nu_pos_of_prime, nu_lt_one_of_prime := nu_lt_one_of_prime } =
      { support := support_1, prodPrimes := prodPrimes_1, prodPrimes_squarefree := prodPrimes_squarefree_1,
        weights := weights_1, weights_nonneg := weights_nonneg_1, totalMass := totalMass_1, nu := nu_1,
        nu_mult := nu_mult_1, nu_pos_of_prime := nu_pos_of_prime_1, nu_lt_one_of_prime := nu_lt_one_of_prime_1 }) =
    (support = support_1 ∧ prodPrimes = prodPrimes_1 ∧ weights = weights_1 ∧ totalMass = totalMass_1 ∧ nu = nu_1)

def SelbergSieve.ctorIdx E1 #

SelbergSieve → ℕ

structure BoundingSieve E1 #

Type

We set up a sieve problem as follows. Take a finite set of natural numbers A, whose elements are weighted by a sequence a n. Also take a finite set of primes P, represented by a squarefree natural number. These are the primes that we will sift from our set A. Suppose we can approximate ∑ n ∈ A with d ∣ n, a n = ν d * X + R d, where X is an approximation to the total size of A and ν is a multiplicative arithmetic function such that 0 < ν p < 1 for all primes p ∣ P.

Then a sieve-type theorem will give us an upper (or lower) bound on the size of the sifted sum ∑ n ∈ support with n.Coprime P, a n, obtained by removing any elements of A that are a multiple of a prime in P.

ctor BoundingSieve.mk E0 #

Finset ℕ →
  (prodPrimes : ℕ) →
    Squarefree prodPrimes →
      (weights : ℕ → ℝ) →
        (∀ (n : ℕ), 0 ≤ weights n) →
          ℝ →
            (nu : ArithmeticFunction ℝ) →
              nu.IsMultiplicative →
                (∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → 0 < nu p) →
                  (∀ (p : ℕ), Nat.Prime p → p ∣ prodPrimes → nu p < 1) → BoundingSieve

abbrev BoundingSieve.support E1 #

BoundingSieve → Finset ℕ

The set of natural numbers that is to be sifted. The fundamental lemma yields an upper bound on the size of this set after the multiples of small primes have been removed.

abbrev BoundingSieve.prodPrimes E1 #

BoundingSieve → ℕ

The finite set of prime numbers whose multiples are to be sifted from support. We work with their product because it lets us treat nu as a multiplicative arithmetic function. It also plays well with Moebius inversion.

theorem BoundingSieve.prodPrimes_squarefree E1 #

∀ (self : BoundingSieve), Squarefree self.prodPrimes

abbrev BoundingSieve.weights E1 #

BoundingSieve → ℕ → ℝ

A sequence representing how much each element of support should be weighted.

theorem BoundingSieve.weights_nonneg E1 #

∀ (self : BoundingSieve) (n : ℕ), 0 ≤ self.weights n

abbrev BoundingSieve.totalMass E1 #

BoundingSieve → ℝ

An approximation to ∑ i in support, weights i, i.e. the size of the unsifted set. A bad approximation will yield a weak statement in the final theorem.

abbrev BoundingSieve.nu E1 #

BoundingSieve → ArithmeticFunction ℝ

nu d is an approximation to the proportion of elements of support that are a multiple of d

theorem BoundingSieve.nu_mult E1 #

∀ (self : BoundingSieve), self.nu.IsMultiplicative

theorem BoundingSieve.nu_pos_of_prime E1 #

∀ (self : BoundingSieve) (p : ℕ), Nat.Prime p → p ∣ self.prodPrimes → 0 < self.nu p

theorem BoundingSieve.nu_lt_one_of_prime E1 #

∀ (self : BoundingSieve) (p : ℕ), Nat.Prime p → p ∣ self.prodPrimes → self.nu p < 1

structure SelbergSieve E1 #

Type

The Selberg upper bound sieve in particular introduces a parameter called the level which gives the user control over the size of the error term.

abbrev SelbergSieve.toBoundingSieve E1 #

SelbergSieve → BoundingSieve

ctor SelbergSieve.mk E0 #

BoundingSieve → (level : ℝ) → 1 ≤ level → SelbergSieve

abbrev SelbergSieve.level E1 #

SelbergSieve → ℝ

The level of the sieve controls how many terms we include in the inclusion-exclusion type sum. A higher level will yield a tighter bound for the main term, but will also increase the size of the error term.

theorem SelbergSieve.one_le_level E1 #

∀ (self : SelbergSieve), 1 ≤ self.level

def Mathlib.Meta.Positivity.evalBoundingSieveWeights E1 #

Mathlib.Meta.Positivity.PositivityExt

Extension for the positivity tactic: BoundingSieve.weights.

theorem BoundingSieve.one_le_y E1 #

∀ {s : SelbergSieve}, 1 ≤ s.level

theorem BoundingSieve.prodPrimes_ne_zero E1 #

∀ {s : BoundingSieve}, s.prodPrimes ≠ 0

theorem BoundingSieve.squarefree_of_dvd_prodPrimes E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∣ s.prodPrimes → Squarefree d

theorem BoundingSieve.squarefree_of_mem_divisors_prodPrimes E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∈ s.prodPrimes.divisors → Squarefree d

theorem BoundingSieve.prod_primeFactors_nu E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∣ s.prodPrimes → ∏ p ∈ d.primeFactors, s.nu p = s.nu d

theorem BoundingSieve.nu_pos_of_dvd_prodPrimes E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∣ s.prodPrimes → 0 < s.nu d

theorem BoundingSieve.nu_ne_zero E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∣ s.prodPrimes → s.nu d ≠ 0

theorem BoundingSieve.nu_lt_one_of_dvd_prodPrimes E1 #

∀ {s : BoundingSieve} {d : ℕ}, d ∣ s.prodPrimes → d ≠ 1 → s.nu d < 1

def BoundingSieve.multSum E1 #

{s : BoundingSieve} → ℕ → ℝ

The weight of all the elements that are a multiple of d.

def BoundingSieve.rem E1 #

{s : BoundingSieve} → ℕ → ℝ

The remainder term in the approximation A_d = ν (d) X + R_d. This is the degree to which nu fails to approximate the proportion of the weight that is a multiple of d.

def BoundingSieve.siftedSum E1 #

{s : BoundingSieve} → ℝ

The weight of all the elements that are not a multiple of any of our finite set of primes.

def BoundingSieve.mainSum E3 #

{s : BoundingSieve} → (ℕ → ℝ) → ℝ

X * mainSum μ⁺ is the main term in the upper bound on sifted_sum.

def BoundingSieve.errSum E3 #

{s : BoundingSieve} → (ℕ → ℝ) → ℝ

errSum μ⁺ is the error term in the upper bound on sifted_sum.

theorem BoundingSieve.multSum_eq_main_err E1 #

∀ {s : BoundingSieve} (d : ℕ), BoundingSieve.multSum d = s.nu d * s.totalMass + BoundingSieve.rem d

theorem BoundingSieve.siftedSum_eq_sum_support_mul_ite E1 #

∀ {s : BoundingSieve}, BoundingSieve.siftedSum = ∑ d ∈ s.support, s.weights d * if s.prodPrimes.gcd d = 1 then 1 else 0

def BoundingSieve.IsUpperMoebius E1 #

(ℕ → ℝ) → Prop

A sequence of coefficients $\mu^{+}$ is upper Moebius if $\mu * \zeta ≤ \mu^{+} * \zeta$. These coefficients then yield an upper bound on the sifted sum.

theorem BoundingSieve.siftedSum_le_sum_of_upperMoebius E1 #

∀ {s : BoundingSieve} (muPlus : ℕ → ℝ),
  BoundingSieve.IsUpperMoebius muPlus →
    BoundingSieve.siftedSum ≤ ∑ d ∈ s.prodPrimes.divisors, muPlus d * BoundingSieve.multSum d

theorem BoundingSieve.siftedSum_le_mainSum_errSum_of_upperMoebius E1 #

∀ {s : BoundingSieve} (muPlus : ℕ → ℝ),
  BoundingSieve.IsUpperMoebius muPlus →
    BoundingSieve.siftedSum ≤ s.totalMass * BoundingSieve.mainSum muPlus + BoundingSieve.errSum muPlus

def BoundingSieve.lambdaSquared E1 #

(ℕ → ℝ) → ℕ → ℝ

We consider a special class of upper bound sieves called the Λ² sieve. This class is parameterised by a sequence of real numbers. We will later choose a set of weights that minimises the main term, under a constraint that lets us control the error term.

theorem BoundingSieve.upperMoebius_lambdaSquared E1 #

∀ (weights : ℕ → ℝ), weights 1 = 1 → BoundingSieve.IsUpperMoebius (BoundingSieve.lambdaSquared weights)

def BoundingSieve.selbergTerms E1 #

{s : BoundingSieve} → ArithmeticFunction ℝ

These are the terms that appear in the sum S in the main term of the fundamental theorem.

$$S = \sum_{l \mid P, l \le \sqrt{y}} g(l)$$

theorem BoundingSieve.selbergTerms_apply E0 #

∀ {s : BoundingSieve} (d : ℕ), BoundingSieve.selbergTerms d = s.nu d * ∏ p ∈ d.primeFactors, (1 - s.nu p)⁻¹

theorem BoundingSieve.selbergTerms_pos E1 #

∀ {s : BoundingSieve} {l : ℕ}, l ∣ s.prodPrimes → 0 < BoundingSieve.selbergTerms l

theorem BoundingSieve.selbergTerms_isMultiplicative E1 #

∀ {s : BoundingSieve}, BoundingSieve.selbergTerms.IsMultiplicative

theorem BoundingSieve.inv_selbergTerms_eq_sum_divisors_moebius_nu E1 #

∀ {s : BoundingSieve} {l : ℕ},
  Squarefree l →
    s.nu l ≠ 0 →
      (BoundingSieve.selbergTerms l)⁻¹ =
        ∑ x ∈ l.divisorsAntidiagonal,
          match x with
          | (d, e) => ↑(ArithmeticFunction.moebius d) * (s.nu e)⁻¹

theorem BoundingSieve.nu_inv_eq_sum_divisors_inv_selbergTerms E1 #

∀ {s : BoundingSieve} {d : ℕ},
  d ∣ s.prodPrimes → (s.nu d)⁻¹ = ∑ l ∈ s.prodPrimes.divisors, if l ∣ d then (BoundingSieve.selbergTerms l)⁻¹ else 0

theorem BoundingSieve.sum_divisors_selbergTerms_eq_selbergTerms_mul_nu_inv E1 #

∀ {s : BoundingSieve} {d : ℕ},
  d ∣ s.prodPrimes →
    (∑ l ∈ s.prodPrimes.divisors, if l ∣ d then BoundingSieve.selbergTerms l else 0) =
      BoundingSieve.selbergTerms d * (s.nu d)⁻¹

theorem BoundingSieve.mainSum_lambdaSquared_eq_sum_sum_mul E1 #

∀ {s : BoundingSieve} (w : ℕ → ℝ),
  BoundingSieve.mainSum (BoundingSieve.lambdaSquared w) =
    ∑ d1 ∈ s.prodPrimes.divisors, ∑ d2 ∈ s.prodPrimes.divisors, s.nu d1 * w d1 * s.nu d2 * w d2 * (s.nu (d1.gcd d2))⁻¹

The main sum we get from Λ² coefficients is a quadratic form. Used to prove the Selberg sieve identity by choosing weights that maximize this sum.

theorem BoundingSieve.mainSum_lambdaSquared_eq_sum_mul_sum_sq E1 #

∀ {s : BoundingSieve} (w : ℕ → ℝ),
  BoundingSieve.mainSum (BoundingSieve.lambdaSquared w) =
    ∑ l ∈ s.prodPrimes.divisors,
      (BoundingSieve.selbergTerms l)⁻¹ * (∑ d ∈ s.prodPrimes.divisors, if l ∣ d then s.nu d * w d else 0) ^ 2

The main sum we get from Λ² coefficients can be written as a diagonalized quadratic form with eigenvalues given by 1/selbergTerms