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.LSeries.PrimesInAP

24 declarations and 2 deprecated aliases. Mathlib docs · Source

Dirichlet's Theorem on primes in arithmetic progression

The goal of this file is to prove Dirichlet's Theorem: If q is a positive natural number and a : ZMod q is invertible, then there are infinitely many prime numbers p such that (p : ZMod q) = a.

The main steps of the proof are as follows.

  1. Define ArithmeticFunction.vonMangoldt.residueClass a for a : ZMod q, which is a function ℕ → ℝ taking the value zero when (n : ZMod q) ≠ a and Λ n else (where Λ is the von Mangoldt function ArithmeticFunction.vonMangoldt; we have Λ (p^k) = log p for prime powers and Λ n = 0 otherwise.)
  2. Show that this function can be written as a linear combination of functions of the form χ * Λ (pointwise product) with Dirichlet characters χ mod q. See ArithmeticFunction.vonMangoldt.residueClass_eq.
  3. This implies that the L-series of ArithmeticFunction.vonMangoldt.residueClass a agrees (on re s > 1) with the corresponding linear combination of negative logarithmic derivatives of Dirichlet L-functions. See ArithmeticFunction.vonMangoldt.LSeries_residueClass_eq.
  4. Define an auxiliary function ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a that is this linear combination of negative logarithmic derivatives of L-functions minus (q.totient)⁻¹/(s-1), which cancels the pole at s = 1. See ArithmeticFunction.vonMangoldt.eqOn_LFunctionResidueClassAux for the statement that the auxiliary function agrees with the L-series of ArithmeticFunction.vonMangoldt.residueClass up to the term (q.totient)⁻¹/(s-1).
  5. Show that the auxiliary function is continuous on re s ≥ 1; see ArithmeticFunction.vonMangoldt.continuousOn_LFunctionResidueClassAux. This relies heavily on the non-vanishing of Dirichlet L-functions on the closed half-plane re s ≥ 1 (DirichletCharacter.LFunction_ne_zero_of_one_le_re), which in turn can only be stated since we know that the L-series of a Dirichlet character extends to an entire function (unless the character is trivial; then there is a simple pole at s = 1); see DirichletCharacter.LFunction_eq_LSeries (contributed by David Loeffler).
  6. Show that the sum of Λ n / n over any residue class, but excluding the primes, converges. See ArithmeticFunction.vonMangoldt.summable_residueClass_non_primes_div.
  7. Combining these ingredients, we can deduce that the sum of Λ n / n over the primes in a residue class must diverge. See ArithmeticFunction.vonMangoldt.not_summable_residueClass_prime_div.
  8. This finally easily implies that there must be infinitely many primes in the residue class.

Definitions

  • ArithmeticFunction.vonMangoldt.residueClass a (see above).
  • ArithmeticFunction.vonMangoldt.continuousOn_LFunctionResidueClassAux (see above).

Main Result

We give two versions of Dirichlet's Theorem:

  • Nat.infinite_setOfPred_prime_and_eq_mod states that the set of primes p such that (p : ZMod q) = a is infinite (when a is invertible in ZMod q).
  • Nat.forall_exists_prime_gt_and_eq_mod states that for any natural number n there is a prime p > n such that (p : ZMod q) = a.

Tags

prime number, arithmetic progression, residue class, Dirichlet's Theorem

The L-series of the von Mangoldt function restricted to a residue class

Dirichlet's Theorem

theorem ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux.congr_simp E1 #

∀ {q : ℕ} (a a_1 : ZMod q),
  a = a_1 →
    ∀ [inst : NeZero q] (s s_1 : ℂ),
      s = s_1 →
        ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a s =
          ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a_1 s_1

abbrev ArithmeticFunction.vonMangoldt.residueClass E1 #

{q : ℕ} → ZMod q → ℕ → ℝ

The von Mangoldt function restricted to the residue class a mod q.

theorem ArithmeticFunction.vonMangoldt.residueClass_nonneg E1 #

∀ {q : ℕ} (a : ZMod q) (n : ℕ), 0 ≤ ArithmeticFunction.vonMangoldt.residueClass a n

theorem ArithmeticFunction.vonMangoldt.residueClass_le E1 #

∀ {q : ℕ} (a : ZMod q) (n : ℕ), ArithmeticFunction.vonMangoldt.residueClass a n ≤ ArithmeticFunction.vonMangoldt n

theorem ArithmeticFunction.vonMangoldt.residueClass_apply_zero E0 #

∀ {q : ℕ} (a : ZMod q), ArithmeticFunction.vonMangoldt.residueClass a 0 = 0

theorem ArithmeticFunction.vonMangoldt.abscissaOfAbsConv_residueClass_le_one E1 #

∀ {q : ℕ} (a : ZMod q), (LSeries.abscissaOfAbsConv fun n ↦ ↑(ArithmeticFunction.vonMangoldt.residueClass a n)) ≤ 1

theorem ArithmeticFunction.vonMangoldt.support_residueClass_prime_div E1 #

∀ {q : ℕ} (a : ZMod q),
  (Function.support fun n ↦ (if Nat.Prime n then ArithmeticFunction.vonMangoldt.residueClass a n else 0) / ↑n) =
    {p | Nat.Prime p ∧ ↑p = a}

The set we are interested in (prime numbers in the residue class a) is the same as the support of ArithmeticFunction.vonMangoldt.residueClass restricted to primes (and divided by n; this is how this result is used later).

theorem ArithmeticFunction.vonMangoldt.summable_residueClass_non_primes_div E1 #

∀ {q : ℕ} (a : ZMod q),
  Summable fun n ↦ (if Nat.Prime n then 0 else ArithmeticFunction.vonMangoldt.residueClass a n) / ↑n

The function n ↦ Λ n / n, restricted to non-primes in a residue class, is summable. This is used to convert results on ArithmeticFunction.vonMangoldt.residueClass to results on primes in an arithmetic progression.

theorem ArithmeticFunction.vonMangoldt.residueClass_apply E0 #

∀ {q : ℕ} {a : ZMod q} [NeZero q],
  IsUnit a →
    ∀ (n : ℕ),
      ↑(ArithmeticFunction.vonMangoldt.residueClass a n) =
        (↑q.totient)⁻¹ * ∑ χ, χ a⁻¹ * χ ↑n * ↑(ArithmeticFunction.vonMangoldt n)

We can express ArithmeticFunction.vonMangoldt.residueClass as a linear combination of twists of the von Mangoldt function by Dirichlet characters.

theorem ArithmeticFunction.vonMangoldt.residueClass_eq E0 #

∀ {q : ℕ} {a : ZMod q} [NeZero q],
  IsUnit a →
    (fun n ↦ ↑(ArithmeticFunction.vonMangoldt.residueClass a n)) =
      (↑q.totient)⁻¹ • ∑ χ, χ a⁻¹ • fun n ↦ χ ↑n * ↑(ArithmeticFunction.vonMangoldt n)

We can express ArithmeticFunction.vonMangoldt.residueClass as a linear combination of twists of the von Mangoldt function by Dirichlet characters.

theorem ArithmeticFunction.vonMangoldt.LSeries_residueClass_eq E0 #

∀ {q : ℕ} {a : ZMod q} [inst : NeZero q],
  IsUnit a →
    ∀ {s : ℂ},
      1 < s.re →
        LSeries (fun n ↦ ↑(ArithmeticFunction.vonMangoldt.residueClass a n)) s =
          -(↑q.totient)⁻¹ * ∑ χ, χ a⁻¹ * (deriv (DirichletCharacter.LFunction χ) s / DirichletCharacter.LFunction χ s)

The L-series of the von Mangoldt function restricted to the residue class a mod q with a invertible in ZMod q is a linear combination of logarithmic derivatives of L-functions of the Dirichlet characters mod q (on re s > 1).

abbrev ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux E0 #

{q : ℕ} → ZMod q → [NeZero q] → ℂ → ℂ

The auxiliary function used, e.g., with the Wiener-Ikehara Theorem to prove Dirichlet's Theorem. On re s > 1, it agrees with the L-series of the von Mangoldt function restricted to the residue class a : ZMod q minus the principal part (q.totient)⁻¹/(s-1) of the pole at s = 1; see ArithmeticFunction.vonMangoldt.eqOn_LFunctionResidueClassAux.

theorem ArithmeticFunction.vonMangoldt.continuousOn_LFunctionResidueClassAux' E1 #

∀ {q : ℕ} (a : ZMod q) [inst : NeZero q],
  ContinuousOn (ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a)
    {s | s = 1 ∨ ∀ (χ : DirichletCharacter ℂ q), DirichletCharacter.LFunction χ s ≠ 0}

The auxiliary function is continuous away from the zeros of the L-functions of the Dirichlet characters mod q (including at s = 1).

theorem ArithmeticFunction.vonMangoldt.continuousOn_LFunctionResidueClassAux E0 #

∀ {q : ℕ} (a : ZMod q) [inst : NeZero q],
  ContinuousOn (ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a) {s | 1 ≤ s.re}

The L-series of the von Mangoldt function restricted to the prime residue class a mod q is continuous on re s ≥ 1 except for a simple pole at s = 1 with residue (q.totient)⁻¹. The statement as given here in terms of ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux is equivalent.

theorem ArithmeticFunction.vonMangoldt.eqOn_LFunctionResidueClassAux E0 #

∀ {q : ℕ} {a : ZMod q} [inst : NeZero q],
  IsUnit a →
    Set.EqOn (ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a)
      (fun s ↦ LSeries (fun n ↦ ↑(ArithmeticFunction.vonMangoldt.residueClass a n)) s - (↑q.totient)⁻¹ / (s - 1))
      {s | 1 < s.re}

The auxiliary function agrees on re s > 1 with the L-series of the von Mangoldt function restricted to the residue class a : ZMod q minus the principal part (q.totient)⁻¹/(s-1) of its pole at s = 1.

theorem ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux_real E1 #

∀ {q : ℕ} {a : ZMod q} [inst : NeZero q],
  IsUnit a →
    ∀ {x : ℝ},
      1 < x →
        ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a ↑x =
          ↑(ArithmeticFunction.vonMangoldt.LFunctionResidueClassAux a ↑x).re

The auxiliary function takes real values for real arguments x > 1.

theorem ArithmeticFunction.vonMangoldt.LSeries_residueClass_lower_bound E1 #

∀ {q : ℕ} [NeZero q] {a : ZMod q},
  IsUnit a →
    ∃ C,
      ∀ {x : ℝ},
        x ∈ Set.Ioc 1 2 →
          (↑q.totient)⁻¹ / (x - 1) - C ≤ ∑' (n : ℕ), ArithmeticFunction.vonMangoldt.residueClass a n / ↑n ^ x

As x approaches 1 from the right along the real axis, the L-series of ArithmeticFunction.vonMangoldt.residueClass is bounded below by (q.totient)⁻¹/(x-1) - C.

theorem ArithmeticFunction.vonMangoldt.not_summable_residueClass_prime_div E1 #

∀ {q : ℕ} [NeZero q] {a : ZMod q},
  IsUnit a → ¬Summable fun n ↦ (if Nat.Prime n then ArithmeticFunction.vonMangoldt.residueClass a n else 0) / ↑n

The function n ↦ Λ n / n restricted to primes in an invertible residue class is not summable. This then implies that there must be infinitely many such primes.

theorem Nat.infinite_setOfPred_prime_and_eq_mod E3 #

∀ {q : ℕ} [NeZero q] {a : ZMod q}, IsUnit a → {p | Nat.Prime p ∧ ↑p = a}.Infinite

Dirichlet's Theorem on primes in arithmetic progression: if q is a positive integer and a : ZMod q is a unit, then there are infinitely many prime numbers p such that (p : ZMod q) = a.

theorem Nat.forall_exists_prime_gt_and_eq_mod E3 #

∀ {q : ℕ} [NeZero q] {a : ZMod q}, IsUnit a → ∀ (n : ℕ), ∃ p > n, Nat.Prime p ∧ ↑p = a

Dirichlet's Theorem on primes in arithmetic progression: if q is a positive integer and a : ZMod q is a unit, then there are infinitely many prime numbers p such that (p : ZMod q) = a.

theorem Nat.forall_exists_prime_gt_and_zmodEq E1 #

∀ (n : ℕ) {q : ℕ} {a : ℤ}, q ≠ 0 → IsCoprime a ↑q → ∃ p > n, Nat.Prime p ∧ ↑p ≡ a [ZMOD ↑q]

Dirichlet's Theorem on primes in arithmetic progression: if q is a positive integer and a : ℤ is coprime to q, then there are infinitely many prime numbers p such that p ≡ a mod q.

theorem Nat.forall_exists_prime_gt_and_modEq E1 #

∀ (n : ℕ) {q a : ℕ}, q ≠ 0 → a.Coprime q → ∃ p > n, Nat.Prime p ∧ p ≡ a [MOD q]

Dirichlet's Theorem on primes in arithmetic progression: if q is a positive integer and a : ℕ is coprime to q, then there are infinitely many prime numbers p such that p ≡ a mod q.

theorem Nat.frequently_atTop_prime_and_modEq E1 #

∀ {q a : ℕ}, q ≠ 0 → a.Coprime q → ∃ᶠ (p : ℕ) in Filter.atTop, Nat.Prime p ∧ p ≡ a [MOD q]

theorem Nat.infinite_setOfPred_prime_and_modEq E1 #

∀ {q a : ℕ}, q ≠ 0 → a.Coprime q → {p | Nat.Prime p ∧ p ≡ a [MOD q]}.Infinite

Deprecated aliases

NameNew nameSince
Nat.infinite_setOf_prime_and_eq_modNat.infinite_setOfPred_prime_and_eq_mod2026-07-09
Nat.infinite_setOf_prime_and_modEqNat.infinite_setOfPred_prime_and_modEq2026-07-09