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.Chebyshev

91 declarations. Mathlib docs · Source

Chebyshev functions

This file defines the Chebyshev functions theta and psi. These give logarithmically weighted sums of primes and prime powers.

Main definitions

  • Chebyshev.psi gives the sum of ArithmeticFunction.vonMangoldt
  • Chebyshev.theta gives the sum of log p over primes
  • Chebyshev.lcmUpto n gives the least common multiple of {1,...,n}

Main results

  • Chebyshev.theta_eq_log_primorial shows that θ x is the log of the product of primes up to x
  • Chebyshev.theta_le_log4_mul_x gives Chebyshev's upper bound on θ
  • Chebyshev.theta_ge gives Chebyshev's lower bound on θ.
  • Chebyshev.psi_eq_log_lcmUpto shows that ψ n is the log of the lcm of {1,...,n}.
  • Chebyshev.psi_eq_sum_theta and Chebyshev.psi_eq_theta_add_sum_theta relate ψ to θ.
  • Chebyshev.psi_sub_theta_le_mul_sqrt gives an upper bound on ψ - θ.
  • Chebyshev.psi_sub_theta_le_psi_add_psi_add_psi and Chebyshev.psi_sub_theta_ge_psi_add_psi_add_psi establish the Costa-Pereira inequalities for ψ - θ.
  • Chebyshev.psi_le_const_mul_self gives Chebyshev's upper bound on ψ.
  • Chebyshev.psi_ge gives Chebyshev's lower bound on ψ.
  • Chebyshev.primeCounting_eq_theta_div_log_add_integral relates the prime counting function to θ
  • Chebyshev.eventually_primeCounting_le gives an asymptotic upper bound on the prime counting function.
  • Chebyshev.pi_le_log4_mul_div gives an explicit upper bound on the prime counting function.
  • Chebyshev.pi_ge gives an explicit lower bound on the prime counting function.

Notation

We introduce the scoped notations θ and ψ in the Chebyshev namespace for the Chebyshev functions.

References

Parts of this file were upstreamed from the PrimeNumberTheoremAnd project by Kontorovich et al, https://github.com/alexKontorovich/PrimeNumberTheoremAnd.

Least common multiple of {1,...,n}

Basic facts about the least common multiple of the first n natural numbers

Relating ψ and θ

We isolate the contributions of different prime powers to ψ and use this to show that ψ and θ are close.

The Costa-Pereira inequalities

The Costa-Pereira inequalities give explicit upper and lower bounds on the difference ψ x - θ x, namely that they lie between ψ x^(1/2) + ψ x^(1/3) + ψ x^(1/7) and ψ x^(1/2) + ψ x^(1/3) + ψ x^(1/5). These are useful for applications in explicit analytic number theory.

Relation to prime counting

We relate θ to the prime counting function π.

def Chebyshev.psi E3 #

ℝ → ℝ

The sum of ArithmeticFunction.vonMangoldt over integers n ≤ x.

def Chebyshev.termψ E1 #

Lean.ParserDescr

The sum of ArithmeticFunction.vonMangoldt over integers n ≤ x.

def Chebyshev.theta E3 #

ℝ → ℝ

The sum of log p over primes p ≤ x.

def Chebyshev.termθ E1 #

Lean.ParserDescr

The sum of log p over primes p ≤ x.

theorem Chebyshev.psi_nonneg E1 #

∀ (x : ℝ), 0 ≤ Chebyshev.psi x

theorem Chebyshev.theta_nonneg E1 #

∀ (x : ℝ), 0 ≤ Chebyshev.theta x

theorem Chebyshev.theta_pos E1 #

∀ {x : ℝ}, 2 ≤ x → 0 < Chebyshev.theta x

theorem Chebyshev.psi_eq_sum_Icc E1 #

∀ (x : ℝ), Chebyshev.psi x = ∑ n ∈ Finset.Icc 0 ⌊x⌋₊, ArithmeticFunction.vonMangoldt n

theorem Chebyshev.theta_eq_sum_Icc E1 #

∀ (x : ℝ), Chebyshev.theta x = ∑ p ∈ Finset.Icc 0 ⌊x⌋₊ with Nat.Prime p, Real.log ↑p

theorem Chebyshev.theta_eq_sum_primesLE E1 #

∀ (x : ℝ), Chebyshev.theta x = ∑ p ∈ ⌊x⌋₊.primesLE, Real.log ↑p

theorem Chebyshev.theta_eq_sum_primesLE_log E1 #

∀ (n : ℕ), Chebyshev.theta ↑n = ∑ p ∈ n.primesLE, Real.log ↑p

theorem Chebyshev.psi_eq_zero_of_lt_two E1 #

∀ {x : ℝ}, x < 2 → Chebyshev.psi x = 0

theorem Chebyshev.psi_eq_zero_iff E0 #

∀ {x : ℝ}, Chebyshev.psi x = 0 ↔ x < 2

theorem Chebyshev.psi_eq_zero_of_le_one E1 #

∀ {x : ℝ}, x ≤ 1 → Chebyshev.psi x = 0

theorem Chebyshev.psi_zero E0 #

Chebyshev.psi 0 = 0

theorem Chebyshev.psi_one E0 #

Chebyshev.psi 1 = 0

theorem Chebyshev.theta_eq_zero_of_lt_two E1 #

∀ {x : ℝ}, x < 2 → Chebyshev.theta x = 0

theorem Chebyshev.theta_eq_zero_iff E0 #

∀ {x : ℝ}, Chebyshev.theta x = 0 ↔ x < 2

theorem Chebyshev.theta_eq_zero_of_le_one E1 #

∀ {x : ℝ}, x ≤ 1 → Chebyshev.theta x = 0

theorem Chebyshev.theta_zero E0 #

Chebyshev.theta 0 = 0

theorem Chebyshev.theta_one E0 #

Chebyshev.theta 1 = 0

theorem Chebyshev.psi_eq_psi_coe_floor E1 #

∀ (x : ℝ), Chebyshev.psi x = Chebyshev.psi ↑⌊x⌋₊

theorem Chebyshev.theta_eq_theta_coe_floor E1 #

∀ (x : ℝ), Chebyshev.theta x = Chebyshev.theta ↑⌊x⌋₊

theorem Chebyshev.psi_mono E1 #

Monotone Chebyshev.psi

theorem Chebyshev.theta_mono E1 #

Monotone Chebyshev.theta

theorem Chebyshev.theta_eq_log_primorial E3 #

∀ (x : ℝ), Chebyshev.theta x = Real.log ↑(primorial ⌊x⌋₊)

θ x is the log of the product of the primes up to x.

theorem Chebyshev.theta_le_log4_mul_x E3 #

∀ {x : ℝ}, 0 ≤ x → Chebyshev.theta x ≤ Real.log 4 * x

Chebyshev's upper bound: θ x ≤ c x with the constant c = log 4.

def Nat.lcmUpto E1 #

ℕ → ℕ

Least common multiple of Icc 1 n.

theorem Nat.lcmUpto_ne_zero E1 #

∀ (n : ℕ), n.lcmUpto ≠ 0

theorem Nat.lcmUpto_pos E1 #

∀ (n : ℕ), 0 < n.lcmUpto

theorem Nat.lcmUpto_dvd_lcmUpto E1 #

∀ {m n : ℕ}, m ≤ n → m.lcmUpto ∣ n.lcmUpto

theorem Nat.factorization_lcmUpto E1 #

∀ (n : ℕ) {p : ℕ}, Nat.Prime p → n.lcmUpto.factorization p = Nat.log p n

theorem Nat.lcmUpto_dvd_factorial E1 #

∀ (n : ℕ), n.lcmUpto ∣ n.factorial

theorem Nat.primeFactors_lcmUpto E1 #

∀ (n : ℕ), n.lcmUpto.primeFactors = n.primesLE

theorem Nat.primorial_dvd_lcmUpto E1 #

∀ (n : ℕ), primorial n ∣ n.lcmUpto

theorem Nat.lcmUpto_eq_prod E1 #

∀ (n : ℕ), n.lcmUpto = ∏ p ∈ n.primesLE, p ^ n.lcmUpto.factorization p

theorem Nat.lcmUpto_eq_prod_pow_log E1 #

∀ (n : ℕ), n.lcmUpto = ∏ p ∈ n.primesLE, p ^ Nat.log p n

theorem Nat.lcmUpto_eq_prod_pow_floor E1 #

∀ (n : ℕ), n.lcmUpto = ∏ p ∈ n.primesLE, p ^ ⌊Real.log ↑n / Real.log ↑p⌋₊

theorem Chebyshev.psi_eq_sum_mul_log_prime E1 #

∀ (n : ℕ), Chebyshev.psi ↑n = ∑ p ∈ n.primesLE, ↑(Nat.log p n) * Real.log ↑p

theorem Chebyshev.psi_le_primeCounting_mul_log E1 #

∀ (n : ℕ), Chebyshev.psi ↑n ≤ ↑n.primeCounting * Real.log ↑n

theorem Chebyshev.psi_le_primeCounting_mul_log' E1 #

∀ (x : ℝ), Chebyshev.psi x ≤ ↑⌊x⌋₊.primeCounting * Real.log x

theorem Chebyshev.psi_eq_log_lcmUpto E3 #

∀ (n : ℕ), Chebyshev.psi ↑n = Real.log ↑n.lcmUpto

ψ n is the logarithm of lcmUpto n.

theorem Chebyshev.choose_dvd_lcmUpto E1 #

∀ {n k : ℕ}, k ≤ n → n.choose k ∣ n.lcmUpto

lcmUpto n is divisible by choose n k for all k ≤ n

theorem Chebyshev.two_pow_le_mul_lcmUpto E1 #

∀ (n : ℕ), 2 ^ n ≤ (n + 1) * n.lcmUpto

theorem Chebyshev.mul_choose_dvd_lcmUpto E1 #

∀ {n k : ℕ}, k ≠ 0 → k ≤ n → k * n.choose k ∣ n.lcmUpto

theorem Chebyshev.mul_mul_choose_dvd_lcmUpto E1 #

∀ {n : ℕ}, n ≠ 0 → n * (n + 1) * (2 * n + 1).choose n ∣ (2 * n + 1).lcmUpto

theorem Chebyshev.mul_four_pow_le_lcmUpto E1 #

∀ {n : ℕ}, n ≠ 0 → n * 4 ^ n ≤ (2 * n + 1).lcmUpto

theorem Chebyshev.two_pow_le_lcmUpto E1 #

∀ {n : ℕ}, 7 ≤ n → 2 ^ n ≤ n.lcmUpto

theorem Chebyshev.sum_PrimePow_eq_sum_sum' E1 #

∀ {R : Type u_1} [inst : AddCommMonoid R] (f : ℕ → R) {x : ℝ},
  0 ≤ x →
    ∀ {N : ℕ},
      ⌊Real.log x / Real.log 2⌋₊ ≤ N →
        ∑ n ∈ Finset.Ioc 0 ⌊x⌋₊ with IsPrimePow n, f n =
          ∑ k ∈ Finset.Icc 1 N, ∑ p ∈ Finset.Ioc 0 ⌊x ^ (1 / ↑k)⌋₊ with Nat.Prime p, f (p ^ k)

A sum over prime powers may be written as a double sum over exponents and then primes.

theorem Chebyshev.sum_PrimePow_eq_sum_sum E1 #

∀ {R : Type u_1} [inst : AddCommMonoid R] (f : ℕ → R) {x : ℝ},
  0 ≤ x →
    ∑ n ∈ Finset.Ioc 0 ⌊x⌋₊ with IsPrimePow n, f n =
      ∑ k ∈ Finset.Icc 1 ⌊Real.log x / Real.log 2⌋₊, ∑ p ∈ Finset.Ioc 0 ⌊x ^ (1 / ↑k)⌋₊ with Nat.Prime p, f (p ^ k)

theorem Chebyshev.psi_eq_sum_theta' E1 #

∀ {x : ℝ},
  0 ≤ x →
    ∀ {N : ℕ}, ⌊Real.log x / Real.log 2⌋₊ ≤ N → Chebyshev.psi x = ∑ n ∈ Finset.Icc 1 N, Chebyshev.theta (x ^ (1 / ↑n))

theorem Chebyshev.psi_eq_sum_theta E3 #

∀ {x : ℝ}, 0 ≤ x → Chebyshev.psi x = ∑ n ∈ Finset.Icc 1 ⌊Real.log x / Real.log 2⌋₊, Chebyshev.theta (x ^ (1 / ↑n))

theorem Chebyshev.psi_eq_theta_add_sum_theta' E1 #

∀ {x : ℝ},
  2 ≤ x →
    ∀ {N : ℕ},
      ⌊Real.log x / Real.log 2⌋₊ ≤ N →
        Chebyshev.psi x = Chebyshev.theta x + ∑ n ∈ Finset.Icc 2 N, Chebyshev.theta (x ^ (1 / ↑n))

theorem Chebyshev.psi_eq_theta_add_sum_theta E3 #

∀ {x : ℝ},
  2 ≤ x →
    Chebyshev.psi x = Chebyshev.theta x + ∑ n ∈ Finset.Icc 2 ⌊Real.log x / Real.log 2⌋₊, Chebyshev.theta (x ^ (1 / ↑n))

theorem Chebyshev.theta_le_psi E1 #

∀ (x : ℝ), Chebyshev.theta x ≤ Chebyshev.psi x

theorem Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log E1 #

∀ {x : ℝ}, 1 ≤ x → |Chebyshev.psi x - Chebyshev.theta x| ≤ 2 * √x * Real.log x

|ψ x - θ x| ≤ c √ x log x with an explicit constant c. To remove the log, see psi_sub_theta_le_mul_sqrt.

theorem Chebyshev.psi_le E1 #

∀ {x : ℝ}, 1 ≤ x → Chebyshev.psi x ≤ Real.log 4 * x + 2 * √x * Real.log x

Explicit upper bound on ψ.

theorem Chebyshev.psi_le_const_mul_self E3 #

∀ {x : ℝ}, 0 ≤ x → Chebyshev.psi x ≤ (Real.log 4 + 4) * x

Chebyshev's bound ψ x ≤ c x with an explicit constant. Note that Chebyshev.psi_le gives a sharper bound with a better main term.

theorem Chebyshev.sum_range_vonMangoldt_le E1 #

∀ (N : ℕ), ∑ i ∈ Finset.range N, ArithmeticFunction.vonMangoldt i ≤ (Real.log 4 + 4) * ↑N

Chebyshev's bound ∑ i < N, Λ i ≤ c N with an explicit constant.

theorem Chebyshev.psi_sub_theta_eq_sum_not_prime E1 #

∀ (x : ℝ),
  Chebyshev.psi x - Chebyshev.theta x = ∑ n ∈ Finset.Ioc 0 ⌊x⌋₊ with ¬Nat.Prime n, ArithmeticFunction.vonMangoldt n

ψ - θ is the sum of Λ over non-primes.

theorem Chebyshev.psi_ge E3 #

∀ (n : ℕ), ↑n * Real.log 2 - Real.log (↑n + 1) ≤ Chebyshev.psi ↑n

The Chebyshev lower bound for ψ.

theorem Chebyshev.psi_ge' E1 #

∀ {x : ℝ}, 0 ≤ x → (x - 1) * Real.log 2 - Real.log (x + 2) ≤ Chebyshev.psi x

theorem Chebyshev.psi_ge_of_seven_le E1 #

∀ {n : ℕ}, 7 ≤ n → ↑n * Real.log 2 ≤ Chebyshev.psi ↑n

theorem Chebyshev.psi_sub_theta_le E1 #

∀ {x : ℝ}, 1 ≤ x → Chebyshev.psi x - Chebyshev.theta x ≤ 2 * √x * Real.log x

theorem Chebyshev.theta_ge E3 #

∀ (n : ℕ), ↑n * Real.log 2 - Real.log (↑n + 1) - 2 * √↑n * Real.log ↑n ≤ Chebyshev.theta ↑n

The Chebyshev lower bound for θ.

theorem Chebyshev.theta_ge' E1 #

∀ {x : ℝ}, 1 ≤ x → (x - 1) * Real.log 2 - Real.log (x + 2) - 2 * √x * Real.log x ≤ Chebyshev.theta x

theorem Chebyshev.psi_sub_theta_le_psi_add_psi_add_psi E3 #

∀ (x : ℝ),
  Chebyshev.psi x - Chebyshev.theta x ≤ Chebyshev.psi (x ^ 2⁻¹) + Chebyshev.psi (x ^ 3⁻¹) + Chebyshev.psi (x ^ 5⁻¹)

theorem Chebyshev.psi_sub_theta_ge_psi_add_psi_add_psi E3 #

∀ {x : ℝ},
  0 ≤ x →
    Chebyshev.psi (x ^ 2⁻¹) + Chebyshev.psi (x ^ 3⁻¹) + Chebyshev.psi (x ^ 7⁻¹) ≤ Chebyshev.psi x - Chebyshev.theta x

theorem Chebyshev.psi_sub_theta_le_mul_sqrt E3 #

∃ C, ∀ (x : ℝ), Chebyshev.psi x - Chebyshev.theta x ≤ C * √x

ψ x = θ x + O( √x ).

theorem Chebyshev.isBigO_psi_sub_theta_sqrt E1 #

(Chebyshev.psi - Chebyshev.theta) =O[Filter.atTop] Real.sqrt

theorem Chebyshev.isLittleO_psi_sub_theta_id E1 #

(Chebyshev.psi - Chebyshev.theta) =o[Filter.atTop] id

Prime powers contribute a sublinear error to the Chebyshev functions.

theorem Chebyshev.isLittleO_sum_vonMangoldt_with_sum_prime_log_with E1 #

∀ (P : ℕ → Prop) [inst : DecidablePred P],
  (fun x ↦
      ∑ n ∈ Finset.Ioc 0 ⌊x⌋₊ with P n, ArithmeticFunction.vonMangoldt n -
        ∑ p ∈ Finset.Ioc 0 ⌊x⌋₊ with Nat.Prime p ∧ P p, Real.log ↑p) =o[Filter.atTop]
    id

Restricting to any predicate preserves the sublinear error from prime powers.

theorem Chebyshev.integrableOn_theta_div_id_mul_log_sq E1 #

∀ (x : ℝ),
  MeasureTheory.IntegrableOn (fun t ↦ Chebyshev.theta t / (t * Real.log t ^ 2)) (Set.Icc 2 x) MeasureTheory.volume

Integrability for the integral in Chebyshev.primeCounting_eq_theta_div_log_add_integral.

theorem Chebyshev.primeCounting_eq_theta_div_log_add_integral E3 #

∀ {x : ℝ},
  2 ≤ x →
    ↑⌊x⌋₊.primeCounting = Chebyshev.theta x / Real.log x + ∫ (t : ℝ) in 2..x, Chebyshev.theta t / (t * Real.log t ^ 2)

Expresses the prime counting function π in terms of θ by using Abel summation.

theorem Chebyshev.theta_eq_primeCounting_mul_log_sub_integral E1 #

∀ {x : ℝ}, 2 ≤ x → Chebyshev.theta x = ↑⌊x⌋₊.primeCounting * Real.log x - ∫ (t : ℝ) in 2..x, ↑⌊t⌋₊.primeCounting / t

Expresses the Chebyshev theta function ϑ in terms of π by using Abel summation.

theorem Chebyshev.intervalIntegrable_one_div_log_sq E1 #

∀ {a b : ℝ}, 1 < a → 1 < b → IntervalIntegrable (fun x ↦ 1 / Real.log x ^ 2) MeasureTheory.volume a b

theorem Chebyshev.integral_one_div_log_sq_isBigO E1 #

(fun x ↦ ∫ (t : ℝ) in 2..x, 1 / Real.log t ^ 2) =O[Filter.atTop] fun x ↦ x / Real.log x ^ 2

theorem Chebyshev.integral_theta_div_log_sq_isBigO E1 #

(fun x ↦ ∫ (t : ℝ) in 2..x, Chebyshev.theta t / (t * Real.log t ^ 2)) =O[Filter.atTop] fun x ↦ x / Real.log x ^ 2

Bound on the integral in Chebyshev.primeCounting_eq_theta_div_log_add_integral.

theorem Chebyshev.integral_theta_div_log_sq_isLittleO E1 #

(fun x ↦ ∫ (t : ℝ) in 2..x, Chebyshev.theta t / (t * Real.log t ^ 2)) =o[Filter.atTop] fun x ↦ x / Real.log x

theorem Chebyshev.primeCounting_sub_theta_div_log_isBigO E1 #

(fun x ↦ ↑⌊x⌋₊.primeCounting - Chebyshev.theta x / Real.log x) =O[Filter.atTop] fun x ↦ x / Real.log x ^ 2

theorem Chebyshev.eventually_primeCounting_le E3 #

∀ {ε : ℝ}, 0 < ε → ∀ᶠ (x : ℝ) in Filter.atTop, ↑⌊x⌋₊.primeCounting ≤ (Real.log 4 + ε) * x / Real.log x

Chebyshev's upper bound on the prime counting function

theorem Chebyshev.pi_ge E3 #

∀ (n : ℕ), (↑n * Real.log 2 - Real.log (↑n + 1)) / Real.log ↑n ≤ ↑n.primeCounting

theorem Chebyshev.pi_ge' E1 #

∀ {x : ℝ}, 1 < x → ((x - 1) * Real.log 2 - Real.log (x + 2)) / Real.log x ≤ ↑⌊x⌋₊.primeCounting

theorem Chebyshev.pi_ge_of_four_le E1 #

∀ {n : ℕ}, 4 ≤ n → ↑n * Real.log 2 / Real.log ↑n ≤ ↑n.primeCounting

theorem Chebyshev.theta_le_pi_mul_log E1 #

∀ (n : ℕ), Chebyshev.theta ↑n ≤ ↑n.primeCounting * Real.log ↑n

theorem Chebyshev.theta_le_pi_mul_log' E1 #

∀ (x : ℝ), Chebyshev.theta x ≤ ↑⌊x⌋₊.primeCounting * Real.log x

theorem Chebyshev.pi_le_log4_mul_div E3 #

∀ {x : ℝ}, 1 < x → ↑⌊x⌋₊.primeCounting ≤ Real.log 4 * x / Real.log √x + √x

A weak but completely explicit upper bound on $\pi(x)$.

theorem Chebyshev.isLittleO_primeCounting_mul_log_sub_theta E3 #

(fun x ↦ ↑⌊x⌋₊.primeCounting * Real.log x - Chebyshev.theta x) =o[Filter.atTop] id

Replacing the logarithm of each prime by log x gives a sublinear error.

theorem Chebyshev.isLittleO_card_prime_with_mul_log_sum_prime_log_with E1 #

∀ (P : ℕ → Prop) [inst : DecidablePred P],
  (fun x ↦
      ↑{p ∈ Finset.Ioc 0 ⌊x⌋₊ | Nat.Prime p ∧ P p}.card * Real.log x -
        ∑ p ∈ Finset.Ioc 0 ⌊x⌋₊ with Nat.Prime p ∧ P p, Real.log ↑p) =o[Filter.atTop]
    id

Restricting to any predicate preserves the sublinear error from replacing log p by log x.

def Mathlib.Meta.Positivity.evalTheta E1 #

Mathlib.Meta.Positivity.PositivityExt

Extension for the positivity tactic: the first Chebyshev function is nonnegative.

def Mathlib.Meta.Positivity.evalPsi E1 #

Mathlib.Meta.Positivity.PositivityExt

Extension for the positivity tactic: the second Chebyshev function is nonnegative.