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.ParametricCurveDerivative |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.ScalarTimeDerivative |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Fields.SquareTimeFields |
| 4 | |
| 5 | /-! |
| 6 | # Scalar curvature differentiated along a square-time curve |
| 7 | |
| 8 | The time term fixes the spatial point. Its sign and factor come from |
| 9 | the actual backward-clock scalar evolution and the square-map chain rule. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | set_option backward.isDefEq.respectTransparency false in |
| 26 | theorem squareTime_scalar_along_hasDerivAt {J : Set ℝ} (F : RicciFlow n M J) |
| 27 | (hM04 : RicciFlowCurvatureTheory.{u}) (T τmax b : ℝ) |
| 28 | (hb : 0 < b) (hmax : b < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 29 | (α : ℝ → M) (s : ℝ) (hs : s ∈ Set.Ioo 0 (Real.sqrt b)) |
| 30 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s) : |
| 31 | HasDerivAt (fun r ↦ (F.connection (T - r ^ 2)).scalarCurvature (α r)) |
| 32 | (2 * s * (-((F.connection (T - s ^ 2)).laplacian |
| 33 | (F.connection (T - s ^ 2)).scalarCurvature (α s) + |
| 34 | 2 * (F.connection (T - s ^ 2)).ricciNormSq (α s))) + |
| 35 | mvfderiv (𝓡 n) (F.connection (T - s ^ 2)).scalarCurvature (α s) |
| 36 | (curveVelocity α s)) s := by |
| 37 | have hτmax : 0 < τmax := hb.trans hmax |
| 38 | have htime : s ∈ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) := |
| 39 | ⟨(neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans hs.1, |
| 40 | hs.2.trans (Real.sqrt_lt_sqrt hb.le hmax)⟩ |
| 41 | have hf : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) |
| 42 | (fun z : ℝ × M ↦ (F.connection (T - z.1 ^ 2)).scalarCurvature z.2) (s, α s) := |
| 43 | ((squareTime_scalar_smooth F hM04 T τmax hτmax hwindow).contMDiffAt |
| 44 | ((isOpen_Ioo.prod isOpen_univ).mem_nhds ⟨htime, Set.mem_univ (α s)⟩)).mdifferentiableAt |
| 45 | (by simp) |
| 46 | have hchain := hasDerivAt_parametric_curve |
| 47 | (fun z : ℝ × M ↦ (F.connection (T - z.1 ^ 2)).scalarCurvature z.2) α s hf hα |
| 48 | have hsquare : s ^ 2 ∈ Set.Icc 0 b := by |
| 49 | constructor |
| 50 | · exact sq_nonneg s |
| 51 | · nlinarith [hs.1, hs.2, Real.sqrt_nonneg b, Real.sq_sqrt hb.le] |
| 52 | have hnear : ∀ᶠ r in 𝓝 s, r ^ 2 ∈ Set.Icc 0 b := by |
| 53 | filter_upwards [isOpen_Ioo.mem_nhds hs] with r hr |
| 54 | exact ⟨sq_nonneg r, by nlinarith [hr.1, hr.2, Real.sqrt_nonneg b, Real.sq_sqrt hb.le]⟩ |
| 55 | have hsqd : HasDerivAt (fun r : ℝ ↦ r ^ 2) (2 * s) s := by |
| 56 | simpa using hasDerivAt_pow 2 s |
| 57 | have hpartial := (backward_scalar_hasDerivWithinAt (F := F) hM04 hwindow hmax.le |
| 58 | hsquare (α s)).comp_hasDerivAt (h := fun r : ℝ ↦ r ^ 2) s hsqd hnear |
| 59 | dsimp only [Function.comp_def] at hpartial hchain |
| 60 | rw [hpartial.deriv] at hchain |
| 61 | convert! hchain using 1 <;> ring |
| 62 | |
| 63 | end PoincareMT.ReducedLength |