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.Calculus.ParametricScalarDerivatives |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.LocalFixedChartHessian |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.SquareChartConnection |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.CoordinateConnectionBilinear |
| 5 | |
| 6 | /-! |
| 7 | # Geometric derivatives of a scalar chart family |
| 8 | |
| 9 | The coordinate second derivative includes the selected connection correction. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | open Filter |
| 17 | |
| 18 | universe u v |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {P : Type v} [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 25 | {J : Set ℝ} |
| 26 | |
| 27 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | noncomputable def parametricChartHessian (F : RicciFlow n M J) (T : ℝ) (p : M) |
| 30 | (C : (P × E) × ℝ → ℝ) (z : (P × E) × ℝ) : E →L[ℝ] E →L[ℝ] ℝ := |
| 31 | parametricSpatialSecond C z - |
| 32 | ((ContinuousLinearMap.compL ℝ E E ℝ) (parametricSpatialCovector C z)).comp |
| 33 | (coordinateConnectionBilinear (squareChartMetric F T p) (Real.sqrt z.2, z.1.2)) |
| 34 | |
| 35 | set_option maxHeartbeats 1000000 in |
| 36 | -- Both spatial derivatives are compared on the same open coordinate germ. |
| 37 | set_option backward.isDefEq.respectTransparency false in |
| 38 | theorem parametric_chart_derivatives (F : RicciFlow n M J) (T τmax : ℝ) |
| 39 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) (p : M) |
| 40 | (C : (P × E) × ℝ → ℝ) (U : Set ((P × E) × ℝ)) |
| 41 | (hU : IsOpen U) (hC : ContDiffOn ℝ ∞ C U) |
| 42 | (a : P) (y : E) (t : ℝ) (hy : y ∈ (chartAt E p).target) |
| 43 | (ht : 0 < t) (hmax : t < τmax) (hz : ((a, y), t) ∈ U) : |
| 44 | let e := chartAt E p |
| 45 | let f : M × ℝ → ℝ := fun w ↦ C ((a, e w.1), w.2) |
| 46 | (∀ u : E, mvfderiv (𝓡 n) (fun q ↦ f (q, t)) (e.symm y) |
| 47 | (chartVectorField p u (e.symm y)) = parametricSpatialCovector C ((a, y), t) u) ∧ |
| 48 | (∀ u v : E, (F.connection (T - t)).hessian (fun q ↦ f (q, t)) |
| 49 | (e.symm y) (chartVectorField p u (e.symm y)) (chartVectorField p v (e.symm y)) = |
| 50 | parametricChartHessian F T p C ((a, y), t) u v) ∧ |
| 51 | deriv (fun s ↦ f (e.symm y, s)) t = fderiv ℝ C ((a, y), t) ((0, 0), 1) := by |
| 52 | dsimp only |
| 53 | let e := chartAt E p |
| 54 | let q := e.symm y |
| 55 | let f : M → ℝ := fun x ↦ C ((a, e x), t) |
| 56 | let c : M → (P × E) × ℝ := fun x ↦ ((a, e x), t) |
| 57 | let O := e.source ∩ c ⁻¹' U |
| 58 | have hc : ContMDiffOn (𝓡 n) (𝓘(ℝ, (P × E) × ℝ)) ∞ c e.source := |
| 59 | (contMDiffOn_const.prodMk_space contMDiffOn_chart).prodMk_space contMDiffOn_const |
| 60 | have hO : IsOpen O := hc.continuousOn.isOpen_inter_preimage e.open_source hU |
| 61 | have hqO : q ∈ O := ⟨e.map_target hy, by |
| 62 | change ((a, e (e.symm y)), t) ∈ U |
| 63 | rwa [e.right_inv hy]⟩ |
| 64 | have hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O := |
| 65 | hC.contMDiffOn.comp (hc.mono Set.inter_subset_left) (fun x hx ↦ hx.2) |
| 66 | have hfd := (hf.contMDiffAt (hO.mem_nhds hqO)).mdifferentiableAt (by simp) |
| 67 | let φ : E → ℝ := fun v ↦ f (e.symm v) |
| 68 | let g : E → ℝ := fun v ↦ C ((a, v), t) |
| 69 | have heq : φ =ᶠ[𝓝 y] g := by |
| 70 | filter_upwards [e.open_target.mem_nhds hy] with v hv |
| 71 | exact congrArg (fun w ↦ C ((a, w), t)) (e.right_inv hv) |
| 72 | have heqD : fderiv ℝ φ =ᶠ[𝓝 y] fderiv ℝ g := |
| 73 | heq.eventuallyEq_nhds.mono (fun _ hh ↦ hh.fderiv_eq) |
| 74 | have hCd := (hC.contDiffAt (hU.mem_nhds hz)).differentiableAt (by simp) |
| 75 | have hfirst : fderiv ℝ φ y = parametricSpatialCovector C ((a, y), t) := |
| 76 | heq.fderiv_eq.trans (fderiv_parametric_spatial_slice C a y t hCd) |
| 77 | have hsecond : fderiv ℝ (fderiv ℝ φ) y = parametricSpatialSecond C ((a, y), t) := |
| 78 | heqD.fderiv_eq.trans (fderiv_parametric_spatial_second C U hU hC a y t hz) |
| 79 | have hs : Real.sqrt t ∈ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) := |
| 80 | ⟨(neg_neg_of_pos (Real.sqrt_pos.mpr hτmax)).trans_le (Real.sqrt_nonneg _), |
| 81 | Real.sqrt_lt_sqrt ht.le hmax⟩ |
| 82 | refine ⟨?_, ?_, ?_⟩ |
| 83 | · intro u |
| 84 | exact (mvfderiv_chartVectorField_normed p f y u hy hfd).trans |
| 85 | (congrArg (fun L : E →L[ℝ] ℝ ↦ L u) hfirst) |
| 86 | · intro u v |
| 87 | let A := coordinateConnectionBilinear (squareChartMetric F T p) (Real.sqrt t, y) u |
| 88 | have hA (w : E) : (F.connection (T - t)).connection (chartVectorField p w) |
| 89 | q (chartVectorField p u q) = chartVectorField p (A w) q := by |
| 90 | have h := (squareChartConnection_eq F T τmax hτmax hwindow p (Real.sqrt t) |
| 91 | hs y hy u w).symm |
| 92 | have hsquare : (Real.sqrt t) ^ 2 = t := Real.sq_sqrt ht.le |
| 93 | rw [hsquare] at h |
| 94 | exact h |
| 95 | have h := hessian_fixedChart_local (F.connection (T - t)) f p q (e.map_target hy) |
| 96 | O hO hqO hf u v A hA |
| 97 | change _ = fderiv ℝ (fderiv ℝ φ) (e q) u v - fderiv ℝ φ (e q) (A v) at h |
| 98 | rw [show e q = y from e.right_inv hy, hfirst, hsecond] at h |
| 99 | exact h |
| 100 | · change deriv (fun s ↦ C ((a, e (e.symm y)), s)) t = _ |
| 101 | rw [e.right_inv hy] |
| 102 | exact deriv_parametric_time_slice C a y t hCd |
| 103 | |
| 104 | theorem parametricChartHessian_smooth (F : RicciFlow n M J) (T τmax : ℝ) |
| 105 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) (p : M) |
| 106 | (C : (P × E) × ℝ → ℝ) (U : Set ((P × E) × ℝ)) |
| 107 | (hU : IsOpen U) (hC : ContDiffOn ℝ ∞ C U) : |
| 108 | ContDiffOn ℝ ∞ (parametricChartHessian F T p C) |
| 109 | (U ∩ ((Set.univ ×ˢ (chartAt E p).target) ×ˢ Set.Ioo 0 τmax)) := by |
| 110 | let S := U ∩ ((Set.univ ×ˢ (chartAt E p).target) ×ˢ Set.Ioo 0 τmax) |
| 111 | let V := Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ×ˢ (chartAt E p).target |
| 112 | have hV : IsOpen V := isOpen_Ioo.prod (chartAt E p).open_target |
| 113 | have hG := squareChartMetric_smooth F T τmax hτmax hwindow p |
| 114 | have hK := coordinateConnectionBilinear_contDiffOn (squareChartMetric F T p) V hV hG |
| 115 | (fun z hz u hu ↦ squareChartMetric_pos F T p z hz.2 u hu) |
| 116 | have hi : ContDiffOn ℝ ∞ (fun z : (P × E) × ℝ ↦ (Real.sqrt z.2, z.1.2)) S := |
| 117 | (contDiffOn_snd.sqrt (fun z hz ↦ hz.2.2.1.ne')).prodMk contDiff_fst.snd.contDiffOn |
| 118 | have hK' := hK.comp hi (fun z hz ↦ |
| 119 | ⟨⟨(neg_neg_of_pos (Real.sqrt_pos.mpr hτmax)).trans_le (Real.sqrt_nonneg _), |
| 120 | Real.sqrt_lt_sqrt hz.2.2.1.le hz.2.2.2⟩, hz.2.1.2⟩) |
| 121 | have hL : ContDiffOn ℝ ∞ (parametricSpatialCovector C) S := |
| 122 | (parametricSpatialCovector_smooth C U hU hC).mono Set.inter_subset_left |
| 123 | exact ((parametricSpatialSecond_smooth C U hU hC).mono Set.inter_subset_left).sub |
| 124 | ((contDiffOn_const.clm_apply hL).clm_comp hK') |
| 125 | |
| 126 | end PoincareMT.ReducedLength |