For let denote the -th prime. Brocard's conjecture, named after Henri Brocard, asserts that for every there are at least four primes strictly between and (Wikipedia). It belongs to the family of "primes between consecutive squares" problems together with Legendre's conjecture, and it is a concrete, elementary-looking question about short-interval prime distribution that remains open.
Primes are listed in increasing order. In the Lean development the list is 0-indexed: Nat.nth Nat.Prime k is the -th prime counting from , so nth 0 = 2, nth 1 = 3, nth 2 = 5, and so on. For an index write n.nth Nat.Prime and (n+1).nth Nat.Prime, two consecutive primes. The quantity of interest is
Milestone (Ferreira): for all sufficiently large indices ,
Goal (Brocard's conjecture): the same inequality for every 0-indexed , i.e. for every pair of consecutive primes starting from .
A proof of the goal settles Brocard's conjecture outright. Given Ferreira's asymptotic result, the remaining work splits into making the threshold effective and closing the finite range below it, both of which would be new formal content; the milestone itself (formalizing Ferreira's analytic argument) is a substantial analytic-number-theory formalization project.
Unconditional results on primes in short intervals only reach exponents well above , while the interval has length about where can be small (e.g. twin primes), i.e. length on the order of the square root of its endpoint. Standard short-interval theorems therefore do not apply uniformly, and Legendre's conjecture — which would only give two primes here — is itself open.
Everything is stated with Mathlib's Nat.nth Nat.Prime, Finset.Ioo (open interval, endpoints excluded) and Finset.filter Nat.Prime, followed by Finset.card. The hypothesis 1 ≤ n in the goal is the 0-indexed form of the source's ""; it is necessary, since for index (primes ) the interval contains only the two primes . The milestone uses Filter.atTop ("for all sufficiently large "), with no explicit threshold. No custom definitions are required.
BrocardConjecture.lean.namespace Brocard
theorem brocard_conjecture (n : ℕ) (hn : 1 ≤ n) :
letI prev := n.nth Nat.Prime;
letI next := (n+1).nth Nat.Prime;
4 ≤ ((Ioo (prev^2) (next^2)).filter Nat.Prime).card := by sorry
end BrocardFor every , writing for the -th prime with 0-based indexing (, , , …), there are at least four primes with . In the usual 1-based indexing this is Brocard's conjecture: for all there are at least four primes between and .