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.Ramp.LocalFlow.Ambient.CurveCoefficients |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.ProductLipschitz |
| 3 | |
| 4 | /-! |
| 5 | # Actual open jet domain and uniform compact coefficient bounds |
| 6 | |
| 7 | Positive projected speed defines an open domain. The actual coefficients |
| 8 | and retraction defect have uniform bounds on arbitrary compact jet sets, |
| 9 | through both time endpoints. MT2007 Claim 19.1, p. 437; |
| 10 | `2026-09-21-ambient-compact-jet-bounds.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff |
| 18 | |
| 19 | universe u v |
| 20 | |
| 21 | namespace PoincareMT.M63 |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 26 | |
| 27 | local notation "W" => EuclideanSpace ℝ ι |
| 28 | |
| 29 | /-- Nonzero projected velocity defines an open jet domain, without any |
| 30 | submersion premise. MT2007 Claim 19.1, p. 437; ambient compact jet |
| 31 | derivation, statement 1. -/ |
| 32 | theorem isOpen_ambientCurveJetDomain (F : RicciFlow n M (Icc a b)) |
| 33 | {U : Set W} (hU : IsOpen U) {ρ : W → M} |
| 34 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) : |
| 35 | IsOpen {z : W × W | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0} := by |
| 36 | obtain ⟨s, hs, _, _, _⟩ := F.nontrivial |
| 37 | have ha : a ∈ Icc a b := ⟨le_rfl, hs.1.trans hs.2⟩ |
| 38 | let G : W × W → ℝ := fun z => (F.metric a).inner (ρ z.1) |
| 39 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) |
| 40 | have hparam : ContDiff ℝ ∞ (fun z : W × W => ((a, z.1), z.2)) := by fun_prop |
| 41 | have hG : ContinuousOn G (U ×ˢ univ) := |
| 42 | ((flow_pullback_metric_hessian_contDiffOn F hU hρ |
| 43 | (f := fun _ => 0) contMDiff_const).1.comp hparam.contDiffOn |
| 44 | (fun _ hz => ⟨⟨ha, hz.1⟩, mem_univ _⟩)).continuousOn |
| 45 | have heq : {z : W × W | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0} = |
| 46 | (U ×ˢ univ) ∩ G ⁻¹' Ioi 0 := by |
| 47 | ext z |
| 48 | refine ⟨fun hz => ⟨⟨hz.1, mem_univ _⟩, (F.metric a).pos (ρ z.1) _ hz.2⟩, ?_⟩ |
| 49 | intro hz |
| 50 | refine ⟨hz.1.1, ?_⟩ |
| 51 | intro hzero |
| 52 | have hpos : 0 < G z := hz.2 |
| 53 | simp only [G, hzero, map_zero] at hpos |
| 54 | exact (lt_irrefl 0) hpos |
| 55 | rw [heq] |
| 56 | exact hG.isOpen_inter_preimage (hU.prod isOpen_univ) isOpen_Ioi |
| 57 | |
| 58 | /-- Actual ellipticity and coefficient/defect Lipschitz constants are |
| 59 | uniform on a compact set of immersed jets for the entire closed flow |
| 60 | interval. The compact set need not be convex or nonempty. MT2007 |
| 61 | Claim 19.1, p. 437; ambient compact jet derivation, statement 2. -/ |
| 62 | theorem ambientCurveCoefficients_uniform_bounds (F : RicciFlow n M (Icc a b)) |
| 63 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 64 | {U : Set W} (hU : IsOpen U) {ρ : W → M} |
| 65 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) |
| 66 | {K : Set (W × W)} (hK : IsCompact K) |
| 67 | (hsub : K ⊆ {z : W × W | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0}) : |
| 68 | ∃ mu Lambda : ℝ, 0 < mu ∧ 0 < Lambda ∧ ∃ L_A L_B L_D : NNReal, |
| 69 | (∀ t ∈ Icc a b, ∀ z ∈ K, |
| 70 | mu ≤ ambientCurvePrincipal F ρ t z.1 z.2 ∧ |
| 71 | ambientCurvePrincipal F ρ t z.1 z.2 ≤ Lambda) ∧ |
| 72 | (∀ t ∈ Icc a b, |
| 73 | LipschitzOnWith L_A (fun z : W × W => ambientCurvePrincipal F ρ t z.1 z.2) K) ∧ |
| 74 | (∀ t ∈ Icc a b, |
| 75 | LipschitzOnWith L_B (fun z : W × W => ambientCurveLower F e ρ t z.1 z.2) K) ∧ |
| 76 | (∀ t ∈ Icc a b, LipschitzOnWith L_D (fun z : W × W => |
| 77 | retractionParabolicDefect (e ∘ ρ) (ambientCurvePrincipal F ρ) |
| 78 | (ambientCurveLower F e ρ) t z.1 z.2) K) := by |
| 79 | let Ω : Set (W × W) := {z | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0} |
| 80 | let A : ℝ × (W × W) → ℝ := fun z => ambientCurvePrincipal F ρ z.1 z.2.1 z.2.2 |
| 81 | let B : ℝ × (W × W) → W := fun z => ambientCurveLower F e ρ z.1 z.2.1 z.2.2 |
| 82 | let r : W → W := e ∘ ρ |
| 83 | let D : ℝ × (W × W) → W := fun z => |
| 84 | retractionParabolicDefect r (ambientCurvePrincipal F ρ) |
| 85 | (ambientCurveLower F e ρ) z.1 z.2.1 z.2.2 |
| 86 | have hΩ : IsOpen Ω := isOpen_ambientCurveJetDomain F hU hρ |
| 87 | obtain ⟨hAraw, hBraw, hposraw⟩ := ambientCurveCoefficients_contDiffOn F he hU hρ |
| 88 | have hparam : ContDiff ℝ ∞ |
| 89 | (fun z : ℝ × (W × W) => ((z.1, z.2.1), z.2.2)) := by fun_prop |
| 90 | have hAcomp := hAraw.comp (s := Icc a b ×ˢ Ω) hparam.contDiffOn |
| 91 | (fun _ hz => ⟨hz.1, hz.2⟩) |
| 92 | have hA : ContDiffOn ℝ ∞ A (Icc a b ×ˢ Ω) := hAcomp |
| 93 | have hBcomp := hBraw.comp (s := Icc a b ×ˢ Ω) hparam.contDiffOn |
| 94 | (fun _ hz => ⟨hz.1, hz.2⟩) |
| 95 | have hB : ContDiffOn ℝ ∞ B (Icc a b ×ˢ Ω) := hBcomp |
| 96 | have hr : ContDiffOn ℝ ∞ r U := (he.comp_contMDiffOn hρ).contDiffOn |
| 97 | have hDr : ContDiffOn ℝ ∞ (fderiv ℝ r) U := hr.fderiv_of_isOpen hU (m := ∞) (by simp) |
| 98 | have hDDr : ContDiffOn ℝ ∞ (fderiv ℝ (fderiv ℝ r)) U := |
| 99 | hDr.fderiv_of_isOpen hU (m := ∞) (by simp) |
| 100 | have hz : ContDiffOn ℝ ∞ (fun z : ℝ × (W × W) => z.2.1) (Icc a b ×ˢ Ω) := |
| 101 | contDiff_snd.fst.contDiffOn |
| 102 | have hv : ContDiffOn ℝ ∞ (fun z : ℝ × (W × W) => z.2.2) (Icc a b ×ˢ Ω) := |
| 103 | contDiff_snd.snd.contDiffOn |
| 104 | have hDrparam : ContDiffOn ℝ ∞ (fun z : ℝ × (W × W) => fderiv ℝ r z.2.1) |
| 105 | (Icc a b ×ˢ Ω) := hDr.comp hz (fun _ hx => hx.2.1) |
| 106 | have hDDrparam : ContDiffOn ℝ ∞ |
| 107 | (fun z : ℝ × (W × W) => fderiv ℝ (fderiv ℝ r) z.2.1) (Icc a b ×ˢ Ω) := |
| 108 | hDDr.comp hz (fun _ hx => hx.2.1) |
| 109 | have hsecond : ContDiffOn ℝ ∞ |
| 110 | (fun z : ℝ × (W × W) => fderiv ℝ (fderiv ℝ r) z.2.1 z.2.2 z.2.2) |
| 111 | (Icc a b ×ˢ Ω) := (hDDrparam.clm_apply hv).clm_apply hv |
| 112 | have hD : ContDiffOn ℝ ∞ D (Icc a b ×ˢ Ω) := |
| 113 | ((hA.smul hsecond).add hB).sub (hDrparam.clm_apply hB) |
| 114 | have hcompact : IsCompact (Icc a b ×ˢ K) := isCompact_Icc.prod hK |
| 115 | have hKU : Icc a b ×ˢ K ⊆ Icc a b ×ˢ Ω := fun _ hz => ⟨hz.1, hsub hz.2⟩ |
| 116 | obtain ⟨L_A, hLA⟩ := exists_lipschitzOnWith_compact_product (convex_Icc a b) hΩ |
| 117 | (hA.of_le (by simp)) hcompact hKU |
| 118 | obtain ⟨L_B, hLB⟩ := exists_lipschitzOnWith_compact_product (convex_Icc a b) hΩ |
| 119 | (hB.of_le (by simp)) hcompact hKU |
| 120 | obtain ⟨L_D, hLD⟩ := exists_lipschitzOnWith_compact_product (convex_Icc a b) hΩ |
| 121 | (hD.of_le (by simp)) hcompact hKU |
| 122 | have hpos (z : ℝ × (W × W)) (hz : z ∈ Icc a b ×ˢ K) : 0 < A z := |
| 123 | hposraw z.1 z.2.1 (hsub hz.2).1 z.2.2 (hsub hz.2).2 |
| 124 | have hbounds : ∃ mu Lambda : ℝ, 0 < mu ∧ 0 < Lambda ∧ |
| 125 | ∀ z ∈ Icc a b ×ˢ K, mu ≤ A z ∧ A z ≤ Lambda := by |
| 126 | by_cases hne : (Icc a b ×ˢ K).Nonempty |
| 127 | · obtain ⟨zmin, hzmin, hmin⟩ := hcompact.exists_isMinOn hne (hA.mono hKU).continuousOn |
| 128 | obtain ⟨zmax, hzmax, hmax⟩ := hcompact.exists_isMaxOn hne (hA.mono hKU).continuousOn |
| 129 | exact ⟨A zmin, A zmax, hpos zmin hzmin, hpos zmax hzmax, |
| 130 | fun _ hz => ⟨hmin hz, hmax hz⟩⟩ |
| 131 | · exact ⟨1, 1, zero_lt_one, zero_lt_one, fun z hz => (hne ⟨z, hz⟩).elim⟩ |
| 132 | obtain ⟨mu, Lambda, hmu, hLambda, hbounds⟩ := hbounds |
| 133 | have hdist (t : ℝ) (z w : W × W) : dist (t, z) (t, w) = dist z w := by |
| 134 | change max (dist t t) (dist z w) = dist z w |
| 135 | simp only [dist_self, max_eq_right dist_nonneg] |
| 136 | refine ⟨mu, Lambda, hmu, hLambda, L_A, L_B, L_D, |
| 137 | (fun t ht z hz => hbounds (t, z) ⟨ht, hz⟩), ?_, ?_, ?_⟩ |
| 138 | · intro t ht |
| 139 | apply LipschitzOnWith.of_dist_le_mul |
| 140 | intro z hz w hw |
| 141 | simpa only [hdist] using hLA.dist_le_mul (t, z) ⟨ht, hz⟩ (t, w) ⟨ht, hw⟩ |
| 142 | · intro t ht |
| 143 | apply LipschitzOnWith.of_dist_le_mul |
| 144 | intro z hz w hw |
| 145 | simpa only [hdist] using hLB.dist_le_mul (t, z) ⟨ht, hz⟩ (t, w) ⟨ht, hw⟩ |
| 146 | · intro t ht |
| 147 | apply LipschitzOnWith.of_dist_le_mul |
| 148 | intro z hz w hw |
| 149 | simpa only [hdist] using hLD.dist_le_mul (t, z) ⟨ht, hz⟩ (t, w) ⟨ht, hw⟩ |
| 150 | |
| 151 | end PoincareMT.M63 |