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 |
| 2 | |
| 3 | public import Mathlib.RingTheory.Valuation.LocalSubring |
| 4 | |
| 5 | /-! |
| 6 | # The valuative criterion for integrality in a field |
| 7 | |
| 8 | For a ring homomorphism into a field, integrality over its image is membership in every valuation |
| 9 | subring containing that image. |
| 10 | -/ |
| 11 | |
| 12 | public section |
| 13 | |
| 14 | /-- An element of a field is integral over a ring map's image if and only if it belongs to every |
| 15 | valuation subring containing that image. -/ |
| 16 | @[stacks 090P "part (1), for the integral closure of the image of a ring map"] |
| 17 | lemma RingHom.isIntegralElem_iff_forall_valuationSubring {A K : Type*} [CommRing A] [Field K] |
| 18 | (f : A →+* K) (x : K) : |
| 19 | f.IsIntegralElem x ↔ ∀ V : ValuationSubring K, (∀ a : A, f a ∈ V) → x ∈ V := by |
| 20 | let : Algebra A K := f.toAlgebra |
| 21 | change _root_.IsIntegral A x ↔ _ |
| 22 | -- Intersect the valuation subrings containing the integral closure. By integral closedness, a |
| 23 | -- valuation subring contains that closure exactly when it contains the image of f. |
| 24 | rw [← mem_integralClosure_iff, ← Subalgebra.mem_toSubring, |
| 25 | Subring.eq_iInf_of_isIntegrallyClosedIn (R := (integralClosure A K).toSubring), |
| 26 | Subring.mem_iInf] |
| 27 | have h_image (V : ValuationSubring K) : |
| 28 | (integralClosure A K).toSubring ≤ V.toSubring ↔ ∀ a : A, f a ∈ V := by |
| 29 | let : IsIntegrallyClosedIn V.toSubring K := inferInstanceAs (IsIntegrallyClosedIn V K) |
| 30 | exact Subring.integralClosure_le_iff |
| 31 | exact ⟨fun h V hV ↦ h ⟨V, (h_image V).mpr hV⟩, |
| 32 | fun h ⟨V, hV⟩ ↦ h V ((h_image V).mp hV)⟩ |