Different Proofs

2. Infinitude of Primes🔗

Definition2.1
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Theorem 2.3
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

There are infinitely many prime numbers.

Lean code for Definition2.1●1 definition
Definition2.2
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

For any natural number n, there exists a prime number greater than n.

Lean code for Definition2.2●1 definition
Theorem2.3
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 2.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

The formulations Definition 2.1 and Definition 2.2 are equivalent.

Lean code for Theorem2.3●1 theorem
  • theorem InfinitudeOfPrimes_iff_InfinitudeOfPrimes' :
      InfinitudeOfPrimes ↔ InfinitudeOfPrimes'
    theorem InfinitudeOfPrimes_iff_InfinitudeOfPrimes' :
      InfinitudeOfPrimes ↔ InfinitudeOfPrimes'
Proof for Theorem 2.3
uses 0

Specialize the general characterization of infinite subsets of a locally finite linear order to the set of natural primes.

First proof is by Euclid.

Theorem2.4
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

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
Proof for Theorem 2.4
uses 0

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.

Theorem2.5
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.5●1 theorem
Proof for Theorem 2.5

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.

Definition2.6
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Lemma 2.7
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The n-th Fermat number is F_n = 2^{2^n} + 1.

Lean code for Definition2.6●1 definition
Lemma2.7
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀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
  • theorem InfinitudeOfPrimes.Goldbach.Fermat_gt_two (n : ℕ) :
      InfinitudeOfPrimes.Goldbach.Fermat n ≥ 2
    theorem InfinitudeOfPrimes.Goldbach.Fermat_gt_two
      (n : ℕ) :
      InfinitudeOfPrimes.Goldbach.Fermat n ≥ 2
Proof for Lemma 2.7
uses 0

Since 2^{2^n} \ge 1, adding one gives F_n \ge 2.

Lemma2.8
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

Every Fermat number is odd. This is about Definition 2.6.

Lean code for Lemma2.8●1 theorem
  • theorem InfinitudeOfPrimes.Goldbach.Fermat_odd (n : ℕ) :
      Odd (InfinitudeOfPrimes.Goldbach.Fermat n)
    theorem InfinitudeOfPrimes.Goldbach.Fermat_odd
      (n : ℕ) :
      Odd
        (InfinitudeOfPrimes.Goldbach.Fermat n)
Proof for Lemma 2.8
uses 0

The exponent 2^n is positive, so 2^{2^n} is even and 2^{2^n}+1 is odd.

Lemma2.9
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

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
  • 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
Proof for Lemma 2.9
uses 0

Inductively prove that \prod_{k<n} F_k = F_n - 2, then rewrite the next product using the difference-of-squares identity.

Lemma2.10
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Lemma 2.8
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

For all n, F_{n+1} is coprime to \prod_{k=0}^{n} F_k. This depends on Lemma 2.9 and Lemma 2.8.

Lean code for Lemma2.10●1 theorem
  • 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)
Proof for Lemma 2.10
uses 0

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.

Lemma2.11
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

Distinct Fermat numbers are coprime. This follows from Lemma 2.10.

Lean code for Lemma2.11●1 theorem
  • 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)
Proof for Lemma 2.11
uses 0

For m<n, the number F_m divides the product of the earlier Fermat numbers, which is coprime to F_n.

Theorem2.12
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.12●1 theorem
Proof for Theorem 2.12

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.

Theorem2.13
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

The harmonic series is unbounded.

Lean code for Theorem2.13●1 theorem
  • theorem InfinitudeOfPrimes.Euler.harmonic_unbounded (M : ℝ) :
      ∃ n, ↑(harmonic n) > M
    theorem InfinitudeOfPrimes.Euler.harmonic_unbounded
      (M : ℝ) : ∃ n, ↑(harmonic n) > M
Proof for Theorem 2.13
uses 0

Use the inequality \log(n+1) \le H_n and the fact that the logarithm is unbounded.

Theorem2.14
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

The finite Euler product over primes at most n is at least the n-th harmonic number.

Lean code for Theorem2.14●1 theorem
  • 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
Proof for Theorem 2.14
uses 0

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.

Theorem2.15
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.15●1 theorem
Proof for Theorem 2.15
Proof uses 2
Proof dependency previews
Preview
Theorem 2.13
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

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

Definition2.16
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Lemma 2.17
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

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
Lemma2.17
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

Every term of Saidak's sequence is at least 2. This is about Definition 2.16.

Lean code for Lemma2.17●1 theorem
  • theorem InfinitudeOfPrimes.Saidak.a_ge_two (n : ℕ) :
      2 ≤ InfinitudeOfPrimes.Saidak.a n
    theorem InfinitudeOfPrimes.Saidak.a_ge_two
      (n : ℕ) :
      2 ≤ InfinitudeOfPrimes.Saidak.a n
Proof for Lemma 2.17
uses 0

The base case is 2; the inductive step multiplies two positive factors and stays at least 2.

Lemma2.18
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 2.16
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

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
  • 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
Proof for Lemma 2.18
uses 0

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.

Theorem2.19
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.19●1 theorem
Proof for Theorem 2.19

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.

Lemma2.20
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

The Fibonacci number F_{37} factors as 73 \cdot 149 \cdot 2221.

Lean code for Lemma2.20●1 theorem
Proof for Lemma 2.20
uses 0

This is a direct computation.

Lemma2.21
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

For any odd prime p, the Fibonacci number F_p is at least 2.

Lean code for Lemma2.21●1 theorem
  • 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
Proof for Lemma 2.21
uses 0

An odd prime is at least 3, and the Fibonacci sequence is monotone, so F_p \ge F_3 = 2.

Lemma2.22
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

If p and q are distinct primes, then F_p and F_q are coprime.

Lean code for Lemma2.22●1 theorem
  • 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)
Proof for Lemma 2.22
uses 0

Distinct primes are coprime, and \gcd(F_m,F_n) = F_{\gcd(m,n)} reduces the result to F_1=1.

Theorem2.23
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.23●1 theorem
Proof for Theorem 2.23
Proof uses 3
Proof dependency previews
Preview
Lemma 2.20
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

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.

Theorem2.24
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

There are infinitely many primes congruent to 1 modulo 4.

Lean code for Theorem2.24●1 theorem
  • 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`. 
Proof for Theorem 2.24
uses 0

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.

Theorem2.25
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.25●1 theorem
Proof for Theorem 2.25

This follows from Theorem 2.24.

Lemma2.26
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

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
  • 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`. 
Proof for Lemma 2.26
uses 0

If every prime factor of n were congruent to 1 modulo 4, then n would be congruent to 1 modulo 4, contradicting the assumption.

Theorem2.27
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

There are infinitely many primes congruent to 3 modulo 4.

Lean code for Theorem2.27●1 theorem
  • 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`. 
Proof for Theorem 2.27

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.

Theorem2.28
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.28●1 theorem
Proof for Theorem 2.28

This follows from Theorem 2.27.

The seventh proof combines the Euler product for \zeta(2) with the irrationality of \pi^2.

Theorem2.29
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

Niven's theorem: \pi^2 is irrational.

Lean code for Theorem2.29●1 theorem
Proof for Theorem 2.29
uses 0

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.

Theorem2.30
Group: Infinitude of primes. (29)
Group member previews
Preview
Definition 2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

There are infinitely many prime numbers.

Lean code for Theorem2.30●1 theorem
  • 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. 
Proof for Theorem 2.30

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.