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.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Regularity.EndpointMomentum |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Minimization.Charts.ChartRegularity |
| 4 | import Mathlib.Analysis.ODE.PicardLindelof |
| 5 | |
| 6 | /-! |
| 7 | # Endpoint smoothness from finite-energy momentum |
| 8 | |
| 9 | The analytic endpoint argument in Morgan-Tian Lemma 6.8, pp. 108-109. |
| 10 | M08's integrable momentum primitive recovers the actual endpoint |
| 11 | velocities. A smooth closed phase equation then supplies all endpoint |
| 12 | derivatives, without prescribing the old totalized endpoint velocity. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped ContDiff Topology intervalIntegral |
| 19 | |
| 20 | namespace ODE |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] |
| 23 | |
| 24 | /-- Finite interior energy and an integrable Euler force recover smooth |
| 25 | endpoint jets and the actual closed momentum equation, the analytic |
| 26 | regularization argument of Lemma 6.8, pp. 108-109. -/ |
| 27 | theorem contDiffOn_of_finite_energy_momentum {a b : ℝ} (hab : a < b) |
| 28 | {S : Set E} (A : ℝ × E → E →L[ℝ] E) (F : ℝ → E × E → E) |
| 29 | (hA : ContDiffOn ℝ ∞ A (Icc a b ×ˢ S)) |
| 30 | (hunit : ∀ z ∈ Icc a b ×ˢ S, IsUnit (A z)) |
| 31 | (hF : ContDiffOn ℝ ∞ (Function.uncurry F) (Icc a b ×ˢ (S ×ˢ univ))) |
| 32 | (u d : ℝ → E) (hu : ContinuousOn u (Icc a b)) (hmem : MapsTo u (Icc a b) S) |
| 33 | (hud : ∀ s ∈ Ioo a b, HasDerivAt u (d s) s) |
| 34 | (hd : MemLp d 2 (volume.restrict (Icc a b))) |
| 35 | (hQ : IntervalIntegrable (fun s => F s (u s, d s)) volume a b) |
| 36 | (hPd : ∀ s ∈ Ioo a b, HasDerivAt (fun r => A (r, u r) (d r)) |
| 37 | (F s (u s, d s)) s) : |
| 38 | ContDiffOn ℝ ∞ u (Icc a b) ∧ EqOn (derivWithin u (Icc a b)) d (Ioo a b) ∧ |
| 39 | ∀ s ∈ Icc a b, |
| 40 | HasDerivWithinAt (fun r => A (r, u r) (derivWithin u (Icc a b) r)) |
| 41 | (F s (u s, derivWithin u (Icc a b) s)) (Icc a b) s := by |
| 42 | let C := Icc a b |
| 43 | let P := fun s => A (s, u s) (d s) |
| 44 | let Q := fun s => F s (u s, d s) |
| 45 | let B := fun s => Ring.inverse (A (s, u s)) |
| 46 | have hgraph : ContinuousOn (fun s => (s, u s)) C := continuousOn_id.prodMk hu |
| 47 | have hgraphmem : MapsTo (fun s => (s, u s)) C (C ×ˢ S) := |
| 48 | fun _ hs => ⟨hs, hmem hs⟩ |
| 49 | have hB : ContinuousOn B C := |
| 50 | (PoincareMT.M08.contDiffOn_inverse_operator A hA hunit).continuousOn.comp hgraph hgraphmem |
| 51 | have hinv (s : ℝ) (hs : s ∈ C) (v : E) : B s (A (s, u s) v) = v := |
| 52 | PoincareMT.M08.inverse_operator_apply _ (hunit _ (hgraphmem hs)) v |
| 53 | obtain ⟨c, q, Pbar, hPbar, hq, hPc, hqc, hPeq, hqeq, _, hudbar, _⟩ := |
| 54 | PoincareMT.M08.endpoint_velocity_of_momentum hab u d P Q hu hud hd |
| 55 | (fun s => A (s, u s)) B hB hinv (fun _ _ => rfl) hQ hPd |
| 56 | let Qbar := fun s => F s (u s, q s) |
| 57 | have hQbar : ContinuousOn Qbar C := hF.continuousOn.comp |
| 58 | (continuousOn_id.prodMk (hu.prodMk hqc)) (fun _ hs => ⟨hs, hmem hs, mem_univ _⟩) |
| 59 | have hQeq : EqOn Qbar Q (Ioo a b) := by |
| 60 | intro s hs |
| 61 | dsimp only [Qbar, Q] |
| 62 | rw [hqeq hs] |
| 63 | have hPdbar (s : ℝ) (hs : s ∈ C) : HasDerivWithinAt Pbar (Qbar s) C s := by |
| 64 | rw [show Pbar = (fun r => c + ∫ t in a..r, Q t) from funext hPbar] |
| 65 | exact PoincareMT.M08.endpoint_momentum_derivative_of_continuous_force |
| 66 | hab c Q Qbar hQeq hQbar s hs |
| 67 | let phase := fun t (z : E × E) => |
| 68 | let v := Ring.inverse (A (t, z.1)) z.2 |
| 69 | (v, F t (z.1, v)) |
| 70 | let Ω := C ×ˢ (S ×ˢ (univ : Set E)) |
| 71 | let k := fun z : ℝ × (E × E) => (z.1, z.2.1) |
| 72 | have hk : ContDiffOn ℝ ∞ k Ω := contDiffOn_fst.prodMk contDiffOn_snd.fst |
| 73 | have hmap : MapsTo k Ω (C ×ˢ S) := fun _ hz => ⟨hz.1, hz.2.1⟩ |
| 74 | have hBinv := (PoincareMT.M08.contDiffOn_inverse_operator A hA hunit).comp hk hmap |
| 75 | have hv := hBinv.clm_apply contDiffOn_snd.snd |
| 76 | have hforce := hF.comp (contDiffOn_fst.prodMk (contDiffOn_snd.fst.prodMk hv)) |
| 77 | (fun _ hz => ⟨hz.1, hz.2.1, mem_univ _⟩) |
| 78 | have hphase : ContDiffOn ℝ ∞ (Function.uncurry phase) Ω := hv.prodMk hforce |
| 79 | have hinvq (s : ℝ) : Ring.inverse (A (s, u s)) (Pbar s) = q s := (hq s).symm |
| 80 | have hphaseDeriv (s : ℝ) (hs : s ∈ C) : |
| 81 | HasDerivWithinAt (fun r => (u r, Pbar r)) (phase s (u s, Pbar s)) C s := by |
| 82 | simpa only [phase, hinvq s, Qbar] using (hudbar s hs).prodMk (hPdbar s hs) |
| 83 | have hphaseMem : MapsTo (fun s => (u s, Pbar s)) C (S ×ˢ univ) := |
| 84 | fun _ hs => ⟨hmem hs, mem_univ _⟩ |
| 85 | have hsmooth := contDiffOn_enat_Icc_of_hasDerivWithinAt (n := ⊤) |
| 86 | hphase hphaseDeriv hphaseMem |
| 87 | have hqd (s : ℝ) (hs : s ∈ C) : derivWithin u C s = q s := |
| 88 | (hudbar s hs).derivWithin (uniqueDiffOn_Icc hab s hs) |
| 89 | have hactualInterior : EqOn (fun s => A (s, u s) (q s)) Pbar (Ioo a b) := by |
| 90 | intro s hs |
| 91 | dsimp only |
| 92 | rw [hqeq hs] |
| 93 | exact (hPeq hs).symm |
| 94 | have hactualClosed : EqOn (fun s => A (s, u s) (q s)) Pbar C := |
| 95 | hactualInterior.of_subset_closure |
| 96 | ((hA.continuousOn.comp hgraph hgraphmem).clm_apply hqc) hPc Ioo_subset_Icc_self |
| 97 | (by rw [closure_Ioo hab.ne]) |
| 98 | have hactual : EqOn (fun s => A (s, u s) (derivWithin u C s)) Pbar C := by |
| 99 | intro s hs |
| 100 | dsimp only |
| 101 | rw [hqd s hs] |
| 102 | exact hactualClosed hs |
| 103 | refine ⟨hsmooth.fst, fun s hs => (hqd s (Ioo_subset_Icc_self hs)).trans (hqeq hs), ?_⟩ |
| 104 | intro s hs |
| 105 | rw [hqd s hs] |
| 106 | exact (hPdbar s hs).congr_of_mem (fun _ hr => hactual hr) hs |
| 107 | |
| 108 | end ODE |