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.Calculus.Differential.ScalarGraphDerivative |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Basic |
| 3 | import PoincareLib.Geometry.Spacetime.Horizontal.Connection |
| 4 | import Mathlib.Tactic.Linarith |
| 5 | import Mathlib.Tactic.LinearCombination |
| 6 | |
| 7 | /-! |
| 8 | # The horizontal pullback metric rule |
| 9 | |
| 10 | Morgan-Tian Lemma 6.4, pp. 107-108, using the generalized metric defect |
| 11 | of Definition 3.36 and Remark 3.37, pp. 60-61. The actual pullback |
| 12 | derivative satisfies the metric product rule and is independent of its |
| 13 | extension, including closed endpoints with unique within derivatives. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M14 |
| 23 | |
| 24 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 25 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 26 | {γ : ℝ → G.Point} {J : Set ℝ} {Y : ∀ s, G.Horizontal (γ s)} |
| 27 | |
| 28 | set_option maxHeartbeats 1000000 in |
| 29 | -- Bundle application elaborates the metric and two dependent section arguments. |
| 30 | /-- Pairing an actual horizontal extension with a local smooth stationary |
| 31 | section is jointly smooth at the required graph point, Lemma 6.4, p. 107. -/ |
| 32 | theorem pullbackExtension_metric_pair_contMDiffAt |
| 33 | (E : M14PullbackExtension G γ J Y) {s : ℝ} (hs : s ∈ J) |
| 34 | (W : HorizontalSection G.spacetime) |
| 35 | (hW : ContMDiffAt (spacetimeModel n) |
| 36 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 37 | (fun p => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 38 | (E := G.Horizontal) p (W p)) (γ s)) : |
| 39 | ContMDiffAt ((𝓘(ℝ, ℝ)).prod (spacetimeModel n)) (𝓘(ℝ, ℝ)) ∞ |
| 40 | (fun z : ℝ × G.Point => G.spacetime.horizontalMetric.inner z.2 |
| 41 | (E.extension z.1 z.2) (W z.2)) (s, γ s) := by |
| 42 | have hmetric : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (spacetimeModel n)) |
| 43 | ((spacetimeModel n).prod |
| 44 | 𝓘(ℝ, EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ)) ∞ |
| 45 | (fun z : ℝ × G.Point => Bundle.TotalSpace.mk' |
| 46 | (E := fun p : G.Point => G.Horizontal p →L[ℝ] G.Horizontal p →L[ℝ] ℝ) |
| 47 | (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 48 | z.2 (G.spacetime.horizontalMetric.inner z.2)) (s, γ s) := |
| 49 | G.spacetime.horizontalMetric.contMDiff.contMDiffAt.comp (s, γ s) |
| 50 | (show ContMDiffAt ((𝓘(ℝ, ℝ)).prod (spacetimeModel n)) (spacetimeModel n) ∞ |
| 51 | (Prod.snd : ℝ × G.Point → G.Point) (s, γ s) from contMDiffAt_snd) |
| 52 | obtain ⟨U, hU, hgraph, hE⟩ := E.joint_smooth |
| 53 | have hfield := (hE (s, γ s) (hgraph s hs)).contMDiffAt (hU.mem_nhds (hgraph s hs)) |
| 54 | have htest := hW.comp (s, γ s) |
| 55 | (show ContMDiffAt ((𝓘(ℝ, ℝ)).prod (spacetimeModel n)) (spacetimeModel n) ∞ |
| 56 | (Prod.snd : ℝ × G.Point → G.Point) (s, γ s) from contMDiffAt_snd) |
| 57 | have h : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (spacetimeModel n)) |
| 58 | ((spacetimeModel n).prod 𝓘(ℝ, ℝ)) ∞ |
| 59 | (fun z : ℝ × G.Point => Bundle.TotalSpace.mk' ℝ |
| 60 | (E := Bundle.Trivial G.Point ℝ) z.2 |
| 61 | (G.spacetime.horizontalMetric.inner z.2 (E.extension z.1 z.2) (W z.2))) |
| 62 | (s, γ s) := by |
| 63 | apply ContMDiffAt.clm_bundle_apply₂ |
| 64 | (F₁ := EuclideanSpace ℝ (Fin n)) (F₂ := EuclideanSpace ℝ (Fin n)) |
| 65 | · exact hmetric |
| 66 | · exact hfield |
| 67 | · exact htest |
| 68 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 69 | using (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 70 | |
| 71 | /-- The pullback metric derivative against a stationary section has the |
| 72 | actual Ricci metric-defect term, also at closed endpoints, Lemma 6.4, |
| 73 | pp. 107-108, and Definition 3.36, pp. 60-61. -/ |
| 74 | theorem horizontalCovariantDerivative_metric_derivative |
| 75 | (E : M14PullbackExtension G γ J Y) {s : ℝ} (hs : s ∈ J) |
| 76 | (hJ : UniqueDiffWithinAt ℝ J s) |
| 77 | (hγ : MDifferentiableWithinAt (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s) |
| 78 | (W : HorizontalSection G.spacetime) |
| 79 | (hW : ContMDiffAt (spacetimeModel n) |
| 80 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 81 | (fun p => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 82 | (E := G.Horizontal) p (W p)) (γ s)) : |
| 83 | HasDerivWithinAt |
| 84 | (fun r => G.spacetime.horizontalMetric.inner (γ r) |
| 85 | (E.extension r (γ r)) (W (γ r))) |
| 86 | (G.spacetime.horizontalMetric.inner (γ s) |
| 87 | (M14HorizontalCovariantDerivative G γ J Y E s) (W (γ s)) + |
| 88 | G.spacetime.horizontalMetric.inner (γ s) (Y s) |
| 89 | (rawHorizontalCovariantDerivative G.leafwise W (γ s) |
| 90 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ))) - |
| 91 | 2 * (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (γ s) |
| 92 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ))) * |
| 93 | horizontalRicci G.leafwise (γ s) (Y s) (W (γ s))) J s := by |
| 94 | let : Bundle.RiemannianBundle (G.Horizontal : G.Point → Type _) := |
| 95 | ⟨G.spacetime.horizontalMetric.toRiemannianMetric⟩ |
| 96 | have hEs := ((E.spatial_smooth s (γ s) (E.graph_mem s hs)).contMDiffAt |
| 97 | (E.domain_open.mem_nhds (E.graph_mem s hs))).mdifferentiableAt (by simp) |
| 98 | have hspace := rawHorizontalCovariantDerivative_metric_defect G.leafwise hEs |
| 99 | (hW.mdifferentiableAt (by simp)) |
| 100 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ)) |
| 101 | rw [G.ricciEquation, E.agrees s hs] at hspace |
| 102 | let clock : ℝ := mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (γ s) |
| 103 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ)) |
| 104 | change _ = clock * (-2 * horizontalRicci G.leafwise (γ s) (Y s) (W (γ s))) at hspace |
| 105 | obtain ⟨d, hd⟩ := E.parameter_derivative s hs |
| 106 | have hpair := ((G.spacetime.horizontalMetric.inner (γ s)).flip (W (γ s))).hasFDerivAt |
| 107 | (x := E.extension s (γ s)) |
| 108 | have htime := hpair.comp_hasDerivAt s hd.differentiableAt.hasDerivAt |
| 109 | change HasDerivAt (fun r => G.spacetime.horizontalMetric.inner (γ s) |
| 110 | (E.extension r (γ s)) (W (γ s))) |
| 111 | (G.spacetime.horizontalMetric.inner (γ s) |
| 112 | (deriv (fun r => E.extension r (γ s)) s) (W (γ s))) s at htime |
| 113 | have h := scalar_graph_hasDerivWithinAt _ |
| 114 | ((pullbackExtension_metric_pair_contMDiffAt E hs W hW).mdifferentiableAt (by simp)) hγ hJ |
| 115 | rw [htime.deriv] at h |
| 116 | have hvalue : G.spacetime.horizontalMetric.inner (γ s) |
| 117 | (M14HorizontalCovariantDerivative G γ J Y E s) (W (γ s)) + |
| 118 | G.spacetime.horizontalMetric.inner (γ s) (Y s) |
| 119 | (rawHorizontalCovariantDerivative G.leafwise W (γ s) |
| 120 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ))) - |
| 121 | 2 * (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (γ s) |
| 122 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ))) * |
| 123 | horizontalRicci G.leafwise (γ s) (Y s) (W (γ s)) = |
| 124 | G.spacetime.horizontalMetric.inner (γ s) |
| 125 | (deriv (fun r => E.extension r (γ s)) s) (W (γ s)) + |
| 126 | mvfderiv (spacetimeModel n) |
| 127 | (fun q => G.spacetime.horizontalMetric.inner q (E.extension s q) (W q)) (γ s) |
| 128 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s (1 : ℝ)) := by |
| 129 | simp only [M14HorizontalCovariantDerivative, map_add, add_apply] |
| 130 | change _ - 2 * clock * horizontalRicci G.leafwise (γ s) (Y s) (W (γ s)) = _ |
| 131 | linear_combination -hspace |
| 132 | exact hvalue.symm ▸ h |
| 133 | |
| 134 | /-- The actual horizontal pullback derivative is independent of the |
| 135 | chosen extension wherever within derivatives are unique, including |
| 136 | closed endpoints, Lemma 6.4, pp. 107-108. -/ |
| 137 | theorem horizontalCovariantDerivative_extension_independent |
| 138 | (E₁ E₂ : M14PullbackExtension G γ J Y) {s : ℝ} (hs : s ∈ J) |
| 139 | (hJ : UniqueDiffWithinAt ℝ J s) |
| 140 | (hγ : MDifferentiableWithinAt (𝓘(ℝ, ℝ)) (spacetimeModel n) γ J s) : |
| 141 | M14HorizontalCovariantDerivative G γ J Y E₁ s = |
| 142 | M14HorizontalCovariantDerivative G γ J Y E₂ s := by |
| 143 | let v := M14HorizontalCovariantDerivative G γ J Y E₁ s - |
| 144 | M14HorizontalCovariantDerivative G γ J Y E₂ s |
| 145 | let W := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v |
| 146 | have hW : ContMDiffAt (spacetimeModel n) |
| 147 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 148 | (fun p => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 149 | (E := G.Horizontal) p (W p)) (γ s) := |
| 150 | FiberBundle.contMDiffAt_extend (spacetimeModel n) (EuclideanSpace ℝ (Fin n)) v |
| 151 | have h₁ := horizontalCovariantDerivative_metric_derivative E₁ hs hJ hγ W hW |
| 152 | have h₂ := horizontalCovariantDerivative_metric_derivative E₂ hs hJ hγ W hW |
| 153 | have h₁' := h₁.congr_of_mem |
| 154 | (show ∀ r ∈ J, G.spacetime.horizontalMetric.inner (γ r) |
| 155 | (E₂.extension r (γ r)) (W (γ r)) = |
| 156 | G.spacetime.horizontalMetric.inner (γ r) (E₁.extension r (γ r)) (W (γ r)) from by |
| 157 | intro r hr |
| 158 | rw [E₁.agrees r hr, E₂.agrees r hr]) hs |
| 159 | have heq := (h₁'.derivWithin hJ).symm.trans (h₂.derivWithin hJ) |
| 160 | have hWself : W (γ s) = v := FiberBundle.extend_apply_self _ _ |
| 161 | rw [hWself] at heq |
| 162 | have hz : G.spacetime.horizontalMetric.inner (γ s) v v = 0 := by |
| 163 | calc |
| 164 | _ = G.spacetime.horizontalMetric.inner (γ s) |
| 165 | (M14HorizontalCovariantDerivative G γ J Y E₁ s) v - |
| 166 | G.spacetime.horizontalMetric.inner (γ s) |
| 167 | (M14HorizontalCovariantDerivative G γ J Y E₂ s) v := |
| 168 | congrArg (fun L : G.Horizontal (γ s) →L[ℝ] ℝ => L v) |
| 169 | ((G.spacetime.horizontalMetric.inner (γ s)).map_sub _ _) |
| 170 | _ = 0 := by linarith |
| 171 | by_contra hne |
| 172 | exact (ne_of_gt (G.spacetime.horizontalMetric.pos (γ s) v (sub_ne_zero.mpr hne))) hz |
| 173 | |
| 174 | end PoincareMT.M14 |