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.Pullback.PullbackRestriction |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.PullbackCongruence |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.PullbackMetric |
| 4 | |
| 5 | /-! |
| 6 | # Actual horizontal Jacobi pairs |
| 7 | |
| 8 | Morgan-Tian Lemmas 6.10 and 6.12, pp. 109-110. The second-order |
| 9 | equation is a first-order system for a horizontal field and its actual |
| 10 | covariant derivative. Extension independence and within restriction |
| 11 | retain this system on smaller closed intervals. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle |
| 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 | |
| 26 | /-- A supplied actual extension is smooth along every smooth base |
| 27 | curve on its parameter set, Lemma 6.4, pp. 107-108. -/ |
| 28 | theorem pullbackExtension_field_contMDiffOn {γ : ℝ → G.Point} {J : Set ℝ} |
| 29 | {Y : ∀ s, G.Horizontal (γ s)} (E : M14PullbackExtension G γ J Y) |
| 30 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ γ J) : |
| 31 | ContMDiffOn (𝓘(ℝ, ℝ)) ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 32 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Y s)) J := by |
| 33 | obtain ⟨U, hU, hgraph, hE⟩ := E.joint_smooth |
| 34 | have h := hE.comp (contMDiffOn_id.prodMk hγ) hgraph |
| 35 | apply h.congr |
| 36 | intro s hs |
| 37 | dsimp only [Function.comp_def, id_eq] |
| 38 | rw [E.agrees s hs] |
| 39 | |
| 40 | variable {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 41 | (R : M14SquareRootPath G p) |
| 42 | |
| 43 | /-- The corrected Jacobi residual written for independent phase |
| 44 | variables Y, P and D_s P, with the frozen curvature order, |
| 45 | Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 46 | noncomputable def horizontalJacobiPairResidual (s : ℝ) |
| 47 | (Y P DP W : G.Horizontal (R.curve s)) : ℝ := |
| 48 | let q := R.curve s |
| 49 | let A := M14SquareRootVelocity R s |
| 50 | G.spacetime.horizontalMetric.inner q DP W + |
| 51 | horizontalRiemann G.leafwise q Y A W A - |
| 52 | 2 * s * M14BcalPairing G q A Y W - |
| 53 | 2 * s ^ 2 * M14HorizontalHessianPairing G q Y W + |
| 54 | 4 * s * M14HorizontalRicciDerivativePairing G q Y A W + |
| 55 | 4 * s * horizontalRicci G.leafwise q P W |
| 56 | |
| 57 | /-- An actual smooth horizontal solution pair on a closed subinterval, |
| 58 | using genuine pullback extensions, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 59 | structure IsHorizontalJacobiPairOn (a b : ℝ) |
| 60 | (z : ∀ s, G.Horizontal (R.curve s) × G.Horizontal (R.curve s)) : Prop where |
| 61 | ordered : a < b |
| 62 | interval_subset : Icc a b ⊆ M14SqrtParameterInterval τ₁ τ₂ |
| 63 | first_smooth : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 64 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 65 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (R.curve s) (z s).1) (Icc a b) |
| 66 | second_smooth : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 67 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 68 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (R.curve s) (z s).2) (Icc a b) |
| 69 | equations : ∃ EY : M14PullbackExtension G R.curve (Icc a b) (fun s => (z s).1), |
| 70 | ∃ EP : M14PullbackExtension G R.curve (Icc a b) (fun s => (z s).2), |
| 71 | (∀ s ∈ Icc a b, M14HorizontalCovariantDerivative G R.curve (Icc a b) |
| 72 | (fun r => (z r).1) EY s = (z s).2) ∧ |
| 73 | ∀ s ∈ Icc a b, ∀ W : G.Horizontal (R.curve s), |
| 74 | horizontalJacobiPairResidual R s (z s).1 (z s).2 |
| 75 | (M14HorizontalCovariantDerivative G R.curve (Icc a b) (fun r => (z r).2) EP s) W = 0 |
| 76 | |
| 77 | variable {R} {a b : ℝ} |
| 78 | {z w : ∀ s, G.Horizontal (R.curve s) × G.Horizontal (R.curve s)} |
| 79 | |
| 80 | /-- A Jacobi pair depends only on the actual fields on its interval, |
| 81 | Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 82 | theorem IsHorizontalJacobiPairOn.congr (h : IsHorizontalJacobiPairOn R a b z) |
| 83 | (hzw : ∀ s ∈ Icc a b, z s = w s) : IsHorizontalJacobiPairOn R a b w := by |
| 84 | obtain ⟨EY, EP, hY, hP⟩ := h.equations |
| 85 | have hfirst := fun s hs => congrArg Prod.fst (hzw s hs) |
| 86 | have hsecond := fun s hs => congrArg Prod.snd (hzw s hs) |
| 87 | let EY' := pullbackExtensionCongr EY rfl (fun s hs => heq_of_eq (hfirst s hs)) |
| 88 | let EP' := pullbackExtensionCongr EP rfl (fun s hs => heq_of_eq (hsecond s hs)) |
| 89 | refine ⟨h.ordered, h.interval_subset, ?_, ?_, EY', EP', ?_, ?_⟩ |
| 90 | · exact h.first_smooth.congr (fun s hs => by rw [← hzw s hs]) |
| 91 | · exact h.second_smooth.congr (fun s hs => by rw [← hzw s hs]) |
| 92 | · intro s hs |
| 93 | exact (hY s hs).trans (hsecond s hs) |
| 94 | · intro s hs W |
| 95 | change horizontalJacobiPairResidual R s (w s).1 (w s).2 |
| 96 | (M14HorizontalCovariantDerivative G R.curve (Icc a b) (fun r => (z r).2) EP s) W = 0 |
| 97 | rw [← hzw s hs] |
| 98 | exact hP s hs W |
| 99 | |
| 100 | /-- The phase equations hold for every supplied pair of extensions, |
| 101 | including at closed endpoints, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 102 | theorem IsHorizontalJacobiPairOn.equations_for_extensions |
| 103 | (h : IsHorizontalJacobiPairOn R a b z) |
| 104 | (EY : M14PullbackExtension G R.curve (Icc a b) (fun s => (z s).1)) |
| 105 | (EP : M14PullbackExtension G R.curve (Icc a b) (fun s => (z s).2)) : |
| 106 | (∀ s ∈ Icc a b, M14HorizontalCovariantDerivative G R.curve (Icc a b) |
| 107 | (fun r => (z r).1) EY s = (z s).2) ∧ |
| 108 | ∀ s ∈ Icc a b, ∀ W : G.Horizontal (R.curve s), |
| 109 | horizontalJacobiPairResidual R s (z s).1 (z s).2 |
| 110 | (M14HorizontalCovariantDerivative G R.curve (Icc a b) (fun r => (z r).2) EP s) W = 0 := by |
| 111 | obtain ⟨EY₀, EP₀, hY, hP⟩ := h.equations |
| 112 | have hR := R.smooth.mono (h.interval_subset.trans R.interval_subset) |
| 113 | constructor |
| 114 | · intro s hs |
| 115 | rw [← horizontalCovariantDerivative_extension_independent EY₀ EY hs |
| 116 | (uniqueDiffOn_Icc h.ordered s hs) ((hR s hs).mdifferentiableWithinAt (by simp))] |
| 117 | exact hY s hs |
| 118 | · intro s hs W |
| 119 | rw [← horizontalCovariantDerivative_extension_independent EP₀ EP hs |
| 120 | (uniqueDiffOn_Icc h.ordered s hs) ((hR s hs).mdifferentiableWithinAt (by simp))] |
| 121 | exact hP s hs W |
| 122 | |
| 123 | /-- Restrict an actual Jacobi pair to any nondegenerate closed |
| 124 | subinterval, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 125 | theorem IsHorizontalJacobiPairOn.restrict (h : IsHorizontalJacobiPairOn R a b z) |
| 126 | {c d : ℝ} (hac : a ≤ c) (hcd : c < d) (hdb : d ≤ b) : |
| 127 | IsHorizontalJacobiPairOn R c d z := by |
| 128 | have hsub : Icc c d ⊆ Icc a b := Icc_subset_Icc hac hdb |
| 129 | have hR := R.smooth.mono (h.interval_subset.trans R.interval_subset) |
| 130 | obtain ⟨EY, EP, hY, hP⟩ := h.equations |
| 131 | refine ⟨hcd, hsub.trans h.interval_subset, h.first_smooth.mono hsub, |
| 132 | h.second_smooth.mono hsub, pullbackExtensionRestrict EY hsub, |
| 133 | pullbackExtensionRestrict EP hsub, ?_, ?_⟩ |
| 134 | · intro s hs |
| 135 | rw [← horizontalCovariantDerivative_restrict_subset EY hsub |
| 136 | (uniqueDiffOn_Icc hcd s hs) ((hR s (hsub hs)).mdifferentiableWithinAt (by simp))] |
| 137 | exact hY s (hsub hs) |
| 138 | · intro s hs W |
| 139 | rw [← horizontalCovariantDerivative_restrict_subset EP hsub |
| 140 | (uniqueDiffOn_Icc hcd s hs) ((hR s (hsub hs)).mdifferentiableWithinAt (by simp))] |
| 141 | exact hP s (hsub hs) W |
| 142 | |
| 143 | end PoincareMT.M14 |