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.Atlas |
| 2 | import Mathlib.Analysis.Calculus.TangentCone.Real |
| 3 | import Mathlib.Analysis.Convex.Topology |
| 4 | |
| 5 | /-! |
| 6 | # Local topology of the time domain |
| 7 | |
| 8 | Every allowed time interval is locally a nondegenerate closed segment. This |
| 9 | includes one-sided neighborhoods at included endpoints and provides the local |
| 10 | domains for importing Mathlib's segment charts into the interval construction. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology |
| 17 | |
| 18 | open PoincareMT |
| 19 | |
| 20 | namespace Poincare.Spacetime.Realization |
| 21 | |
| 22 | theorem interval_convex (I : SpacetimeInterval) : Convex ℝ I.domain := |
| 23 | I.ordConnected.convex |
| 24 | |
| 25 | theorem interval_interior_nonempty (I : SpacetimeInterval) : |
| 26 | (interior I.domain).Nonempty := |
| 27 | (interval_convex I).nontrivial_iff_nonempty_interior.mp I.nontrivial |
| 28 | |
| 29 | theorem interval_uniqueDiffOn (I : SpacetimeInterval) : UniqueDiffOn ℝ I.domain := |
| 30 | uniqueDiffOn_convex (interval_convex I) (interval_interior_nonempty I) |
| 31 | |
| 32 | /-- An included boundary point is precisely an included endpoint. -/ |
| 33 | theorem interval_mem_frontier_iff (I : SpacetimeInterval) {t : ℝ} (ht : t ∈ I.domain) : |
| 34 | t ∈ frontier I.domain ↔ IsLeast I.domain t ∨ IsGreatest I.domain t := by |
| 35 | constructor |
| 36 | · intro hfront |
| 37 | by_contra h |
| 38 | have hleft : ∃ a ∈ I.domain, a < t := by |
| 39 | by_contra hn |
| 40 | push Not at hn |
| 41 | exact h (Or.inl ⟨ht, fun a ha ↦ hn a ha⟩) |
| 42 | have hright : ∃ b ∈ I.domain, t < b := by |
| 43 | by_contra hn |
| 44 | push Not at hn |
| 45 | exact h (Or.inr ⟨ht, fun b hb ↦ hn b hb⟩) |
| 46 | obtain ⟨a, ha, hat⟩ := hleft |
| 47 | obtain ⟨b, hb, htb⟩ := hright |
| 48 | have hInt : t ∈ interior (Icc a b) := by |
| 49 | rw [interior_Icc] |
| 50 | exact ⟨hat, htb⟩ |
| 51 | exact hfront.2 (interior_mono (I.ordConnected.out ha hb) hInt) |
| 52 | · rintro (hmin | hmax) |
| 53 | · refine ⟨subset_closure ht, ?_⟩ |
| 54 | intro hInt |
| 55 | have : t ∈ interior (Ici t) := interior_mono (fun _ hy ↦ hmin.2 hy) hInt |
| 56 | simp only [interior_Ici, mem_Ioi, lt_self_iff_false] at this |
| 57 | · refine ⟨subset_closure ht, ?_⟩ |
| 58 | intro hInt |
| 59 | have : t ∈ interior (Iic t) := interior_mono (fun _ hy ↦ hmax.2 hy) hInt |
| 60 | simp only [interior_Iic, mem_Iio, lt_self_iff_false] at this |
| 61 | |
| 62 | /-- A local segment contains a relative neighborhood, including at endpoints. -/ |
| 63 | theorem interval_exists_local_segment (I : SpacetimeInterval) {t : ℝ} |
| 64 | (ht : t ∈ I.domain) : |
| 65 | ∃ a b : ℝ, a < b ∧ t ∈ Icc a b ∧ Icc a b ⊆ I.domain ∧ |
| 66 | Icc a b ∈ 𝓝[I.domain] t := by |
| 67 | by_cases hleft : ∃ a ∈ I.domain, a < t |
| 68 | · obtain ⟨a, ha, hat⟩ := hleft |
| 69 | by_cases hright : ∃ b ∈ I.domain, t < b |
| 70 | · obtain ⟨b, hb, htb⟩ := hright |
| 71 | exact ⟨a, b, hat.trans htb, ⟨hat.le, htb.le⟩, I.ordConnected.out ha hb, |
| 72 | mem_nhdsWithin_of_mem_nhds (Icc_mem_nhds hat htb)⟩ |
| 73 | · refine ⟨a, t, hat, ⟨hat.le, le_rfl⟩, I.ordConnected.out ha ht, ?_⟩ |
| 74 | filter_upwards [self_mem_nhdsWithin, |
| 75 | mem_nhdsWithin_of_mem_nhds (Ioi_mem_nhds hat)] with s hs has |
| 76 | exact ⟨has.le, le_of_not_gt (fun hts ↦ hright ⟨s, hs, hts⟩)⟩ |
| 77 | · have hright : ∃ b ∈ I.domain, t < b := by |
| 78 | obtain ⟨a, ha, b, hb, hab⟩ := I.nontrivial |
| 79 | by_contra hn |
| 80 | have heq : ∀ s ∈ I.domain, s = t := by |
| 81 | intro s hs |
| 82 | exact le_antisymm (le_of_not_gt (fun hts ↦ hn ⟨s, hs, hts⟩)) |
| 83 | (le_of_not_gt (fun hst ↦ hleft ⟨s, hs, hst⟩)) |
| 84 | exact hab ((heq a ha).trans (heq b hb).symm) |
| 85 | obtain ⟨b, hb, htb⟩ := hright |
| 86 | refine ⟨t, b, htb, ⟨le_rfl, htb.le⟩, I.ordConnected.out ht hb, ?_⟩ |
| 87 | filter_upwards [self_mem_nhdsWithin, |
| 88 | mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htb)] with s hs hsb |
| 89 | exact ⟨le_of_not_gt (fun hst ↦ hleft ⟨s, hs, hst⟩), hsb.le⟩ |
| 90 | |
| 91 | /-- The original interval and its local segment have identical germs in the real line. -/ |
| 92 | theorem interval_exists_segment_germ (I : SpacetimeInterval) {t : ℝ} |
| 93 | (ht : t ∈ I.domain) : |
| 94 | ∃ a b : ℝ, a < b ∧ t ∈ Icc a b ∧ Icc a b ⊆ I.domain ∧ |
| 95 | I.domain =ᶠ[𝓝 t] Icc a b := by |
| 96 | obtain ⟨a, b, hab, ht', hsub, hmem⟩ := interval_exists_local_segment I ht |
| 97 | refine ⟨a, b, hab, ht', hsub, nhdsWithin_eq_iff_eventuallyEq.mp ?_⟩ |
| 98 | apply le_antisymm |
| 99 | · exact le_inf nhdsWithin_le_nhds (Filter.le_principal_iff.mpr hmem) |
| 100 | · exact nhdsWithin_mono t hsub |
| 101 | |
| 102 | /-- Relative openness preserves the exact included boundary at each point. -/ |
| 103 | theorem interval_frontier_of_relatively_open (I J : SpacetimeInterval) |
| 104 | (hopen : ∃ U : Set ℝ, IsOpen U ∧ J.domain = I.domain ∩ U) |
| 105 | {t : ℝ} (ht : t ∈ J.domain) : |
| 106 | t ∈ frontier J.domain ↔ t ∈ frontier I.domain := by |
| 107 | obtain ⟨U, hU, hJ⟩ := hopen |
| 108 | have htI : t ∈ I.domain := by rw [hJ] at ht; exact ht.1 |
| 109 | have htU : t ∈ U := by rw [hJ] at ht; exact ht.2 |
| 110 | have hInt : t ∈ interior J.domain ↔ t ∈ interior I.domain := by |
| 111 | rw [hJ, interior_inter, hU.interior_eq] |
| 112 | exact and_iff_left htU |
| 113 | change (t ∈ closure J.domain ∧ t ∉ interior J.domain) ↔ |
| 114 | (t ∈ closure I.domain ∧ t ∉ interior I.domain) |
| 115 | simp only [subset_closure ht, subset_closure htI, true_and, hInt] |
| 116 | |
| 117 | end Poincare.Spacetime.Realization |