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.AdaptedFields.AccelerationPair |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.SurfacePartials |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Second.SecondVariationBoundary |
| 5 | |
| 6 | /-! |
| 7 | # Actual density and boundary terms of the coordinate surface formula |
| 8 | |
| 9 | Morgan-Tian Proposition 6.33, pp. 120-121. On the interior of a |
| 10 | relative gauge rectangle, the actual variation density and its |
| 11 | acceleration boundary pair are exactly M08's coordinate surface |
| 12 | quantities. Neighborhood equality then transports their derivatives. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Coordinate tangents and actual horizontal vectors are identified at equal base points. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M14 |
| 25 | |
| 26 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 27 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 28 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 29 | {R : M14SquareRootPath G p} (V : M14LVariationData G p R) |
| 30 | (b : G.gaugeCover.index) |
| 31 | (hCoordinates : SpacetimeGaugeTheory.{u, 0} G.leafwise G.timeIntervals) |
| 32 | (W : OrdinaryGaugeWitness G.leafwise (G.gaugeCover.cylinder b) (G.gaugeCover.metric b)) |
| 33 | (x₀ : G.gaugeCover.spatial b) {N P : Set ℝ} (hN : IsOpen N) (hP : IsOpen P) |
| 34 | {β : ℝ × ℝ → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 35 | G.gaugeCover.spatial b} |
| 36 | (hβ : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ β |
| 37 | ((M14SqrtParameterInterval τ₁ τ₂ ∩ N) ×ˢ P)) |
| 38 | (hrec : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 39 | (G.gaugeCover.cylinder b).toSpacetime (β (r, u)) = V.squareFamily r u) |
| 40 | (hclock : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 41 | (β (r, u)).1.val = T - r ^ 2) |
| 42 | |
| 43 | private theorem surface_inner_eq_of_heq {q r : G.Point} (h : q = r) |
| 44 | {a z : G.Horizontal q} {a' z' : G.Horizontal r} (ha : HEq a a') (hz : HEq z z') : |
| 45 | G.spacetime.horizontalMetric.inner q a z = G.spacetime.horizontalMetric.inner r a' z' := by |
| 46 | cases h |
| 47 | cases ha |
| 48 | cases hz |
| 49 | rfl |
| 50 | |
| 51 | include hCoordinates hN hP hβ hrec hclock |
| 52 | |
| 53 | /-- The actual action density equals the ordinary surface density |
| 54 | on the open interior gauge rectangle, Proposition 6.33, pp. 120-121. -/ |
| 55 | theorem surfaceActionDensity_gauge {s u : ℝ} |
| 56 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) (hsN : s ∈ N) (hu : u ∈ P) : |
| 57 | M08.surfaceActionDensity (M08.chartActionMetric W.flow T x₀) |
| 58 | (M08.chartActionPotential W.flow T x₀) (fun z => (β z).2.val) (s, u) = |
| 59 | variationActionDensity V (s, u) := by |
| 60 | have hsC : s ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N := ⟨Ioo_subset_Icc_self hs, hsN⟩ |
| 61 | have hSneigh : M14SqrtParameterInterval τ₁ τ₂ ∩ N ∈ 𝓝 s := |
| 62 | inter_mem (Icc_mem_nhds hs.1 hs.2) (hN.mem_nhds hsN) |
| 63 | have hq := variationGauge_spatial_contDiffOn b hβ |
| 64 | have hqd := (hq.contDiffAt (prod_mem_nhds hSneigh (hP.mem_nhds hu))).differentiableAt |
| 65 | (by simp) |
| 66 | have hA : M08.coordinatePartialS (fun z => (β z).2.val) (s, u) = |
| 67 | derivWithin (fun r => (β (r, u)).2.val) (M14SqrtParameterInterval τ₁ τ₂ ∩ N) s := by |
| 68 | rw [derivWithin_of_mem_nhds hSneigh] |
| 69 | exact (M08.coordinateSlice_fst_hasDerivAt _ hqd).deriv.symm |
| 70 | have hv := variationSquareVelocity_gauge V b hN hβ hrec hsC hu |
| 71 | have hm := surface_inner_eq_of_heq (hrec s hsC u hu) hv.symm hv.symm |
| 72 | unfold M08.surfaceActionDensity |
| 73 | dsimp only [Prod.fst, Prod.snd] |
| 74 | rw [hA, gauge_chartActionMetric b W T x₀ (β (s, u)).2 s (β (s, u)).1 |
| 75 | (hclock s hsC u hu).symm, |
| 76 | gauge_chartActionPotential b W hCoordinates T x₀ (β (s, u)).2 s (β (s, u)).1 |
| 77 | (hclock s hsC u hu).symm, hm, hrec s hsC u hu] |
| 78 | unfold variationActionDensity |
| 79 | ring |
| 80 | |
| 81 | /-- The coordinate acceleration boundary pair equals the actual |
| 82 | frozen pair on the interior gauge rectangle, Proposition 6.33, |
| 83 | pp. 120-121. -/ |
| 84 | theorem surfaceAccelerationBoundaryPair_gauge (D : M14VariationDerivativeData V) |
| 85 | (hzero : (0 : ℝ) ∈ P) (hPsub : P ⊆ V.parameterDomain) |
| 86 | {s : ℝ} (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) (hsN : s ∈ N) : |
| 87 | M08.surfaceAccelerationBoundaryPair (M08.chartActionMetric W.flow T x₀) |
| 88 | (M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N)) |
| 89 | (fun z => (β z).2.val) (s, 0) = variationAccelerationBoundaryPair V D s := by |
| 90 | let Ω := (Ioo (Real.sqrt τ₁) (Real.sqrt τ₂) ∩ N) ×ˢ P |
| 91 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 92 | have hΩ : IsOpen Ω := (isOpen_Ioo.inter hN).prod hP |
| 93 | have hq : ContDiffOn ℝ ∞ q Ω := (variationGauge_spatial_contDiffOn b hβ).mono |
| 94 | (fun _ hz => ⟨⟨Ioo_subset_Icc_self hz.1.1, hz.1.2⟩, hz.2⟩) |
| 95 | have hp : (s, (0 : ℝ)) ∈ Ω := ⟨⟨hs, hsN⟩, hzero⟩ |
| 96 | have hqd := (hq.contDiffAt (hΩ.mem_nhds hp)).differentiableAt (by simp) |
| 97 | have hSneigh : M14SqrtParameterInterval τ₁ τ₂ ∩ N ∈ 𝓝 s := |
| 98 | inter_mem (Icc_mem_nhds hs.1 hs.2) (hN.mem_nhds hsN) |
| 99 | have hA : M08.coordinatePartialS q (s, 0) = |
| 100 | derivWithin (fun r => q (r, 0)) (M14SqrtParameterInterval τ₁ τ₂ ∩ N) s := by |
| 101 | rw [derivWithin_of_mem_nhds hSneigh] |
| 102 | exact (M08.coordinateSlice_fst_hasDerivAt q hqd).deriv.symm |
| 103 | have hZ := coordinateCovariantU_partialU_eq_slice hΩ q hq hp |
| 104 | (M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N)) |
| 105 | change M08.chartActionMetric W.flow T x₀ (s, q (s, 0)) |
| 106 | (M08.coordinatePartialS q (s, 0)) |
| 107 | (M08.coordinateCovariantU |
| 108 | (M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N)) q |
| 109 | (M08.coordinatePartialU q) (s, 0)) = _ |
| 110 | rw [hA, hZ] |
| 111 | exact (variationAccelerationBoundaryPair_gauge V D b hCoordinates W x₀ hN hP hzero hPsub |
| 112 | hβ hrec hclock ⟨Ioo_subset_Icc_self hs, hsN⟩).symm |
| 113 | |
| 114 | end PoincareMT.M14 |