2. Definitions
Everything in this chapter is deliberately elementary: only the n-th-prime function,
remainder arithmetic, if-expressions, finite sums, and a single infinite series appear.
Dirichlet characters, L-functions, and all other analytic objects are confined to proofs
in later chapters, so the statements below — and the irrationality theorem and its analytic
core that reuse them — can be audited without trusting any analytic machinery.
For k \ge 0, let p_k denote the k-th odd prime, so p_0 = 3, p_1 = 5,
p_2 = 7, and so on. In Lean this is the (k+1)-st prime in Mathlib's enumeration
(Nat.nth): since the zeroth prime is 2, shifting the index by one skips exactly the prime
2.
Lean code for Definition oddPrime
-
⟲
def oddPrime (k : ℕ) : ℕ
def oddPrime (k : ℕ) : ℕ
⟲:= Nat.nthNat.nth (p : ℕ → Prop) (n : ℕ) : ℕFind the `n`-th natural number satisfying `p` (indexed from `0`, so `nth p 0` is the first
natural number satisfying `p`), or `0` if there is no such number. See also
`Subtype.orderIsoOfNat` for the order isomorphism with ℕ when `p` is infinitely often true. Nat.PrimeNat.Prime (p : ℕ) : Prop`Nat.Prime p` means that `p` is a prime number, that is, a natural number
at least 2 whose only divisors are `p` and `1`.
The theorem `Nat.prime_def` witnesses this description of a prime number. (kℕ + 1ℕ)
The k-th bit is
b_k = \begin{cases} 1 & \text{if } p_k \equiv 3 \pmod 4, \\ 0 & \text{if } p_k \equiv 1 \pmod 4. \end{cases}
Every odd prime is congruent to 1 or 3 mod 4, so the two cases are exhaustive. The
first eight bits are 1,0,1,1,0,0,1,1 (from the primes 3, 5, 7, 11, 13, 17, 19, 23).
Lean code for Definition bit
-
⟲
def bit (k : ℕ) : ℕ
def bit (k : ℕ) : ℕ
⟲:= if`if c then t else e` is notation for `ite c t e`, "if-then-else", which decides to
return `t` or `e` depending on whether `c` is true or false. The explicit argument
`c : Prop` does not have any actual computational content, but there is an additional
`[Decidable c]` argument synthesized by typeclass inference which actually
determines how to evaluate `c` to true or false. Write `if h : c then t else e`
instead for a "dependent if-then-else" `dite`, which allows `t`/`e` to use the fact
that `c` is true/false.
oddPrimeA362583.oddPrime (k : ℕ) : ℕThe `k`-th odd prime: `oddPrime 0 = 3`, `oddPrime 1 = 5`, `oddPrime 2 = 7`, ….
Writing the odd primes as `p_1, p_2, …`, this is `p_{k+1}`; since
`Nat.nth Nat.Prime 0 = 2`, skipping index 0 skips exactly the prime 2. kℕ % 4ℕ = 3ℕ then`if c then t else e` is notation for `ite c t e`, "if-then-else", which decides to
return `t` or `e` depending on whether `c` is true or false. The explicit argument
`c : Prop` does not have any actual computational content, but there is an additional
`[Decidable c]` argument synthesized by typeclass inference which actually
determines how to evaluate `c` to true or false. Write `if h : c then t else e`
instead for a "dependent if-then-else" `dite`, which allows `t`/`e` to use the fact
that `c` is true/false.
1ℕ else`if c then t else e` is notation for `ite c t e`, "if-then-else", which decides to
return `t` or `e` depending on whether `c` is true or false. The explicit argument
`c : Prop` does not have any actual computational content, but there is an additional
`[Decidable c]` argument synthesized by typeclass inference which actually
determines how to evaluate `c` to true or false. Write `if h : c then t else e`
instead for a "dependent if-then-else" `dite`, which allows `t`/`e` to use the fact
that `c` is true/false.
0ℕ
The prime race constant \varrho is the sum of the series
\varrho \;=\; \sum_{k \ge 0} \frac{b_k}{2^{\,k+1}} \;=\; 0.7004001\ldots,
which converges absolutely by comparison with the geometric series. Since each b_k is
0 or 1, the series is exactly the place-value reading of the binary numeral
0.b_0 b_1 b_2 \ldots_2 — and these are genuinely the binary digits of \varrho:
infinitely many b_k are 0 (Dirichlet's theorem), so the digit string is not
eventually all 1s and no carry ambiguity arises. Reading successive digit prefixes as
binary integers recovers the OEIS sequence A362583, which is why we call \varrho the
A362583 constant. The theorem of this blueprint is that \varrho is irrational.
Lean code for Definition ϱ
-
⟲
def ϱ : ℝ
def ϱ : ℝ
⟲:= ∑' kℕ : ℕNat : TypeThe natural numbers, starting at zero.
This type is special-cased by both the kernel and the compiler, and overridden with an efficient
implementation. Both use a fast arbitrary-precision arithmetic library (usually
[GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
, (bitA362583.bit (k : ℕ) : ℕ`k`-th bit of the constant: `1` iff the `k`-th odd prime is `≡ 3 (mod 4)`.
The `b_{k+1}` of the 1-based bit sequence; first values `1 0 1 1 0 0 1 1`
(primes `3, 5, 7, 11, 13, 17, 19, 23`). kℕ : ℝReal : TypeThe type `ℝ` of real numbers constructed as equivalence classes of Cauchy sequences of rational
numbers. ) / 2ℝ ^ (kℕ + 1ℕ)
The Chebyshev race sum is the integer
S(N) \;=\; \sum_{\substack{p \le N \\ p \text{ prime}}} \begin{cases} +1 & p \equiv 1 \pmod 4 \\ -1 & p \equiv 3 \pmod 4 \\ \;\;\,0 & p = 2, \end{cases}
i.e. S(N) = \sum_{p \le N} \chi_4(p) — but stated with plain remainder arithmetic rather
than a character, per the statement-hygiene principle. The convention "primes \le N"
matches Mathlib's prime-counting function \pi(N) (Nat.primeCounting), which the race-sum
theorems quantify against.
Lean code for Definition raceSum
-
⟲
def raceSum (N : ℕ) : ℤ
def raceSum (N : ℕ) : ℤ
⟲:= ∑ pℕ ∈ (Finset.rangeFinset.range (n : ℕ) : Finset ℕ`range n` is the set of natural numbers less than `n`. (Nℕ + 1ℕ)).filterFinset.filter.{u_1} {α : Type u_1} (p : α → Prop) [DecidablePred p] (s : Finset α) : Finset α`Finset.filter p s` is the set of elements of `s` that satisfy `p`.
For example, one can use `s.filter (· ∈ t)` to get the intersection of `s` with `t : Set α`
as a `Finset α` (when a `DecidablePred (· ∈ t)` instance is available). Nat.PrimeNat.Prime (p : ℕ) : Prop`Nat.Prime p` means that `p` is a prime number, that is, a natural number
at least 2 whose only divisors are `p` and `1`.
The theorem `Nat.prime_def` witnesses this description of a prime number. , raceKernelA362583.raceKernel (n : ℕ) : ℤThe summand of the Chebyshev race sum: `+1` on `n ≡ 1 (mod 4)`, `-1` on
`n ≡ 3 (mod 4)`, `0` otherwise. At a prime `p` this is `χ₄(p)`. pℕ
Sanity pins guard against definitional drift: the module A362583/Pins.lean proves,
sorry-free, that p_0 = 3 and p_3 = 11; that the first eight bits are
1,0,1,1,0,0,1,1; that \tfrac12 < \varrho < 1 (strictly — using b_0 = 1, b_2 = 1 for the
lower bound and b_1 = 0 for strictness above); and that S(10) = -1 (from
\chi_4(2) = 0, \chi_4(3) = -1, \chi_4(5) = 1, \chi_4(7) = -1). These pins are
anonymous examples in the Lean source, so they are described here rather than linked. One
further cross-check lives outside Lean: the first 34 bits, read as a binary integer, equal
12032782746, matching the value a(35) in the OEIS b-file for
Vergo (2023).