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 Mathlib.Geometry.Manifold.IntegralCurve.Transform |
| 2 | import PoincareLib.Geometry.Manifold.Flow.Uniqueness |
| 3 | /-! |
| 4 | # Cancellation of forward and reverse integral curves |
| 5 | |
| 6 | A curve of the opposite vector field retraces the original curve whenever |
| 7 | their endpoints agree. The proof uses time reversal and local uniqueness. |
| 8 | -/ |
| 9 | |
| 10 | open Set Filter |
| 11 | open scoped Manifold ContDiff Bundle Topology |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | namespace Poincare.Manifold |
| 15 | /-- Reversing the field and matching the endpoint recovers the initial point. -/ |
| 16 | theorem reverse_integralCurve_endpoint |
| 17 | {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 18 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 19 | {X : (x : M) → TangentSpace (𝓡 n) x} {U : Set M} (hU : IsOpen U) |
| 20 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) 1 (T% X) U) |
| 21 | {α β : ℝ → M} {T δ ε : ℝ} (hT : 0 ≤ T) (hδ : 0 < δ) (hε : 0 < ε) |
| 22 | (hαU : ∀ t ∈ Ioo (-δ) (T + δ), α t ∈ U) |
| 23 | (hα : IsMIntegralCurveOn (I := 𝓡 n) α X (Ioo (-δ) (T + δ))) |
| 24 | (hβ : IsMIntegralCurveOn (I := 𝓡 n) β (fun x => -X x) (Ioo (-ε) (T + ε))) |
| 25 | (hinit : α T = β 0) : β T = α 0 := by |
| 26 | let d := min δ ε |
| 27 | have hd : 0 < d := lt_min hδ hε |
| 28 | have hdδ : d ≤ δ := min_le_left _ _ |
| 29 | have hdε : d ≤ ε := min_le_right _ _ |
| 30 | have hsub : Ioo (-d) (T + d) ⊆ Ioo (-δ) (T + δ) := by |
| 31 | apply Ioo_subset_Ioo <;> linarith |
| 32 | have hrev : IsMIntegralCurveOn (I := 𝓡 n) (fun t => β (T-t)) X |
| 33 | (Ioo (-d) (T+d)) := by |
| 34 | have hr := ((hβ.comp_add T).comp_mul (-1)).mono |
| 35 | (show Ioo (-d) (T+d) ⊆ {t : ℝ | t * -1 + T ∈ Ioo (-ε) (T+ε)} from by |
| 36 | intro t ht |
| 37 | constructor <;> linarith [ht.1,ht.2]) |
| 38 | simpa only [Function.comp_def, Pi.smul_apply, neg_one_smul, neg_neg, |
| 39 | mul_neg_one, neg_add_eq_sub, Pi.neg_def] using hr |
| 40 | have heq := eqOn_of_isMIntegralCurveOn hU hX isOpen_Ioo isPreconnected_Ioo |
| 41 | (show T ∈ Ioo (-d) (T+d) from ⟨by linarith,by linarith⟩) |
| 42 | (fun t ht => hαU t (hsub ht)) (hα.mono hsub) hrev |
| 43 | (by simpa only [sub_self] using hinit) |
| 44 | simpa only [sub_zero] using (heq (show 0 ∈ Ioo (-d) (T+d) from ⟨by linarith,by linarith⟩)).symm |
| 45 | end Poincare.Manifold |