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.Spacetime.Realization.Interval.Topology |
| 2 | import PoincareLib.Geometry.Spacetime.Interval |
| 3 | |
| 4 | /-! |
| 5 | # Segment charts on an arbitrary time interval |
| 6 | |
| 7 | The local segment projection and inclusion are inverse on a relatively open |
| 8 | neighborhood. Composing with the existing segment charts therefore preserves |
| 9 | the original subtype topology, even when the whole interval is not closed. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | open PoincareMT |
| 18 | |
| 19 | namespace Poincare.Spacetime.Realization |
| 20 | |
| 21 | structure IntervalSegmentNeighborhood (I : SpacetimeInterval) where |
| 22 | left : ℝ |
| 23 | right : ℝ |
| 24 | lt : left < right |
| 25 | segment_subset : Icc left right ⊆ I.domain |
| 26 | window : Set ℝ |
| 27 | open_window : IsOpen window |
| 28 | window_subset : window ∩ I.domain ⊆ Icc left right |
| 29 | |
| 30 | theorem exists_intervalSegmentNeighborhood (I : SpacetimeInterval) (t : I.domain) : |
| 31 | ∃ D : IntervalSegmentNeighborhood I, t.val ∈ D.window := by |
| 32 | obtain ⟨a, b, hab, _, hsub, hmem⟩ := interval_exists_local_segment I t.property |
| 33 | obtain ⟨U, hU, htU, hUsub⟩ := mem_nhdsWithin.mp hmem |
| 34 | exact ⟨⟨a, b, hab, hsub, U, hU, hUsub⟩, htU⟩ |
| 35 | |
| 36 | namespace IntervalSegmentNeighborhood |
| 37 | |
| 38 | variable {I : SpacetimeInterval} (D : IntervalSegmentNeighborhood I) |
| 39 | |
| 40 | /-- The projection is used only on the neighborhood where it is the identity. -/ |
| 41 | noncomputable def toSegment : OpenPartialHomeomorph I.domain (Icc D.left D.right) where |
| 42 | toFun t := projIcc D.left D.right D.lt.le t.val |
| 43 | invFun t := ⟨t.val, D.segment_subset t.property⟩ |
| 44 | source := {t | t.val ∈ D.window} |
| 45 | target := {t | t.val ∈ D.window} |
| 46 | map_source' := by |
| 47 | intro t ht |
| 48 | change (projIcc D.left D.right D.lt.le t.val).val ∈ D.window |
| 49 | rw [projIcc_of_mem D.lt.le (D.window_subset ⟨ht, t.property⟩)] |
| 50 | exact ht |
| 51 | map_target' := fun _ ht ↦ ht |
| 52 | left_inv' := by |
| 53 | intro t ht |
| 54 | apply Subtype.ext |
| 55 | change (projIcc D.left D.right D.lt.le t.val).val = t.val |
| 56 | rw [projIcc_of_mem D.lt.le (D.window_subset ⟨ht, t.property⟩)] |
| 57 | right_inv' := by |
| 58 | intro t _ |
| 59 | exact projIcc_of_mem D.lt.le t.property |
| 60 | open_source := D.open_window.preimage continuous_subtype_val |
| 61 | open_target := D.open_window.preimage continuous_subtype_val |
| 62 | continuousOn_toFun := by fun_prop |
| 63 | continuousOn_invFun := by fun_prop |
| 64 | |
| 65 | theorem toSegment_val {t : I.domain} (ht : t.val ∈ D.window) : |
| 66 | (D.toSegment t).val = t.val := by |
| 67 | change (projIcc D.left D.right D.lt.le t.val).val = t.val |
| 68 | rw [projIcc_of_mem D.lt.le (D.window_subset ⟨ht, t.property⟩)] |
| 69 | |
| 70 | theorem toSegment_symm_val (t : Icc D.left D.right) : |
| 71 | (D.toSegment.symm t).val = t.val := rfl |
| 72 | |
| 73 | end IntervalSegmentNeighborhood |
| 74 | |
| 75 | noncomputable def intervalSegmentAt (I : SpacetimeInterval) (t : I.domain) : |
| 76 | IntervalSegmentNeighborhood I := |
| 77 | Classical.choose (exists_intervalSegmentNeighborhood I t) |
| 78 | |
| 79 | theorem intervalSegmentAt_mem (I : SpacetimeInterval) (t : I.domain) : |
| 80 | t.val ∈ (intervalSegmentAt I t).window := |
| 81 | Classical.choose_spec (exists_intervalSegmentNeighborhood I t) |
| 82 | |
| 83 | /-- A genuine half-space chart on the exact interval subtype. -/ |
| 84 | noncomputable def intervalChartAt (I : SpacetimeInterval) (t : I.domain) : |
| 85 | OpenPartialHomeomorph I.domain (EuclideanHalfSpace 1) := |
| 86 | let D := intervalSegmentAt I t |
| 87 | letI : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 88 | D.toSegment.trans (chartAt (EuclideanHalfSpace 1) (D.toSegment t)) |
| 89 | |
| 90 | theorem mem_intervalChartAt_source (I : SpacetimeInterval) (t : I.domain) : |
| 91 | t ∈ (intervalChartAt I t).source := by |
| 92 | let : Fact ((intervalSegmentAt I t).left < (intervalSegmentAt I t).right) := |
| 93 | ⟨(intervalSegmentAt I t).lt⟩ |
| 94 | refine ⟨intervalSegmentAt_mem I t, ?_⟩ |
| 95 | exact mem_chart_source _ _ |
| 96 | |
| 97 | /-- These charts retain the subspace topology supplied in the contract. -/ |
| 98 | noncomputable abbrev intervalChartedSpace (I : SpacetimeInterval) : |
| 99 | ChartedSpace (EuclideanHalfSpace 1) I.domain where |
| 100 | atlas := Set.range (intervalChartAt I) |
| 101 | chartAt := intervalChartAt I |
| 102 | mem_chart_source := mem_intervalChartAt_source I |
| 103 | chart_mem_atlas := fun t ↦ Set.mem_range_self t |
| 104 | |
| 105 | /-- Between two local segments the actual map is the second segment projection. -/ |
| 106 | theorem intervalSegment_transition_smooth {I : SpacetimeInterval} |
| 107 | (D E : IntervalSegmentNeighborhood I) : |
| 108 | letI : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 109 | letI : Fact (E.left < E.right) := ⟨E.lt⟩ |
| 110 | ContMDiffOn (𝓡∂ 1) (𝓡∂ 1) ∞ (E.toSegment ∘ D.toSegment.symm) |
| 111 | (D.toSegment.target ∩ D.toSegment.symm ⁻¹' E.toSegment.source) := by |
| 112 | let : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 113 | let : Fact (E.left < E.right) := ⟨E.lt⟩ |
| 114 | apply contMDiffOn_projIcc.comp contMDiff_subtypeVal_Icc.contMDiffOn |
| 115 | intro t ht |
| 116 | exact E.window_subset ⟨ht.2, D.segment_subset t.property⟩ |
| 117 | |
| 118 | theorem intervalChartAt_transition_smooth (I : SpacetimeInterval) (p q : I.domain) : |
| 119 | ContMDiffOn (𝓡∂ 1) (𝓡∂ 1) ∞ |
| 120 | ((intervalChartAt I p).symm.trans (intervalChartAt I q)) |
| 121 | ((intervalChartAt I p).symm.trans (intervalChartAt I q)).source := by |
| 122 | let D := intervalSegmentAt I p |
| 123 | let E := intervalSegmentAt I q |
| 124 | let : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 125 | let : Fact (E.left < E.right) := ⟨E.lt⟩ |
| 126 | let c := chartAt (EuclideanHalfSpace 1) (D.toSegment p) |
| 127 | let d := chartAt (EuclideanHalfSpace 1) (E.toSegment q) |
| 128 | have hc : ContMDiffOn (𝓡∂ 1) (𝓡∂ 1) ∞ c.symm c.target := |
| 129 | contMDiffOn_chart_symm |
| 130 | have hd : ContMDiffOn (𝓡∂ 1) (𝓡∂ 1) ∞ d d.source := contMDiffOn_chart |
| 131 | apply (hd.comp' ((intervalSegment_transition_smooth D E).comp' hc)).mono |
| 132 | dsimp [intervalChartAt, D, E, c, d] |
| 133 | mfld_set_tac |
| 134 | |
| 135 | theorem interval_isManifold (I : SpacetimeInterval) : |
| 136 | letI := intervalChartedSpace I |
| 137 | IsManifold (𝓡∂ 1) ∞ I.domain := by |
| 138 | let := intervalChartedSpace I |
| 139 | apply isManifold_of_contDiffOn |
| 140 | rintro e e' ⟨p, rfl⟩ ⟨q, rfl⟩ |
| 141 | rw [← contMDiffOn_iff_contDiffOn] |
| 142 | apply (𝓡∂ 1).contMDiff.comp_contMDiffOn |
| 143 | exact (intervalChartAt_transition_smooth I p q).comp |
| 144 | ((𝓡∂ 1).contMDiffOn_symm.mono inter_subset_right) inter_subset_left |
| 145 | |
| 146 | theorem interval_inclusion_smooth (I : SpacetimeInterval) : |
| 147 | letI := intervalChartedSpace I |
| 148 | ContMDiff (𝓡∂ 1) 𝓘(ℝ) ∞ (Subtype.val : I.domain → ℝ) := by |
| 149 | let := intervalChartedSpace I |
| 150 | intro t |
| 151 | let D := intervalSegmentAt I t |
| 152 | let : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 153 | apply contMDiffAt_iff.mpr |
| 154 | refine ⟨continuous_subtype_val.continuousAt, ?_⟩ |
| 155 | exact (contMDiffAt_iff.mp |
| 156 | (contMDiff_subtypeVal_Icc (n := ∞) (D.toSegment t))).2 |
| 157 | |
| 158 | theorem interval_boundary_eq (I : SpacetimeInterval) : |
| 159 | letI := intervalChartedSpace I |
| 160 | (𝓡∂ 1).boundary I.domain = {t : I.domain | t.val ∈ frontier I.domain} := by |
| 161 | let := intervalChartedSpace I |
| 162 | ext t |
| 163 | let D := intervalSegmentAt I t |
| 164 | let : Fact (D.left < D.right) := ⟨D.lt⟩ |
| 165 | have hwindow : t.val ∈ D.window := intervalSegmentAt_mem I t |
| 166 | have htseg : t.val ∈ Icc D.left D.right := D.window_subset ⟨hwindow, t.property⟩ |
| 167 | have hgerm : I.domain =ᶠ[𝓝 t.val] Icc D.left D.right := by |
| 168 | filter_upwards [D.open_window.mem_nhds hwindow] with s hs |
| 169 | exact propext ⟨fun h ↦ D.window_subset ⟨hs, h⟩, fun h ↦ D.segment_subset h⟩ |
| 170 | have hfront : t.val ∈ frontier I.domain ↔ t.val ∈ frontier (Icc D.left D.right) := by |
| 171 | rw [mem_frontier_iff_notMem_interior t.property, mem_frontier_iff_notMem_interior htseg, |
| 172 | hgerm.mem_interior_iff] |
| 173 | change (D.toSegment t ∈ (𝓡∂ 1).boundary (Icc D.left D.right)) ↔ |
| 174 | t.val ∈ frontier I.domain |
| 175 | rw [hfront, boundary_Icc, frontier_Icc D.lt.le] |
| 176 | simp only [mem_insert_iff, mem_singleton_iff, Subtype.ext_iff, |
| 177 | D.toSegment_val hwindow, Icc.coe_bot, Icc.coe_top] |
| 178 | |
| 179 | end Poincare.Spacetime.Realization |