Mathlib theorem · Existing formal mathematics

Existing in Mathlib · Number theory

Infinitely Many Primes

Choose any natural number n. There is always a prime number p with p at least n, so no finite threshold contains all primes.

Exact theorem

Exact Mathlib statement

theorem Nat.exists_infinite_primes (n : ℕ) : ∃ p, n ≤ p ∧ Nat.Prime p

The theorem at a glance

Infinitely Many Primes at a glance

A visual guide to the theorem's hypotheses, structure, and conclusion; the exact statement gives the formal detail.

Every threshold has a prime at or above it; the poster presents unboundedness without implying a prime-gap or counting estimate. Explanatory diagram.
Detailed visual description

A blue threshold gate labeled n opens onto a gold path toward a green prime beacon p and a repeating horizon. The formal threshold-existence statement sits above, while lower panels explain the three reading steps and explicitly exclude prime-gap and prime-count estimates.

Statement structure

From hypotheses to conclusion

Statement map for Infinitely Many PrimesFor every natural-number threshold, there is a prime at or above it. The pinned upstream declaration is Nat.exists_infinite_primes. The exact checked statement is theorem Nat.exists_infinite_primes (n : ℕ) : ∃ p, n ≤ p ∧ Nat.Prime p.Mathematical readingFor every natural-numberthreshold, there is aprime at or above it.Pinned declarationmathlib ·Nat.exists_infinite_primesExact checked formtheoremNat.exists_infinite_primes(n : ℕ) : ∃ p, n ≤ p ∧Nat.Prime pStatement map for Infinitely Many PrimesFor every natural-number threshold, there is a prime at or above it. The pinned upstream declaration is Nat.exists_infinite_primes. The exact checked statement is theorem Nat.exists_infinite_primes (n : ℕ) : ∃ p, n ≤ p ∧ Nat.Prime p.Mathematical readingFor every natural-numberthreshold, there is aprime at or above it.Pinned declarationmathlib ·Nat.exists_infinite_primesExact checked formtheoremNat.exists_infinite_primes(n : ℕ) : ∃ p, n ≤ p ∧Nat.Prime p

This map summarizes the statement's structure; the exact Mathlib declaration remains authoritative.

Beyond any chosen threshold, another prime can be found. Explanatory scientific diagram.
Detailed visual description

An engraved road crosses a foreground gate and climbs through a forest-green landscape. Gold beacons continue after the gate toward a luminous open horizon, while irregular stone clusters sit away from the path.

Why it matters

A mathematical landmark

Euclid's theorem is the archetypal infinitude argument in number theory. This threshold formulation states unboundedness of the prime numbers directly.

Proof architecture

A least-prime-factor route beyond every threshold

3 curated stages

Mathlib chooses p as the least prime factor of n! + 1, proves p prime, and rules out p below the arbitrary threshold because such a p would divide both n! and n! + 1 and therefore divide one. The result is unboundedness of primes, not a next-prime or prime-gap theorem.

These source-anchored stages explain the retained Mathlib proof route. They are generated explanations, not proof evidence or an extracted Lean proof-term dependency graph.

  1. Select the least prime factor of the factorial successor

    From the factorial successor, select its least prime factor; the source proves that this selected factor is prime.

    p := minFac (n! + 1) and Nat.Prime p

    The source defines p to be minFac (n! + 1). Factorial positivity shows n! + 1 is not one, so minFac_prime proves that this specifically selected least factor p is prime.

  2. A factor at or below the threshold would divide one

    If the selected prime factor lay at or below the threshold, it would divide both the factorial and its successor, hence divide one—impossible for a prime.

    p ∣ n! and p ∣ n! + 1 imply p ∣ 1, contradicting Nat.Prime p

    Assume contrariwise that p lies at or below n. Positivity of p and dvd_factorial then give p ∣ n!, while minFac_dvd gives p ∣ n! + 1; the addition divisibility lemma forces p ∣ 1, contradicting the fact that p is prime.

  3. A prime exists at or above every threshold

    The contradiction places the selected prime at or above the arbitrary threshold, establishing that primes are unbounded.

    ∃ p, n ≤ p ∧ Nat.Prime p

    The divisibility contradiction proves n ≤ p. Pairing that bound with the already established primality of p yields the witness ⟨p, np, pp⟩ for the arbitrary threshold n, which is exactly the theorem's unbounded-primes conclusion.

ProofAtlas record

What has been checked

Upstream indexedPinned source bytes verified locally
Locally reproducedExact upstream declaration replayed
Reviewed pageCurrent public presentation reviewed
Accepted Atlas resultNot recorded for the preferred artifact

Mathlib is the source of the theorem; the local Lean replay and page review are separate.

Claim boundary

No new theorem is claimed

This is the exact threshold-existence form in Mathlib. It proves a prime exists at or above every natural-number bound; it does not give a quantitative prime-gap estimate or a count of primes below a bound.

Source and local evidence

Where the theorem comes from

Existing declaration
Nat.exists_infinite_primes in mathlib
Relationship
The checked artifact is the upstream declaration itself
Local Lean evidence
artifact.library.mathlib.infinitely-many-primes.v001
Source
Open the pinned upstream reference