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.Coordinates.SquareChartPairing |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 4 | |
| 5 | /-! |
| 6 | # Energy differentiation for regularized chart solutions |
| 7 | |
| 8 | Differentiation of the actual quadratic energy cancels the spatial metric |
| 9 | derivatives. The resulting identity is Morgan-Tian's equation (nablas), |
| 10 | including the time-dependent metric contribution. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | section Coordinate |
| 23 | |
| 24 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 25 | [FiniteDimensional ℝ E] |
| 26 | |
| 27 | theorem coordinateEnergy_hasDerivAt |
| 28 | (G : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ) (R : ℝ × E → ℝ) |
| 29 | (a v : ℝ → E) (s : ℝ) (hG : DifferentiableAt ℝ G (s, a s)) |
| 30 | (hsymm : ∀ u w : E, G (s, a s) u w = G (s, a s) w u) |
| 31 | (hpos : ∀ u : E, u ≠ 0 → 0 < G (s, a s) u u) |
| 32 | (ha : HasDerivAt a (v s) s) |
| 33 | (hv : HasDerivAt v (regularizedCoordinatePhase G R (s, (a s, v s))).2 s) : |
| 34 | HasDerivAt (fun r ↦ G (r, a r) (v r) (v r)) |
| 35 | (4 * s ^ 2 * fderiv ℝ R (s, a s) (0, v s) - |
| 36 | fderiv ℝ G (s, a s) (1, 0) (v s) (v s)) s := by |
| 37 | have hGt := hG.hasFDerivAt.comp_hasDerivAt s ((hasDerivAt_id s).prodMk ha) |
| 38 | have henergy := (hGt.clm_apply hv).clm_apply hv |
| 39 | have henergy' : HasDerivAt (fun r ↦ G (r, a r) (v r) (v r)) |
| 40 | (fderiv ℝ G (s, a s) (1, v s) (v s) (v s) + |
| 41 | G (s, a s) (regularizedCoordinatePhase G R (s, (a s, v s))).2 (v s) + |
| 42 | G (s, a s) (v s) (regularizedCoordinatePhase G R (s, (a s, v s))).2) s := by |
| 43 | simpa only [Function.comp_apply, Function.id_def, add_apply] using henergy |
| 44 | have hphase := regularizedCoordinatePhase_pairing G R (s, a s) hpos (v s) (v s) |
| 45 | have hsplit : fderiv ℝ G (s, a s) (1, v s) (v s) (v s) = |
| 46 | fderiv ℝ G (s, a s) (1, 0) (v s) (v s) + |
| 47 | fderiv ℝ G (s, a s) (0, v s) (v s) (v s) := by |
| 48 | rw [show (1, v s) = ((1 : ℝ), (0 : E)) + (0, v s) by simp, |
| 49 | map_add, add_apply, add_apply] |
| 50 | apply henergy'.congr_deriv |
| 51 | rw [hsplit, hsymm (v s) (regularizedCoordinatePhase G R (s, (a s, v s))).2] |
| 52 | dsimp only at hphase |
| 53 | linarith |
| 54 | |
| 55 | end Coordinate |
| 56 | |
| 57 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 58 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 59 | [IsManifold (𝓡 n) ∞ M] |
| 60 | |
| 61 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 62 | |
| 63 | theorem squareChartEnergy_hasDerivAt {J : Set ℝ} (F : RicciFlow n M J) |
| 64 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 65 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 66 | (p : M) (a v : ℝ → E) (s : ℝ) |
| 67 | (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 68 | (hy : a s ∈ (chartAt E p).target) (ha : HasDerivAt a (v s) s) |
| 69 | (hv : HasDerivAt v |
| 70 | (regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 71 | (s, (a s, v s))).2 s) : |
| 72 | HasDerivAt (fun r ↦ squareChartMetric F T p (r, a r) (v r) (v r)) |
| 73 | (4 * s ^ 2 * |
| 74 | mvfderiv (𝓡 n) (fun x ↦ (F.connection (T - s ^ 2)).scalarCurvature x) |
| 75 | ((chartAt E p).symm (a s)) |
| 76 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm (a s) (v s)) - |
| 77 | 4 * s * (F.connection (T - s ^ 2)).ricci ((chartAt E p).symm (a s)) |
| 78 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm (a s) (v s)) |
| 79 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm (a s) (v s))) s := by |
| 80 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, a s) := |
| 81 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 82 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩)).differentiableAt |
| 83 | (by simp) |
| 84 | have h := coordinateEnergy_hasDerivAt (squareChartMetric F T p) (squareChartScalar F T p) |
| 85 | a v s hG (squareChartMetric_symm F T p (s, a s)) |
| 86 | (squareChartMetric_pos F T p (s, a s) hy) ha hv |
| 87 | rw [squareChartScalar_space_pairing F hM04 T b hb hwindow p s hs (a s) (v s) hy, |
| 88 | squareChartMetric_time_pairing F T b hb hwindow p s hs (a s) (v s) (v s) hy] at h |
| 89 | exact h |
| 90 | |
| 91 | end PoincareMT.ReducedLength |