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.Compat.GeneralizedEquation |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Induction.Noncollapse.LGeometry.CapEntry.CylinderRelativeImage |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Local.ContinuousFirstExit |
| 4 | |
| 5 | /-! |
| 6 | # First exit from an included tested cylinder |
| 7 | |
| 8 | Lemma 16.15, pp. 379-381. The actual closed cylinder image need not |
| 9 | be open in the whole history at its terminal clock. It is open along |
| 10 | every continuous curve whose clocks remain in the physical interval. |
| 11 | This supplies the first exit without extending the cylinder in time. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter Function |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | universe u v |
| 21 | |
| 22 | namespace PoincareMT.Proofs.M12 |
| 23 | end PoincareMT.Proofs.M12 |
| 24 | open PoincareMT.EpochExtension.Spacetime |
| 25 | local notation "GeneralizedFlowCarrierConclusion" => PoincareMT.GeneralizedFlowCarrierConclusionWithInterval |
| 26 | |
| 27 | namespace PoincareMT.Proofs.M46 |
| 28 | |
| 29 | open PoincareMT.Proofs.M12 |
| 30 | |
| 31 | /-- Relative openness in the actual physical clock interval gives |
| 32 | openness of capture on any continuous parameter space with included |
| 33 | clocks. Source: Lemma 16.15, pp. 379-381. -/ |
| 34 | theorem rawCylinder_preimage_isOpen |
| 35 | {F : GeneralizedRicciFlowData.{u}} |
| 36 | (R : GeneralizedFlowCarrierConclusion (flowBoxAtlas F)) |
| 37 | {C : GeneralizedSliceCarrier.{u}} {origin scale : ℝ} {J : SpacetimeInterval} |
| 38 | {U : TopologicalSpace.Opens C.carrier} |
| 39 | (e : GeneralizedFlowCylinder F C origin scale J.domain U) |
| 40 | (hI : (cylinderPhysicalInterval origin scale e.scale_pos J).domain ⊆ F.interval) |
| 41 | {A : Type v} [TopologicalSpace A] (gamma : A → R.spacetime.Point) |
| 42 | (hgamma : Continuous gamma) |
| 43 | (hclock : ∀ t, R.spacetime.timeFunction (gamma t) ∈ |
| 44 | (cylinderPhysicalInterval origin scale e.scale_pos J).domain) : |
| 45 | IsOpen (gamma ⁻¹' range (rawCylinderMap R e)) := by |
| 46 | apply isOpen_iff_mem_nhds.mpr |
| 47 | rintro t ⟨p, hp⟩ |
| 48 | have hnear := rawCylinder_range_mem_nhdsWithin_clock R e hI p |
| 49 | rw [hp] at hnear |
| 50 | have htend : Tendsto gamma (𝓝 t) |
| 51 | (𝓝[R.spacetime.timeFunction ⁻¹' |
| 52 | (cylinderPhysicalInterval origin scale e.scale_pos J).domain] (gamma t)) := by |
| 53 | exact tendsto_nhdsWithin_iff.mpr |
| 54 | ⟨hgamma.continuousAt, Eventually.of_forall hclock⟩ |
| 55 | exact htend hnear |
| 56 | |
| 57 | /-- First exit needs openness only along the closed parameter interval, |
| 58 | not an ambient open image of the tracked cylinder. Source: Lemma 16.15, |
| 59 | pp. 379-381. -/ |
| 60 | theorem exists_first_exit_of_relative_preimage |
| 61 | {X : Type v} [TopologicalSpace X] {gamma : ℝ → X} {a b : ℝ} |
| 62 | (hgamma : ContinuousOn gamma (Icc a b)) {O : Set X} |
| 63 | (hrelative : IsOpen {t : Icc a b | gamma t.val ∈ O}) |
| 64 | (ha : gamma a ∈ O) (hleave : ∃ s ∈ Icc a b, gamma s ∉ O) : |
| 65 | ∃ c ∈ Ioc a b, gamma c ∉ O ∧ MapsTo gamma (Ico a c) O ∧ |
| 66 | MapsTo gamma (Icc a c) (closure O) := by |
| 67 | obtain ⟨V, hV, hVeq⟩ := Topology.IsInducing.subtypeVal.isOpen_iff.mp hrelative |
| 68 | have hmem (t : ℝ) (ht : t ∈ Icc a b) : t ∈ V ↔ gamma t ∈ O := by |
| 69 | exact iff_of_eq (congrArg (fun S : Set (Icc a b) => (⟨t, ht⟩ : Icc a b) ∈ S) hVeq) |
| 70 | obtain ⟨s, hs, hsout⟩ := hleave |
| 71 | have hab : a ≤ b := hs.1.trans hs.2 |
| 72 | obtain ⟨c, hc, hcout, hinside, _⟩ := M14.exists_first_exit_of_continuousOn |
| 73 | (continuousOn_id : ContinuousOn (id : ℝ → ℝ) (Icc a b)) hV |
| 74 | ((hmem a ⟨le_rfl, hab⟩).mpr ha) ⟨s, hs, fun h => hsout ((hmem s hs).mp h)⟩ |
| 75 | have hactual : MapsTo gamma (Ico a c) O := by |
| 76 | intro t ht |
| 77 | exact (hmem t ⟨ht.1, ht.2.le.trans hc.2⟩).mp (hinside ht) |
| 78 | refine ⟨c, hc, fun h => hcout ((hmem c ⟨hc.1.le, hc.2⟩).mpr h), hactual, ?_⟩ |
| 79 | have hcont : ContinuousOn gamma (closure (Ico a c)) := by |
| 80 | rw [closure_Ico hc.1.ne] |
| 81 | exact hgamma.mono (Icc_subset_Icc le_rfl hc.2) |
| 82 | have hclosure := hactual.closure_of_continuousOn hcont |
| 83 | simpa only [closure_Ico hc.1.ne] using hclosure |
| 84 | |
| 85 | end PoincareMT.Proofs.M46 |