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.Analysis.ODE.ExistUnique |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.RCLike |
| 3 | import Mathlib.Topology.Connected.Clopen |
| 4 | |
| 5 | /-! |
| 6 | # Uniqueness for smooth ODEs on an open time-state domain |
| 7 | |
| 8 | A joint local Lipschitz bound supplies one constant on the time slices of |
| 9 | a neighborhood. Local uniqueness then propagates through a common open |
| 10 | preconnected time domain. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace PoincareMT.ReducedLength |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | |
| 21 | theorem openODE_eventuallyEq (S : Set (ℝ × E)) (hS : IsOpen S) |
| 22 | (V : ℝ × E → E) (hV : ContDiffOn ℝ 1 V S) |
| 23 | (f g : ℝ → E) (t0 : ℝ) (h0 : (t0, f t0) ∈ S) (heq : f t0 = g t0) |
| 24 | (hf : ∀ᶠ t in 𝓝 t0, (t, f t) ∈ S ∧ HasDerivAt f (V (t, f t)) t) |
| 25 | (hg : ∀ᶠ t in 𝓝 t0, (t, g t) ∈ S ∧ HasDerivAt g (V (t, g t)) t) : |
| 26 | f =ᶠ[𝓝 t0] g := by |
| 27 | obtain ⟨K, Q, hQ, hL⟩ := (hV.contDiffAt (hS.mem_nhds h0)).exists_lipschitzOnWith |
| 28 | have hLip : ∀ t : ℝ, LipschitzOnWith K (fun x ↦ V (t, x)) {x | (t, x) ∈ Q} := by |
| 29 | intro t x hx y hy |
| 30 | simpa only [Prod.edist_eq, edist_self, |
| 31 | max_eq_right (show 0 ≤ edist x y from bot_le)] using hL hx hy |
| 32 | have hfQ : ∀ᶠ t in 𝓝 t0, (t, f t) ∈ Q := |
| 33 | (continuousAt_id.prodMk hf.self_of_nhds.2.continuousAt).preimage_mem_nhds hQ |
| 34 | have hgQ : ∀ᶠ t in 𝓝 t0, (t, g t) ∈ Q := by |
| 35 | apply (continuousAt_id.prodMk hg.self_of_nhds.2.continuousAt).preimage_mem_nhds |
| 36 | simpa only [heq, Function.id_def] using hQ |
| 37 | exact ODE_solution_unique_of_eventually (Filter.Eventually.of_forall hLip) |
| 38 | ((hf.and hfQ).mono (fun _ h ↦ ⟨h.1.2, h.2⟩)) |
| 39 | ((hg.and hgQ).mono (fun _ h ↦ ⟨h.1.2, h.2⟩)) heq |
| 40 | |
| 41 | theorem openODE_eqOn (S : Set (ℝ × E)) (hS : IsOpen S) |
| 42 | (V : ℝ × E → E) (hV : ContDiffOn ℝ 1 V S) |
| 43 | (I : Set ℝ) (hI : IsOpen I) (hconn : IsPreconnected I) |
| 44 | (f g : ℝ → E) (t0 : ℝ) (ht0 : t0 ∈ I) (heq : f t0 = g t0) |
| 45 | (hf : ∀ t ∈ I, (t, f t) ∈ S ∧ HasDerivAt f (V (t, f t)) t) |
| 46 | (hg : ∀ t ∈ I, (t, g t) ∈ S ∧ HasDerivAt g (V (t, g t)) t) : |
| 47 | Set.EqOn f g I := by |
| 48 | letI : PreconnectedSpace I := isPreconnected_iff_preconnectedSpace.mp hconn |
| 49 | let A : Set I := {t | f t = g t} |
| 50 | have hfc : ContinuousOn f I := fun t ht ↦ (hf t ht).2.continuousAt.continuousWithinAt |
| 51 | have hgc : ContinuousOn g I := fun t ht ↦ (hg t ht).2.continuousAt.continuousWithinAt |
| 52 | have hclosed : IsClosed A := isClosed_eq hfc.domRestrict hgc.domRestrict |
| 53 | have hopen : IsOpen A := by |
| 54 | apply isOpen_iff_mem_nhds.mpr |
| 55 | intro t ht |
| 56 | have hf' : ∀ᶠ r in 𝓝 (t : ℝ), |
| 57 | (r, f r) ∈ S ∧ HasDerivAt f (V (r, f r)) r := |
| 58 | Filter.Eventually.mono (hI.mem_nhds t.property) (fun r hr ↦ hf r hr) |
| 59 | have hg' : ∀ᶠ r in 𝓝 (t : ℝ), |
| 60 | (r, g r) ∈ S ∧ HasDerivAt g (V (r, g r)) r := |
| 61 | Filter.Eventually.mono (hI.mem_nhds t.property) (fun r hr ↦ hg r hr) |
| 62 | exact continuousAt_subtype_val.preimage_mem_nhds |
| 63 | (openODE_eventuallyEq S hS V hV f g t (hf t t.property).1 ht hf' hg') |
| 64 | have hAll : A = Set.univ := IsClopen.eq_univ ⟨hclosed, hopen⟩ ⟨⟨t0, ht0⟩, heq⟩ |
| 65 | intro t ht |
| 66 | have hm : (⟨t, ht⟩ : I) ∈ A := by rw [hAll]; exact Set.mem_univ _ |
| 67 | exact hm |
| 68 | |
| 69 | end PoincareMT.ReducedLength |