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.CurveShortening.Comparison.Analysis.Capped.FirstExitOpen |
| 2 | import Mathlib.Topology.Maps.Proper.Basic |
| 3 | import Mathlib.MeasureTheory.Constructions.BorelSpace.Order |
| 4 | |
| 5 | /-! |
| 6 | # Measurable capped first-exit times |
| 7 | |
| 8 | For a continuous family, hitting the closed complement of an open set during |
| 9 | a fixed compact time window is a closed condition on the parameter. The |
| 10 | sublevel sets of the capped first-exit height are countable unions of these |
| 11 | closed hitting sets. The parameter type is arbitrary, so it may be a subtype |
| 12 | of the boundary arc on which initial entry is known. |
| 13 | |
| 14 | Context: Morgan--Tian Lemma 19.46, Case (ii), printed pp. 475-478. |
| 15 | Source/construction: |
| 16 | proof-work/tasks/M64/derivations/2026-09-25-regional-first-exit-endpoints.md. |
| 17 | -/ |
| 18 | |
| 19 | noncomputable section |
| 20 | set_option autoImplicit false |
| 21 | |
| 22 | open Set MeasureTheory |
| 23 | open scoped Topology |
| 24 | |
| 25 | namespace PoincareMT |
| 26 | |
| 27 | /-- Parameters whose curves leave an open set during a fixed compact time window form a |
| 28 | closed set. Source/construction: |
| 29 | proof-work/tasks/M64/derivations/2026-09-25-regional-first-exit-endpoints.md. -/ |
| 30 | theorem m64_isClosed_capped_exit_window |
| 31 | {P X : Type*} [TopologicalSpace P] [TopologicalSpace X] |
| 32 | {u : P × ℝ → X} (hu : Continuous u) {U : Set X} (hU : IsOpen U) |
| 33 | (a b : ℝ) : IsClosed {s : P | ∃ t ∈ Icc a b, u (s, t) ∉ U} := by |
| 34 | let T := Icc a b |
| 35 | let : CompactSpace T := isCompact_iff_compactSpace.mp isCompact_Icc |
| 36 | have hmap : Continuous (fun p : P × T => u (p.1, p.2.val)) := |
| 37 | hu.comp (continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd)) |
| 38 | have hC : IsClosed {p : P × T | u (p.1, p.2.val) ∉ U} := |
| 39 | hU.isClosed_compl.preimage hmap |
| 40 | have hprojection := isClosedMap_fst_of_compactSpace _ hC |
| 41 | convert hprojection using 1 |
| 42 | ext s |
| 43 | constructor |
| 44 | · rintro ⟨t, ht, hout⟩ |
| 45 | exact ⟨(s, ⟨t, ht⟩), hout, rfl⟩ |
| 46 | · rintro ⟨⟨s, t⟩, hout, rfl⟩ |
| 47 | exact ⟨t.val, t.property, hout⟩ |
| 48 | |
| 49 | /-- The exact capped first-exit characterization makes the height measurable over any |
| 50 | parameter space whose open sets are measurable. Source/construction: |
| 51 | proof-work/tasks/M64/derivations/2026-09-25-regional-first-exit-endpoints.md. -/ |
| 52 | theorem m64_capped_first_exit_open_measurable |
| 53 | {P X : Type*} [TopologicalSpace P] [MeasurableSpace P] |
| 54 | [OpensMeasurableSpace P] [TopologicalSpace X] |
| 55 | {u : P × ℝ → X} (hu : Continuous u) {U : Set X} (hU : IsOpen U) |
| 56 | {height : P → ℝ} {R : ℝ} |
| 57 | (hheight : ∀ s : P, 0 < height s ∧ height s ≤ R ∧ |
| 58 | (∀ t ∈ Ioo (0 : ℝ) (height s), u (s, t) ∈ U) ∧ |
| 59 | u (s, height s) ∈ closure U ∧ |
| 60 | (height s = R ∨ u (s, height s) ∈ frontier U)) : |
| 61 | Measurable height := by |
| 62 | apply measurable_of_Iic |
| 63 | intro r |
| 64 | by_cases hRr : R ≤ r |
| 65 | · have heq : height ⁻¹' Iic r = univ := by |
| 66 | ext s |
| 67 | simp only [mem_preimage, mem_Iic, mem_univ, iff_true] |
| 68 | exact (hheight s).2.1.trans hRr |
| 69 | rw [heq] |
| 70 | exact MeasurableSet.univ |
| 71 | · have hrR : r < R := lt_of_not_ge hRr |
| 72 | have heq : height ⁻¹' Iic r = ⋃ n : ℕ, |
| 73 | {s : P | ∃ t ∈ Icc (1 / (n + 1 : ℝ)) r, u (s, t) ∉ U} := by |
| 74 | ext s |
| 75 | constructor |
| 76 | · intro hs |
| 77 | obtain ⟨n, hn⟩ := exists_nat_one_div_lt (hheight s).1 |
| 78 | refine mem_iUnion.mpr ⟨n, height s, ⟨hn.le, hs⟩, ?_⟩ |
| 79 | rcases (hheight s).2.2.2.2 with hcap | hfront |
| 80 | · exact False.elim ((not_lt_of_ge hs) (hcap ▸ hrR)) |
| 81 | · rw [frontier, hU.interior_eq] at hfront |
| 82 | exact hfront.2 |
| 83 | · intro hs |
| 84 | obtain ⟨n, t, ht, hout⟩ := mem_iUnion.mp hs |
| 85 | by_contra hn |
| 86 | have hrt : r < height s := lt_of_not_ge hn |
| 87 | have hpos : 0 < t := |
| 88 | lt_of_lt_of_le (by positivity : 0 < 1 / (n + 1 : ℝ)) ht.1 |
| 89 | have hinside := (hheight s).2.2.1 t ⟨hpos, ht.2.trans_lt hrt⟩ |
| 90 | exact hout hinside |
| 91 | rw [heq] |
| 92 | exact MeasurableSet.iUnion (fun n => |
| 93 | (m64_isClosed_capped_exit_window hu hU (1 / (n + 1 : ℝ)) r).measurableSet) |
| 94 | |
| 95 | /-- A continuous entering family over an arbitrary parameter space admits a measurable |
| 96 | choice of its capped first-exit times. Source/construction: |
| 97 | proof-work/tasks/M64/derivations/2026-09-25-regional-first-exit-endpoints.md. -/ |
| 98 | theorem m64_exists_measurable_capped_first_exit_open |
| 99 | {P X : Type*} [TopologicalSpace P] [MeasurableSpace P] |
| 100 | [OpensMeasurableSpace P] [TopologicalSpace X] |
| 101 | {u : P × ℝ → X} (hu : Continuous u) {U : Set X} (hU : IsOpen U) |
| 102 | {R : ℝ} (hR : 0 < R) |
| 103 | (henter : ∀ s : P, ∃ eta : ℝ, 0 < eta ∧ |
| 104 | ∀ t ∈ Ioo (0 : ℝ) eta, u (s, t) ∈ U) : |
| 105 | ∃ height : P → ℝ, Measurable height ∧ ∀ s : P, |
| 106 | 0 < height s ∧ height s ≤ R ∧ |
| 107 | (∀ t ∈ Ioo (0 : ℝ) (height s), u (s, t) ∈ U) ∧ |
| 108 | u (s, height s) ∈ closure U ∧ |
| 109 | (height s = R ∨ u (s, height s) ∈ frontier U) := by |
| 110 | have hexists (s : P) : ∃ b : ℝ, 0 < b ∧ b ≤ R ∧ |
| 111 | (∀ t ∈ Ioo (0 : ℝ) b, u (s, t) ∈ U) ∧ |
| 112 | u (s, b) ∈ closure U ∧ (b = R ∨ u (s, b) ∈ frontier U) := by |
| 113 | obtain ⟨eta, heta, hs⟩ := henter s |
| 114 | exact m64_exists_capped_first_exit_open |
| 115 | (hu.comp (continuous_const.prodMk continuous_id)) hU hR heta hs |
| 116 | choose height hheight using hexists |
| 117 | refine ⟨height, m64_capped_first_exit_open_measurable hu hU hheight, hheight⟩ |
| 118 | |
| 119 | end PoincareMT |