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 Mathlib.Topology.Instances.Real.Lemmas |
| 2 | import Mathlib.Tactic.Linarith |
| 3 | |
| 4 | /-! |
| 5 | # Closed relative neighborhoods with a strict left margin |
| 6 | |
| 7 | Morgan-Tian Lemma 6.18, pp. 113-114. At a point strictly after |
| 8 | the left endpoint, a relative neighborhood contains a smaller closed |
| 9 | neighborhood with room on the left, even at the right endpoint. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace PoincareMT.M14 |
| 18 | |
| 19 | /-- A relative neighborhood in a closed interval contains a closed |
| 20 | neighborhood with a strict left margin at every point after the left |
| 21 | endpoint, the window used for Lemma 6.18, pp. 113-114. -/ |
| 22 | theorem exists_closed_left_neighborhood {a b t : ℝ} (hat : a < t) (htb : t ≤ b) |
| 23 | {S : Set ℝ} (hS : S ∈ 𝓝[Icc a b] t) : |
| 24 | ∃ c d : ℝ, a < c ∧ c < t ∧ t ≤ d ∧ d ≤ b ∧ Icc c d ⊆ S ∧ |
| 25 | Icc c d ∈ 𝓝[Icc a b] t := by |
| 26 | obtain ⟨N, hN, htN, hNS⟩ := mem_nhdsWithin.mp hS |
| 27 | obtain ⟨l, u, ⟨hlt, htu⟩, hln⟩ := |
| 28 | mem_nhds_iff_exists_Ioo_subset.mp (hN.mem_nhds htN) |
| 29 | let c := (max a l + t) / 2 |
| 30 | let e := (t + u) / 2 |
| 31 | let d := min b e |
| 32 | have hmt : max a l < t := max_lt hat hlt |
| 33 | have hmc : max a l < c := by dsimp only [c]; linarith |
| 34 | have hct : c < t := by dsimp only [c]; linarith |
| 35 | have hac : a < c := (le_max_left _ _).trans_lt hmc |
| 36 | have hlc : l < c := (le_max_right _ _).trans_lt hmc |
| 37 | have hte : t < e := by dsimp only [e]; linarith |
| 38 | have heu : e < u := by dsimp only [e]; linarith |
| 39 | have htd : t ≤ d := le_min htb hte.le |
| 40 | refine ⟨c, d, hac, hct, htd, min_le_left _ _, ?_, ?_⟩ |
| 41 | · intro s hs |
| 42 | exact hNS ⟨hln ⟨hlc.trans_le hs.1, hs.2.trans_lt ((min_le_right _ _).trans_lt heu)⟩, |
| 43 | hac.le.trans hs.1, hs.2.trans (min_le_left _ _)⟩ |
| 44 | · exact mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 45 | ⟨Ioo c e, Ioo_mem_nhds hct hte, fun s hs => ⟨hs.1.1.le, le_min hs.2.2 hs.1.2.le⟩⟩ |
| 46 | |
| 47 | /-- A retained closed relative neighborhood keeps a strict left |
| 48 | margin whenever the original interval has one, as needed when |
| 49 | shrinking local ODE windows in Lemma 6.18, pp. 113-114. -/ |
| 50 | theorem left_lt_of_Icc_mem_nhdsWithin {a b c d t : ℝ} (hat : a < t) (htb : t ≤ b) |
| 51 | (hnear : Icc c d ∈ 𝓝[Icc a b] t) : c < t := by |
| 52 | obtain ⟨l, r, _, hlt, htr, _, hsub, _⟩ := exists_closed_left_neighborhood hat htb hnear |
| 53 | exact (hsub ⟨le_rfl, hlt.le.trans htr⟩).1.trans_lt hlt |
| 54 | |
| 55 | end PoincareMT.M14 |