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.Generalized.ReducedGeometry.Variation.Euler.EulerResidual |
| 2 | |
| 3 | /-! |
| 4 | # First variation along an actual square Euler path |
| 5 | |
| 6 | Morgan-Tian Lemma 6.22, pp. 115-116, using Lemma 6.4, |
| 7 | pp. 107-108. Actual extension independence eliminates the full |
| 8 | Euler integral. A stationary initial endpoint eliminates the initial |
| 9 | boundary pairing, leaving the final square-velocity pairing. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff intervalIntegral |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M14 |
| 20 | |
| 21 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 22 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 23 | {T a b : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 24 | {R : M14SquareRootPath G p} |
| 25 | |
| 26 | /-- An actual square Euler path with stationary initial endpoint has |
| 27 | the final square-velocity first variation, Lemma 6.22, pp. 115-116. -/ |
| 28 | theorem firstVariation_euler_fixedInitial |
| 29 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 30 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 31 | (E : M14PullbackExtension G R.curve (M14SqrtParameterInterval a b) R.horizontal_velocity) |
| 32 | (hEuler : ∀ s ∈ M14SqrtParameterInterval a b, ∀ W, |
| 33 | M14SquareRootEulerResidual G R E s W = 0) |
| 34 | (V : M14LVariationData G p R) (hzero : M14VariationField V (Real.sqrt a) = 0) : |
| 35 | HasDerivAt (M14VariationAction V) |
| 36 | (G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt b)) |
| 37 | (R.horizontal_velocity (Real.sqrt b)) (M14VariationField V (Real.sqrt b))) 0 := by |
| 38 | obtain ⟨D⟩ := exists_variationDerivativeData V |
| 39 | have hfirst := firstVariationIdentity hCoordinates hM12 V D |
| 40 | have hres : M14FirstVariationResidualIntegral V D = 0 := by |
| 41 | unfold M14FirstVariationResidualIntegral |
| 42 | rw [← intervalIntegral.integral_zero (a := Real.sqrt a) (b := Real.sqrt b)] |
| 43 | apply intervalIntegral.integral_congr_Ioo_of_le (Real.sqrt_le_sqrt p.tau_lt.le) |
| 44 | intro s hs |
| 45 | change -M14SquareRootEulerResidual G R D.base_extension s (M14VariationField V s) = 0 |
| 46 | rw [squareRootEulerResidual_extension_independent D.base_extension E |
| 47 | (Ioo_subset_Icc_self hs), hEuler s (Ioo_subset_Icc_self hs), neg_zero] |
| 48 | simpa only [M14FirstVariationIdentity, hres, add_zero, M14FirstVariationBoundaryTerm, |
| 49 | M14SquareRootVelocity, hzero, map_zero, sub_zero] using hfirst |
| 50 | |
| 51 | end PoincareMT.M14 |