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.ReducedLength.ODE.SquareChartFlow |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ChartCurveEquation |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 4 | |
| 5 | /-! |
| 6 | # Constructed local families with initial square-root velocity 2Z |
| 7 | |
| 8 | The actual chart equation is solved on a common neighborhood of an initial |
| 9 | tangent vector. Its inverse-chart image supplies the curve, velocity |
| 10 | extension and regularized Euler equation on one signed time interval. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | structure LocalRegularizedInitialFamily {J : Set ℝ} (F : RicciFlow n M J) |
| 30 | (T : ℝ) (p : M) (Z0 : TangentSpace (𝓡 n) p) where |
| 31 | radius : ℝ |
| 32 | radius_pos : 0 < radius |
| 33 | neighborhood : Set (TangentSpace (𝓡 n) p) |
| 34 | neighborhood_open : IsOpen neighborhood |
| 35 | center_mem : Z0 ∈ neighborhood |
| 36 | curve : TangentSpace (𝓡 n) p → ℝ → M |
| 37 | curve_smooth : |
| 38 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 39 | ⟨(F.metric T).toRiemannianMetric⟩ |
| 40 | ContMDiffOn ((𝓘(ℝ, TangentSpace (𝓡 n) p)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ |
| 41 | (fun z ↦ curve z.1 z.2) (neighborhood ×ˢ Set.Ioo (-radius) radius) |
| 42 | curve_start : ∀ Z ∈ neighborhood, curve Z 0 = p |
| 43 | initial_derivative : ∀ Z (hZ : Z ∈ neighborhood), |
| 44 | (curve_start Z hZ) ▸ curveVelocity (n := n) (curve Z) 0 = (2 : ℝ) • Z |
| 45 | time_mem : ∀ s ∈ Set.Ioo (-radius) radius, T - s ^ 2 ∈ J |
| 46 | velocity_extension : ∀ Z ∈ neighborhood, |
| 47 | ParametricAlongCurveExtensionOn (n := n) (Set.Ioo (-radius) radius) (curve Z) |
| 48 | (curveVelocityWithin (n := n) (curve Z) (Set.Ioo (-radius) radius)) |
| 49 | equation : ∀ Z (hZ : Z ∈ neighborhood), ∀ s ∈ Set.Ioo (-radius) radius, |
| 50 | regularizedLGeodesicEquation F T (curve Z) (Set.Ioo (-radius) radius) |
| 51 | (velocity_extension Z hZ) s |
| 52 | |
| 53 | set_option backward.isDefEq.respectTransparency false in |
| 54 | theorem nonempty_localRegularizedInitialFamily {J : Set ℝ} (F : RicciFlow n M J) |
| 55 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 56 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 57 | (p : M) (Z0 : TangentSpace (𝓡 n) p) : |
| 58 | Nonempty (LocalRegularizedInitialFamily F T p Z0) := by |
| 59 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 60 | ⟨(F.metric T).toRiemannianMetric⟩ |
| 61 | let e := chartAt E p |
| 62 | let L : TangentSpace (𝓡 n) p →L[ℝ] E := mfderiv (𝓡 n) (𝓡 n) e p |
| 63 | let q : TangentSpace (𝓡 n) p → E × E := fun Z ↦ (e p, (2 : ℝ) • L Z) |
| 64 | have hq : ContDiff ℝ ∞ q := contDiff_const.prodMk (L.contDiff.const_smul (2 : ℝ)) |
| 65 | obtain ⟨beta, W, d, hW, hq0, _, hd, hbeta, hbeta0, hbetaODE⟩ := |
| 66 | exists_squareChart_initial_flow F hM04 T b hb hwindow p |
| 67 | (e p) ((2 : ℝ) • L Z0) (e.map_source (mem_chart_source E p)) |
| 68 | let N : Set (TangentSpace (𝓡 n) p) := q ⁻¹' W |
| 69 | let I : Set ℝ := Set.Ioo (-d) d |
| 70 | let a : TangentSpace (𝓡 n) p → ℝ → E := fun Z s ↦ (beta (q Z, s)).1 |
| 71 | let v : TangentSpace (𝓡 n) p → ℝ → E := fun Z s ↦ (beta (q Z, s)).2 |
| 72 | let c : TangentSpace (𝓡 n) p → ℝ → M := fun Z s ↦ e.symm (a Z s) |
| 73 | have hN : IsOpen N := hW.preimage hq.continuous |
| 74 | have hZ0 : Z0 ∈ N := hq0 |
| 75 | have hI : IsOpen I := isOpen_Ioo |
| 76 | have h0 : (0 : ℝ) ∈ I := ⟨neg_lt_zero.mpr hd, hd⟩ |
| 77 | have hmap : ContDiff ℝ ∞ |
| 78 | (fun z : TangentSpace (𝓡 n) p × ℝ ↦ (q z.1, z.2)) := |
| 79 | (hq.comp contDiff_fst).prodMk contDiff_snd |
| 80 | have hbmap : ContDiffOn ℝ ∞ |
| 81 | (fun z : TangentSpace (𝓡 n) p × ℝ ↦ beta (q z.1, z.2)) (N ×ˢ I) := |
| 82 | hbeta.comp hmap.contDiffOn (fun z hz ↦ ⟨hz.1, hz.2⟩) |
| 83 | have hy : ∀ Z ∈ N, ∀ s ∈ I, a Z s ∈ e.target := |
| 84 | fun Z hZ s hs ↦ (hbetaODE (q Z) hZ s hs).2.1 |
| 85 | have htime : I ⊆ Set.Ioo (-Real.sqrt b) (Real.sqrt b) := |
| 86 | fun s hs ↦ (hbetaODE (q Z0) hZ0 s hs).1 |
| 87 | have ha : ∀ Z ∈ N, ∀ s ∈ I, HasDerivAt (a Z) (v Z s) s := by |
| 88 | intro Z hZ s hs |
| 89 | exact (ContinuousLinearMap.fst ℝ E E).hasFDerivAt.comp_hasDerivAt s |
| 90 | (hbetaODE (q Z) hZ s hs).2.2 |
| 91 | have hdv : ∀ Z ∈ N, ∀ s ∈ I, HasDerivAt (v Z) |
| 92 | (regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 93 | (s, (a Z s, v Z s))).2 s := by |
| 94 | intro Z hZ s hs |
| 95 | exact (ContinuousLinearMap.snd ℝ E E).hasFDerivAt.comp_hasDerivAt s |
| 96 | (hbetaODE (q Z) hZ s hs).2.2 |
| 97 | have hv : ∀ Z ∈ N, ContDiffOn ℝ ∞ (v Z) I := by |
| 98 | intro Z hZ |
| 99 | exact contDiff_snd.contDiffOn.comp |
| 100 | (hbeta.comp (contDiff_const.prodMk contDiff_id).contDiffOn |
| 101 | (fun s hs ↦ ⟨hZ, hs⟩)) (fun _ _ ↦ Set.mem_univ _) |
| 102 | have hc : ContMDiffOn ((𝓘(ℝ, TangentSpace (𝓡 n) p)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ |
| 103 | (fun z ↦ c z.1 z.2) (N ×ˢ I) := by |
| 104 | have haSmooth : ContDiffOn ℝ ∞ |
| 105 | (fun z : TangentSpace (𝓡 n) p × ℝ ↦ a z.1 z.2) (N ×ˢ I) := |
| 106 | contDiff_fst.contDiffOn.comp hbmap (fun _ _ ↦ Set.mem_univ _) |
| 107 | have haM : ContMDiffOn ((𝓘(ℝ, TangentSpace (𝓡 n) p)).prod (𝓘(ℝ, ℝ))) |
| 108 | (𝓡 n) ∞ (fun z ↦ a z.1 z.2) (N ×ˢ I) := by |
| 109 | convert! haSmooth.contMDiffOn using 1 <;> |
| 110 | simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 111 | exact contMDiffOn_chart_symm.comp haM |
| 112 | (fun z hz ↦ hy z.1 hz.1 z.2 hz.2) |
| 113 | have hstart : ∀ Z ∈ N, c Z 0 = p := by |
| 114 | intro Z hZ |
| 115 | change e.symm (beta (q Z, 0)).1 = p |
| 116 | rw [hbeta0 (q Z) hZ] |
| 117 | exact e.left_inv (mem_chart_source E p) |
| 118 | have hinitial : ∀ Z (hZ : Z ∈ N), |
| 119 | (hstart Z hZ) ▸ curveVelocity (n := n) (c Z) 0 = (2 : ℝ) • Z := by |
| 120 | intro Z hZ |
| 121 | have hvel := curveVelocityWithin_inverseChart p (a Z) I 0 (v Z 0) |
| 122 | (hI.uniqueDiffOn 0 h0) (ha Z hZ 0 h0) (hy Z hZ 0 h0) |
| 123 | have htotal : curveVelocityWithin (n := n) (c Z) I 0 = |
| 124 | curveVelocity (n := n) (c Z) 0 := by |
| 125 | unfold curveVelocityWithin curveVelocity |
| 126 | rw [mfderivWithin_of_isOpen hI h0] |
| 127 | rw [htotal] at hvel |
| 128 | have hz : a Z 0 = e p := congrArg Prod.fst (hbeta0 (q Z) hZ) |
| 129 | have hvz : v Z 0 = (2 : ℝ) • L Z := congrArg Prod.snd (hbeta0 (q Z) hZ) |
| 130 | have hinv := congrArg (fun A : TangentSpace (𝓡 n) p →L[ℝ] |
| 131 | TangentSpace (𝓡 n) p ↦ A Z) |
| 132 | ((mdifferentiable_chart (I := 𝓡 n) p).symm_comp_deriv (mem_chart_source E p)) |
| 133 | have hcast (x y : M) (h : x = y) (w : TangentSpace (𝓡 n) x) : |
| 134 | (h ▸ w : TangentSpace (𝓡 n) y) = (show TangentSpace (𝓡 n) y from w) := by |
| 135 | cases h |
| 136 | rfl |
| 137 | rw [hcast _ _ (hstart Z hZ) (curveVelocity (n := n) (c Z) 0)] |
| 138 | change curveVelocity (n := n) (c Z) 0 = (2 : ℝ) • Z |
| 139 | calc |
| 140 | _ = mfderiv (𝓡 n) (𝓡 n) e.symm (a Z 0) (v Z 0) := hvel |
| 141 | _ = mfderiv (𝓡 n) (𝓡 n) e.symm (e p) ((2 : ℝ) • L Z) := by rw [hz, hvz] |
| 142 | _ = (2 : ℝ) • Z := by rw [map_smul]; exact congrArg ((2 : ℝ) • ·) hinv |
| 143 | let ext := fun Z (hZ : Z ∈ N) ↦ |
| 144 | chartCurveVelocityExtension p (a Z) (v Z) I I hI (Set.Subset.refl I) |
| 145 | hI.uniqueDiffOn (hv Z hZ) (ha Z hZ) (hy Z hZ) |
| 146 | refine ⟨{ |
| 147 | radius := d |
| 148 | radius_pos := hd |
| 149 | neighborhood := N |
| 150 | neighborhood_open := hN |
| 151 | center_mem := hZ0 |
| 152 | curve := c |
| 153 | curve_smooth := hc |
| 154 | curve_start := hstart |
| 155 | initial_derivative := hinitial |
| 156 | time_mem := fun s hs ↦ hwindow (squareTime_mem_window T hb (htime hs)) |
| 157 | velocity_extension := ext |
| 158 | equation := ?_ |
| 159 | }⟩ |
| 160 | intro Z hZ s hs |
| 161 | exact chartCurve_regularized_equation F hM04 T b hb hwindow p (a Z) (v Z) |
| 162 | I I hI (Set.Subset.refl I) hI.uniqueDiffOn (hv Z hZ) (ha Z hZ) (hy Z hZ) |
| 163 | htime (hdv Z hZ) s hs |
| 164 | |
| 165 | end PoincareMT.ReducedLength |