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.Surface.VariationTorsion |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.MovingMetric |
| 3 | |
| 4 | /-! |
| 5 | # Parameter derivative of the generalized action density |
| 6 | |
| 7 | Morgan-Tian Lemma 6.4, pp. 107-108, in the square-root variable of |
| 8 | equation (6.2), p. 106. The parameter tangent has zero clock component, |
| 9 | and surface torsion identifies the actual mixed covariant derivatives. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | -- The scalar tangent aliases and the dependent horizontal fibers use the frozen transports. |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 26 | {R : M14SquareRootPath G p} |
| 27 | |
| 28 | /-- The actual parameter derivative of the smooth action density, |
| 29 | including closed time endpoints, Lemma 6.4, pp. 107-108. -/ |
| 30 | theorem hasDerivAt_variationActionDensity |
| 31 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (V : M14LVariationData G p R) |
| 32 | {s v : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) (hv : v ∈ V.parameterDomain) |
| 33 | (E : M14PullbackExtension G (fun u => V.squareFamily s u) V.parameterDomain |
| 34 | (variationSquareVelocity V s)) : |
| 35 | HasDerivAt (fun u => variationActionDensity V (s, u)) |
| 36 | (2 * s ^ 2 * M14HorizontalScalarDifferential G (V.squareFamily s v) |
| 37 | (M14EndpointVariationField V s v).val + |
| 38 | G.spacetime.horizontalMetric.inner (V.squareFamily s v) |
| 39 | (variationSquareVelocity V s v) |
| 40 | (M14HorizontalCovariantDerivative G (fun u => V.squareFamily s u) |
| 41 | V.parameterDomain (variationSquareVelocity V s) E v)) v := by |
| 42 | have hP : IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 43 | have hγ := ((variation_parameter_smooth V hs v hv).contMDiffAt |
| 44 | (hP.mem_nhds hv)).mdifferentiableAt (by simp) |
| 45 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 46 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 47 | have hR := (H.scalar_smooth.mdifferentiable (by simp) (V.squareFamily s v)).hasMFDerivAt |
| 48 | have hscalar := (hR.comp v hγ.hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 49 | change HasDerivAt (fun u => horizontalScalarCurvature G.leafwise (V.squareFamily s u)) |
| 50 | (M14HorizontalScalarDifferential G (V.squareFamily s v) |
| 51 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun u => V.squareFamily s u) v 1)) v |
| 52 | at hscalar |
| 53 | rw [← endpointVariationField_val_eq_tangent V hs hv] at hscalar |
| 54 | have hmetric := horizontalCovariantDerivative_metric_product E E hv |
| 55 | (hP.uniqueDiffOn v hv) hγ.mdifferentiableWithinAt |
| 56 | have hclock : (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 57 | (V.squareFamily s v) |
| 58 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun u => V.squareFamily s u) |
| 59 | V.parameterDomain v (1 : ℝ))) = 0 := by |
| 60 | simpa only [mfderivWithin_of_mem_nhds (hP.mem_nhds hv)] using |
| 61 | variation_parameter_clock_eq_zero V hs hv |
| 62 | rw [hclock, mul_zero, zero_mul, sub_zero, |
| 63 | G.spacetime.horizontalMetric.symm (V.squareFamily s v) |
| 64 | (M14HorizontalCovariantDerivative G (fun u => V.squareFamily s u) |
| 65 | V.parameterDomain (variationSquareVelocity V s) E v)] at hmetric |
| 66 | have h := (hscalar.const_mul (2 * s ^ 2)).add |
| 67 | ((hmetric.hasDerivAt (hP.mem_nhds hv)).const_mul (1 / 2 : ℝ)) |
| 68 | convert! h using 1 |
| 69 | ring |
| 70 | |
| 71 | private theorem horizontal_inner_heq {q r : G.Point} (h : q = r) |
| 72 | {a b : G.Horizontal q} {c d : G.Horizontal r} (ha : HEq a c) (hb : HEq b d) : |
| 73 | G.spacetime.horizontalMetric.inner q a b = G.spacetime.horizontalMetric.inner r c d := by |
| 74 | cases h |
| 75 | cases ha |
| 76 | cases hb |
| 77 | rfl |
| 78 | |
| 79 | private theorem horizontal_scalar_heq {q r : G.Point} (h : q = r) |
| 80 | {a : G.Horizontal q} {b : G.Horizontal r} (ha : HEq a b) : |
| 81 | M14HorizontalScalarDifferential G q a.val = M14HorizontalScalarDifferential G r b.val := by |
| 82 | cases h |
| 83 | cases ha |
| 84 | rfl |
| 85 | |
| 86 | private theorem horizontal_transport_heq {q r : G.Point} (h : q = r) |
| 87 | (v : G.Horizontal q) : HEq (h.symm ▸ v : G.Horizontal r) v := by |
| 88 | cases h |
| 89 | rfl |
| 90 | |
| 91 | /-- At parameter zero the density derivative uses the frozen variation |
| 92 | field and its actual base-curve derivative, Lemma 6.4, pp. 107-108. -/ |
| 93 | theorem hasDerivAt_variationActionDensity_zero |
| 94 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 95 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 96 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) |
| 97 | {s : ℝ} (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) : |
| 98 | HasDerivAt (fun u => variationActionDensity V (s, u)) |
| 99 | (2 * s ^ 2 * M14HorizontalScalarDifferential G (R.curve s) (M14VariationField V s).val + |
| 100 | G.spacetime.horizontalMetric.inner (R.curve s) (R.horizontal_velocity s) |
| 101 | (M14HorizontalCovariantDerivative G R.curve (M14SqrtParameterInterval τ₁ τ₂) |
| 102 | (M14VariationField V) D.variation_extension s)) 0 := by |
| 103 | have hsC : s ∈ M14SqrtParameterInterval τ₁ τ₂ := Ioo_subset_Icc_self hs |
| 104 | have hzero : (0 : ℝ) ∈ V.parameterDomain := by |
| 105 | rw [V.parameterDomain_eq] |
| 106 | exact ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 107 | obtain ⟨E⟩ := exists_variation_velocity_parameter_extension V hsC |
| 108 | have h := hasDerivAt_variationActionDensity hM12 V hsC hzero E |
| 109 | have hY : HEq (M14EndpointVariationField V s 0) (M14VariationField V s) := |
| 110 | (horizontal_transport_heq (V.square_base s) _).symm |
| 111 | have hA : HEq (variationSquareVelocity V s 0) (R.horizontal_velocity s) := by |
| 112 | rw [variationSquareVelocity_zero V hsC] |
| 113 | exact horizontal_transport_heq (V.square_base s).symm _ |
| 114 | have hD := (variation_covariantDerivative_commute hCoordinates V D hs E).symm |
| 115 | rw [horizontal_scalar_heq (V.square_base s) hY, |
| 116 | horizontal_inner_heq (V.square_base s) hA hD] at h |
| 117 | exact h |
| 118 | |
| 119 | end PoincareMT.M14 |