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.Euler.EulerResidual |
| 2 | |
| 3 | /-! |
| 4 | # Continuity of the actual Euler residual at closed endpoints |
| 5 | |
| 6 | Morgan-Tian Definition 6.7 and Lemma 6.8, pp. 108-109. Pairing with |
| 7 | a smooth stationary horizontal section expresses the residual as a |
| 8 | smooth boundary derivative minus a connection pairing and a scalar |
| 9 | differential. The actual Ricci defect cancels. M12 supplies the smooth |
| 10 | connection and scalar curvature, so this works within closed time |
| 11 | intervals without extending the curve beyond its endpoints. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | -- The connection Hom bundle and the scalar tangent model use the frozen fibers. |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M14 |
| 24 | |
| 25 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 26 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 27 | |
| 28 | /-- The raw derivative of a smooth horizontal section is a smooth |
| 29 | bundle-valued linear map, using M12's actual connection witness, |
| 30 | Definition 3.36 and Lemma 6.8, pp. 60-61, 108-109. -/ |
| 31 | theorem rawHorizontalCovariantDerivative_contMDiff |
| 32 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (W : HorizontalSection G.spacetime) |
| 33 | (hW : ContMDiff (spacetimeModel n) |
| 34 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 35 | (fun q => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q (W q))) : |
| 36 | ContMDiff (spacetimeModel n) |
| 37 | ((spacetimeModel n).prod |
| 38 | 𝓘(ℝ, SpacetimeModelVector n →L[ℝ] EuclideanSpace ℝ (Fin n))) ∞ |
| 39 | (fun q => Bundle.TotalSpace.mk' |
| 40 | (SpacetimeModelVector n →L[ℝ] EuclideanSpace ℝ (Fin n)) |
| 41 | (E := fun q => TangentSpace (spacetimeModel n) q →L[ℝ] G.Horizontal q) |
| 42 | q (rawHorizontalCovariantDerivative G.leafwise W q)) := by |
| 43 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 44 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 45 | obtain ⟨C⟩ := H.horizontal_connection |
| 46 | have hCW := C.smooth.contMDiff.contMDiff (hW.contMDiffOn.of_le (by simp)) |
| 47 | apply (contMDiffOn_univ.mp hCW).congr |
| 48 | intro q |
| 49 | rw [C.raw_eq univ isOpen_univ W hW.contMDiffOn q (mem_univ q)] |
| 50 | |
| 51 | /-- The scalar-curvature differential evaluated on a smooth horizontal |
| 52 | section is smooth, the potential term in Definition 6.7, p. 108. -/ |
| 53 | theorem horizontalScalarDifferential_contMDiff |
| 54 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (W : HorizontalSection G.spacetime) |
| 55 | (hW : ContMDiff (spacetimeModel n) |
| 56 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 57 | (fun q => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q (W q))) : |
| 58 | ContMDiff (spacetimeModel n) (𝓘(ℝ, ℝ)) ∞ |
| 59 | (fun q => M14HorizontalScalarDifferential G q (W q).val) := by |
| 60 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 61 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 62 | have hI : ContMDiff ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 63 | (spacetimeModel n).tangent ∞ |
| 64 | (fun v : Bundle.TotalSpace (EuclideanSpace ℝ (Fin n)) G.Horizontal => |
| 65 | Bundle.TotalSpace.mk' (SpacetimeModelVector n) |
| 66 | (E := (TangentSpace (spacetimeModel n) : G.Point → Type _)) v.proj v.2.val) := |
| 67 | G.spacetime.horizontal_inclusion_smooth |
| 68 | have hT := (H.scalar_smooth.contMDiff_tangentMap (m := ∞) (by simp)).comp |
| 69 | (hI.comp hW) |
| 70 | exact (contMDiff_snd_tangentBundle_modelSpace ℝ (𝓘(ℝ, ℝ))).comp hT |
| 71 | |
| 72 | private theorem horizontalMetric_pair_contDiffOn {γ : ℝ → G.Point} {J : Set ℝ} |
| 73 | {Y Z : ∀ s, G.Horizontal (γ s)} |
| 74 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ γ J) |
| 75 | (hY : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 76 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 77 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Y s)) J) |
| 78 | (hZ : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 79 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 80 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Z s)) J) : |
| 81 | ContDiffOn ℝ ∞ (fun s => G.spacetime.horizontalMetric.inner (γ s) (Y s) (Z s)) J := by |
| 82 | have hpair := (G.spacetime.horizontalMetric.contMDiff.comp_contMDiffOn hγ).clm_bundle_apply₂ |
| 83 | (F₃ := ℝ) (E₃ := Bundle.Trivial G.Point ℝ) hY hZ |
| 84 | apply ContMDiffOn.contDiffOn |
| 85 | intro s hs |
| 86 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 87 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hpair s hs)).2 |
| 88 | |
| 89 | variable {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 90 | {R : M14SquareRootPath G p} |
| 91 | |
| 92 | /-- The actual geometric residual against a smooth stationary section |
| 93 | is continuous at every closed square-root point, including zero, |
| 94 | Definition 6.7 and Lemma 6.8, pp. 108-109. -/ |
| 95 | theorem squareRootEulerResidual_stationary_continuousOn |
| 96 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 97 | (E : M14PullbackExtension G R.curve (M14SqrtParameterInterval τ₁ τ₂) |
| 98 | R.horizontal_velocity) (W : HorizontalSection G.spacetime) |
| 99 | (hW : ContMDiff (spacetimeModel n) |
| 100 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 101 | (fun q => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q (W q))) : |
| 102 | ContinuousOn (fun s => M14SquareRootEulerResidual G R E s (W (R.curve s))) |
| 103 | (M14SqrtParameterInterval τ₁ τ₂) := by |
| 104 | let C := M14SqrtParameterInterval τ₁ τ₂ |
| 105 | let B := fun s => G.spacetime.horizontalMetric.inner (R.curve s) |
| 106 | (R.horizontal_velocity s) (W (R.curve s)) |
| 107 | have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 108 | have hR := R.smooth.mono R.interval_subset |
| 109 | have hA := squareRoot_horizontalVelocity_smooth R |
| 110 | have hB : ContDiffOn ℝ ∞ B C := horizontalMetric_pair_contDiffOn hR hA |
| 111 | (hW.comp_contMDiffOn hR) |
| 112 | have hvelocity := hR.contMDiffOn_mfderivWithin_const_apply hC (1 : ℝ) |
| 113 | (k := ∞) (by simp) |
| 114 | have hraw := (rawHorizontalCovariantDerivative_contMDiff hM12 W hW).comp_contMDiffOn hR |
| 115 | have hDW := hraw.clm_bundle_apply hvelocity |
| 116 | have hconnection := horizontalMetric_pair_contDiffOn hR hA hDW |
| 117 | have hscalar := ((horizontalScalarDifferential_contMDiff hM12 W hW).comp_contMDiffOn |
| 118 | hR).contDiffOn |
| 119 | have hweight : ContDiffOn ℝ ∞ (fun s : ℝ => 2 * s ^ 2) C := |
| 120 | contDiffOn_const.mul (contDiffOn_id.pow 2) |
| 121 | have hcont := (((hB.derivWithin hC (m := ∞) (by simp)).sub hconnection).sub |
| 122 | (hweight.mul hscalar)).continuousOn |
| 123 | apply hcont.congr |
| 124 | intro s hs |
| 125 | have hd := horizontalCovariantDerivative_metric_derivative E hs (hC s hs) |
| 126 | ((hR s hs).mdifferentiableWithinAt (by simp)) W (hW (R.curve s)) |
| 127 | rw [squareRoot_velocity_clock R hs] at hd |
| 128 | have hdB : HasDerivWithinAt B _ C s := hd.congr_of_mem |
| 129 | (fun r hr => by simp only [B, E.agrees r hr]) hs |
| 130 | have hderiv := hdB.derivWithin (hC s hs) |
| 131 | change M14SquareRootEulerResidual G R E s (W (R.curve s)) = |
| 132 | derivWithin B C s - _ - 2 * s ^ 2 * |
| 133 | M14HorizontalScalarDifferential G (R.curve s) (W (R.curve s)).val |
| 134 | unfold M14SquareRootEulerResidual M14SquareRootVelocity |
| 135 | linarith |
| 136 | |
| 137 | end PoincareMT.M14 |