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.Pullback.OpenSurfaceClock |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.MovingMetric |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.Gauge.Geometry |
| 4 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 5 | |
| 6 | /-! |
| 7 | # Actual density and weighted momentum derivatives on a surface |
| 8 | |
| 9 | Morgan-Tian Lemma 6.4 and Definition 6.7, pp. 107-108. Parameter |
| 10 | differentiation has zero clock defect, while the weighted time-pair |
| 11 | derivative retains the actual +2 Ricci defect and sqrt derivative. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | -- Both slice derivatives use the frozen scalar and horizontal tangent fibers. |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff |
| 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 | {α : ℝ × ℝ → G.Point} {J P : Set ℝ} {T s v : ℝ} |
| 28 | |
| 29 | /-- The actual original-time density has its geometric variation |
| 30 | derivative with no parameter-clock defect, Lemma 6.4, pp. 107-108. -/ |
| 31 | theorem hasDerivAt_surfaceRawDensity (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 32 | (hJ : IsOpen J) (hP : IsOpen P) |
| 33 | (hα : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ α (J ×ˢ P)) |
| 34 | (hclock : ∀ z ∈ J ×ˢ P, G.spacetime.timeFunction (α z) = T - z.1) |
| 35 | (hs : s ∈ J) (hv : v ∈ P) |
| 36 | (E : M14PullbackExtension G (fun u => α (s, u)) P (fun u => surfaceHorizontalFst α s u)) : |
| 37 | HasDerivAt |
| 38 | (fun u => M14RawLIntegrand G (fun r => α (r, u)) (fun r => surfaceHorizontalFst α r u) s) |
| 39 | (Real.sqrt s * |
| 40 | (M14HorizontalScalarDifferential G (α (s, v)) (surfaceHorizontalSnd α s v).val + |
| 41 | 2 * G.spacetime.horizontalMetric.inner (α (s, v)) (surfaceHorizontalFst α s v) |
| 42 | (M14HorizontalCovariantDerivative G (fun u => α (s, u)) P |
| 43 | (fun u => surfaceHorizontalFst α s u) E v))) v := by |
| 44 | have hγ := (((hα _ ⟨hs, hv⟩).contMDiffAt ((hJ.prod hP).mem_nhds ⟨hs, hv⟩)).mdifferentiableAt |
| 45 | (by simp)).comp v (mdifferentiableAt_const.prodMk mdifferentiableAt_id) |
| 46 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 47 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 48 | have hscalar := ((H.scalar_smooth.mdifferentiable (by simp) (α (s, v))).hasMFDerivAt.comp v |
| 49 | hγ.hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 50 | change HasDerivAt (fun u => horizontalScalarCurvature G.leafwise (α (s, u))) |
| 51 | (M14HorizontalScalarDifferential G (α (s, v)) |
| 52 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun u => α (s, u)) v 1)) v at hscalar |
| 53 | rw [← surfaceHorizontalSnd_val hJ hP hα hclock hs hv] at hscalar |
| 54 | have hmetric := horizontalCovariantDerivative_metric_product E E hv |
| 55 | (hP.uniqueDiffOn v hv) hγ.mdifferentiableWithinAt |
| 56 | rw [mfderivWithin_of_mem_nhds (hP.mem_nhds hv), |
| 57 | surface_parameter_clock hJ hP hα hclock hs hv, mul_zero, zero_mul, sub_zero, |
| 58 | G.spacetime.horizontalMetric.symm (α (s, v)) |
| 59 | (M14HorizontalCovariantDerivative G (fun u => α (s, u)) P |
| 60 | (fun u => surfaceHorizontalFst α s u) E v)] at hmetric |
| 61 | have hd := (hscalar.add (hmetric.hasDerivAt (hP.mem_nhds hv))).const_mul (Real.sqrt s) |
| 62 | convert hd using 1 <;> first | rfl | ring |
| 63 | |
| 64 | /-- The actual weighted momentum pairing has the sqrt derivative and |
| 65 | the +2 Ricci metric defect at positive backward time, Lemma 6.4 and |
| 66 | Definition 6.7, pp. 107-108. -/ |
| 67 | theorem hasDerivAt_surfaceWeightedPair (hJ : IsOpen J) (hP : IsOpen P) |
| 68 | (hα : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ α (J ×ˢ P)) |
| 69 | (hclock : ∀ z ∈ J ×ˢ P, G.spacetime.timeFunction (α z) = T - z.1) |
| 70 | (hs : s ∈ J) (hv : v ∈ P) (hspos : 0 < s) |
| 71 | (E : M14PullbackExtension G (fun r => α (r, v)) J (fun r => surfaceHorizontalFst α r v)) |
| 72 | (F : M14PullbackExtension G (fun r => α (r, v)) J (fun r => surfaceHorizontalSnd α r v)) : |
| 73 | HasDerivAt |
| 74 | (fun r => 2 * Real.sqrt r * G.spacetime.horizontalMetric.inner (α (r, v)) |
| 75 | (surfaceHorizontalFst α r v) (surfaceHorizontalSnd α r v)) |
| 76 | ((1 / Real.sqrt s) * G.spacetime.horizontalMetric.inner (α (s, v)) |
| 77 | (surfaceHorizontalFst α s v) (surfaceHorizontalSnd α s v) + |
| 78 | 2 * Real.sqrt s * |
| 79 | (G.spacetime.horizontalMetric.inner (α (s, v)) |
| 80 | (M14HorizontalCovariantDerivative G (fun r => α (r, v)) J |
| 81 | (fun r => surfaceHorizontalFst α r v) E s) (surfaceHorizontalSnd α s v) + |
| 82 | G.spacetime.horizontalMetric.inner (α (s, v)) (surfaceHorizontalFst α s v) |
| 83 | (M14HorizontalCovariantDerivative G (fun r => α (r, v)) J |
| 84 | (fun r => surfaceHorizontalSnd α r v) F s) + |
| 85 | 2 * horizontalRicci G.leafwise (α (s, v)) |
| 86 | (surfaceHorizontalFst α s v) (surfaceHorizontalSnd α s v))) s := by |
| 87 | have hγ := (((hα _ ⟨hs, hv⟩).contMDiffAt ((hJ.prod hP).mem_nhds ⟨hs, hv⟩)).mdifferentiableAt |
| 88 | (by simp)).comp s (mdifferentiableAt_id.prodMk mdifferentiableAt_const) |
| 89 | have hmetric := horizontalCovariantDerivative_metric_product E F hs |
| 90 | (hJ.uniqueDiffOn s hs) hγ.mdifferentiableWithinAt |
| 91 | rw [mfderivWithin_of_mem_nhds (hJ.mem_nhds hs), surface_time_clock hJ hP hα hclock hs hv] |
| 92 | at hmetric |
| 93 | have hweight : HasDerivAt (fun r : ℝ => 2 * Real.sqrt r) (1 / Real.sqrt s) s := by |
| 94 | convert (Real.hasDerivAt_sqrt hspos.ne').const_mul 2 using 1 <;> first | rfl | ring |
| 95 | convert hweight.mul (hmetric.hasDerivAt (hJ.mem_nhds hs)) using 1 <;> first | rfl | ring |
| 96 | |
| 97 | end PoincareMT.M14 |