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.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Surface.VariationSurfaceBridge |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Surface.VariationGaugeDerivative |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.BaseGaugeFields |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.SurfaceGaugeCoefficients |
| 6 | |
| 7 | /-! |
| 8 | # The actual index and Euler terms of surface second variation |
| 9 | |
| 10 | Morgan-Tian Proposition 6.33, pp. 120-121. Actual field identities |
| 11 | transport M08's coordinate index and Euler expressions to the frozen |
| 12 | M14 density and residual. The supplied derivative extensions remain |
| 13 | arbitrary throughout. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | -- Reconstructed gauge points have the same actual horizontal tangent fibers. |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M14 |
| 26 | |
| 27 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 28 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 29 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 30 | {R : M14SquareRootPath G p} (V : M14LVariationData G p R) |
| 31 | (D : M14VariationDerivativeData V) (b : G.gaugeCover.index) |
| 32 | (hCoordinates : SpacetimeGaugeTheory.{u, 0} G.leafwise G.timeIntervals) |
| 33 | (hscalar : ContMDiff (spacetimeModel n) (𝓘(ℝ, ℝ)) ∞ |
| 34 | (horizontalScalarCurvature G.leafwise)) |
| 35 | (hM04 : RicciFlowCurvatureTheory.{0}) |
| 36 | (W : OrdinaryGaugeWitness G.leafwise (G.gaugeCover.cylinder b) (G.gaugeCover.metric b)) |
| 37 | (x₀ : G.gaugeCover.spatial b) {N P : Set ℝ} (hN : IsOpen N) (hP : IsOpen P) |
| 38 | (hzero : (0 : ℝ) ∈ P) |
| 39 | {β : ℝ × ℝ → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 40 | G.gaugeCover.spatial b} |
| 41 | (hβ : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ β |
| 42 | ((M14SqrtParameterInterval τ₁ τ₂ ∩ N) ×ˢ P)) |
| 43 | (hrec : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 44 | (G.gaugeCover.cylinder b).toSpacetime (β (r, u)) = V.squareFamily r u) |
| 45 | (hclock : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 46 | (β (r, u)).1.val = T - r ^ 2) |
| 47 | |
| 48 | private theorem horizontal_function_eq_of_heq |
| 49 | (f : ∀ q : G.Point, G.Horizontal q → G.Horizontal q → G.Horizontal q → ℝ) |
| 50 | {q r : G.Point} (h : q = r) |
| 51 | {a v d : G.Horizontal q} {a' v' d' : G.Horizontal r} |
| 52 | (ha : HEq a a') (hv : HEq v v') (hd : HEq d d') : f q a v d = f r a' v' d' := by |
| 53 | cases h |
| 54 | cases ha |
| 55 | cases hv |
| 56 | cases hd |
| 57 | rfl |
| 58 | |
| 59 | include hCoordinates hscalar hM04 hN hP hzero hβ hrec hclock |
| 60 | |
| 61 | /-- The coordinate index term is the exact frozen second-variation |
| 62 | index density at every interior square time, Proposition 6.33, |
| 63 | pp. 120-121. -/ |
| 64 | theorem surfaceIndex_gauge {s : ℝ} |
| 65 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) (hsN : s ∈ N) : |
| 66 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 67 | let m := M08.chartActionMetric W.flow T x₀ |
| 68 | let Γ := M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N) |
| 69 | let a := M08.coordinatePartialS q (s, 0) |
| 70 | let v := M08.coordinatePartialU q (s, 0) |
| 71 | let d := M08.coordinateCovariantS Γ q (M08.coordinatePartialU q) (s, 0) |
| 72 | let P₀ := fun z => M08.chartActionPotential W.flow T x₀ (s, z) |
| 73 | m (s, q (s, 0)) d d + |
| 74 | m (s, q (s, 0)) (M08.coordinateCurvature Γ (s, q (s, 0)) v a v) a - |
| 75 | m (s, q (s, 0)) (fderiv ℝ Γ (s, q (s, 0)) (1, 0) v v) a + |
| 76 | (fderiv ℝ (fderiv ℝ P₀) (q (s, 0)) v v - |
| 77 | fderiv ℝ P₀ (q (s, 0)) (Γ (s, q (s, 0)) v v)) = |
| 78 | M14SecondVariationIndexDensity V D s := by |
| 79 | let S := M14SqrtParameterInterval τ₁ τ₂ ∩ N |
| 80 | let Ω := (Ioo (Real.sqrt τ₁) (Real.sqrt τ₂) ∩ N) ×ˢ P |
| 81 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 82 | let Γ := M08.closedChartConnection W.flow T x₀ S |
| 83 | let j : EuclideanSpace ℝ (Fin n) ≃L[ℝ] |
| 84 | G.Horizontal ((G.gaugeCover.cylinder b).toSpacetime (β (s, 0))) := |
| 85 | (G.gaugeCover.metric b).spatialTangentEquiv (β (s, 0)).1 (β (s, 0)).2 |
| 86 | have hsS : s ∈ S := ⟨Ioo_subset_Icc_self hs, hsN⟩ |
| 87 | have hSneigh : S ∈ 𝓝 s := inter_mem (Icc_mem_nhds hs.1 hs.2) (hN.mem_nhds hsN) |
| 88 | have hS : UniqueDiffOn ℝ S := |
| 89 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt)).inter hN |
| 90 | have htime (r : ℝ) (hr : r ∈ S) : T - r ^ 2 ∈ (G.gaugeCover.interval b).domain := by |
| 91 | rw [← hclock r hr 0 hzero] |
| 92 | exact (β (r, 0)).1.property |
| 93 | have hΩ : IsOpen Ω := (isOpen_Ioo.inter hN).prod hP |
| 94 | have hq : ContDiffOn ℝ ∞ q Ω := (variationGauge_spatial_contDiffOn b hβ).mono |
| 95 | (fun _ hz => ⟨⟨Ioo_subset_Icc_self hz.1.1, hz.1.2⟩, hz.2⟩) |
| 96 | have hp : (s, (0 : ℝ)) ∈ Ω := ⟨⟨hs, hsN⟩, hzero⟩ |
| 97 | have hqd := (hq.contDiffAt (hΩ.mem_nhds hp)).differentiableAt (by simp) |
| 98 | have hβ₀ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun r => β (r, 0)) S := |
| 99 | hβ.comp (contMDiff_id.prodMk (contMDiff_const (c := (0 : ℝ)))).contMDiffOn |
| 100 | (fun _ hr => ⟨hr, hzero⟩) |
| 101 | have hbase (r : ℝ) (hr : r ∈ S) : |
| 102 | (G.gaugeCover.cylinder b).toSpacetime (β (r, 0)) = R.curve r := |
| 103 | (hrec r hr 0 hzero).trans (V.square_base r) |
| 104 | have hAcoord : derivWithin (fun r => q (r, 0)) S s = M08.coordinatePartialS q (s, 0) := by |
| 105 | rw [derivWithin_of_mem_nhds hSneigh] |
| 106 | exact (M08.coordinateSlice_fst_hasDerivAt q hqd).deriv |
| 107 | have hYcoord : deriv (fun v => q (s, v)) 0 = M08.coordinatePartialU q (s, 0) := |
| 108 | (M08.coordinateSlice_snd_hasDerivAt q hqd).deriv |
| 109 | have hDYcoord := coordinateCovariantS_partialU_eq_slice hΩ q hq hp Γ hSneigh |
| 110 | have hA := (squareRootVelocity_gauge R b hN hβ₀ hbase hsS).trans |
| 111 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hAcoord)) |
| 112 | have hY := (variationField_gauge V b hP hzero hβ hrec hsS).trans |
| 113 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hYcoord)) |
| 114 | have hDY := (variationCovariantDerivative_gauge V D b hCoordinates W x₀ |
| 115 | hN hP hzero hβ hrec hclock hsS).trans |
| 116 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hDYcoord.symm)) |
| 117 | have htransport := horizontal_function_eq_of_heq (G := G) |
| 118 | (fun q a v d => G.spacetime.horizontalMetric.inner q d d + |
| 119 | horizontalRiemann G.leafwise q v a a v + |
| 120 | 2 * s ^ 2 * M14HorizontalHessianPairing G q v v - |
| 121 | 4 * s * M14HorizontalRicciDerivativePairing G q v a v + |
| 122 | 2 * s * M14HorizontalRicciDerivativePairing G q a v v) |
| 123 | (hbase s hsS).symm hA hY hDY |
| 124 | exact (gauge_surfaceIndex_expression b W hCoordinates hscalar hM04 T hS htime x₀ |
| 125 | (β (s, 0)).2 hsS hSneigh (β (s, 0)).1 (hclock s hsS 0 hzero).symm _ _ _).trans |
| 126 | htransport.symm |
| 127 | |
| 128 | /-- The coordinate Euler term is the exact frozen square Euler |
| 129 | residual against the actual endpoint acceleration, Proposition 6.33, |
| 130 | pp. 120-121. -/ |
| 131 | theorem surfaceEuler_gauge (hPsub : P ⊆ V.parameterDomain) {s : ℝ} |
| 132 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) (hsN : s ∈ N) : |
| 133 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 134 | let m := M08.chartActionMetric W.flow T x₀ |
| 135 | let Γ := M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N) |
| 136 | let a := M08.coordinatePartialS q (s, 0) |
| 137 | let z := M08.coordinateCovariantU Γ q (M08.coordinatePartialU q) (s, 0) |
| 138 | let d := M08.coordinateCovariantS Γ q (M08.coordinatePartialS q) (s, 0) |
| 139 | let P₀ := fun z => M08.chartActionPotential W.flow T x₀ (s, z) |
| 140 | m (s, q (s, 0)) d z - fderiv ℝ P₀ (q (s, 0)) z + |
| 141 | fderiv ℝ m (s, q (s, 0)) (1, 0) a z = |
| 142 | M14SquareRootEulerResidual G R D.base_extension s (variationAccelerationField V D s) := by |
| 143 | let S := M14SqrtParameterInterval τ₁ τ₂ ∩ N |
| 144 | let Ω := (Ioo (Real.sqrt τ₁) (Real.sqrt τ₂) ∩ N) ×ˢ P |
| 145 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 146 | let Γ := M08.closedChartConnection W.flow T x₀ S |
| 147 | let j : EuclideanSpace ℝ (Fin n) ≃L[ℝ] |
| 148 | G.Horizontal ((G.gaugeCover.cylinder b).toSpacetime (β (s, 0))) := |
| 149 | (G.gaugeCover.metric b).spatialTangentEquiv (β (s, 0)).1 (β (s, 0)).2 |
| 150 | have hsS : s ∈ S := ⟨Ioo_subset_Icc_self hs, hsN⟩ |
| 151 | have hSneigh : S ∈ 𝓝 s := inter_mem (Icc_mem_nhds hs.1 hs.2) (hN.mem_nhds hsN) |
| 152 | have hS : UniqueDiffOn ℝ S := |
| 153 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt)).inter hN |
| 154 | have htime (r : ℝ) (hr : r ∈ S) : T - r ^ 2 ∈ (G.gaugeCover.interval b).domain := by |
| 155 | rw [← hclock r hr 0 hzero] |
| 156 | exact (β (r, 0)).1.property |
| 157 | have hΩ : IsOpen Ω := (isOpen_Ioo.inter hN).prod hP |
| 158 | have hq : ContDiffOn ℝ ∞ q Ω := (variationGauge_spatial_contDiffOn b hβ).mono |
| 159 | (fun _ hz => ⟨⟨Ioo_subset_Icc_self hz.1.1, hz.1.2⟩, hz.2⟩) |
| 160 | have hp : (s, (0 : ℝ)) ∈ Ω := ⟨⟨hs, hsN⟩, hzero⟩ |
| 161 | have hqd := (hq.contDiffAt (hΩ.mem_nhds hp)).differentiableAt (by simp) |
| 162 | have hβ₀ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun r => β (r, 0)) S := |
| 163 | hβ.comp (contMDiff_id.prodMk (contMDiff_const (c := (0 : ℝ)))).contMDiffOn |
| 164 | (fun _ hr => ⟨hr, hzero⟩) |
| 165 | have hbase (r : ℝ) (hr : r ∈ S) : |
| 166 | (G.gaugeCover.cylinder b).toSpacetime (β (r, 0)) = R.curve r := |
| 167 | (hrec r hr 0 hzero).trans (V.square_base r) |
| 168 | have hAcoord : derivWithin (fun r => q (r, 0)) S s = M08.coordinatePartialS q (s, 0) := by |
| 169 | rw [derivWithin_of_mem_nhds hSneigh] |
| 170 | exact (M08.coordinateSlice_fst_hasDerivAt q hqd).deriv |
| 171 | have hDAcoord := coordinateCovariantS_partialS_eq_slice hΩ q hq hp Γ hSneigh |
| 172 | have hZcoord := coordinateCovariantU_partialU_eq_slice hΩ q hq hp Γ |
| 173 | have hA := (squareRootVelocity_gauge R b hN hβ₀ hbase hsS).trans |
| 174 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hAcoord)) |
| 175 | have hDA := (squareRootCovariantVelocity_gauge R b hCoordinates W x₀ hN hβ₀ hbase |
| 176 | (fun r hr => hclock r hr 0 hzero) D.base_extension hsS).trans |
| 177 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hDAcoord.symm)) |
| 178 | have hZ : HEq (variationAccelerationField V D s) |
| 179 | (j (M08.coordinateCovariantU Γ q (M08.coordinatePartialU q) (s, 0))) := by |
| 180 | rw [variationAccelerationField_eq V D hsS.1] |
| 181 | exact (variationEndpointAcceleration_gauge V D b hCoordinates W x₀ |
| 182 | inter_subset_left hP hzero hPsub hβ hrec hclock hsS).trans |
| 183 | (heq_of_eq (congrArg (fun v : EuclideanSpace ℝ (Fin n) => j v) hZcoord.symm)) |
| 184 | have htransport := horizontal_function_eq_of_heq (G := G) |
| 185 | (fun q a d z => G.spacetime.horizontalMetric.inner q d z - |
| 186 | 2 * s ^ 2 * M14HorizontalScalarDifferential G q z.val + |
| 187 | 4 * s * horizontalRicci G.leafwise q a z) |
| 188 | (hbase s hsS).symm hA hDA hZ |
| 189 | exact (gauge_surfaceEuler_expression b W hCoordinates hscalar hM04 T hS htime x₀ |
| 190 | (β (s, 0)).2 hsS hSneigh (β (s, 0)).1 (hclock s hsS 0 hzero).symm _ _ _).trans |
| 191 | htransport.symm |
| 192 | |
| 193 | end PoincareMT.M14 |