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.Connection.BoundaryRegularity |
| 2 | import PoincareLib.Geometry.RicciFlow.Frame.RicciTransport |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 4 | import Mathlib.Analysis.Calculus.TangentCone.Real |
| 5 | |
| 6 | /-! |
| 7 | # The Ricci endomorphism on a half-open flow interval |
| 8 | |
| 9 | The metric time derivative packages Ricci curvature as a continuous bilinear |
| 10 | form directly from the Ricci-flow equation. Metric duality then constructs its |
| 11 | endomorphism, with time regularity also at the initial slice. |
| 12 | |
| 13 | This supplies the coefficient of Morgan--Tian (2007), equation (3.9) and |
| 14 | Claim 3.16, printed p. 42. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | set_option maxHeartbeats 800000 |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | open Bundle Filter Set |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | noncomputable section |
| 27 | |
| 28 | namespace PoincareMT.RicciFlow.Frame |
| 29 | |
| 30 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 32 | {a b : ℝ} |
| 33 | |
| 34 | private lemma contDiffWithinAt_clm_of_apply |
| 35 | {E G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 36 | [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ E] |
| 37 | {f : ℝ → E →L[ℝ] G} {J : Set ℝ} {t : ℝ} |
| 38 | (hf : ∀ v, ContDiffWithinAt ℝ ∞ (fun s => f s v) J t) : |
| 39 | ContDiffWithinAt ℝ ∞ f J t := by |
| 40 | let d := Module.finrank ℝ E |
| 41 | have hd : d = Module.finrank ℝ (Fin d → ℝ) := (Module.finrank_fin_fun ℝ).symm |
| 42 | let e₁ : E ≃L[ℝ] (Fin d → ℝ) := ContinuousLinearEquiv.ofFinrankEq hd |
| 43 | let e₂ := (e₁.arrowCongr (1 : G ≃L[ℝ] G)).trans (ContinuousLinearEquiv.piRing (Fin d)) |
| 44 | rw [← Function.id_comp f, ← e₂.symm_comp_self] |
| 45 | exact e₂.symm.contDiff.contDiffAt.comp_contDiffWithinAt t |
| 46 | (contDiffWithinAt_pi.mpr fun i => hf _) |
| 47 | |
| 48 | /-- The metric is a smooth curve of bilinear forms, including the initial slice. -/ |
| 49 | theorem contDiffOn_metricBilin (F : RicciFlow n M (Ico a b)) (x : M) : |
| 50 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 51 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 52 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 53 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 54 | ContDiffOn ℝ ∞ (fun t => (F.metric t).inner x) (Ico a b) := by |
| 55 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 57 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 58 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 59 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 60 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 61 | (TangentSpace (𝓡 n) : M → Type _) x |
| 62 | intro t ht |
| 63 | exact contDiffWithinAt_clm_of_apply fun v => contDiffWithinAt_clm_of_apply fun w => |
| 64 | F.contDiffWithinAt_inner_time ht x v w |
| 65 | |
| 66 | /-- Ricci curvature as a continuous bilinear form, obtained from metric evolution. -/ |
| 67 | def ricciBilin (F : RicciFlow n M (Ico a b)) (x : M) (t : ℝ) : |
| 68 | TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x →L[ℝ] ℝ := |
| 69 | ricciForm F x t |
| 70 | |
| 71 | /-- The operator-valued derivative is the Ricci-flow equation. -/ |
| 72 | theorem metricBilin_hasDerivWithinAt (F : RicciFlow n M (Ico a b)) (x : M) |
| 73 | {t : ℝ} (ht : t ∈ Ico a b) : |
| 74 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 75 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 76 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 77 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 78 | HasDerivWithinAt (fun s => (F.metric s).inner x) |
| 79 | ((-2 : ℝ) • ricciBilin F x t) (Ico a b) t := by |
| 80 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 81 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 82 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 83 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 84 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 85 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 86 | have hd := ((contDiffOn_metricBilin F x t ht).differentiableWithinAt |
| 87 | (by simp)).hasDerivWithinAt |
| 88 | simpa only [ricciBilin, ricciForm, smul_smul, show (-2 : ℝ) * -(1 / 2) = 1 by norm_num, |
| 89 | one_smul] using hd |
| 90 | |
| 91 | /-- The bilinear representative agrees with the retained Ricci evaluation. -/ |
| 92 | theorem ricciBilin_apply (F : RicciFlow n M (Ico a b)) (x : M) |
| 93 | {t : ℝ} (ht : t ∈ Ico a b) (v w : TangentSpace (𝓡 n) x) : |
| 94 | ricciBilin F x t v w = (F.connection t).ricci x v w := by |
| 95 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 96 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 97 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 98 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 99 | have hd := ((metricBilin_hasDerivWithinAt F x ht).clm_apply |
| 100 | (hasDerivWithinAt_const t (Ico a b) v)).clm_apply |
| 101 | (hasDerivWithinAt_const t (Ico a b) w) |
| 102 | have heq := (uniqueDiffOn_Ico a b t ht).eq_deriv (Ico a b) hd (F.equation t ht x v w) |
| 103 | simp only [smul_apply, map_zero, smul_eq_mul, add_zero] at heq |
| 104 | linarith |
| 105 | |
| 106 | theorem ricciBilin_symm (F : RicciFlow n M (Ico a b)) (x : M) |
| 107 | {t : ℝ} (ht : t ∈ Ico a b) (v w : TangentSpace (𝓡 n) x) : |
| 108 | ricciBilin F x t v w = ricciBilin F x t w v := by |
| 109 | have heq := (uniqueDiffOn_Ico a b t ht).eq_deriv (Ico a b) (F.equation t ht x v w) |
| 110 | (by simpa only [(F.metric _).symm] using F.equation t ht x w v) |
| 111 | rw [ricciBilin_apply F x ht, ricciBilin_apply F x ht] |
| 112 | linarith |
| 113 | |
| 114 | theorem metric_ricciEndomorphism_left (F : RicciFlow n M (Ico a b)) (x : M) |
| 115 | (t : ℝ) (v w : TangentSpace (𝓡 n) x) : |
| 116 | (F.metric t).inner x (ricciEndomorphism F x t v) w = ricciBilin F x t v w := by |
| 117 | exact congrArg (fun f : TangentSpace (𝓡 n) x →L[ℝ] ℝ => f w) |
| 118 | (((F.metric t).inner_isInvertible x).self_apply_inverse (ricciBilin F x t v)) |
| 119 | |
| 120 | theorem metric_ricciEndomorphism_right (F : RicciFlow n M (Ico a b)) (x : M) |
| 121 | {t : ℝ} (ht : t ∈ Ico a b) (v w : TangentSpace (𝓡 n) x) : |
| 122 | (F.metric t).inner x v (ricciEndomorphism F x t w) = ricciBilin F x t v w := by |
| 123 | rw [(F.metric t).symm, metric_ricciEndomorphism_left, ricciBilin_symm F x ht] |
| 124 | |
| 125 | /-- Ricci is smooth in time up to the initial slice. -/ |
| 126 | theorem contDiffOn_ricciBilin (F : RicciFlow n M (Ico a b)) (x : M) : |
| 127 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 128 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 129 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 130 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 131 | ContDiffOn ℝ ∞ (ricciBilin F x) (Ico a b) := by |
| 132 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 133 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 134 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 135 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 136 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 137 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 138 | exact ((contDiffOn_metricBilin F x).derivWithin (uniqueDiffOn_Ico a b) (by simp)).const_smul _ |
| 139 | |
| 140 | /-- The endomorphism coefficient is smooth in time, with within derivatives at `a`. -/ |
| 141 | theorem contDiffOn_ricciEndomorphism (F : RicciFlow n M (Ico a b)) (x : M) : |
| 142 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 143 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 144 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 145 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 146 | ContDiffOn ℝ ∞ (ricciEndomorphism F x) (Ico a b) := by |
| 147 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 148 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 149 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 150 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 151 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 152 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 153 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 154 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 155 | (TangentSpace (𝓡 n) : M → Type _) x |
| 156 | intro t ht |
| 157 | have hi := ((F.metric t).inner_isInvertible x).contDiffAt_map_inverse.comp_contDiffWithinAt t |
| 158 | (contDiffOn_metricBilin F x t ht) |
| 159 | exact hi.clm_comp (contDiffOn_ricciBilin F x t ht) |
| 160 | |
| 161 | end PoincareMT.RicciFlow.Frame |