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.Frame.Transport.Variational |
| 2 | |
| 3 | /-! |
| 4 | # Higher joint regularity of linear transport |
| 5 | |
| 6 | Spatial derivatives satisfy a triangular linear equation on the product of |
| 7 | two copies of the state space. Applying regularity inductively to that system |
| 8 | gives all joint spatial and time derivatives, including the time endpoints. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxHeartbeats 1000000 |
| 13 | |
| 14 | open Set |
| 15 | open scoped ContDiff NNReal |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | namespace PoincareMT.RicciFlow.Frame |
| 20 | |
| 21 | variable {P G : Type*} |
| 22 | [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] |
| 23 | [NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G] |
| 24 | |
| 25 | noncomputable local instance : NormedAddCommGroup (G →L[ℝ] G) := |
| 26 | ContinuousLinearMap.toNormedAddCommGroup |
| 27 | |
| 28 | noncomputable local instance : NormedSpace ℝ (G →L[ℝ] G) := |
| 29 | ContinuousLinearMap.toNormedSpace |
| 30 | |
| 31 | /-- Triangular coefficient for a solution and one of its spatial derivatives. -/ |
| 32 | private def variationCoeff (A D : G →L[ℝ] G) : (G × G) →L[ℝ] (G × G) := |
| 33 | (A.comp (ContinuousLinearMap.fst ℝ G G)).prod |
| 34 | (D.comp (ContinuousLinearMap.fst ℝ G G) + A.comp (ContinuousLinearMap.snd ℝ G G)) |
| 35 | |
| 36 | private theorem variationCoeff_apply (A D : G →L[ℝ] G) (z : G × G) : |
| 37 | variationCoeff A D z = (A z.1, D z.1 + A z.2) := rfl |
| 38 | |
| 39 | private theorem variationCoeff_contDiffOn |
| 40 | {A D : P × ℝ → G →L[ℝ] G} {S : Set (P × ℝ)} |
| 41 | (hA : ContDiffOn ℝ ∞ A S) (hD : ContDiffOn ℝ ∞ D S) : |
| 42 | ContDiffOn ℝ ∞ (fun q => variationCoeff (A q) (D q)) S := by |
| 43 | letI : NormedAddCommGroup ((G × G) →L[ℝ] G) := ContinuousLinearMap.toNormedAddCommGroup |
| 44 | letI : NormedSpace ℝ ((G × G) →L[ℝ] G) := ContinuousLinearMap.toNormedSpace |
| 45 | letI : NormedAddCommGroup ((G × G) →L[ℝ] (G × G)) := |
| 46 | ContinuousLinearMap.toNormedAddCommGroup |
| 47 | letI : NormedSpace ℝ ((G × G) →L[ℝ] (G × G)) := ContinuousLinearMap.toNormedSpace |
| 48 | exact (ContinuousLinearMap.prodL (𝕜 := ℝ) (E := G × G) (F := G) (G := G) ℝ).contDiff.comp_contDiffOn |
| 49 | ((hA.clm_comp contDiffOn_const).prodMk |
| 50 | ((hD.clm_comp contDiffOn_const).add (hA.clm_comp contDiffOn_const))) |
| 51 | |
| 52 | /-- Every finite order of joint regularity holds up to the compact time |
| 53 | endpoints for a smooth parameter-dependent linear equation. -/ |
| 54 | theorem linearODE_contDiffOn_nat |
| 55 | (n : ℕ) (A : P → ℝ → G →L[ℝ] G) {a b : ℝ} (hab : a ≤ b) |
| 56 | {U : Set P} (hU : IsOpen U) |
| 57 | (hA : ContDiffOn ℝ ∞ (Function.uncurry A) (U ×ˢ Icc a b)) |
| 58 | (Φ : P → ℝ → G) (hinit : ContDiffOn ℝ ∞ (fun p => Φ p a) U) |
| 59 | (hsol : ∀ p ∈ U, ∀ t ∈ Icc a b, |
| 60 | HasDerivWithinAt (Φ p) (A p t (Φ p t)) (Icc a b) t) : |
| 61 | ContDiffOn ℝ (n : WithTop ℕ∞) (Function.uncurry Φ) (U ×ˢ Icc a b) := by |
| 62 | induction n generalizing G with |
| 63 | | zero => |
| 64 | exact contDiffOn_zero.mpr (linearODE_continuousOn A hab hU hA Φ hinit hsol) |
| 65 | | succ n ih => |
| 66 | rcases eq_or_lt_of_le hab with heq | hlt |
| 67 | · have h0 : ContDiffOn ℝ (n + 1 : WithTop ℕ∞) |
| 68 | (fun q : P × ℝ => Φ q.1 a) (U ×ˢ Icc a b) := |
| 69 | (hinit.of_le (by exact_mod_cast (show (n + 1 : ℕ∞) ≤ ⊤ from le_top))).comp |
| 70 | contDiffOn_fst (fun _ hq => hq.1) |
| 71 | apply h0.congr |
| 72 | intro q hq |
| 73 | have ht : q.2 = a := by obtain ⟨ht₁, ht₂⟩ := hq.2; linarith |
| 74 | simp only [Function.uncurry, ht] |
| 75 | have hΦn : ContDiffOn ℝ (n : WithTop ℕ∞) (Function.uncurry Φ) (U ×ˢ Icc a b) := |
| 76 | ih A hA Φ hinit hsol |
| 77 | have hD : ContDiffOn ℝ (n : WithTop ℕ∞) |
| 78 | (fun q : P × ℝ => fderiv ℝ (fun p => Φ p q.2) q.1) (U ×ˢ Icc a b) := by |
| 79 | rw [contDiffOn_clm_apply] |
| 80 | intro v |
| 81 | let DA : P → ℝ → G →L[ℝ] G := fun p t => (fderiv ℝ (fun x => A x t) p) v |
| 82 | let B : P → ℝ → (G × G) →L[ℝ] (G × G) := |
| 83 | fun p t => variationCoeff (A p t) (DA p t) |
| 84 | let Z : P → ℝ → G × G := fun p t => (Φ p t, (fderiv ℝ (fun x => Φ x t) p) v) |
| 85 | have hDA : ContDiffOn ℝ ∞ (Function.uncurry DA) (U ×ˢ Icc a b) := |
| 86 | (contDiffOn_fderiv_param_Icc hlt hU hA).clm_apply contDiffOn_const |
| 87 | have hB : ContDiffOn ℝ ∞ (Function.uncurry B) (U ×ˢ Icc a b) := |
| 88 | variationCoeff_contDiffOn hA hDA |
| 89 | have hZinit : ContDiffOn ℝ ∞ (fun p => Z p a) U := |
| 90 | hinit.prodMk ((hinit.fderiv_of_isOpen hU (m := ∞) (by simp)).clm_apply contDiffOn_const) |
| 91 | have hZsol : ∀ p ∈ U, ∀ t ∈ Icc a b, |
| 92 | HasDerivWithinAt (Z p) (B p t (Z p t)) (Icc a b) t := by |
| 93 | intro p hp t ht |
| 94 | have hv := (linearODE_hasDerivWithinAt_fderiv_param A hab hU hA Φ hinit hsol hp ht).clm_apply |
| 95 | (hasDerivWithinAt_const (x := t) (s := Icc a b) (c := v)) |
| 96 | have hpair := (hsol p hp t ht).prodMk hv |
| 97 | simpa [Z, B, DA, variationCoeff_apply] using hpair |
| 98 | exact (ih B hB Z hZinit hZsol).snd |
| 99 | have htime : ContDiffOn ℝ (n : WithTop ℕ∞) |
| 100 | (fun q : P × ℝ => A q.1 q.2 (Φ q.1 q.2)) (U ×ˢ Icc a b) := |
| 101 | (hA.of_le (by exact_mod_cast (show (n : ℕ∞) ≤ ⊤ from le_top))).clm_apply hΦn |
| 102 | let D : P × ℝ → (P × ℝ) →L[ℝ] G := fun q => |
| 103 | (fderiv ℝ (fun p => Φ p q.2) q.1).coprod |
| 104 | (ContinuousLinearMap.toSpanSingleton ℝ (A q.1 q.2 (Φ q.1 q.2))) |
| 105 | have htimeL : ContDiffOn ℝ (n : WithTop ℕ∞) |
| 106 | (fun q : P × ℝ => ContinuousLinearMap.toSpanSingleton ℝ (A q.1 q.2 (Φ q.1 q.2))) |
| 107 | (U ×ˢ Icc a b) := |
| 108 | (ContinuousLinearMap.toSpanSingletonCLE (𝕜 := ℝ) (E := G)).contDiff.comp_contDiffOn htime |
| 109 | have hDn : ContDiffOn ℝ (n : WithTop ℕ∞) D (U ×ˢ Icc a b) := by |
| 110 | exact (ContinuousLinearMap.coprodEquivL ℝ (E := P) (F := ℝ) (G := G)).contDiff.comp_contDiffOn |
| 111 | (hD.prodMk htimeL) |
| 112 | have hder : ∀ q ∈ U ×ˢ Icc a b, |
| 113 | HasFDerivWithinAt (Function.uncurry Φ) (D q) (U ×ˢ Icc a b) q := by |
| 114 | intro q hq |
| 115 | have hs := linearODE_contDiffOn_spatial A hab hU hA Φ hinit hsol hq.2 |
| 116 | have hx := (((hs q.1 hq.1).contDiffAt (hU.mem_nhds hq.1)).differentiableAt |
| 117 | (by simp)).hasFDerivAt |
| 118 | apply Poincare.hasFDerivWithinAt_prod_of_continuous_partial (convex_Icc a b) hq hx |
| 119 | (fun r hr => (hsol r.1 hr.1 r.2 hr.2).hasFDerivWithinAt) |
| 120 | exact ContinuousLinearMap.toSpanSingletonCLE.continuous.continuousAt.comp_continuousWithinAt |
| 121 | ((hA.continuousOn.clm_apply |
| 122 | (linearODE_continuousOn A hab hU hA Φ hinit hsol)) q hq) |
| 123 | have hud : UniqueDiffOn ℝ (U ×ˢ Icc a b) := hU.uniqueDiffOn.prod (uniqueDiffOn_Icc hlt) |
| 124 | change ContDiffOn ℝ ((n : WithTop ℕ∞) + 1) (Function.uncurry Φ) (U ×ˢ Icc a b) |
| 125 | exact (contDiffOn_succ_iff_hasFDerivWithinAt_of_uniqueDiffOn hud).mpr |
| 126 | ⟨by simp, D, hDn, hder⟩ |
| 127 | |
| 128 | /-- Smooth linear-equation families are jointly smooth up to the compact time |
| 129 | endpoints. The only initial-data hypothesis is smoothness in the parameter. -/ |
| 130 | theorem linearODE_contDiffOn |
| 131 | (A : P → ℝ → G →L[ℝ] G) {a b : ℝ} (hab : a ≤ b) |
| 132 | {U : Set P} (hU : IsOpen U) |
| 133 | (hA : ContDiffOn ℝ ∞ (Function.uncurry A) (U ×ˢ Icc a b)) |
| 134 | (Φ : P → ℝ → G) (hinit : ContDiffOn ℝ ∞ (fun p => Φ p a) U) |
| 135 | (hsol : ∀ p ∈ U, ∀ t ∈ Icc a b, |
| 136 | HasDerivWithinAt (Φ p) (A p t (Φ p t)) (Icc a b) t) : |
| 137 | ContDiffOn ℝ ∞ (Function.uncurry Φ) (U ×ˢ Icc a b) := by |
| 138 | rw [contDiffOn_infty] |
| 139 | intro n |
| 140 | exact linearODE_contDiffOn_nat n A hab hU hA Φ hinit hsol |
| 141 | |
| 142 | /-- The constructed compact transport is jointly smooth on the closed time |
| 143 | interval when its coefficient is jointly smooth there. -/ |
| 144 | theorem transportCurveOn_contDiffOn_closed |
| 145 | {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 146 | [CompleteSpace V] [FiniteDimensional ℝ V] |
| 147 | (A : P → ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 148 | {U : Set P} (hU : IsOpen U) |
| 149 | (hA : ContDiffOn ℝ ∞ (Function.uncurry A) (U ×ˢ Icc a b)) |
| 150 | (hcont : ∀ p, ContinuousOn (A p) (Icc a b)) {K : P → ℝ≥0} |
| 151 | (hK : ∀ p, ∀ t ∈ Icc a b, ‖A p t‖₊ ≤ K p) : |
| 152 | ContDiffOn ℝ ∞ |
| 153 | (fun q : P × ℝ => transportCurveOn (A q.1) hab (hcont q.1) (hK q.1) q.2) |
| 154 | (U ×ˢ Icc a b) := by |
| 155 | let : NormedAddCommGroup (V →L[ℝ] V) := ContinuousLinearMap.toNormedAddCommGroup |
| 156 | let : NormedSpace ℝ (V →L[ℝ] V) := ContinuousLinearMap.toNormedSpace |
| 157 | let : NormedAddCommGroup ((V →L[ℝ] V) →L[ℝ] V →L[ℝ] V) := |
| 158 | ContinuousLinearMap.toNormedAddCommGroup |
| 159 | let : NormedSpace ℝ ((V →L[ℝ] V) →L[ℝ] V →L[ℝ] V) := ContinuousLinearMap.toNormedSpace |
| 160 | apply linearODE_contDiffOn |
| 161 | (fun p s => ContinuousLinearMap.compL ℝ V V V (A p s)) hab hU |
| 162 | ((ContinuousLinearMap.compL ℝ V V V).contDiff.comp_contDiffOn hA) |
| 163 | (fun p s => transportCurveOn (A p) hab (hcont p) (hK p) s) ?_ ?_ |
| 164 | · apply (contDiffOn_const : |
| 165 | ContDiffOn ℝ ∞ (fun _ : P => ContinuousLinearMap.id ℝ V) U).congr |
| 166 | intro p hp |
| 167 | rw [transportCurveOn_left] |
| 168 | · intro p hp s hs |
| 169 | exact transportCurveOn_hasDerivWithinAt (A p) hab (hcont p) (hK p) hs |
| 170 | |
| 171 | end PoincareMT.RicciFlow.Frame |
| 172 | |
| 173 | end |