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

| 1 | module -- shake: keep-all |
| 2 | -- Its imports stay public: its settings apply to them, and the tactic extensions below are used |
| 3 | -- by nearly every file. |
| 4 | |
| 5 | public import Mathlib.Algebra.DirectSum.Internal |
| 6 | public import Mathlib.Algebra.Order.Floor.Extended |
| 7 | public import Mathlib.Algebra.Order.Floor.Semifield |
| 8 | public import Mathlib.Algebra.Order.Interval.Basic |
| 9 | public import Mathlib.Algebra.Ring.BooleanRing |
| 10 | public import Mathlib.Analysis.Complex.UpperHalfPlane.Basic |
| 11 | public import Mathlib.Analysis.InnerProductSpace.Reproducing |
| 12 | public import Mathlib.Analysis.Normed.Unbundled.GelfandRadiusNorm |
| 13 | public import Mathlib.Analysis.SpecialFunctions.Gamma.Basic |
| 14 | public import Mathlib.Analysis.SpecialFunctions.Trigonometric.DerivHyp |
| 15 | public import Mathlib.Combinatorics.Enumerative.DyckWord |
| 16 | public import Mathlib.Combinatorics.SimpleGraph.Triangle.Removal |
| 17 | public import Mathlib.Data.NNRat.Floor |
| 18 | public import Mathlib.Data.Nat.Choose.Multinomial |
| 19 | public import Mathlib.Geometry.Euclidean.Volume.Basic |
| 20 | public import Mathlib.GroupTheory.SpecificGroups.KleinFour |
| 21 | public import Mathlib.NumberTheory.Chebyshev |
| 22 | public import Mathlib.NumberTheory.Height.NumberField |
| 23 | public import Mathlib.NumberTheory.Height.Projectivization |
| 24 | public import Mathlib.NumberTheory.LucasLehmer |
| 25 | public import Mathlib.NumberTheory.SelbergSieve |
| 26 | public import Mathlib.RepresentationTheory.Basic |
| 27 | public import Mathlib.RingTheory.Radical.NatInt |
| 28 | public import Mathlib.Tactic.Echelon.Zsqrtd |
| 29 | public import Mathlib.Tactic.Inclusion.Extension.Core.Core |
| 30 | public import Mathlib.Tactic.Inclusion.Extension.Interval.BinarySplit |
| 31 | public import Mathlib.Tactic.Inclusion.Extension.IntervalDyadicReal.Exp |
| 32 | public import Mathlib.Tactic.Inclusion.Extension.IntervalDyadicReal.Hypotheses |
| 33 | public import Mathlib.Tactic.Inclusion.Extension.IntervalDyadicReal.Log |
| 34 | public import Mathlib.Tactic.Inclusion.Extension.IntervalDyadicReal.Sqrt |
| 35 | public import Mathlib.Tactic.Inclusion.Extension.IntervalInt.Basic |
| 36 | public import Mathlib.Tactic.Inclusion.Extension.IntervalInt.Hypotheses |
| 37 | public import Mathlib.Tactic.Lemma |
| 38 | public import Mathlib.Tactic.NormNum.Irrational |
| 39 | public import Mathlib.Tactic.NormNum.IsCoprime |
| 40 | public import Mathlib.Tactic.NormNum.IsSquare |
| 41 | public import Mathlib.Tactic.NormNum.LegendreSymbol |
| 42 | public import Mathlib.Tactic.NormNum.ModEq |
| 43 | public import Mathlib.Tactic.NormNum.NatFib |
| 44 | public import Mathlib.Tactic.NormNum.NatLog |
| 45 | public import Mathlib.Tactic.NormNum.NatSqrt |
| 46 | public import Mathlib.Tactic.NormNum.Ordinal |
| 47 | public import Mathlib.Tactic.NormNum.Parity |
| 48 | public import Mathlib.Tactic.NormNum.Prime |
| 49 | public import Mathlib.Tactic.NormNum.RealSqrt |
| 50 | public import Mathlib.Tactic.TypeStar |
| 51 | public import Mathlib.Topology.Sheaves.Init |
| 52 | public import Aesop.Frontend.Tactic |
| 53 | public import Aesop.Main |
| 54 | public import Mathlib.RingTheory.WittVector.IsPoly |
| 55 | public import Mathlib.Tactic.Basify |
| 56 | public import Mathlib.Tactic.ENatToNat |
| 57 | public import Mathlib.Tactic.Polynomial.Basic |
| 58 | public import Mathlib.Tactic.ReduceModChar |
| 59 | public import Std.Internal.Order.Automation |
| 60 | public import Std.Tactic.BVDecide.Normalize.Prop |
| 61 | |
| 62 | /-! |
| 63 | # Speed settings |
| 64 | |
| 65 | The three speed settings of this file make instance search and `simp` faster in all files of the |
| 66 | development. They add no axiom, but a few proofs rely on them: without them, six files fail to |
| 67 | compile, two of them by timeouts. The file also makes `Representation.isTrivial_def` a `simp` lemma, |
| 68 | which one proof uses as such. |
| 69 | -/ |
| 70 | |
| 71 | @[expose] public section |
| 72 | |
| 73 | -- Instance search tries these instances late (the default priority is 1000). They give the |
| 74 | -- grade-zero part `A 0` of a graded ring its algebraic structure, and unifying `A 0` with an |
| 75 | -- arbitrary subtype is expensive. Without them `New.Derivatives.Divisibility.NormalForm` times out, |
| 76 | -- and `Lib.GaloisRep.Hilbert90.UnitaryGroups`, `Lib.Shimura.HeckeTower.Model` and |
| 77 | -- `New.Spanning.Frames.RealPlaceGauge` fail. |
| 78 | attribute [instance 20] SetLike.GradeZero.instMonoid SetLike.GradeZero.instCommMonoid |
| 79 | SetLike.GradeZero.instSemiring SetLike.GradeZero.instCommSemiring SetLike.GradeZero.instRing |
| 80 | SetLike.GradeZero.instCommRing |
| 81 | |
| 82 | -- These lemmas leave the default `simp` set of every importing file. They match very many terms |
| 83 | -- and then fail on a side condition. Tagging a lemma in both directions erases both, and, unlike |
| 84 | -- `attribute [-simp]`, the effect passes to importers. The reversed tags last one command only, |
| 85 | -- so the warning about their head symbols does not apply. |
| 86 | set_option warning.simp.varHead false in |
| 87 | attribute [simp ←, simp] MonoidHom.CompTriple.comp_eq |
| 88 | LinearMap.identityMapOfZeroModuleIsZero smul_left_cancel_iff mul_cancel_left_mem_nonZeroDivisors |
| 89 | IsAddKleinFour.card_four' MeasureTheory.lintegral_of_isEmpty Nat.card_eq_zero_of_infinite |
| 90 | IsRegular.smul_eq_zero_iff_right Unitary.star_mul_self_of_mem inv_mul_cancel_of_invertible |
| 91 | bot_eq_one' EmbeddingLike.map_eq_one_iff Submodule.smul_coe_torsionBy Valuation.IsUniformizer.val |
| 92 | star_trivial SetLike.GradeZero.coe_ofNat Associates.coe_unit_eq_one inv_mul_cancel_comm_assoc |
| 93 | nsmul_eq_zero_iff SetLike.GradeZero.coe_mul RingHomCompTriple.comp_eq |
| 94 | Finset.univ_eq_empty IsRegular.smul_right_inj IsAddKleinFour.card_four BooleanRing.mul_add_mul |
| 95 | Submodule.smul_mem_iff' IsKleinFour.card_four' Nat.sub_eq_zero_of_le IsUnit.inv_mul_cancel |
| 96 | IsUnit.mul_inv_cancel GroupWithZero.dvd_iff Ring.inverse_non_unit ciSup_of_not_bddAbove |
| 97 | inv_mul_cancel_comm mul_inv_cancel_comm CharP.cast_eq_zero IsEmpty.exists_iff |
| 98 | IsMin.finsetIio_eq Set.Icc_eq_empty RCLike.star_def inf_of_le_right inf_of_le_left FunLike.coe_mul |
| 99 | Nat.card_unique smul_left_inj norm_map RKHS.coe_smul tsum_comp_neg conj_trivial bot_eq_zero' |
| 100 | |
| 101 | -- Not a `simp` lemma in Mathlib; the development uses it as one. |
| 102 | attribute [simp] Representation.isTrivial_def |
| 103 | |
| 104 | /-- A synonym of `IsEmpty` about which `simp` knows nothing. -/ |
| 105 | def New.IsVoid : Sort* → Prop := IsEmpty |
| 106 | |
| 107 | /-- Many `simp` lemmas have a hypothesis `[IsEmpty α]`. When instance search does not find it, |
| 108 | `simp` tries to prove it. This lemma ends the attempt at once. -/ |
| 109 | @[simp 1001] |
| 110 | lemma New.isEmpty_iff_isVoid (α : Sort*) : IsEmpty α ↔ IsVoid α := .rfl |