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.LGeometry.Variation.VariationAction |
| 2 | import Mathlib.Analysis.Calculus.DerivativeTest |
| 3 | |
| 4 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/IndexPositivity.lean` at |
| 5 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 6 | |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Set Filter Topology |
| 12 | open scoped Manifold ContDiff Bundle |
| 13 | |
| 14 | universe u |
| 15 | |
| 16 | namespace PoincareMT.LGeometry |
| 17 | |
| 18 | theorem secondDerivative_nonneg_of_localMin {f : ℝ → ℝ} {x q : ℝ} |
| 19 | (hmin : IsLocalMin f x) (hc : ContinuousAt f x) |
| 20 | (hd : HasDerivAt (deriv f) q x) : 0 ≤ q := by |
| 21 | by_contra hq |
| 22 | have hneg : q < 0 := lt_of_not_ge hq |
| 23 | have hmax : IsLocalMax f x := isLocalMax_of_deriv_deriv_neg |
| 24 | (by rw [hd.deriv]; exact hneg) hmin.deriv_eq_zero hc |
| 25 | have heq : f =ᶠ[𝓝 x] fun _ ↦ f x := by |
| 26 | filter_upwards [hmin, hmax] with y hy hy' |
| 27 | exact le_antisymm hy' hy |
| 28 | have hzero : deriv (deriv f) x = 0 := by |
| 29 | rw [heq.deriv.deriv_eq] |
| 30 | simp |
| 31 | have : q = 0 := hd.deriv.symm.trans hzero |
| 32 | linarith |
| 33 | |
| 34 | theorem mixedTerm_eq_zero_of_quadratic_nonneg {B C : ℝ} |
| 35 | (h : ∀ c : ℝ, 0 ≤ 2 * c * B + c ^ 2 * C) : B = 0 := by |
| 36 | have hmin : IsLocalMin (fun c : ℝ ↦ 2 * c * B + c ^ 2 * C) 0 := by |
| 37 | apply Filter.Eventually.of_forall |
| 38 | intro c |
| 39 | simpa only [mul_zero, zero_mul, zero_pow (by norm_num : (2 : ℕ) ≠ 0), zero_add] |
| 40 | using h c |
| 41 | have hd : HasDerivAt (fun c : ℝ ↦ 2 * c * B + c ^ 2 * C) (2 * B) 0 := by |
| 42 | convert (((hasDerivAt_id (0 : ℝ)).const_mul 2).mul_const B).add |
| 43 | (((hasDerivAt_id (0 : ℝ)).pow 2).mul_const C) using 1 <;> |
| 44 | first | rfl | norm_num |
| 45 | have hz := hmin.hasDerivAt_eq_zero hd |
| 46 | linarith |
| 47 | |
| 48 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 49 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 50 | |
| 51 | theorem secondVariation_nonneg {J : Set ℝ} {F : RicciFlow n M J} |
| 52 | {T τ₁ τ₂ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) |
| 53 | {p : BackwardTimePath F T τ₁ τ₂} |
| 54 | (hmin : IsMinimizingBackwardLPath F T τ₁ τ₂ p) |
| 55 | (V : FixedEndpointLVariation F T τ₁ τ₂ p) {q : ℝ} |
| 56 | (hd : HasDerivAt (fun u ↦ deriv (variationLLength V.toLVariation) u) q 0) : |
| 57 | 0 ≤ q := by |
| 58 | have hc := (hasDerivAt_variationLLength_integral hM04 V.toLVariation |
| 59 | (show (0 : ℝ) ∈ V.toLVariation.parameterDomain from |
| 60 | ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩)).continuousAt |
| 61 | exact secondDerivative_nonneg_of_localMin (isLocalMin_variationLLength hmin V) hc hd |
| 62 | |
| 63 | end PoincareMT.LGeometry |
| 64 |