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.Coordinates.MovingMetric |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquareRootVelocityExtension |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.Gauge.Geometry |
| 4 | |
| 5 | /-! |
| 6 | # Closed square-time scalar and kinetic derivatives |
| 7 | |
| 8 | The actual clock and Euler equation give the scalar and kinetic |
| 9 | derivatives used in Morgan-Tian Lemma 6.48, p. 130. All derivatives |
| 10 | retain the closed square interval, including its zero endpoint. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 23 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 24 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 25 | |
| 26 | /-- Scalar curvature along the actual square path is smooth on the |
| 27 | closed interval, as used in Lemmas 6.47-6.48, p. 130. -/ |
| 28 | theorem squareRoot_scalar_contDiffOn |
| 29 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) : |
| 30 | ContDiffOn ℝ ∞ (fun s => horizontalScalarCurvature G.leafwise (R.curve s)) |
| 31 | (M14SqrtParameterInterval τ₁ τ₂) := by |
| 32 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 33 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 34 | exact (H.scalar_smooth.comp_contMDiffOn (R.smooth.mono R.interval_subset)).contDiffOn |
| 35 | |
| 36 | /-- The actual square kinetic energy is smooth on the closed interval, |
| 37 | including zero, as used in Lemmas 6.47-6.48, p. 130. -/ |
| 38 | theorem squareRoot_energy_contDiffOn (R : M14SquareRootPath G p) : |
| 39 | ContDiffOn ℝ ∞ (fun s => G.spacetime.horizontalMetric.inner (R.curve s) |
| 40 | (R.horizontal_velocity s) (R.horizontal_velocity s)) |
| 41 | (M14SqrtParameterInterval τ₁ τ₂) := by |
| 42 | have hR := R.smooth.mono R.interval_subset |
| 43 | have hA := squareRoot_horizontalVelocity_smooth R |
| 44 | have hpair := (G.spacetime.horizontalMetric.contMDiff.comp_contMDiffOn hR).clm_bundle_apply₂ |
| 45 | (F₃ := ℝ) (E₃ := Bundle.Trivial G.Point ℝ) hA hA |
| 46 | apply ContMDiffOn.contDiffOn |
| 47 | intro s hs |
| 48 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 49 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hpair s hs)).2 |
| 50 | |
| 51 | set_option backward.isDefEq.respectTransparency false in |
| 52 | -- The real tangent fibers identify the manifold chain rule with a scalar derivative. |
| 53 | /-- The scalar square-time derivative has the actual backward sign, |
| 54 | by the clock decomposition in Lemma 6.8 and Lemma 6.48, pp. 108, 130. -/ |
| 55 | theorem squareRoot_scalar_hasDerivWithinAt |
| 56 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) |
| 57 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 58 | HasDerivWithinAt (fun r => horizontalScalarCurvature G.leafwise (R.curve r)) |
| 59 | (2 * s * M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) (R.curve s) + |
| 60 | M14HorizontalScalarDifferential G (R.curve s) (R.horizontal_velocity s).val) |
| 61 | (M14SqrtParameterInterval τ₁ τ₂) s := by |
| 62 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 63 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 64 | have hR := ((R.smooth.mono R.interval_subset) s hs).mdifferentiableWithinAt (by simp) |
| 65 | have hd := (H.scalar_smooth.mdifferentiable (by simp) (R.curve s)).hasMFDerivAt |
| 66 | have hcomp := hd.comp_hasMFDerivWithinAt s hR.hasMFDerivWithinAt |
| 67 | have hscalar := hcomp.hasFDerivWithinAt.hasDerivWithinAt |
| 68 | change HasDerivWithinAt (fun r => horizontalScalarCurvature G.leafwise (R.curve r)) |
| 69 | (M14HorizontalScalarDifferential G (R.curve s) |
| 70 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) R.curve |
| 71 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ))) _ s at hscalar |
| 72 | rw [R.derivative_eq s hs, map_add, map_smul, smul_eq_mul] at hscalar |
| 73 | convert hscalar using 1 |
| 74 | unfold M14BackwardTimeDerivative M14HorizontalScalarDifferential |
| 75 | ring |
| 76 | |
| 77 | /-- Testing the actual square Euler equation with its velocity gives |
| 78 | the kinetic derivative, with the moving-metric Ricci term, Lemma 6.48, |
| 79 | p. 130. -/ |
| 80 | theorem squareRoot_energy_hasDerivWithinAt (R : M14SquareRootPath G p) |
| 81 | (E : M14PullbackExtension G R.curve (M14SqrtParameterInterval τ₁ τ₂) |
| 82 | R.horizontal_velocity) {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 83 | (hEuler : ∀ W, M14SquareRootEulerResidual G R E s W = 0) : |
| 84 | HasDerivWithinAt (fun r => G.spacetime.horizontalMetric.inner (R.curve r) |
| 85 | (R.horizontal_velocity r) (R.horizontal_velocity r)) |
| 86 | (4 * s ^ 2 * M14HorizontalScalarDifferential G (R.curve s) |
| 87 | (R.horizontal_velocity s).val - |
| 88 | 4 * s * horizontalRicci G.leafwise (R.curve s) |
| 89 | (R.horizontal_velocity s) (R.horizontal_velocity s)) |
| 90 | (M14SqrtParameterInterval τ₁ τ₂) s := by |
| 91 | have h := squareRoot_covariantDerivative_metric_product R E E hs |
| 92 | have hE := hEuler (R.horizontal_velocity s) |
| 93 | unfold M14SquareRootEulerResidual M14SquareRootVelocity at hE |
| 94 | rw [G.spacetime.horizontalMetric.symm (R.curve s) (R.horizontal_velocity s)] at h |
| 95 | convert h using 1 |
| 96 | linarith |
| 97 | |
| 98 | end PoincareMT.M14 |