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.Barrier.SpatialContact |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.NormalizedActionDerivative |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ParametricCurveDerivative |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Geometry.MinimizingInitialVectors |
| 5 | |
| 6 | /-! |
| 7 | # First derivatives at smooth spacetime lower contacts |
| 8 | |
| 9 | The normalized action along a fixed initial vector touches the lower |
| 10 | contact. Its moving-endpoint derivative retains the spatial velocity term. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | open Filter |
| 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] [ConnectedSpace M] |
| 26 | |
| 27 | set_option maxHeartbeats 800000 in |
| 28 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem lExponentialFamily_first_derivatives_of_lower_contact |
| 30 | {J : Set ℝ} {F : RicciFlow n M J} |
| 31 | (hM04 : RicciFlowCurvatureTheory.{u}) {T τmax : ℝ} |
| 32 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 33 | (hL : LGeodesicTheory F T τmax) {p : M} |
| 34 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 35 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) (B : M × ℝ → ℝ) |
| 36 | (hB : ContMDiffAt ((𝓡 n).prod (𝓘(ℝ, ℝ))) (𝓘(ℝ, ℝ)) ∞ B (A.gamma Z b, b)) |
| 37 | (hvalue : B (A.gamma Z b, b) = A.action Z b / (2 * Real.sqrt b)) |
| 38 | (hlower : ∀ᶠ w in 𝓝 (A.gamma Z b, b), B w ≤ reducedLength F T p w.1 w.2) : |
| 39 | (∀ v : TangentSpace (𝓡 n) (A.gamma Z b), |
| 40 | mvfderiv (𝓡 n) (fun q ↦ B (q, b)) (A.gamma Z b) v = |
| 41 | (F.metric (T - b)).inner (A.gamma Z b) (curveVelocity (A.gamma Z) b) v) ∧ |
| 42 | reducedLengthGradientNormSq F T B b (A.gamma Z b) = |
| 43 | (F.metric (T - b)).inner (A.gamma Z b) |
| 44 | (curveVelocity (A.gamma Z) b) (curveVelocity (A.gamma Z) b) ∧ |
| 45 | deriv (fun t ↦ B (A.gamma Z b, t)) b = |
| 46 | ((F.connection (T - b)).scalarCurvature (A.gamma Z b) - |
| 47 | (F.metric (T - b)).inner (A.gamma Z b) |
| 48 | (curveVelocity (A.gamma Z) b) (curveVelocity (A.gamma Z) b)) / 2 - |
| 49 | B (A.gamma Z b, b) / (2 * b) := by |
| 50 | have hspace := lExponentialFamily_spatial_differential_of_lower_contact hM04 hτmax |
| 51 | hwindow hL A Z b hb hmax (fun q ↦ B (q, b)) |
| 52 | (hB.comp (A.gamma Z b) (contMDiffAt_id.prodMk contMDiffAt_const)) hvalue |
| 53 | ((continuous_id.prodMk continuous_const).continuousAt.tendsto.eventually hlower) |
| 54 | refine ⟨hspace, reducedLengthGradientNormSq_eq_of_differential F T b B _ _ hspace, ?_⟩ |
| 55 | have hswap := (hB.comp (b, A.gamma Z b) |
| 56 | (contMDiffAt_snd.prodMk contMDiffAt_fst)).mdifferentiableAt (by simp) |
| 57 | have hcurve := (lExponentialFamily_gammaSlice_contMDiffAt A Z b hb hmax).mdifferentiableAt (by simp) |
| 58 | have hchain := hasDerivAt_parametric_curve (fun z : ℝ × M ↦ B (z.2, z.1)) |
| 59 | (A.gamma Z) b hswap hcurve |
| 60 | have hactual := lExponentialFamily_normalizedAction_hasDerivAt hM04 hwindow A Z b hb hmax |
| 61 | have hnear : ∀ᶠ t in 𝓝 b, |
| 62 | B (A.gamma Z t, t) ≤ reducedLength F T p (A.gamma Z t) t := |
| 63 | (hcurve.continuousAt.prodMk continuousAt_id).tendsto.eventually hlower |
| 64 | have hmin : IsLocalMin |
| 65 | (fun t ↦ A.action Z t / (2 * Real.sqrt t) - B (A.gamma Z t, t)) b := by |
| 66 | filter_upwards [isOpen_Ioo.mem_nhds (show b ∈ Set.Ioo 0 τmax from ⟨hb, hmax⟩), hnear] |
| 67 | with t ht hl |
| 68 | rw [← hvalue, sub_self] |
| 69 | exact sub_nonneg.mpr (hl.trans |
| 70 | (lExponentialFamily_reducedLength_le_action hL A Z t ht.1 ht.2)) |
| 71 | have hstat := hmin.hasDerivAt_eq_zero (hactual.sub hchain) |
| 72 | dsimp only at hstat |
| 73 | rw [hspace, ← hvalue] at hstat |
| 74 | linarith |
| 75 | |
| 76 | end PoincareMT.ReducedLength |