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.Singular.Geometry |
| 2 | import Mathlib.Topology.Connected.Clopen |
| 3 | import Mathlib.Topology.Order.IntermediateValue |
| 4 | |
| 5 | /-! |
| 6 | # Global overlap compatibility of reference worldlines |
| 7 | |
| 8 | The local compatibility in a singular-time reference propagates throughout |
| 9 | the common interval with each old generalized-flow box. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.SingularTimeReference |
| 19 | |
| 20 | variable {F : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 21 | {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 23 | [IsManifold (𝓡 3) ∞ M] |
| 24 | |
| 25 | theorem spacetime_forward_eq (R : SingularTimeReference F T M) |
| 26 | (t : Set.Ico R.tMinus T) (y : M) : |
| 27 | R.spacetime_forward (t, y) = (⟨t, R.forward t t.property y⟩ : F.point) := by |
| 28 | exact Sigma.ext (R.spacetime_time (t, y)) (R.spacetime_spatial (t, y)) |
| 29 | |
| 30 | /-- Equality of a reference worldline and an old box worldline propagates |
| 31 | through their entire common time interval. -/ |
| 32 | theorem forward_eq_of_eq (R : SingularTimeReference F T M) |
| 33 | (b : F.box_index) (x : (F.box b).carrier.carrier) (y : M) |
| 34 | {t : ℝ} (ht : t ∈ Set.Ico R.tMinus T) (hbt : t ∈ (F.box b).interval) |
| 35 | (heq : R.forward t ht y = (F.box b).forward t hbt x) |
| 36 | {s : ℝ} (hs : s ∈ Set.Ico R.tMinus T) (hbs : s ∈ (F.box b).interval) : |
| 37 | R.forward s hs y = (F.box b).forward s hbs x := by |
| 38 | let I : Set ℝ := (F.box b).interval ∩ Set.Ico R.tMinus T |
| 39 | let : T2Space F.point := F.space_t2 |
| 40 | let : PreconnectedSpace I := isPreconnected_iff_preconnectedSpace.mp |
| 41 | ((F.box b).flow.interval.inter Set.ordConnected_Ico).isPreconnected |
| 42 | let r : I → F.point := fun a => R.spacetime_forward (⟨a, a.property.2⟩, y) |
| 43 | let c : I → F.point := fun a => |
| 44 | ⟨a, (F.box b).forward a a.property.1 x⟩ |
| 45 | have hr : Continuous r := R.spacetime_embedding.continuous.comp |
| 46 | ((continuous_subtype_val.subtype_mk (fun a => a.property.2)).prodMk continuous_const) |
| 47 | have hc : Continuous c := (F.box_openEmbedding b).continuous.comp |
| 48 | ((continuous_subtype_val.subtype_mk (fun a => a.property.1)).prodMk continuous_const) |
| 49 | have hclosed : IsClosed {a : I | r a = c a} := isClosed_eq hr hc |
| 50 | have hopen : IsOpen {a : I | r a = c a} := by |
| 51 | rw [Metric.isOpen_iff] |
| 52 | intro a ha |
| 53 | obtain ⟨d, z, δ, hδ, hloc⟩ := R.vertical_compatibility a a.property.2 y |
| 54 | obtain ⟨hda, hda_eq⟩ := hloc a a.property.2 (by simpa using hδ) |
| 55 | have hbase : R.forward a a.property.2 y = (F.box b).forward a a.property.1 x := by |
| 56 | have hsig := ha |
| 57 | change R.spacetime_forward (⟨a, a.property.2⟩, y) = _ at hsig |
| 58 | rw [R.spacetime_forward_eq] at hsig |
| 59 | exact eq_of_heq (Sigma.mk.inj_iff.mp hsig).2 |
| 60 | refine ⟨δ, hδ, ?_⟩ |
| 61 | intro v hv |
| 62 | have hvδ : |(v : ℝ) - (a : ℝ)| < δ := by |
| 63 | simpa only [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] using hv |
| 64 | obtain ⟨hdv, hdv_eq⟩ := hloc v v.property.2 hvδ |
| 65 | change R.spacetime_forward (⟨v, v.property.2⟩, y) = _ |
| 66 | rw [R.spacetime_forward_eq] |
| 67 | apply congrArg (Sigma.mk (v : ℝ)) |
| 68 | exact hdv_eq.trans |
| 69 | (F.vertical_compatibility d b a hda a.property.1 z x |
| 70 | (hda_eq.symm.trans hbase) v hdv v.property.1) |
| 71 | have hall : {a : I | r a = c a} = Set.univ := |
| 72 | (show IsClopen {a : I | r a = c a} from ⟨hclosed, hopen⟩).eq_univ |
| 73 | ⟨⟨t, hbt, ht⟩, by |
| 74 | change R.spacetime_forward (⟨t, ht⟩, y) = _ |
| 75 | rw [R.spacetime_forward_eq] |
| 76 | exact congrArg (Sigma.mk t) heq⟩ |
| 77 | have hsig : r ⟨s, hbs, hs⟩ = c ⟨s, hbs, hs⟩ := by |
| 78 | exact Set.eq_univ_iff_forall.mp hall ⟨s, hbs, hs⟩ |
| 79 | change R.spacetime_forward (⟨s, hs⟩, y) = _ at hsig |
| 80 | rw [R.spacetime_forward_eq] at hsig |
| 81 | exact eq_of_heq (Sigma.mk.inj_iff.mp hsig).2 |
| 82 | |
| 83 | end PoincareMT.SingularTimeReference |