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.CurveShortening.Comparison.AnnularEvolution.Finite.MotionEnergyTrace |
| 2 | |
| 3 | /-! Differentiating the literal weighted energy of a C1 annulus under |
| 4 | an actual ambient motion. Source: MT Lemma 19.15, pp. 447-449; M64 |
| 5 | finite-energy-variation derivation. -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option warningAsError true |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter MeasureTheory |
| 13 | open scoped Manifold ContDiff Topology |
| 14 | |
| 15 | namespace PoincareMT |
| 16 | |
| 17 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 18 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 19 | {k : ℕ} {N : Type*} [TopologicalSpace N] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin k)) N] [IsManifold (𝓡 k) ∞ N] |
| 21 | {a b : ℝ} |
| 22 | |
| 23 | omit [IsManifold (𝓡 n) ∞ M] in |
| 24 | /-- The continuous first-jet trace equals the original energy density almost everywhere on |
| 25 | the actual closed source rectangle. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 26 | 19.16, pp. 447-449; project derivation |
| 27 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 28 | theorem m64AnnulusMotionEnergyTrace_ae_eq (F : RicciFlow k N (Icc a b)) |
| 29 | (time : ℝ) {T : Set ℝ} (hT : IsOpen T) {O : Set M} (hO : IsOpen O) |
| 30 | (Phi : ℝ × M → N) |
| 31 | (hPhi : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 k) ∞ Phi (T ×ˢ O)) |
| 32 | (r : ℝ) {f : LoopPlane → M} |
| 33 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) 1 f m64AnnulusDomain) |
| 34 | (hfO : MapsTo f m64AnnulusDomain O) {s : ℝ} (hs : s ∈ T) : |
| 35 | (fun p => m64AnnulusMotionEnergyTrace (n := n) F time Phi r f (s, p)) |
| 36 | =ᵐ[volume.restrict m64AnnulusDomain] |
| 37 | m64ModulusEnergyDensity (F.metric (time + s)) r (fun p => Phi (s, f p)) := by |
| 38 | rw [m64Annulus_restrict_closed_eq_interior] |
| 39 | filter_upwards [ae_restrict_mem isOpen_interior.measurableSet] with p hp |
| 40 | exact m64AnnulusMotionEnergyTrace_eq F time hT hO Phi hPhi r hf hfO hs hp |
| 41 | |
| 42 | /-- Compact C1 source data supply integrability of the literal moving weighted energy |
| 43 | density at each allowed time. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, |
| 44 | pp. 447-449; project derivation |
| 45 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 46 | theorem m64AnnulusMotionEnergy_integrable (F : RicciFlow k N (Icc a b)) |
| 47 | (time : ℝ) {T : Set ℝ} (hT : IsOpen T) {O : Set M} (hO : IsOpen O) |
| 48 | (hTF : ∀ s ∈ T, time + s ∈ Ioo a b) (Phi : ℝ × M → N) |
| 49 | (hPhi : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 k) ∞ Phi (T ×ˢ O)) |
| 50 | (r : ℝ) {f : LoopPlane → M} |
| 51 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) 1 f m64AnnulusDomain) |
| 52 | (hfO : MapsTo f m64AnnulusDomain O) {s : ℝ} (hs : s ∈ T) : |
| 53 | IntegrableOn (m64ModulusEnergyDensity (F.metric (time + s)) r |
| 54 | (fun p => Phi (s, f p))) m64AnnulusDomain volume := by |
| 55 | have hE := (m64AnnulusMotionEnergyTrace_continuous F time hT hO hTF Phi hPhi r hf hfO).1 |
| 56 | have hc : ContinuousOn (fun p => m64AnnulusMotionEnergyTrace (n := n) F time Phi r f (s, p)) |
| 57 | m64AnnulusDomain := |
| 58 | hE.comp (continuous_const.prodMk continuous_id).continuousOn (fun _ hp => ⟨hs, hp⟩) |
| 59 | exact (hc.integrableOn_compact m64AnnulusDomain_isCompact).congr |
| 60 | (m64AnnulusMotionEnergyTrace_ae_eq F time hT hO Phi hPhi r hf hfO hs) |
| 61 | |
| 62 | /-- The actual weighted-energy integral is differentiable under smooth ambient motion even |
| 63 | when the original annulus is only C1 at its boundary. The derivative is the integral of the |
| 64 | actual pointwise time derivative. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 65 | 19.16, pp. 447-449; project derivation |
| 66 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 67 | theorem m64AnnulusMotionEnergy_hasDerivAt (F : RicciFlow k N (Icc a b)) |
| 68 | (time : ℝ) {epsilon : ℝ} (hepsilon : 0 < epsilon) |
| 69 | (hTF : ∀ s ∈ Ioo (-epsilon) epsilon, time + s ∈ Ioo a b) |
| 70 | {O : Set M} (hO : IsOpen O) (Phi : ℝ × M → N) |
| 71 | (hPhi : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 k) ∞ Phi |
| 72 | (Ioo (-epsilon) epsilon ×ˢ O)) |
| 73 | (r : ℝ) {f : LoopPlane → M} |
| 74 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) 1 f m64AnnulusDomain) |
| 75 | (hfO : MapsTo f m64AnnulusDomain O) : |
| 76 | let E := fun s p => m64ModulusEnergyDensity (F.metric (time + s)) r |
| 77 | (fun z => Phi (s, f z)) p |
| 78 | IntegrableOn (fun p => deriv (fun s => E s p) 0) m64AnnulusDomain volume ∧ |
| 79 | HasDerivAt (fun s => ∫ p in m64AnnulusDomain, E s p) |
| 80 | (∫ p in m64AnnulusDomain, deriv (fun s => E s p) 0) 0 := by |
| 81 | let E := fun s p => m64ModulusEnergyDensity (F.metric (time + s)) r |
| 82 | (fun z => Phi (s, f z)) p |
| 83 | let H := m64AnnulusMotionEnergyTrace (n := n) F time Phi r f |
| 84 | let H' := m64AnnulusMotionEnergyDerivativeTrace (n := n) F time Phi r f |
| 85 | have hzero : (0 : ℝ) ∈ Ioo (-epsilon) epsilon := ⟨by linarith, hepsilon⟩ |
| 86 | obtain ⟨hE, hD⟩ := m64AnnulusMotionEnergyTrace_continuous F time isOpen_Ioo hO hTF |
| 87 | Phi hPhi r hf hfO |
| 88 | obtain ⟨hI, hder⟩ := m64AnnulusIntegral_hasDerivAt_of_local_continuous_derivative |
| 89 | (F := fun s p => H (s, p)) (F' := fun s p => H' (s, p)) hepsilon |
| 90 | (fun s hs => hE.comp (continuous_const.prodMk continuous_id).continuousOn |
| 91 | (fun _ hp => ⟨hs, hp⟩)) hD |
| 92 | (fun s hs p hp => m64AnnulusMotionEnergyTrace_hasDerivAt F time isOpen_Ioo hO hTF |
| 93 | Phi hPhi r f hs p (hfO hp)) |
| 94 | have hjet : (fun p => H' (0, p)) =ᵐ[volume.restrict m64AnnulusDomain] |
| 95 | fun p => deriv (fun s => E s p) 0 := by |
| 96 | rw [m64Annulus_restrict_closed_eq_interior] |
| 97 | filter_upwards [ae_restrict_mem isOpen_interior.measurableSet] with p hp |
| 98 | have hd : HasDerivAt (fun s => E s p) (H' (0, p)) 0 := by |
| 99 | apply (m64AnnulusMotionEnergyTrace_hasDerivAt F time isOpen_Ioo hO hTF |
| 100 | Phi hPhi r f hzero p (hfO (interior_subset hp))).congr_of_eventuallyEq |
| 101 | filter_upwards [isOpen_Ioo.mem_nhds hzero] with s hs |
| 102 | exact (m64AnnulusMotionEnergyTrace_eq F time isOpen_Ioo hO Phi hPhi r hf hfO hs hp).symm |
| 103 | exact hd.deriv.symm |
| 104 | refine ⟨hI.congr hjet, ?_⟩ |
| 105 | apply (hder.congr_deriv (integral_congr_ae hjet)).congr_of_eventuallyEq |
| 106 | filter_upwards [isOpen_Ioo.mem_nhds hzero] with s hs |
| 107 | exact (integral_congr_ae |
| 108 | (m64AnnulusMotionEnergyTrace_ae_eq F time isOpen_Ioo hO Phi hPhi r hf hfO hs)).symm |
| 109 | |
| 110 | end PoincareMT |