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.Variation.Coordinates.ClosedChartCoefficients |
| 2 | import Mathlib.Analysis.ODE.ExistUnique |
| 3 | |
| 4 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ContinuationLocalODE.lean` at |
| 5 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 6 | |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | noncomputable section |
| 12 | |
| 13 | open Set Filter Topology |
| 14 | open scoped ContDiff Manifold Bundle |
| 15 | |
| 16 | namespace PoincareMT.LGeometry |
| 17 | |
| 18 | section LocalODE |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 21 | |
| 22 | set_option maxHeartbeats 1000000 in |
| 23 | theorem exists_smooth_local_phase {U : Set ℝ} {V : Set E} |
| 24 | (hU : IsOpen U) (hV : IsOpen V) (f : ℝ → E → E) |
| 25 | (hf : ContDiffOn ℝ ∞ (Function.uncurry f) (U ×ˢ V)) |
| 26 | {t₀ : ℝ} {z₀ : E} (ht₀ : t₀ ∈ U) (hz₀ : z₀ ∈ V) : |
| 27 | ∃ ε : ℝ, 0 < ε ∧ ∃ z : ℝ → E, |
| 28 | z t₀ = z₀ ∧ Ioo (t₀ - 2 * ε) (t₀ + 2 * ε) ⊆ U ∧ |
| 29 | MapsTo z (Ioo (t₀ - 2 * ε) (t₀ + 2 * ε)) V ∧ |
| 30 | ContDiffOn ℝ ∞ z (Ioo (t₀ - 2 * ε) (t₀ + 2 * ε)) ∧ |
| 31 | ∀ t ∈ Ioo (t₀ - 2 * ε) (t₀ + 2 * ε), HasDerivAt z (f t (z t)) t := by |
| 32 | let A : ℝ × E → ℝ × E := fun w ↦ (1, f w.1 w.2) |
| 33 | have hA : ContDiffAt ℝ 1 A (t₀, z₀) := |
| 34 | (contDiffAt_const.prodMk ((hf _ ⟨ht₀, hz₀⟩).contDiffAt |
| 35 | ((hU.prod hV).mem_nhds ⟨ht₀, hz₀⟩))).of_le (by simp) |
| 36 | obtain ⟨γ, hγ₀, d, hd, hγd⟩ := |
| 37 | hA.exists_forall_mem_closedBall_exists_eq_forall_mem_Ioo_hasDerivAt₀ t₀ |
| 38 | have hγtd (r : ℝ) (hr : r ∈ Ioo (t₀ - d) (t₀ + d)) : |
| 39 | HasDerivAt (fun t ↦ (γ t).1) 1 r := by |
| 40 | exact (hγd r hr).fst |
| 41 | have hγt (t : ℝ) (ht : t ∈ Ioo (t₀ - d) (t₀ + d)) : (γ t).1 = t := by |
| 42 | have heq : EqOn (fun r ↦ (γ r).1) (fun r ↦ r) (Ioo (t₀ - d) (t₀ + d)) := by |
| 43 | apply isOpen_Ioo.eqOn_of_deriv_eq (x := t₀) isPreconnected_Ioo |
| 44 | (fun r hr ↦ (hγtd r hr).differentiableAt.differentiableWithinAt) |
| 45 | differentiableOn_id |
| 46 | · intro r hr |
| 47 | rw [(hγtd r hr).deriv, deriv_id] |
| 48 | · exact ⟨by linarith, by linarith⟩ |
| 49 | · exact congrArg Prod.fst hγ₀ |
| 50 | exact heq ht |
| 51 | have hγc : ContinuousAt γ t₀ := |
| 52 | (hγd t₀ ⟨by linarith, by linarith⟩).continuousAt |
| 53 | have hnear : ∀ᶠ t in 𝓝 t₀, γ t ∈ U ×ˢ V := by |
| 54 | apply hγc (hU.prod hV |>.mem_nhds ?_) |
| 55 | rw [hγ₀] |
| 56 | exact ⟨ht₀, hz₀⟩ |
| 57 | obtain ⟨r, hr, hball⟩ := Metric.eventually_nhds_iff.mp hnear |
| 58 | let e := min d r / 4 |
| 59 | have he : 0 < e := by dsimp only [e]; positivity |
| 60 | have hsub : Icc (t₀ - 3 * e) (t₀ + 3 * e) ⊆ Ioo (t₀ - d) (t₀ + d) := by |
| 61 | intro t ht |
| 62 | have he' : 4 * e ≤ d := by dsimp only [e]; linarith [min_le_left d r] |
| 63 | exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 64 | have hmem (t : ℝ) (ht : t ∈ Icc (t₀ - 3 * e) (t₀ + 3 * e)) : γ t ∈ U ×ˢ V := by |
| 65 | apply hball |
| 66 | have he' : 4 * e ≤ r := by dsimp only [e]; linarith [min_le_right d r] |
| 67 | rw [Real.dist_eq, abs_lt] |
| 68 | exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 69 | let z := fun t ↦ (γ t).2 |
| 70 | have hzd (t : ℝ) (ht : t ∈ Icc (t₀ - 3 * e) (t₀ + 3 * e)) : |
| 71 | HasDerivAt z (f t (z t)) t := by |
| 72 | have h := (hγd t (hsub ht)).snd |
| 73 | change HasDerivAt z (f (γ t).1 (z t)) t at h |
| 74 | rwa [hγt t (hsub ht)] at h |
| 75 | have htime : Icc (t₀ - 3 * e) (t₀ + 3 * e) ⊆ U := by |
| 76 | intro t ht |
| 77 | simpa only [hγt t (hsub ht)] using (hmem t ht).1 |
| 78 | have htarget : MapsTo z (Icc (t₀ - 3 * e) (t₀ + 3 * e)) V := |
| 79 | fun t ht ↦ (hmem t ht).2 |
| 80 | have hzs : ContDiffOn ℝ ∞ z (Icc (t₀ - 3 * e) (t₀ + 3 * e)) := |
| 81 | ODE.contDiffOn_enat_Icc_of_hasDerivWithinAt (n := ⊤) |
| 82 | (hf.mono (prod_mono htime subset_rfl)) |
| 83 | (fun t ht ↦ (hzd t ht).hasDerivWithinAt) htarget |
| 84 | have hsmall : Ioo (t₀ - 2 * e) (t₀ + 2 * e) ⊆ Icc (t₀ - 3 * e) (t₀ + 3 * e) := by |
| 85 | intro t ht |
| 86 | exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 87 | exact ⟨e, he, z, congrArg Prod.snd hγ₀, hsmall.trans htime, |
| 88 | htarget.mono_left hsmall, hzs.mono hsmall, fun t ht ↦ hzd t (hsmall ht)⟩ |
| 89 | |
| 90 | theorem smooth_phase_eventuallyEq (f : ℝ → E → E) {z w : ℝ → E} {t₀ : ℝ} |
| 91 | (hf : ContDiffAt ℝ 1 (Function.uncurry f) (t₀, z t₀)) |
| 92 | (hz : ∀ᶠ t in 𝓝 t₀, HasDerivAt z (f t (z t)) t) |
| 93 | (hw : ∀ᶠ t in 𝓝 t₀, HasDerivAt w (f t (w t)) t) |
| 94 | (heq : z t₀ = w t₀) : z =ᶠ[𝓝 t₀] w := by |
| 95 | obtain ⟨K, S, hS, hLip⟩ := hf.exists_lipschitzOnWith |
| 96 | have hzc : ContinuousAt z t₀ := (hz.self_of_nhds).continuousAt |
| 97 | have hwc : ContinuousAt w t₀ := (hw.self_of_nhds).continuousAt |
| 98 | have hzS : ∀ᶠ t in 𝓝 t₀, (t, z t) ∈ S := |
| 99 | (continuousAt_id.prodMk hzc) hS |
| 100 | have hwS : ∀ᶠ t in 𝓝 t₀, (t, w t) ∈ S := by |
| 101 | apply (continuousAt_id.prodMk hwc) |
| 102 | simpa only [heq, id_eq] using hS |
| 103 | apply ODE_solution_unique_of_eventually (K := K) (s := fun t ↦ {y | (t, y) ∈ S}) |
| 104 | (Filter.Eventually.of_forall (fun t ↦ ?_)) (hz.and hzS) (hw.and hwS) heq |
| 105 | apply LipschitzOnWith.of_dist_le_mul |
| 106 | intro y hy y' hy' |
| 107 | simpa only [Function.uncurry_apply_pair, Prod.dist_eq, dist_self, |
| 108 | max_eq_right dist_nonneg] using hLip.dist_le_mul (x := (t, y)) (y := (t, y')) hy hy' |
| 109 | |
| 110 | end LocalODE |
| 111 | |
| 112 | end PoincareMT.LGeometry |