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.Fields.VariationVelocity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationIntegral |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.Gauge.Geometry |
| 5 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts |
| 6 | import Mathlib.Tactic.Ring |
| 7 | |
| 8 | /-! |
| 9 | # Differentiating the actual generalized variation action |
| 10 | |
| 11 | Morgan-Tian equations (6.1)-(6.2), Lemma 6.4 and Proposition 6.33, |
| 12 | pp. 106-108, 121-122. The smooth density uses the actual within square |
| 13 | velocity. Interior equality suffices for the action substitution. The |
| 14 | generic first and second integral differentiation theorems are reused |
| 15 | directly from M08, and M12 supplies horizontal scalar regularity. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | -- The product self-model and its charted-space instance are transported together. |
| 20 | set_option backward.isDefEq.respectTransparency false |
| 21 | |
| 22 | open scoped Manifold ContDiff Bundle Topology intervalIntegral |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M14 |
| 27 | |
| 28 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 29 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 30 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 31 | {R : M14SquareRootPath G p} |
| 32 | |
| 33 | /-- The smooth square-root variation density built from the actual |
| 34 | within velocity, equation (6.2), p. 106. -/ |
| 35 | noncomputable def variationActionDensity (V : M14LVariationData G p R) (z : ℝ × ℝ) : ℝ := |
| 36 | 2 * z.1 ^ 2 * horizontalScalarCurvature G.leafwise (V.squareFamily z.1 z.2) + |
| 37 | (1 / 2 : ℝ) * G.spacetime.horizontalMetric.inner (V.squareFamily z.1 z.2) |
| 38 | (variationSquareVelocity V z.1 z.2) (variationSquareVelocity V z.1 z.2) |
| 39 | |
| 40 | private theorem parameterDomain_isOpen (V : M14LVariationData G p R) : |
| 41 | IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 42 | |
| 43 | set_option maxHeartbeats 1000000 in |
| 44 | -- Smooth metric application elaborates two dependent actual velocity fields. |
| 45 | /-- The actual square-root density is smooth on the closed-by-open |
| 46 | rectangle, including initial time zero, Lemma 6.4, pp. 107-108. -/ |
| 47 | theorem variationActionDensity_contDiffOn (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 48 | (V : M14LVariationData G p R) : |
| 49 | ContDiffOn ℝ ∞ (variationActionDensity V) |
| 50 | (M14SqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain) := by |
| 51 | let S := M14SqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain |
| 52 | let α := fun z : ℝ × ℝ => V.squareFamily z.1 z.2 |
| 53 | have hα : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (spacetimeModel n) ∞ α S := by |
| 54 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 55 | exact V.square_smooth.mono V.square_contains |
| 56 | have hA : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) |
| 57 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 58 | (fun z : ℝ × ℝ => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 59 | (E := G.Horizontal) (α z) (variationSquareVelocity V z.1 z.2)) S := by |
| 60 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 61 | exact variationSquareVelocity_smooth V |
| 62 | have hmetric := G.spacetime.horizontalMetric.contMDiff.comp_contMDiffOn hα |
| 63 | have hpair := hmetric.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial G.Point ℝ) hA hA |
| 64 | have hg : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓘(ℝ, ℝ)) ∞ |
| 65 | (fun z => G.spacetime.horizontalMetric.inner (α z) |
| 66 | (variationSquareVelocity V z.1 z.2) (variationSquareVelocity V z.1 z.2)) S := by |
| 67 | intro z hz |
| 68 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 69 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hpair z hz)).2 |
| 70 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 71 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 72 | have hR := (H.scalar_smooth.comp_contMDiffOn hα).contDiffOn |
| 73 | exact ((contDiffOn_const.mul (contDiffOn_fst.pow 2)).mul hR).add |
| 74 | (contDiffOn_const.mul hg.contDiffOn) |
| 75 | |
| 76 | private theorem inner_transport {q r : G.Point} (h : q = r) (v w : G.Horizontal r) : |
| 77 | G.spacetime.horizontalMetric.inner q (h.symm ▸ v) (h.symm ▸ w) = |
| 78 | G.spacetime.horizontalMetric.inner r v w := by |
| 79 | cases h |
| 80 | rfl |
| 81 | |
| 82 | /-- Interior density equality for the square substitution, without an |
| 83 | endpoint claim about the totalized original velocity, equation (6.2), p. 106. -/ |
| 84 | theorem variationActionDensity_eq_transformed (V : M14LVariationData G p R) |
| 85 | {s u : ℝ} (hs : s ∈ Set.Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) |
| 86 | (hu : u ∈ V.parameterDomain) : |
| 87 | variationActionDensity V (s, u) = |
| 88 | M14RawLIntegrand G (fun r => V.family r u) (V.family_velocity u) (s ^ 2) * (2 * s) := by |
| 89 | have hs0 : 0 < s := (Real.sqrt_nonneg τ₁).trans_lt hs.1 |
| 90 | have heq := V.square_agrees s ⟨hs.1.le, hs.2.le⟩ u hu |
| 91 | unfold variationActionDensity M14RawLIntegrand |
| 92 | rw [variationSquareVelocity_eq_rescaled V hs hu, inner_transport heq, heq, |
| 93 | Real.sqrt_sq hs0.le] |
| 94 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 95 | ring |
| 96 | |
| 97 | /-- The smooth square-root integral equals the actual variation action |
| 98 | at every valid parameter, including a path starting at time zero, |
| 99 | equation (6.2), p. 106. -/ |
| 100 | theorem variationAction_eq_squareIntegral (V : M14LVariationData G p R) |
| 101 | {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 102 | M14VariationAction V u = |
| 103 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, variationActionDensity V (s, u) := by |
| 104 | have hle := Real.sqrt_le_sqrt p.tau_lt.le |
| 105 | have hsub := intervalIntegral.integral_comp_mul_deriv_of_deriv_nonneg |
| 106 | (a := Real.sqrt τ₁) (b := Real.sqrt τ₂) |
| 107 | (f := fun s : ℝ => s ^ 2) (f' := fun s => 2 * s) |
| 108 | (g := M14RawLIntegrand G (fun r => V.family r u) (V.family_velocity u)) |
| 109 | (continuous_id.pow 2).continuousOn |
| 110 | (fun s _ => by simpa using hasDerivAt_pow 2 s) |
| 111 | (fun s hs => by |
| 112 | rw [min_eq_left hle, max_eq_right hle] at hs |
| 113 | exact mul_nonneg (by norm_num) ((Real.sqrt_nonneg τ₁).trans hs.1.le)) |
| 114 | have haction : M14VariationAction V u = |
| 115 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 116 | M14RawLIntegrand G (fun r => V.family r u) (V.family_velocity u) (s ^ 2) * (2 * s) := by |
| 117 | simpa only [Real.sq_sqrt p.tau_nonneg, Real.sq_sqrt (p.tau_nonneg.trans p.tau_lt.le), |
| 118 | Function.comp_def, M14VariationAction] using hsub.symm |
| 119 | exact haction.trans (intervalIntegral.integral_congr_Ioo_of_le hle |
| 120 | (fun _ hs => (variationActionDensity_eq_transformed V hs hu).symm)) |
| 121 | |
| 122 | /-- The smooth density is integrable along each closed square-root |
| 123 | parameter interval, the integrability step of Lemma 6.4, pp. 107-108. -/ |
| 124 | theorem variationActionDensity_intervalIntegrable (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 125 | (V : M14LVariationData G p R) {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 126 | IntervalIntegrable (fun s => variationActionDensity V (s, u)) MeasureTheory.volume |
| 127 | (Real.sqrt τ₁) (Real.sqrt τ₂) := |
| 128 | ((variationActionDensity_contDiffOn hM12 V).continuousOn.comp |
| 129 | (continuousOn_id.prodMk continuousOn_const) (fun _ hs => ⟨hs, hu⟩)).intervalIntegrable_of_Icc |
| 130 | (Real.sqrt_le_sqrt p.tau_lt.le) |
| 131 | |
| 132 | /-- First parameter differentiation of the actual action is integration |
| 133 | of the actual smooth density partial, using M08's closed-rectangle |
| 134 | integral theorem, Lemma 6.4, pp. 107-108. -/ |
| 135 | theorem hasDerivAt_variationAction_integral (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 136 | (V : M14LVariationData G p R) {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 137 | HasDerivAt (M14VariationAction V) |
| 138 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 139 | M08.variationParameterDeriv (M14SqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 140 | (variationActionDensity V) (s, u)) u := by |
| 141 | have h := M08.hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 142 | (parameterDomain_isOpen V) (variationActionDensity V) |
| 143 | (variationActionDensity_contDiffOn hM12 V) hu |
| 144 | apply h.congr_of_eventuallyEq |
| 145 | filter_upwards [(parameterDomain_isOpen V).mem_nhds hu] with v hv |
| 146 | exact variationAction_eq_squareIntegral V hv |
| 147 | |
| 148 | /-- Second parameter differentiation of the actual action is integration |
| 149 | of the iterated smooth density partial, directly reusing M08's theorem, |
| 150 | Proposition 6.33, pp. 121-122. -/ |
| 151 | theorem hasDerivAt_deriv_variationAction_integral (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 152 | (V : M14LVariationData G p R) {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 153 | HasDerivAt (fun v => deriv (M14VariationAction V) v) |
| 154 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 155 | M08.variationParameterDeriv (M14SqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 156 | (M08.variationParameterDeriv (M14SqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 157 | (variationActionDensity V)) (s, u)) u := by |
| 158 | have h := M08.hasDerivAt_deriv_variationIntegral (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 159 | (parameterDomain_isOpen V) (variationActionDensity V) |
| 160 | (variationActionDensity_contDiffOn hM12 V) hu |
| 161 | apply h.congr_of_eventuallyEq |
| 162 | filter_upwards [(parameterDomain_isOpen V).mem_nhds hu] with v hv |
| 163 | exact (hasDerivAt_variationAction_integral hM12 V hv).deriv.trans |
| 164 | (M08.hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 165 | (parameterDomain_isOpen V) (variationActionDensity V) |
| 166 | (variationActionDensity_contDiffOn hM12 V) hv).deriv.symm |
| 167 | |
| 168 | end PoincareMT.M14 |