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.Paths.SquareRoot.Action.SquareRepresentative |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.PullbackRestriction |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquareRootComparison |
| 4 | |
| 5 | /-! |
| 6 | # Actual Euler residuals on a common closed subset |
| 7 | |
| 8 | Morgan-Tian Definition 6.7, Lemma 6.8 and Lemma 6.18, |
| 9 | pp. 108-109, 113-114. Agreement of actual square curves on a |
| 10 | uniquely differentiable common subset identifies their velocities, |
| 11 | pullback derivatives and Euler residuals, even for different intervals. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T a b T' c d : ℝ} {x y x' y' : G.Point} |
| 26 | {p : M14BackwardPath G T a b x y} {q : M14BackwardPath G T' c d x' y'} |
| 27 | |
| 28 | private theorem residualPair_heq {x y : G.Point} (h : x = y) |
| 29 | {A V W : G.Horizontal x} {A' V' W' : G.Horizontal y} |
| 30 | (hA : HEq A A') (hV : HEq V V') (hW : HEq W W') (s : ℝ) : |
| 31 | G.spacetime.horizontalMetric.inner x A W - |
| 32 | 2 * s ^ 2 * M14HorizontalScalarDifferential G x W.val + |
| 33 | 4 * s * horizontalRicci G.leafwise x V W = |
| 34 | G.spacetime.horizontalMetric.inner y A' W' - |
| 35 | 2 * s ^ 2 * M14HorizontalScalarDifferential G y W'.val + |
| 36 | 4 * s * horizontalRicci G.leafwise y V' W' := by |
| 37 | cases h |
| 38 | cases hA |
| 39 | cases hV |
| 40 | cases hW |
| 41 | rfl |
| 42 | |
| 43 | /-- Actual Euler residuals agree on a common uniquely differentiable |
| 44 | subset for arbitrary extension witnesses and different path intervals, |
| 45 | the local continuation step of Lemma 6.18, pp. 113-114. -/ |
| 46 | theorem squareRootEulerResidual_eq_on_subset |
| 47 | (R : M14SquareRootPath G p) (S : M14SquareRootPath G q) |
| 48 | (E : M14PullbackExtension G R.curve (M14SqrtParameterInterval a b) |
| 49 | R.horizontal_velocity) |
| 50 | (F : M14PullbackExtension G S.curve (M14SqrtParameterInterval c d) |
| 51 | S.horizontal_velocity) {K : Set ℝ} |
| 52 | (hKR : K ⊆ M14SqrtParameterInterval a b) (hKS : K ⊆ M14SqrtParameterInterval c d) |
| 53 | (hK : UniqueDiffOn ℝ K) (heq : EqOn R.curve S.curve K) |
| 54 | {s : ℝ} (hs : s ∈ K) {W : G.Horizontal (R.curve s)} |
| 55 | {W' : G.Horizontal (S.curve s)} (hW : HEq W W') : |
| 56 | M14SquareRootEulerResidual G R E s W = M14SquareRootEulerResidual G S F s W' := by |
| 57 | have hvel (r : ℝ) (hr : r ∈ K) := |
| 58 | squareRoot_horizontalVelocity_heq_on_subset R S hKR hKS heq hr (hK r hr) |
| 59 | let E₀ := pullbackExtensionRestrict E hKR |
| 60 | let F₀ := pullbackExtensionRestrict F hKS |
| 61 | let E₁ := pullbackExtensionCongrOn E₀ heq hvel |
| 62 | have hR := ((R.smooth.mono R.interval_subset) s (hKR hs)).mdifferentiableWithinAt |
| 63 | (by simp) |
| 64 | have hS := ((S.smooth.mono S.interval_subset) s (hKS hs)).mdifferentiableWithinAt |
| 65 | (by simp) |
| 66 | have hDR := horizontalCovariantDerivative_restrict_subset E hKR (hK s hs) hR |
| 67 | have hDS := horizontalCovariantDerivative_restrict_subset F hKS (hK s hs) hS |
| 68 | have hDE := horizontalCovariantDerivative_congrOn E₀ heq hvel hs |
| 69 | have hEF := horizontalCovariantDerivative_extension_independent E₁ F₀ hs (hK s hs) |
| 70 | (hS.mono hKS) |
| 71 | have hD : HEq (M14HorizontalCovariantDerivative G R.curve |
| 72 | (M14SqrtParameterInterval a b) R.horizontal_velocity E s) |
| 73 | (M14HorizontalCovariantDerivative G S.curve |
| 74 | (M14SqrtParameterInterval c d) S.horizontal_velocity F s) := by |
| 75 | rw [hDR, hDS] |
| 76 | exact hDE.trans (heq_of_eq hEF) |
| 77 | exact residualPair_heq (G := G) (heq hs) hD (hvel s hs) hW s |
| 78 | |
| 79 | end PoincareMT.M14 |