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.RicciFlow.ReducedGeometry.LGeometry.Continuation.ContinuationLocalODE |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ContinuationEndpoint.lean` at |
| 4 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 5 | |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | noncomputable section |
| 11 | |
| 12 | open Set Filter Topology |
| 13 | open scoped ContDiff |
| 14 | |
| 15 | namespace PoincareMT.LGeometry |
| 16 | |
| 17 | theorem smooth_phase_eqOn_right {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 18 | (f : ℝ → E → E) {z w : ℝ → E} {a b : ℝ} (hab : a < b) |
| 19 | (hf : ContDiffAt ℝ 1 (Function.uncurry f) (a, z a)) |
| 20 | (hz : ∀ t ∈ Icc a b, HasDerivWithinAt z (f t (z t)) (Icc a b) t) |
| 21 | (hw : ∀ t ∈ Icc a b, HasDerivWithinAt w (f t (w t)) (Icc a b) t) |
| 22 | (heq : z a = w a) : |
| 23 | ∃ d : ℝ, a < d ∧ d < b ∧ EqOn z w (Icc a d) := by |
| 24 | obtain ⟨K, S, hS, hLip⟩ := hf.exists_lipschitzOnWith |
| 25 | have ha : a ∈ Icc a b := ⟨le_rfl, hab.le⟩ |
| 26 | have hzc : ContinuousOn z (Icc a b) := HasDerivWithinAt.continuousOn hz |
| 27 | have hwc : ContinuousOn w (Icc a b) := HasDerivWithinAt.continuousOn hw |
| 28 | have hzS : ∀ᶠ t in 𝓝[Icc a b] a, (t, z t) ∈ S := |
| 29 | (continuousWithinAt_id.prodMk (hzc a ha)) hS |
| 30 | have hwS : ∀ᶠ t in 𝓝[Icc a b] a, (t, w t) ∈ S := by |
| 31 | apply (continuousWithinAt_id.prodMk (hwc a ha)) |
| 32 | simpa only [heq, id_eq] using hS |
| 33 | obtain ⟨U, hU, haU, hUS⟩ := mem_nhdsWithin.mp (hzS.and hwS) |
| 34 | obtain ⟨l, r, ⟨hla, har⟩, hUr⟩ := mem_nhds_iff_exists_Ioo_subset.mp (hU.mem_nhds haU) |
| 35 | obtain ⟨d, had, hdm⟩ := exists_between (lt_min hab har) |
| 36 | have hdb := hdm.trans_le (min_le_left b r) |
| 37 | have hsub : Icc a d ⊆ Icc a b := Icc_subset_Icc_right hdb.le |
| 38 | have hmem (t : ℝ) (ht : t ∈ Icc a d) : (t, z t) ∈ S ∧ (t, w t) ∈ S := |
| 39 | hUS ⟨hUr ⟨hla.trans_le ht.1, ht.2.trans_lt (hdm.trans_le (min_le_right b r))⟩, hsub ht⟩ |
| 40 | refine ⟨d, had, hdb, ?_⟩ |
| 41 | apply ODE_solution_unique_of_mem_Icc_right (K := K) (v := f) |
| 42 | (s := fun t ↦ {y | (t, y) ∈ S}) ?_ (hzc.mono hsub) ?_ |
| 43 | (fun t ht ↦ (hmem t (Ico_subset_Icc_self ht)).1) (hwc.mono hsub) ?_ |
| 44 | (fun t ht ↦ (hmem t (Ico_subset_Icc_self ht)).2) heq |
| 45 | · intro t _ht |
| 46 | apply LipschitzOnWith.of_dist_le_mul |
| 47 | intro y hy y' hy' |
| 48 | simpa only [Function.uncurry_apply_pair, Prod.dist_eq, dist_self, |
| 49 | max_eq_right dist_nonneg] using hLip.dist_le_mul (x := (t, y)) (y := (t, y')) hy hy' |
| 50 | · intro t ht |
| 51 | exact (hz t (hsub (Ico_subset_Icc_self ht))).mono_of_mem_nhdsWithin |
| 52 | (Icc_mem_nhdsGE_of_mem ⟨ht.1, ht.2.trans hdb⟩) |
| 53 | · intro t ht |
| 54 | exact (hw t (hsub (Ico_subset_Icc_self ht))).mono_of_mem_nhdsWithin |
| 55 | (Icc_mem_nhdsGE_of_mem ⟨ht.1, ht.2.trans hdb⟩) |
| 56 | |
| 57 | end PoincareMT.LGeometry |