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.Blowup.Controlled.Geometry |
| 2 | import PoincareLib.Geometry.Spacetime.Realization.OrdinaryProduct.Atlas |
| 3 | import PoincareLib.Geometry.Spacetime.Realization.Interval.Topology |
| 4 | |
| 5 | /-! |
| 6 | # Actual generalized flow boxes in manifold coordinates |
| 7 | |
| 8 | Morgan--Tian Definitions 3.34-3.38, pp. 59-61. Refinement keeps the original |
| 9 | box interval, spatial map and ordinary metric. Empty carriers contribute no |
| 10 | refined boxes. No smooth spacetime structure is an input. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Function Filter |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.EpochExtension.Spacetime |
| 22 | |
| 23 | open Poincare.Spacetime.Realization |
| 24 | |
| 25 | variable (F : GeneralizedRicciFlowData.{u}) |
| 26 | |
| 27 | def flowInterval : SpacetimeInterval := |
| 28 | ⟨F.interval, F.interval_connected, F.interval_nontrivial⟩ |
| 29 | |
| 30 | def boxInterval (b : F.box_index) : SpacetimeInterval := |
| 31 | ⟨(F.box b).interval, (F.box b).flow.interval, (F.box b).flow.nontrivial⟩ |
| 32 | |
| 33 | /-- The actual inverse supplied by the box, restricted to its open image. -/ |
| 34 | def boxSliceMap (b : F.box_index) (t : ℝ) (ht : t ∈ (F.box b).interval) : |
| 35 | OpenPartialHomeomorph (F.box b).carrier.carrier (F.slice t).carrier where |
| 36 | toFun := (F.box b).forward t ht |
| 37 | invFun := (F.box b).inverse t ht |
| 38 | source := univ |
| 39 | target := range ((F.box b).forward t ht) |
| 40 | map_source' x _ := ⟨x, rfl⟩ |
| 41 | map_target' _ _ := mem_univ _ |
| 42 | left_inv' x _ := (F.box b).left_inverse t ht x |
| 43 | right_inv' := (F.box b).right_inverse t ht |
| 44 | open_source := isOpen_univ |
| 45 | open_target := ((F.box b).forward_openEmbedding t ht).isOpen_range |
| 46 | continuousOn_toFun := ((F.box b).forward_smooth t ht).continuous.continuousOn |
| 47 | continuousOn_invFun := ((F.box b).inverse_smooth t ht).continuousOn |
| 48 | |
| 49 | def refinedBoxIndex := Σ b : F.box_index, (F.box b).carrier.carrier |
| 50 | |
| 51 | noncomputable def refinedBox (b : refinedBoxIndex F) : |
| 52 | AdaptedMetricBox 3 F.point Sigma.fst (flowInterval F) where |
| 53 | interval := boxInterval F b.1 |
| 54 | spatial := spatialChartDomain b.2 |
| 55 | spatial_nonempty := ⟨chartAt (EuclideanSpace ℝ (Fin 3)) b.2 b.2, |
| 56 | mem_chart_target _ b.2⟩ |
| 57 | interval_relatively_open := (F.box b.1).relatively_open |
| 58 | toSpacetime q := ⟨q.1.1, (F.box b.1).forward q.1.1 q.1.2 (spatialChartInverse b.2 q.2)⟩ |
| 59 | openEmbedding := (F.box_openEmbedding b.1).comp |
| 60 | (Topology.IsOpenEmbedding.id.prodMap (spatialChartInverse_openEmbedding b.2)) |
| 61 | time_toSpacetime _ := rfl |
| 62 | metric := ordinaryChartMetric (F.box b.1).flow.metric b.2 |
| 63 | metric_smooth := ordinaryChartMetric_smooth _ _ (F.box b.1).flow.smooth b.2 |
| 64 | metric_symm := fun t _ x _ v w => ordinaryChartMetric_symm _ b.2 t x v w |
| 65 | metric_pos := fun t _ x hx v hv => ordinaryChartMetric_pos _ b.2 t x hx v hv |
| 66 | |
| 67 | /-- Relative openness gives a nontrivial overlap even at a global endpoint. -/ |
| 68 | theorem commonInterval_nontrivial (b c : F.box_index) (t : ℝ) |
| 69 | (hb : t ∈ (F.box b).interval) (hc : t ∈ (F.box c).interval) : |
| 70 | ((F.box b).interval ∩ (F.box c).interval).Nontrivial := by |
| 71 | obtain ⟨U, hU, hUb⟩ := (F.box b).relatively_open |
| 72 | obtain ⟨V, hV, hVc⟩ := (F.box c).relatively_open |
| 73 | have htI : t ∈ F.interval := by rw [hUb] at hb; exact hb.1 |
| 74 | have htUV : t ∈ U ∩ V := by |
| 75 | rw [hUb] at hb |
| 76 | rw [hVc] at hc |
| 77 | exact ⟨hb.2, hc.2⟩ |
| 78 | have hacc := ((interval_uniqueDiffOn (flowInterval F) t htI).inter |
| 79 | ((hU.inter hV).mem_nhds htUV)).accPt |
| 80 | obtain ⟨s, hs, hst⟩ := accPt_iff_nhds.mp hacc univ univ_mem |
| 81 | refine ⟨s, ?_, t, ⟨hb, hc⟩, hst⟩ |
| 82 | rw [hUb, hVc] |
| 83 | exact ⟨⟨hs.2.1, hs.2.2.1⟩, ⟨hs.2.1, hs.2.2.2⟩⟩ |
| 84 | |
| 85 | def commonInterval (b c : F.box_index) (t : ℝ) |
| 86 | (hb : t ∈ (F.box b).interval) (hc : t ∈ (F.box c).interval) : |
| 87 | SpacetimeInterval where |
| 88 | domain := (F.box b).interval ∩ (F.box c).interval |
| 89 | ordConnected := (F.box b).flow.interval.inter (F.box c).flow.interval |
| 90 | nontrivial := commonInterval_nontrivial F b c t hb hc |
| 91 | |
| 92 | end PoincareMT.EpochExtension.Spacetime |