2. Infinitude of Primes
There are infinitely many prime numbers.
Lean code for Definition2.1●1 definition
Associated Lean declarations
-
InfinitudeOfPrimes[complete]
-
InfinitudeOfPrimes[complete]
-
defdefined in DifferentProofs/InfinitudeOfPrimes/Defs.leancomplete
def InfinitudeOfPrimes : Prop
def InfinitudeOfPrimes : Prop
For any natural number n, there exists a prime number greater than n.
Lean code for Definition2.2●1 definition
Associated Lean declarations
-
InfinitudeOfPrimes'[complete]
-
InfinitudeOfPrimes'[complete]
-
defdefined in DifferentProofs/InfinitudeOfPrimes/Defs.leancomplete
def InfinitudeOfPrimes' : Prop
def InfinitudeOfPrimes' : Prop
The formulations Definition 2.1 and Definition 2.2 are equivalent.
Lean code for Theorem2.3●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Basic.leancomplete
theorem InfinitudeOfPrimes_iff_InfinitudeOfPrimes' : InfinitudeOfPrimes ↔ InfinitudeOfPrimes'
theorem InfinitudeOfPrimes_iff_InfinitudeOfPrimes' : InfinitudeOfPrimes ↔ InfinitudeOfPrimes'
Specialize the general characterization of infinite subsets of a locally finite linear order to the set of natural primes.
First proof is by Euclid.
There are infinitely many prime numbers. This proof uses the product of the finite set of all primes and proves Definition 2.1.
Lean code for Theorem2.4●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Euclid'[complete]
-
InfinitudeOfPrimes_Euclid'[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Euclid.leancomplete
theorem InfinitudeOfPrimes_Euclid' : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Euclid' : InfinitudeOfPrimes
If the set of primes were finite, a prime divisor of one plus their product would already lie in the set, and therefore divide both the product and the product plus one.
A variant of Euclid's proof uses n! + 1 instead of the product of all primes.
There are infinitely many prime numbers.
Lean code for Theorem2.5●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Euclid[complete]
-
InfinitudeOfPrimes_Euclid[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Euclid.leancomplete
theorem InfinitudeOfPrimes_Euclid : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Euclid : InfinitudeOfPrimes
If all primes were bounded by n, a prime divisor of n! + 1 would both
divide n! and divide n! + 1, hence divide 1, impossible; so the primes
are infinite Definition 2.1.
Second proof is by Goldbach, using Fermat numbers F_n = 2^{2^n} + 1 and their pairwise coprimality.
The n-th Fermat number is F_n = 2^{2^n} + 1.
Lean code for Definition2.6●1 definition
Associated Lean declarations
-
InfinitudeOfPrimes.Goldbach.Fermat[complete]
-
InfinitudeOfPrimes.Goldbach.Fermat[complete]
-
defdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
def InfinitudeOfPrimes.Goldbach.Fermat (n : ℕ) : ℕ
def InfinitudeOfPrimes.Goldbach.Fermat (n : ℕ) : ℕ
For all natural numbers n, the Fermat number F_n is at least 2.
This is about Definition 2.6.
Lean code for Lemma2.7●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes.Goldbach.Fermat_gt_two (n : ℕ) : InfinitudeOfPrimes.Goldbach.Fermat n ≥ 2
theorem InfinitudeOfPrimes.Goldbach.Fermat_gt_two (n : ℕ) : InfinitudeOfPrimes.Goldbach.Fermat n ≥ 2
Since 2^{2^n} \ge 1, adding one gives F_n \ge 2.
Every Fermat number is odd. This is about Definition 2.6.
Lean code for Lemma2.8●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes.Goldbach.Fermat_odd[complete]
-
InfinitudeOfPrimes.Goldbach.Fermat_odd[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes.Goldbach.Fermat_odd (n : ℕ) : Odd (InfinitudeOfPrimes.Goldbach.Fermat n)
theorem InfinitudeOfPrimes.Goldbach.Fermat_odd (n : ℕ) : Odd (InfinitudeOfPrimes.Goldbach.Fermat n)
The exponent 2^n is positive, so 2^{2^n} is even and
2^{2^n}+1 is odd.
For all n, the Fermat numbers satisfy
F_{n+1} = \prod_{k=0}^{n} F_k + 2. This uses
Definition 2.6.
Lean code for Lemma2.9●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes.Goldbach.Fermat_recurrence (n : ℕ) : InfinitudeOfPrimes.Goldbach.Fermat (n + 1) = ∏ k ∈ Finset.range (n + 1), InfinitudeOfPrimes.Goldbach.Fermat k + 2
theorem InfinitudeOfPrimes.Goldbach.Fermat_recurrence (n : ℕ) : InfinitudeOfPrimes.Goldbach.Fermat (n + 1) = ∏ k ∈ Finset.range (n + 1), InfinitudeOfPrimes.Goldbach.Fermat k + 2
Inductively prove that \prod_{k<n} F_k = F_n - 2, then rewrite the next
product using the difference-of-squares identity.
Lean code for Lemma2.10●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes.Goldbach.Fermat_coprime (n : ℕ) : (InfinitudeOfPrimes.Goldbach.Fermat (n + 1)).Coprime (∏ k ∈ Finset.range (n + 1), InfinitudeOfPrimes.Goldbach.Fermat k)
theorem InfinitudeOfPrimes.Goldbach.Fermat_coprime (n : ℕ) : (InfinitudeOfPrimes.Goldbach.Fermat (n + 1)).Coprime (∏ k ∈ Finset.range (n + 1), InfinitudeOfPrimes.Goldbach.Fermat k)
The recurrence writes F_{n+1} as the product plus 2. The product is odd,
so the only possible common divisor with 2 is 1.
Distinct Fermat numbers are coprime. This follows from Lemma 2.10.
Lean code for Lemma2.11●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes.Goldbach.Fermat_pairwise_coprime : Pairwise fun m n ↦ (InfinitudeOfPrimes.Goldbach.Fermat m).Coprime (InfinitudeOfPrimes.Goldbach.Fermat n)
theorem InfinitudeOfPrimes.Goldbach.Fermat_pairwise_coprime : Pairwise fun m n ↦ (InfinitudeOfPrimes.Goldbach.Fermat m).Coprime (InfinitudeOfPrimes.Goldbach.Fermat n)
For m<n, the number F_m divides the product of the earlier Fermat
numbers, which is coprime to F_n.
There are infinitely many prime numbers.
Lean code for Theorem2.12●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Goldbach[complete]
-
InfinitudeOfPrimes_Goldbach[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Goldbach.leancomplete
theorem InfinitudeOfPrimes_Goldbach : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Goldbach : InfinitudeOfPrimes
Each Fermat number has a prime divisor. Pairwise coprimality Lemma 2.11 makes the chosen prime divisors pairwise distinct, producing infinitely many primes.
Third proof is by Euler, using the divergence of the harmonic series and the Euler product formula.
The harmonic series is unbounded.
Lean code for Theorem2.13●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Euler.leancomplete
theorem InfinitudeOfPrimes.Euler.harmonic_unbounded (M : ℝ) : ∃ n, ↑(harmonic n) > M
theorem InfinitudeOfPrimes.Euler.harmonic_unbounded (M : ℝ) : ∃ n, ↑(harmonic n) > M
Use the inequality \log(n+1) \le H_n and the fact that the logarithm is
unbounded.
The finite Euler product over primes at most n is at least the n-th
harmonic number.
Lean code for Theorem2.14●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Euler.leancomplete
theorem InfinitudeOfPrimes.Euler.prod_prime_div_prime_sub_one_ge_harmonic (n : ℕ) : ∏ p ∈ Finset.range (n + 1) with Nat.Prime p, ↑p / (↑p - 1) ≥ harmonic n
theorem InfinitudeOfPrimes.Euler.prod_prime_div_prime_sub_one_ge_harmonic (n : ℕ) : ∏ p ∈ Finset.range (n + 1) with Nat.Prime p, ↑p / (↑p - 1) ≥ harmonic n
Expand each factor p/(p-1) as a finite geometric sum. The resulting product
contains terms corresponding to reciprocals of positive integers up to n.
There are infinitely many prime numbers.
Lean code for Theorem2.15●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Euler[complete]
-
InfinitudeOfPrimes_Euler[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Euler.leancomplete
theorem InfinitudeOfPrimes_Euler : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Euler : InfinitudeOfPrimes
If there were only finitely many primes, the Euler product over all of them would be fixed. But the product over primes below a sufficiently large bound Theorem 2.14 dominates arbitrarily large harmonic sums Theorem 2.13, a contradiction.
Fourth proof is by Saidak, using the sequence a_0 = 2 and a_{n+1} = a_n(a_n+1).
Saidak's sequence is defined by a_0 = 2 and
a_{n+1} = a_n(a_n+1).
Lean code for Definition2.16●1 definition
Associated Lean declarations
-
InfinitudeOfPrimes.Saidak.a[complete]
-
InfinitudeOfPrimes.Saidak.a[complete]
-
defdefined in DifferentProofs/InfinitudeOfPrimes/Saidak.leancomplete
def InfinitudeOfPrimes.Saidak.a : ℕ → ℕ
def InfinitudeOfPrimes.Saidak.a : ℕ → ℕ
Every term of Saidak's sequence is at least 2. This is about
Definition 2.16.
Lean code for Lemma2.17●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes.Saidak.a_ge_two[complete]
-
InfinitudeOfPrimes.Saidak.a_ge_two[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Saidak.leancomplete
theorem InfinitudeOfPrimes.Saidak.a_ge_two (n : ℕ) : 2 ≤ InfinitudeOfPrimes.Saidak.a n
theorem InfinitudeOfPrimes.Saidak.a_ge_two (n : ℕ) : 2 ≤ InfinitudeOfPrimes.Saidak.a n
The base case is 2; the inductive step multiplies two positive factors and
stays at least 2.
For every n, the term a_n has at least n+1 distinct prime divisors.
This uses Definition 2.16 and Lemma 2.17.
Lean code for Lemma2.18●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Saidak.leancomplete
theorem InfinitudeOfPrimes.Saidak.a_primeFactors_card_ge (n : ℕ) : n + 1 ≤ (InfinitudeOfPrimes.Saidak.a n).primeFactors.card
theorem InfinitudeOfPrimes.Saidak.a_primeFactors_card_ge (n : ℕ) : n + 1 ≤ (InfinitudeOfPrimes.Saidak.a n).primeFactors.card
Consecutive numbers a_n and a_n+1 are coprime, so the prime factors of
a_{n+1} split as a disjoint union of the prime factors of the two factors.
There are infinitely many prime numbers.
Lean code for Theorem2.19●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Saidak[complete]
-
InfinitudeOfPrimes_Saidak[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Saidak.leancomplete
theorem InfinitudeOfPrimes_Saidak : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Saidak : InfinitudeOfPrimes
If only finitely many primes existed, the number of prime factors of any
a_n would be bounded by that finite set, contradicting the previous lemma
Lemma 2.18 for large n.
Fifth proof is by Wunderlich, using Fibonacci numbers, their coprimality, and the fact that F_{37} has three distinct prime factors.
The Fibonacci number F_{37} factors as 73 \cdot 149 \cdot 2221.
Lean code for Lemma2.20●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes.Wunderlich.fib_37[complete]
-
InfinitudeOfPrimes.Wunderlich.fib_37[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Wunderlich.leancomplete
theorem InfinitudeOfPrimes.Wunderlich.fib_37 : Nat.fib 37 = 73 * 149 * 2221
theorem InfinitudeOfPrimes.Wunderlich.fib_37 : Nat.fib 37 = 73 * 149 * 2221
This is a direct computation.
For any odd prime p, the Fibonacci number F_p is at least 2.
Lean code for Lemma2.21●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Wunderlich.leancomplete
theorem InfinitudeOfPrimes.Wunderlich.fib_prime_ge_two {p : ℕ} (hp : Nat.Prime p) (hp2 : p ≠ 2) : 2 ≤ Nat.fib p
theorem InfinitudeOfPrimes.Wunderlich.fib_prime_ge_two {p : ℕ} (hp : Nat.Prime p) (hp2 : p ≠ 2) : 2 ≤ Nat.fib p
An odd prime is at least 3, and the Fibonacci sequence is monotone, so
F_p \ge F_3 = 2.
If p and q are distinct primes, then F_p and F_q are coprime.
Lean code for Lemma2.22●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Wunderlich.leancomplete
theorem InfinitudeOfPrimes.Wunderlich.fib_coprime_of_distinct_primes {p q : ℕ} (hp : Nat.Prime p) (hq : Nat.Prime q) (hpq : p ≠ q) : (Nat.fib p).Coprime (Nat.fib q)
theorem InfinitudeOfPrimes.Wunderlich.fib_coprime_of_distinct_primes {p q : ℕ} (hp : Nat.Prime p) (hq : Nat.Prime q) (hpq : p ≠ q) : (Nat.fib p).Coprime (Nat.fib q)
Distinct primes are coprime, and
\gcd(F_m,F_n) = F_{\gcd(m,n)} reduces the result to F_1=1.
There are infinitely many prime numbers.
Lean code for Theorem2.23●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Wunderlich[complete]
-
InfinitudeOfPrimes_Wunderlich[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Wunderlich.leancomplete
theorem InfinitudeOfPrimes_Wunderlich : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Wunderlich : InfinitudeOfPrimes
Assuming finitely many primes, look at Fibonacci numbers indexed by odd primes,
each at least 2 Lemma 2.21. They are pairwise coprime
Lemma 2.22, but F_{37} already has three
distinct prime factors Lemma 2.20, contradicting the
finite counting bound.
The sixth set of proofs shows a stronger result: there are infinitely many primes in certain congruence classes.
There are infinitely many primes congruent to 1 modulo 4.
Lean code for Theorem2.24●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_cong_one_four[complete]
-
InfinitudeOfPrimes_cong_one_four[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Dirichlet.leancomplete
theorem InfinitudeOfPrimes_cong_one_four : InfinitudeOfPrimes_cong 1 4
theorem InfinitudeOfPrimes_cong_one_four : InfinitudeOfPrimes_cong 1 4
**Infinitely many primes are congruent to `1` mod `4`**, because `-1` is a square modulo every prime factor of `4 * M ^ 2 + 1`.
Assume that there are only finitely many such primes.
Let P be the product of all such primes and consider N = 4P^2 + 1.
If we choose a prime factor q of N, then (2P)^2 \equiv -1 \pmod{q}. Hence -1 is a square modulo q, so q \equiv 1 \pmod{4}, which contradicts
the assumption that P is the product of all such primes.
There are infinitely many prime numbers.
Lean code for Theorem2.25●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_from_one_four[complete]
-
InfinitudeOfPrimes_from_one_four[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Dirichlet.leancomplete
theorem InfinitudeOfPrimes_from_one_four : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_from_one_four : InfinitudeOfPrimes
This follows from Theorem 2.24.
If a natural number is congruent to 3 modulo 4, then it has a prime factor that is congruent to 3 modulo 4.
Lean code for Lemma2.26●1 theorem
Associated Lean declarations
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Dirichlet.leancomplete
theorem InfinitudeOfPrimes.Dirichlet.nat_three_mod_four_div_of_prime_three_mod_four (n : ℕ) (hn : n ≡ 3 [MOD 4]) : ∃ p, Nat.Prime p ∧ p ≡ 3 [MOD 4] ∧ p ∣ n
theorem InfinitudeOfPrimes.Dirichlet.nat_three_mod_four_div_of_prime_three_mod_four (n : ℕ) (hn : n ≡ 3 [MOD 4]) : ∃ p, Nat.Prime p ∧ p ≡ 3 [MOD 4] ∧ p ∣ n
A natural number congruent to `3` mod `4` has a prime factor congruent to `3` mod `4`: it is odd, and a product of primes that are all `1` mod `4` is again `1` mod `4`.
If every prime factor of n were congruent to 1 modulo 4, then n would be congruent to 1 modulo 4, contradicting the assumption.
There are infinitely many primes congruent to 3 modulo 4.
Lean code for Theorem2.27●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_cong_three_four[complete]
-
InfinitudeOfPrimes_cong_three_four[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Dirichlet.leancomplete
theorem InfinitudeOfPrimes_cong_three_four : InfinitudeOfPrimes_cong 3 4
theorem InfinitudeOfPrimes_cong_three_four : InfinitudeOfPrimes_cong 3 4
**Infinitely many primes are congruent to `3` mod `4`**, because `4 * M - 1` is congruent to `3` mod `4` and so has a prime factor congruent to `3` mod `4`.
Assume that there are only finitely many such primes.
Let P be the product of all such primes and consider N = 4P - 1.
Since N \equiv 3 \pmod{4}, it has a prime factor q with q \equiv 3 \pmod{4}
Lemma 2.26, which contradicts the assumption that P is the product of all such primes.
There are infinitely many prime numbers.
Lean code for Theorem2.28●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_from_three_four[complete]
-
InfinitudeOfPrimes_from_three_four[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Dirichlet.leancomplete
theorem InfinitudeOfPrimes_from_three_four : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_from_three_four : InfinitudeOfPrimes
This follows from Theorem 2.27.
The seventh proof combines the Euler product for \zeta(2) with the irrationality of \pi^2.
Niven's theorem: \pi^2 is irrational.
Lean code for Theorem2.29●1 theorem
Associated Lean declarations
-
irrational_pi_sq[complete]
-
irrational_pi_sq[complete]
-
theoremdefined in DifferentProofsForMathlib/Analysis/Real/Pi/Irrational.leancomplete
theorem irrational_pi_sq : Irrational (Real.pi ^ 2)
theorem irrational_pi_sq : Irrational (Real.pi ^ 2)
**Niven's theorem**: `π ^ 2` is irrational.
Set I_n = \int_0^1 (x-x^2)^n \sin(\pi x)\,dx. Since (x-x^2)^n vanishes at both endpoints,
integrating by parts twice gives
\pi^2 I_{n+2} = 2(n+2)(2n+3) I_{n+1} - (n+2)(n+1) I_n.
Suppose \pi^2 = a/b with a, b integers and b > 0. The recursion then shows that the
integers defined by A_0 = 2, A_1 = 4b and A_{n+2} = 2(2n+3) b A_{n+1} - ab A_n satisfy
A_n \cdot n! = b^n \pi^{2n+1} I_n. This is Niven's assertion that
\pi \int_0^1 a^n x^n (1-x)^n \sin(\pi x)/n!\,dx is an integer, which he reads off from the
auxiliary function g = b^n \sum_k (-1)^k \pi^{2n-2k} f^{(2k)} for f(x) = x^n(1-x)^n/n!;
the telescoping property of g is exactly the recursion above.
The integrand of I_n is positive on (0,1), so each A_n is a positive integer and
A_n \ge 1. But 0 \le x - x^2 \le 1/4 and \sin(\pi x) \le 1 on [0,1] give
I_n \le 4^{-n}, hence A_n \le \pi (a/4)^n / n!, which tends to 0. Contradiction.
There are infinitely many prime numbers.
Lean code for Theorem2.30●1 theorem
Associated Lean declarations
-
InfinitudeOfPrimes_Zeta[complete]
-
InfinitudeOfPrimes_Zeta[complete]
-
theoremdefined in DifferentProofs/InfinitudeOfPrimes/Zeta.leancomplete
theorem InfinitudeOfPrimes_Zeta : InfinitudeOfPrimes
theorem InfinitudeOfPrimes_Zeta : InfinitudeOfPrimes
**The infinitude of primes**, from the irrationality of `π ^ 2` and the Euler product for the Riemann zeta function.
If there were only finitely many primes, the partial Euler products
\prod_{p < n} (1 - p^{-2})^{-1} would be constant for large n, so Euler's product formula
\zeta(2) = \prod_p (1 - p^{-2})^{-1} would exhibit \zeta(2) as a finite product of
rational numbers, hence as a rational number. But \zeta(2) = \pi^2/6 and \pi^2 is
irrational Theorem 2.29, a contradiction.