Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Stability.PrefixMinimality |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquarePathPrefix |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquareDensity |
| 4 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 5 | |
| 6 | /-! |
| 7 | # Actual minimizing prefixes and the normalized action primitive |
| 8 | |
| 9 | Raw reduced length along an actual minimizing square path equals the |
| 10 | absolute-time normalized action of every positive-length prefix. |
| 11 | Morgan-Tian Proposition 6.30, pp. 118-119, and Lemma 6.49, p. 131. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter MeasureTheory |
| 17 | open scoped Manifold ContDiff Topology intervalIntegral |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T a b : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 26 | |
| 27 | /-- The actual raw reduced length on each nontrivial square prefix |
| 28 | is its square action divided by twice the absolute square-root time, |
| 29 | Proposition 6.30 and Definition 6.45, pp. 118-119, 129. -/ |
| 30 | theorem positiveStart_reducedLengthAt_square_prefix |
| 31 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (hp : M14IsMinimizing p) |
| 32 | (R : M14SquareRootPath G p) {s : ℝ} |
| 33 | (hs : s ∈ Ioc (Real.sqrt a) (Real.sqrt b)) : |
| 34 | M14ReducedLengthAt G T a x (R.curve s) = |
| 35 | (∫ r in Real.sqrt a..s, squareRootLIntegrand R r) / (2 * s) := by |
| 36 | have hs0 : 0 < s := (Real.sqrt_nonneg a).trans_lt hs.1 |
| 37 | have hsC : s ∈ M14SqrtParameterInterval a b := ⟨hs.1.le, hs.2⟩ |
| 38 | rcases lt_or_eq_of_le hs.2 with hlt | rfl |
| 39 | · have hac : a < s ^ 2 := by |
| 40 | nlinarith [Real.sq_sqrt p.tau_nonneg, Real.sqrt_nonneg a, hs.1] |
| 41 | have hcb : s ^ 2 < b := by |
| 42 | nlinarith [Real.sq_sqrt (p.tau_nonneg.trans p.tau_lt.le), Real.sqrt_nonneg b] |
| 43 | have hmin := isMinimizing_prefixPath hM12 p hp (show s ^ 2 ∈ Ioo a b from ⟨hac, hcb⟩) |
| 44 | have haction := integral_squareRootLIntegrand_eq_action (prefixSquarePath R hac hcb.le) |
| 45 | change (∫ r in Real.sqrt a..Real.sqrt (s ^ 2), squareRootLIntegrand R r) = |
| 46 | M14BackwardLAction G (prefixPath p (s ^ 2) hac hcb.le) at haction |
| 47 | rw [Real.sqrt_sq hs0.le] at haction |
| 48 | unfold M14ReducedLengthAt |
| 49 | rw [R.curve_time s hsC, sub_sub_cancel, R.agrees s hsC, |
| 50 | reducedLengthValue_eq_of_minimizing _ hmin, Real.sqrt_sq hs0.le, haction] |
| 51 | · have hb : 0 < b := p.tau_nonneg.trans_lt p.tau_lt |
| 52 | have hpoint : R.curve (Real.sqrt b) = y := by |
| 53 | rw [R.agrees _ hsC, Real.sq_sqrt hb.le, p.curve_end] |
| 54 | unfold M14ReducedLengthAt |
| 55 | rw [R.curve_time _ hsC, Real.sq_sqrt hb.le, sub_sub_cancel, hpoint, |
| 56 | reducedLengthValue_eq_of_minimizing p hp, integral_squareRootLIntegrand_eq_action R] |
| 57 | |
| 58 | /-- The normalized minimizing action primitive has its genuine |
| 59 | within derivative at the final closed square time, including physical |
| 60 | time boundaries, equation (6.8) and Lemma 6.49, pp. 118, 131. -/ |
| 61 | theorem positiveStart_reducedLengthAt_square_hasDerivWithinAt |
| 62 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (hp : M14IsMinimizing p) |
| 63 | (R : M14SquareRootPath G p) : |
| 64 | HasDerivWithinAt (fun r => M14ReducedLengthAt G T a x (R.curve r)) |
| 65 | ((squareRootLIntegrand R (Real.sqrt b) * (2 * Real.sqrt b) - |
| 66 | M14BackwardLAction G p * 2) / (2 * Real.sqrt b) ^ 2) |
| 67 | (M14SqrtParameterInterval a b) (Real.sqrt b) := by |
| 68 | let C := M14SqrtParameterInterval a b |
| 69 | have hab := Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt |
| 70 | have hb : 0 < b := p.tau_nonneg.trans_lt p.tau_lt |
| 71 | have hs : Real.sqrt b ∈ C := ⟨hab.le, le_rfl⟩ |
| 72 | have hcont := (squareRootLIntegrand_contDiffOn hM12 R).continuousOn |
| 73 | let : Fact (Real.sqrt b ∈ Icc (Real.sqrt a) (Real.sqrt b)) := ⟨hs⟩ |
| 74 | have hderiv := intervalIntegral.integral_hasDerivWithinAt_right |
| 75 | (s := Icc (Real.sqrt a) (Real.sqrt b)) (t := Icc (Real.sqrt a) (Real.sqrt b)) |
| 76 | (squareRootLIntegrand_intervalIntegrable R) |
| 77 | (hcont.stronglyMeasurableAtFilter_nhdsWithin measurableSet_Icc (Real.sqrt b)) |
| 78 | (hcont _ hs) |
| 79 | have hden : HasDerivWithinAt (fun r : ℝ => 2 * r) 2 C (Real.sqrt b) := by |
| 80 | simpa only [id_eq, mul_one] using (hasDerivWithinAt_id (Real.sqrt b) C).const_mul 2 |
| 81 | have hquot := hderiv.div hden (mul_pos zero_lt_two (Real.sqrt_pos.mpr hb)).ne' |
| 82 | rw [integral_squareRootLIntegrand_eq_action R] at hquot |
| 83 | apply hquot.congr_of_eventuallyEq_of_mem _ hs |
| 84 | filter_upwards [self_mem_nhdsWithin, |
| 85 | mem_nhdsWithin_of_mem_nhds (Ioi_mem_nhds hab)] with r hr hr0 |
| 86 | exact positiveStart_reducedLengthAt_square_prefix hM12 hp R ⟨hr0, hr.2⟩ |
| 87 | |
| 88 | end PoincareMT.M14 |