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.RegularLimit.Spacetime.RegularBox |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Singular.RegularLimit.Spacetime.GluingTopology |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.Singular.RegularLimit.Spacetime.Worldlines |
| 4 | |
| 5 | /-! |
| 6 | # The generalized Ricci flow through the singular time |
| 7 | |
| 8 | When the regular region is nonempty, the old boxes and the regular terminal |
| 9 | box give a generalized flow on the glued spacetime. The old slices, metrics, |
| 10 | connections and worldlines are retained under their canonical identifications. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | noncomputable section |
| 22 | |
| 23 | namespace PoincareMT.SingularTimeAssumptions |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 28 | [T2Space M] [T3Space M] [SecondCountableTopology M] |
| 29 | {F : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 30 | |
| 31 | def extendedBox (H : SingularTimeAssumptions F T M) |
| 32 | (P04 : RicciFlowCurvatureTheory.{u}) (hΩ : H.reference.regularLimitSet.Nonempty) |
| 33 | (b : F.box_index ⊕ PUnit.{u + 1}) : |
| 34 | GeneralizedRicciFlowBox |
| 35 | (fun t => (H.extendedSliceGeometry P04 t).slice) |
| 36 | (fun t => (H.extendedSliceGeometry P04 t).metric) |
| 37 | (H.extendedTimeInterval P04) := |
| 38 | match b with |
| 39 | | .inl b => H.oldBox P04 b |
| 40 | | .inr _ => H.regularBox P04 hΩ |
| 41 | |
| 42 | theorem oldBox_spacetime_forward (H : SingularTimeAssumptions F T M) |
| 43 | (P04 : RicciFlowCurvatureTheory.{u}) (b : F.box_index) |
| 44 | (p : (F.box b).interval × (F.box b).carrier.carrier) : |
| 45 | (⟨p.1, (H.oldBox P04 b).forward p.1 p.1.property p.2⟩ : H.extendedPoint P04) = |
| 46 | H.oldSpacetimeForward P04 ⟨p.1, (F.box b).forward p.1 p.1.property p.2⟩ := rfl |
| 47 | |
| 48 | theorem extendedBox_openEmbedding (H : SingularTimeAssumptions F T M) |
| 49 | (P04 : RicciFlowCurvatureTheory.{u}) (hΩ : H.reference.regularLimitSet.Nonempty) |
| 50 | (b : F.box_index ⊕ PUnit.{u + 1}) : |
| 51 | letI := H.extendedSpacetimeTopology P04 |
| 52 | Topology.IsOpenEmbedding (fun p : (H.extendedBox P04 hΩ b).interval × |
| 53 | (H.extendedBox P04 hΩ b).carrier.carrier => |
| 54 | (⟨p.1, (H.extendedBox P04 hΩ b).forward p.1 p.1.property p.2⟩ : |
| 55 | H.extendedPoint P04)) := by |
| 56 | let := H.extendedSpacetimeTopology P04 |
| 57 | cases b with |
| 58 | | inl b => |
| 59 | exact (H.oldSpacetimeForward_isOpenEmbedding P04).comp (F.box_openEmbedding b) |
| 60 | | inr b => |
| 61 | have heq : (fun p : Ioc H.reference.tMinus T × H.regularRegion P04 => |
| 62 | (⟨p.1, (H.regularBox P04 hΩ).forward p.1 p.1.property p.2⟩ : |
| 63 | H.extendedPoint P04)) = H.regularSpacetimeForward P04 := |
| 64 | funext (H.regularBox_spacetime_forward P04 hΩ) |
| 65 | change Topology.IsOpenEmbedding (fun p : Ioc H.reference.tMinus T × |
| 66 | H.regularRegion P04 => |
| 67 | (⟨p.1, (H.regularBox P04 hΩ).forward p.1 p.1.property p.2⟩ : |
| 68 | H.extendedPoint P04)) |
| 69 | rw [heq] |
| 70 | exact H.regularSpacetimeForward_isOpenEmbedding P04 |
| 71 | |
| 72 | theorem extendedBox_covers (H : SingularTimeAssumptions F T M) |
| 73 | (P04 : RicciFlowCurvatureTheory.{u}) (hΩ : H.reference.regularLimitSet.Nonempty) |
| 74 | (t : ℝ) (x : (H.extendedSliceGeometry P04 t).slice.carrier) : |
| 75 | ∃ b, ∃ ht : t ∈ (H.extendedBox P04 hΩ b).interval, |
| 76 | ∃ y, (H.extendedBox P04 hΩ b).forward t ht y = x := by |
| 77 | by_cases ht : t = T |
| 78 | · subst t |
| 79 | refine ⟨.inr PUnit.unit, ⟨H.reference.tMinus_lt, le_rfl⟩, |
| 80 | H.terminalSliceHomeomorph P04 x, ?_⟩ |
| 81 | change (H.regularBox P04 hΩ).forward T _ (H.terminalSliceHomeomorph P04 x) = x |
| 82 | rw [H.regularBox_forward_terminal P04] |
| 83 | exact (H.terminalSliceHomeomorph P04).symm_apply_apply x |
| 84 | · obtain ⟨b, hb, y, hy⟩ := F.box_covers t ((H.oldSliceHomeomorph P04 ht).symm x) |
| 85 | refine ⟨.inl b, hb, y, ?_⟩ |
| 86 | change H.oldSliceHomeomorph P04 ht ((F.box b).forward t hb y) = x |
| 87 | rw [hy, Homeomorph.apply_symm_apply] |
| 88 | |
| 89 | theorem old_regular_box_vertical_compatibility |
| 90 | (H : SingularTimeAssumptions F T M) (P04 : RicciFlowCurvatureTheory.{u}) |
| 91 | (hΩ : H.reference.regularLimitSet.Nonempty) (b : F.box_index) |
| 92 | (t : ℝ) (ht : t ∈ (F.box b).interval) (hc : t ∈ Ioc H.reference.tMinus T) |
| 93 | (x : (F.box b).carrier.carrier) (y : H.regularRegion P04) |
| 94 | (heq : (H.oldBox P04 b).forward t ht x = (H.regularBox P04 hΩ).forward t hc y) |
| 95 | (s : ℝ) (hs : s ∈ (F.box b).interval) (hs' : s ∈ Ioc H.reference.tMinus T) : |
| 96 | (H.oldBox P04 b).forward s hs x = (H.regularBox P04 hΩ).forward s hs' y := by |
| 97 | have hsig := congrArg (fun z : (H.extendedSliceGeometry P04 t).slice.carrier => |
| 98 | (⟨t, z⟩ : H.extendedPoint P04)) heq |
| 99 | change (⟨t, (H.oldBox P04 b).forward t ht x⟩ : H.extendedPoint P04) = _ at hsig |
| 100 | rw [H.oldBox_spacetime_forward P04 b (⟨t, ht⟩, x), |
| 101 | H.regularBox_spacetime_forward P04 hΩ (⟨t, hc⟩, y)] at hsig |
| 102 | have hnew := H.regularSpacetimeForward_eq_oldBox_of_eq P04 b x y hc ht hsig.symm hs' hs |
| 103 | rw [← H.oldBox_spacetime_forward P04 b (⟨s, hs⟩, x), |
| 104 | ← H.regularBox_spacetime_forward P04 hΩ (⟨s, hs'⟩, y)] at hnew |
| 105 | exact (eq_of_heq (Sigma.mk.inj_iff.mp hnew).2).symm |
| 106 | |
| 107 | theorem extendedBox_vertical_compatibility |
| 108 | (H : SingularTimeAssumptions F T M) (P04 : RicciFlowCurvatureTheory.{u}) |
| 109 | (hΩ : H.reference.regularLimitSet.Nonempty) (b c : F.box_index ⊕ PUnit.{u + 1}) |
| 110 | (t : ℝ) (ht : t ∈ (H.extendedBox P04 hΩ b).interval) |
| 111 | (hc : t ∈ (H.extendedBox P04 hΩ c).interval) |
| 112 | (x : (H.extendedBox P04 hΩ b).carrier.carrier) |
| 113 | (y : (H.extendedBox P04 hΩ c).carrier.carrier) |
| 114 | (heq : (H.extendedBox P04 hΩ b).forward t ht x = |
| 115 | (H.extendedBox P04 hΩ c).forward t hc y) |
| 116 | (s : ℝ) (hs : s ∈ (H.extendedBox P04 hΩ b).interval) |
| 117 | (hs' : s ∈ (H.extendedBox P04 hΩ c).interval) : |
| 118 | (H.extendedBox P04 hΩ b).forward s hs x = |
| 119 | (H.extendedBox P04 hΩ c).forward s hs' y := by |
| 120 | cases b with |
| 121 | | inl b => |
| 122 | cases c with |
| 123 | | inl c => |
| 124 | have hbase := (H.oldSliceHomeomorph P04 (H.oldBox_time_ne_terminal b ht)).injective heq |
| 125 | exact congrArg (H.oldSliceHomeomorph P04 (H.oldBox_time_ne_terminal b hs)) |
| 126 | (F.vertical_compatibility b c t ht hc x y hbase s hs hs') |
| 127 | | inr c => exact H.old_regular_box_vertical_compatibility P04 hΩ b t ht hc x y heq s hs hs' |
| 128 | | inr b => |
| 129 | cases c with |
| 130 | | inl c => |
| 131 | exact (H.old_regular_box_vertical_compatibility P04 hΩ c t hc ht y x heq.symm s hs' hs).symm |
| 132 | | inr c => |
| 133 | have hxy := ((H.regularBox P04 hΩ).forward_openEmbedding t ht).injective heq |
| 134 | exact congrArg ((H.regularBox P04 hΩ).forward s hs) hxy |
| 135 | |
| 136 | /-- The generalized flow on the old spacetime with its nonempty regular |
| 137 | terminal slice, carrying the actual terminal metric and connection. -/ |
| 138 | def nonemptyExtendedFlow (H : SingularTimeAssumptions F T M) |
| 139 | (P04 : RicciFlowCurvatureTheory.{u}) (hΩ : H.reference.regularLimitSet.Nonempty) : |
| 140 | GeneralizedRicciFlowData.{u} where |
| 141 | slice t := (H.extendedSliceGeometry P04 t).slice |
| 142 | interval := H.extendedTimeInterval P04 |
| 143 | interval_connected := H.extendedTimeInterval_connected P04 |
| 144 | interval_nontrivial := H.extendedTimeInterval_nontrivial P04 |
| 145 | slice_nonempty_iff := H.extendedSliceGeometry_nonempty_iff P04 |
| 146 | metric t := (H.extendedSliceGeometry P04 t).metric |
| 147 | connection t := (H.extendedSliceGeometry P04 t).connection |
| 148 | space_topology := H.extendedSpacetimeTopology P04 |
| 149 | space_t2 := H.extendedSpacetime_t2 P04 |
| 150 | space_secondCountable := H.extendedSpacetime_secondCountable P04 |
| 151 | time_continuous := H.extendedSpacetime_time_continuous P04 |
| 152 | slice_embedding := H.extendedSpacetime_slice_embedding P04 |
| 153 | box_index := F.box_index ⊕ PUnit.{u + 1} |
| 154 | box := H.extendedBox P04 hΩ |
| 155 | box_openEmbedding := H.extendedBox_openEmbedding P04 hΩ |
| 156 | box_covers := H.extendedBox_covers P04 hΩ |
| 157 | vertical_compatibility := H.extendedBox_vertical_compatibility P04 hΩ |
| 158 | |
| 159 | /-- The exact old-time extension into the constructed generalized flow. -/ |
| 160 | def nonemptyExtension (H : SingularTimeAssumptions F T M) |
| 161 | (P04 : RicciFlowCurvatureTheory.{u}) (hΩ : H.reference.regularLimitSet.Nonempty) : |
| 162 | GeneralizedFlowExtension F T where |
| 163 | extended := H.nonemptyExtendedFlow P04 hΩ |
| 164 | times_subset := H.extendedTimeInterval_subset_old_union_terminal P04 |
| 165 | old_times := H.old_times_subset_extendedTimeInterval P04 |
| 166 | forward t ht := H.oldSliceHomeomorph P04 (fun heq => H.terminal_not_in_interval (heq ▸ ht)) |
| 167 | inverse t ht := (H.oldSliceHomeomorph P04 (fun heq => H.terminal_not_in_interval (heq ▸ ht))).symm |
| 168 | forward_smooth t ht := H.oldSliceHomeomorph_smooth P04 _ |
| 169 | inverse_smooth t ht := H.oldSliceHomeomorph_symm_smooth P04 _ |
| 170 | left_inverse t ht := (H.oldSliceHomeomorph P04 _).symm_apply_apply |
| 171 | right_inverse t ht := (H.oldSliceHomeomorph P04 _).apply_symm_apply |
| 172 | metric_pullback t ht := H.oldSliceHomeomorph_metric_pullback P04 _ |
| 173 | scalar_pullback t ht := H.oldSliceHomeomorph_scalar_pullback P04 _ |
| 174 | spacetime_forward := H.oldSpacetimeForward P04 |
| 175 | spacetime_time := H.oldSpacetimeForward_time P04 |
| 176 | spacetime_slices t ht x := rfl |
| 177 | spacetime_openEmbedding := H.oldSpacetimeForward_isOpenEmbedding P04 |
| 178 | spacetime_image := H.oldSpacetimeForward_range P04 |
| 179 | vertical_compatibility b t ht x := by |
| 180 | refine ⟨.inl b, x, 1, by norm_num, ?_⟩ |
| 181 | intro s hs _ |
| 182 | exact ⟨hs, rfl⟩ |
| 183 | |
| 184 | end PoincareMT.SingularTimeAssumptions |