Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

Comparing changes
Choose two branches to see what changed, then open a pull request to bring the work across.
Able to merge. These branches can be merged automatically.
A pull request is already open: #46 Check INDEX.md known results rows 41-60; row 58's file corrected
3 commits
+1 −1 INDEX.md View file
| @@ -173,7 +173,7 @@ The prime number theorem in this table is known (Montgomery and Vaughan, Multipl | ||
| 173 | 173 | | The Weber invariants of discriminant `-d` with `d ≡ 7 mod 8` are integral | `Lib/CM/Integrality/TorsionValues` | | Birch, *Weber's class invariants* | |
| 174 | 174 | | The integrality of Siegel functions at torsion points | `Lib/CM/Integrality/TorsionValues` | | Kubert and Lang, *Modular Units* | |
| 175 | 175 | | Integral expansions of theta functions of CM elliptic curves, at ordinary primes `p ≥ 5` | `Lib/CM/Integrality/IntegralSections` | | Bannai and Kobayashi, Algebraic theta functions and the p-adic interpolation of Eisenstein-Kronecker numbers, Duke Math. J. 153 (2010), 229-295, after Norman and Mazur–Tate | |
| 176 | -| For a lattice with complex multiplication, the value of the Siegel function at a torsion point is a unit if two different prime ideals divide the annihilator of the point | `Lib/CM/Integrality/IntegralSections` | | Ramachandra and Robert; Kubert and Lang, *Modular Units* | | |
| 176 | +| For a lattice with complex multiplication, the value of the Siegel function at a torsion point is a unit if two different prime ideals divide the annihilator of the point | `Lib/CM/GoodReduction` | | Ramachandra and Robert; Kubert and Lang, *Modular Units* | | |
| 177 | 177 | | An isogeny of elliptic curves with good reduction acts on the formal groups by an integral power series | `Lib/CM/Integrality/IsogenyIntegrality` | | | |
| 178 | 178 | | The second logarithmic derivative of a theta function is a Weierstrass function up to a constant | `Lib/CM/Integrality/LogTheta` | | | |
| 179 | 179 | | The formal group law of a Weierstrass curve has integral coefficients | `Lib/CM/Integrality/LogTheta` | | Silverman, The Arithmetic of Elliptic Curves, IV.1 and IV.2 | |
+97 −0 routes/p5-known-41-60/README.md added View file
| @@ -0,0 +1,97 @@ | ||
| 1 | +--- | |
| 2 | +issue: 6 | |
| 3 | +status: done | |
| 4 | +--- | |
| 5 | +# p5-known-41-60 | |
| 6 | + | |
| 7 | +Rows 41 to 60 of `INDEX.md`, checked against the code: the file each row names, whether that file's | |
| 8 | +head states the row's result, the Lean declaration that states it, and whether the "related work" | |
| 9 | +column agrees with the sources the head gives. The twenty rows are lines 159 to 178 of `INDEX.md` | |
| 10 | +at `ac00c25`, and they cover thirteen files, all under `src/Lib/CM`. | |
| 11 | + | |
| 12 | +## The table | |
| 13 | + | |
| 14 | +"Head states it" means the row's text appears in the head of the file in the row, up to whitespace; | |
| 15 | +it is a check on the row, not on the mathematics. Line numbers are in the file named. | |
| 16 | + | |
| 17 | +| # | file | Lean declaration | related work in the row | verdict | | |
| 18 | +|---|---|---|---|---| | |
| 19 | +| 41 | `Lib/CM/KroneckerLimit` | `New.kronecker_limit` :101 | Siegel TIFR I §1 Thm 1 p. 13; Chamizo, Ramanujan J. 59 (2022) §3 Prop. 1 p. 949 | agrees; both sources are in the head | | |
| 20 | +| 42 | `Lib/CM/GoodReduction` | `New.CMLattice.exists_latticeModule_eq_scaledIdeal` :245, `New.QuadField.scaledIdeal` :85 | Silverman, Advanced Topics | agrees | | |
| 21 | +| 43 | `Lib/CM/GoodReduction` | `New.CMLattice.norm_scaledDisc_le_one` :760, `prod_scaledDisc_t` :779, `norm_disc_eq_one` :799 | Kubert–Lang, Modular Units; Birch, Weber's class invariants (1969) | agrees | | |
| 22 | +| 44 | `Lib/CM/FiniteLattices` | `New.CMLattice.finite_range_latticeModule` :117 | Silverman, Advanced Topics, Chapter II | agrees | | |
| 23 | +| 45 | `Lib/CM/ChowlaSelberg`, further `Lib/CM/ConjugateCurve` | `New.QuadField.classGroup_sq_bijective` :119 | Gauss, Disquisitiones; Cox (1989) §3, §6 | agrees; the further file exists | | |
| 24 | +| 46 | `Lib/CM/ChowlaSelberg` | `New.QuadField.eulerProd_one_eq_zeta_mul` :172 | Neukirch (1999) VII.5, VII.10 | agrees | | |
| 25 | +| 47 | `Lib/CM/ChowlaSelberg` | `New.CMLattice.sum_kronecker_terms` :554, `chowla_selberg` :620 | Selberg–Chowla (1967); Gross, arXiv 2005.04194 | agrees | | |
| 26 | +| 48 | `Lib/CM/ChowlaSelberg` | `New.CMLattice.complex_multiplication_theta` :339 | Shimura (1971) Thm 5.4; Milne (2020) 9.17 | agrees | | |
| 27 | +| 49 | `Lib/CM/FormalGroup/IntegralParameter` | `New.CMLattice.taylorVia_translatedX_mem_integralSeriesRing` :267, `derivative_mem_integralSeriesRing` :306 | Lubin–Tate, Formal complex multiplication in local fields | agrees | | |
| 28 | +| 50 | `Lib/CM/FormalGroup/PrimeNotation` | `New.exists_mul_conj_eq_pow` :430, `New.piPrime` :60, `norm_piPrime` :332 | empty | agrees: the head cites nothing | | |
| 29 | +| 51 | `Lib/CM/FormalGroup/InseparableDegree` | `New.CMLattice.insepDegree_le` :331, `insepDegree_piPrime_le` :365 | Deuring; Blake, arXiv 1311.5454 Thm 1.1; Bluher, ANTS-III LNCS 1423 (1998) 3.2 and 6.1 | agrees | | |
| 30 | +| 52 | `Lib/CM/FormalGroup/FormalParameter` | `New.CMLattice.isSeriesGenerator_formalParam` :112, `exists_scaled_formalParam` :225 | empty | the head cites Lubin–Tate; the cell is empty | | |
| 31 | +| 53 | `Lib/CM/Integrality/Doubling` | `New.CMLattice.theta_two_mul` :119, `sigma_two_mul_eq` :133, `sigma_two_mul_sq` :158 | DLMF chapters 20 and 23 | agrees | | |
| 32 | +| 54 | `Lib/CM/Integrality/Doubling` | `New.norm_doublingForms` :254 | Silverman, GTM 241 (2007), chapters 2 and 6 | agrees | | |
| 33 | +| 55 | `Lib/CM/Integrality/TorsionValues` | `New.CMLattice.norm_a₁_le_one` :88, `hasIntegralValues_monomialSection` :458 | Birch, Weber's class invariants | agrees | | |
| 34 | +| 56 | `Lib/CM/Integrality/TorsionValues` | `New.CMLattice.torsionValue` :116, `HasIntegralValues` :144, `hasIntegralValues_monomialSection` :458 | Kubert–Lang, Modular Units | agrees | | |
| 35 | +| 57 | `Lib/CM/Integrality/IntegralSections` | `New.CMLattice.mem_span_monomialSection` :349, `exists_taylorVia_eq_theta_pow_mul` :444 | Bannai–Kobayashi, Duke 153 (2010) 229–295 | agrees | | |
| 36 | +| 58 | `Lib/CM/GoodReduction` (was `Lib/CM/Integrality/IntegralSections`) | `New.CMLattice.norm_disc_eq_one` :799 | Ramachandra and Robert; Kubert–Lang, Modular Units | **file corrected here**; the row paraphrases the head | | |
| 37 | +| 59 | `Lib/CM/Integrality/IsogenyIntegrality` | `New.CMLattice.norm_le_one_of_mapsTo_lattice` :120, `exists_rescale_theta_eq_theta_pow_mul` :73 | empty | the head cites Silverman, AEC chapters IV and VII; the cell is empty | | |
| 38 | +| 60 | `Lib/CM/Integrality/LogTheta` | `New.CMLattice.derivative_derivative_negLogTheta` :203, `norm_sqrt_mul_coeff_two_negLogTheta_le_one` :356 | empty | agrees: the head's Silverman IV.1–IV.2 belongs to the next row | | |
| 39 | + | |
| 40 | +Nineteen of the twenty rows are stated in the head of the file they name. All thirteen files exist, | |
| 41 | +and the one further file (row 45, `Lib/CM/ConjugateCurve`) exists. Every `New.*` name in these heads | |
| 42 | +was looked up with `git grep`; names that the heads use from other files — `New.PrimeSevenModEight` | |
| 43 | +(`src/Lib/General/NumberTheory/ImaginaryQuadraticField.lean:116`), `New.chowlaSelbergConst` (same | |
| 44 | +file, :98), `New.CMLattice.translatedX` (`src/Lib/CM/Sigma/Basic.lean:694`), `translatedY` (same | |
| 45 | +file, :697), `New.seriesToCp` (`src/Lib/CM/FormalGroup/IntegralParameter.lean:76`) — exist there. | |
| 46 | + | |
| 47 | +## What differs, and what I changed | |
| 48 | + | |
| 49 | +**Row 58 named the wrong file.** Its result is the unit property of Siegel units at a torsion point: | |
| 50 | +the head of `src/Lib/CM/GoodReduction.lean` states it under "Known result: Siegel units" (lines | |
| 51 | +50–53), the lemma `New.CMLattice.norm_disc_eq_one` (`GoodReduction.lean:799`) proves the case of the | |
| 52 | +point `t`, and its docstring (`GoodReduction.lean:797`) is where Ramachandra and Robert, the row's | |
| 53 | +first source, appear. The head of `src/Lib/CM/Integrality/IntegralSections.lean` has nothing about | |
| 54 | +Siegel functions; `git grep -n Siegel src/Lib/CM` finds the phrase only in `GoodReduction`, | |
| 55 | +`TorsionValues` and `KroneckerLimit`. I changed the row's file cell to `Lib/CM/GoodReduction` and | |
| 56 | +left its words as they are. | |
| 57 | + | |
| 58 | +The row is not stale from this project's own work: it already read | |
| 59 | +`Lib/CM/Integrality/IntegralSections` at the import commit `d63b3b1` ("Start from | |
| 60 | +leanprover-community/riemann-hypothesis at 630d1e43"), and no commit since the import touches | |
| 61 | +`INDEX.md` (`git log d63b3b1..origin/main -- INDEX.md` is empty). At that commit the head of | |
| 62 | +`IntegralSections` had no occurrence of "Siegel" either, so the row was wrong when it arrived. The | |
| 63 | +row's sentence is a paraphrase of the `GoodReduction` entry rather than a quotation of it; that is | |
| 64 | +why `check.py` reports it as not stated word for word even after the correction, and prints the | |
| 65 | +paragraph it paraphrases. | |
| 66 | + | |
| 67 | +**Two rows leave empty a "related work" cell whose head names a source.** Row 52's head ends | |
| 68 | +"Lubin–Tate, Formal complex multiplication in local fields", and row 59's head says "Background: | |
| 69 | +Silverman, *The Arithmetic of Elliptic Curves*, Chapters IV and VII". I did not fill them in: an | |
| 70 | +empty cell states no falsehood, and filling it means adding a citation to `INDEX.md`, which | |
| 71 | +`AGENTS.md` asks to check against the source first. A maintainer may prefer to do that or to leave | |
| 72 | +the cells empty; both rows' results are stated in their files. | |
| 73 | + | |
| 74 | +**Two empty cells agree with their heads.** Row 50's head cites no source ("The existence of `α` | |
| 75 | +follows from the finiteness of the class group"), and row 60's head cites Silverman IV.1–IV.2 for | |
| 76 | +the *next* row's result, the formal group law, not for the second logarithmic derivative. | |
| 77 | + | |
| 78 | +## Reproducing | |
| 79 | + | |
| 80 | +`python3 routes/p5-known-41-60/check.py` prints, for each of the twenty rows, the file, whether its | |
| 81 | +head states the row, the `New.*` names of the head with the lines that declare them, and whether the | |
| 82 | +row's "related work" agrees with the head. It ends with the list of rows whose file does not state | |
| 83 | +them. It reads `INDEX.md` and `src/` only. | |
| 84 | + | |
| 85 | +## What this note does not show | |
| 86 | + | |
| 87 | +It does not check any source against the literature: it compares each row with the head of its file, | |
| 88 | +and the heads' own claims about sources are taken as given. It does not read the proofs, and it says | |
| 89 | +nothing about whether any of these statements is true, or about the proof of the Riemann hypothesis — | |
| 90 | +the rows are results classed as known in the literature. It also does not check the other rows of | |
| 91 | +`INDEX.md`. | |
| 92 | + | |
| 93 | +## Next | |
| 94 | + | |
| 95 | +Rows 61 to 80 (`Lib/CM/Sigma` onwards) are unchecked. A second reader could decide whether rows 43 | |
| 96 | +and 58, which now both point at the same `GoodReduction` entry, should be one row, and whether the | |
| 97 | +empty cells of rows 52 and 59 should carry the sources their heads name. | |
+133 −0 routes/p5-known-41-60/check.py added View file
| @@ -0,0 +1,133 @@ | ||
| 1 | +"""Check the twenty rows of INDEX.md numbered 41 to 60 against the code. | |
| 2 | + | |
| 3 | +Run from the project root: python3 routes/p5-known-41-60/check.py | |
| 4 | + | |
| 5 | +The twenty rows are the twenty consecutive table rows of `INDEX.md` that start with the row | |
| 6 | +"Kronecker's first limit formula" (rows 41 to 60 of the index). For each row the script prints the | |
| 7 | +file named in the row, whether that file's head states the row's statement, the `New.*` names the | |
| 8 | +head introduces together with the line that declares them, and whether the "related work" column | |
| 9 | +agrees with the sources the head names. Nothing here reads the literature: the script compares | |
| 10 | +`INDEX.md` with the heads of the files and with the declarations. | |
| 11 | +""" | |
| 12 | + | |
| 13 | +import os | |
| 14 | +import re | |
| 15 | +import sys | |
| 16 | + | |
| 17 | +START = "Kronecker's first limit formula" | |
| 18 | +COUNT = 20 | |
| 19 | + | |
| 20 | + | |
| 21 | +def cells(line): | |
| 22 | + parts, cur, i = [], '', 0 | |
| 23 | + while i < len(line): | |
| 24 | + if line[i] == '\\' and i + 1 < len(line) and line[i + 1] == '|': | |
| 25 | + cur += '|' | |
| 26 | + i += 2 | |
| 27 | + continue | |
| 28 | + if line[i] == '|': | |
| 29 | + parts.append(cur) | |
| 30 | + cur = '' | |
| 31 | + i += 1 | |
| 32 | + continue | |
| 33 | + cur += line[i] | |
| 34 | + i += 1 | |
| 35 | + parts.append(cur) | |
| 36 | + return [p.strip() for p in parts[1:-1]] | |
| 37 | + | |
| 38 | + | |
| 39 | +def norm(s): | |
| 40 | + s = s.replace('**', '').replace('`', '').replace('\\|', '|') | |
| 41 | + return re.sub(r'\s+', ' ', s).strip() | |
| 42 | + | |
| 43 | + | |
| 44 | +def index_rows(path='INDEX.md'): | |
| 45 | + out = [] | |
| 46 | + for line in open(path, encoding='utf-8'): | |
| 47 | + if line.startswith('|'): | |
| 48 | + c = cells(line) | |
| 49 | + if len(c) == 4: | |
| 50 | + out.append(c) | |
| 51 | + return out | |
| 52 | + | |
| 53 | + | |
| 54 | +def head_of(rel): | |
| 55 | + text = open(f'src/{rel}.lean', encoding='utf-8').read() | |
| 56 | + m = re.search(r'/-!(.*?)-/', text, re.S) | |
| 57 | + return m.group(1) if m else '' | |
| 58 | + | |
| 59 | + | |
| 60 | +def decl_lines(rel, name): | |
| 61 | + tail = name.split('.')[-1] | |
| 62 | + pat = re.compile( | |
| 63 | + r'^\s*(?:@\[[^\]]*\]\s*)?(?:noncomputable\s+|private\s+|protected\s+)*' | |
| 64 | + r'(?:lemma|theorem|def|abbrev|structure|instance|class)\s+' | |
| 65 | + r'(?:[A-Za-z0-9_.\'₀-₉]*\.)?' + re.escape(tail) + r'\b') | |
| 66 | + return [k for k, line in enumerate(open(f'src/{rel}.lean', encoding='utf-8').read().split('\n'), 1) | |
| 67 | + if pat.match(line)] | |
| 68 | + | |
| 69 | + | |
| 70 | +def known_results(head): | |
| 71 | + """The head's `Known result:` paragraphs, each up to the next one.""" | |
| 72 | + parts = norm(head).split('Known result:') | |
| 73 | + return ['Known result:' + p.strip() for p in parts[1:]] | |
| 74 | + | |
| 75 | + | |
| 76 | +def nearest_known_result(head, desc): | |
| 77 | + """The `Known result:` paragraph of the head that shares most of the row's words.""" | |
| 78 | + words = [w for w in re.findall(r'[a-z]+', desc.lower()) if len(w) >= 4] | |
| 79 | + paras = known_results(head) | |
| 80 | + if not paras or not words: | |
| 81 | + return 'none' | |
| 82 | + | |
| 83 | + def coverage(p): | |
| 84 | + have = set(re.findall(r'[a-z]+', p.lower())) | |
| 85 | + return sum(1 for w in words if w in have) / len(words) | |
| 86 | + | |
| 87 | + best = max(paras, key=coverage) | |
| 88 | + return f'{coverage(best):.2f} of the row\'s words: {best[:220]}' | |
| 89 | + | |
| 90 | + | |
| 91 | +def main(): | |
| 92 | + rows = index_rows() | |
| 93 | + starts = [i for i, r in enumerate(rows) if norm(r[0]) == START] | |
| 94 | + if not starts: | |
| 95 | + print(f'no row reads {START!r}', file=sys.stderr) | |
| 96 | + return 1 | |
| 97 | + block = rows[starts[0]:starts[0] + COUNT] | |
| 98 | + print(f'rows 41 to 60 of INDEX.md: {len(block)} rows, starting at {START!r}\n') | |
| 99 | + bad = [] | |
| 100 | + for n, (desc, filecell, further, work) in enumerate(block, 41): | |
| 101 | + rel = filecell.strip('`') | |
| 102 | + head = head_of(rel) | |
| 103 | + stated = norm(desc).rstrip('.').lower() in norm(head).lower() | |
| 104 | + print(f'--- row {n}: {norm(desc)}') | |
| 105 | + print(f' file `{rel}` head states the row: {stated}') | |
| 106 | + for f in re.split(r',\s*', further.replace('`', '').strip()): | |
| 107 | + if f: | |
| 108 | + print(f' further file `{f}`: {os.path.exists("src/" + f + ".lean")}') | |
| 109 | + here, elsewhere = [], [] | |
| 110 | + for name in dict.fromkeys(re.findall(r'`(New\.[A-Za-z0-9_.\'₀-₉]*)`', head)): | |
| 111 | + (here if decl_lines(rel, name) else elsewhere).append( | |
| 112 | + f'{name} -> src/{rel}.lean:{decl_lines(rel, name)}' if decl_lines(rel, name) else name) | |
| 113 | + for line in here: | |
| 114 | + print(f' declared here: {line}') | |
| 115 | + if elsewhere: | |
| 116 | + print(f' named from other files: {", ".join(elsewhere)}') | |
| 117 | + if work: | |
| 118 | + missing = [f for f in re.split(r';', work) if norm(f)[:24].lower() not in norm(head).lower()] | |
| 119 | + print(' related work: ' + ('agrees with the head' if not missing | |
| 120 | + else 'not in the head: ' + ' | '.join(missing))) | |
| 121 | + else: | |
| 122 | + cited = [norm(c) for c in re.findall(r'(?:Source:|Sources:|Background:)\s*([^\n]+)', head)] | |
| 123 | + print(f' related work: empty in INDEX; the head cites: {cited if cited else "nothing"}') | |
| 124 | + if not stated: | |
| 125 | + bad.append(n) | |
| 126 | + nearest = nearest_known_result(head, norm(desc)) | |
| 127 | + print(f' nearest "Known result" of the head: {nearest}') | |
| 128 | + print(f'\nrows whose file does not state the row: {bad if bad else "none"}') | |
| 129 | + return 0 | |
| 130 | + | |
| 131 | + | |
| 132 | +if __name__ == '__main__': | |
| 133 | + sys.exit(main()) | |