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.Surgery.Induction.Noncollapse.StableSet.Seed.CornerRecovery |
| 2 | import Mathlib.Topology.Order.ProjIcc |
| 3 | |
| 4 | /-! |
| 5 | # Joining the actual square-time prefix and seed tail |
| 6 | |
| 7 | Morgan--Tian Claim 16.27, pp. 391-393. Two actual closed C1 curves |
| 8 | with the same meeting point give one continuous comparison curve. |
| 9 | Its two action integrals retain the actual projected velocity on |
| 10 | their interiors. No differentiability at the junction is asserted. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.Proofs.M46 |
| 22 | |
| 23 | variable {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport 3 X time I} |
| 25 | |
| 26 | /-- The actual projected square density depends only on the curve |
| 27 | germ at an interior parameter, independently of its containing interval. -/ |
| 28 | theorem squareCurveDensity_germ_eq {gamma beta : ℝ → G.Point} {A B : Set ℝ} {s : ℝ} |
| 29 | (hA : A ∈ 𝓝 s) (hB : B ∈ 𝓝 s) (h : gamma =ᶠ[𝓝 s] beta) : |
| 30 | M14.squareCurveDensity G gamma A s = M14.squareCurveDensity G beta B s := by |
| 31 | unfold M14.squareCurveDensity M14.projectedCurveVelocityWithin |
| 32 | rw [mfderivWithin_of_mem_nhds hA, mfderivWithin_of_mem_nhds hB, |
| 33 | h.mfderiv_eq, h.eq_of_nhds] |
| 34 | |
| 35 | /-- Gluing at the actual meeting point and clamping outside the |
| 36 | closed interval gives the globally continuous curve used in recovery. -/ |
| 37 | theorem exists_oneCorner_square_join {a c b : ℝ} (hac : a ≤ c) (hcb : c ≤ b) |
| 38 | (alpha beta : ℝ → G.Point) |
| 39 | (halpha : ContMDiffOn 𝓘(ℝ, ℝ) (spacetimeModel 3) 1 alpha (Icc a c)) |
| 40 | (hbeta : ContMDiffOn 𝓘(ℝ, ℝ) (spacetimeModel 3) 1 beta (Icc c b)) |
| 41 | (hjoin : alpha c = beta c) : |
| 42 | ∃ gamma : ℝ → G.Point, Continuous gamma ∧ |
| 43 | EqOn gamma alpha (Icc a c) ∧ EqOn gamma beta (Icc c b) ∧ |
| 44 | ContMDiffOn 𝓘(ℝ, ℝ) (spacetimeModel 3) 1 gamma (Icc a c) ∧ |
| 45 | ContMDiffOn 𝓘(ℝ, ℝ) (spacetimeModel 3) 1 gamma (Icc c b) := by |
| 46 | classical |
| 47 | let g := (Iic c).piecewise alpha beta |
| 48 | have hgl (s : ℝ) (hs : s ≤ c) : g s = alpha s := piecewise_eq_of_mem _ _ _ hs |
| 49 | have hgr (s : ℝ) (hs : c ≤ s) : g s = beta s := by |
| 50 | by_cases hsc : s ≤ c |
| 51 | · have heq := le_antisymm hsc hs |
| 52 | rw [heq, hgl c le_rfl, hjoin] |
| 53 | · exact piecewise_eq_of_notMem _ _ _ hsc |
| 54 | have hg : ContinuousOn g (Icc a b) := by |
| 55 | apply ContinuousOn.piecewise |
| 56 | · intro s hs |
| 57 | have hsc : s = c := by simpa only [frontier_Iic, mem_singleton_iff] using hs.2 |
| 58 | simpa only [hsc] using hjoin |
| 59 | · apply halpha.continuousOn.mono |
| 60 | intro s hs |
| 61 | exact ⟨hs.1.1, by simpa only [closure_Iic, mem_Iic] using hs.2⟩ |
| 62 | · apply hbeta.continuousOn.mono |
| 63 | intro s hs |
| 64 | exact ⟨by simpa only [compl_Iic, closure_Ioi, mem_Ici] using hs.2, hs.1.2⟩ |
| 65 | let gamma s := g (projIcc a b (hac.trans hcb) s).val |
| 66 | have hgamma : Continuous gamma := hg.domRestrict.comp continuous_projIcc |
| 67 | have heq (s : ℝ) (hs : s ∈ Icc a b) : gamma s = g s := by |
| 68 | simp only [gamma, projIcc_of_mem _ hs] |
| 69 | have hleft : EqOn gamma alpha (Icc a c) := fun s hs => |
| 70 | (heq s ⟨hs.1, hs.2.trans hcb⟩).trans (hgl s hs.2) |
| 71 | have hright : EqOn gamma beta (Icc c b) := fun s hs => |
| 72 | (heq s ⟨hac.trans hs.1, hs.2⟩).trans (hgr s hs.1) |
| 73 | exact ⟨gamma, hgamma, hleft, hright, |
| 74 | halpha.congr (fun _ hs => hleft hs), hbeta.congr (fun _ hs => hright hs)⟩ |
| 75 | |
| 76 | end PoincareMT.Proofs.M46 |