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.Coordinates.CurveVelocity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.SquareEnergy |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.Gauge.Geometry |
| 5 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 6 | |
| 7 | /-! |
| 8 | # Smooth square curves give integrable original actions |
| 9 | |
| 10 | Morgan-Tian equation (6.2) and Lemma 6.8, pp. 106, 108-109. The actual |
| 11 | within velocity gives a smooth density on the closed square-root interval. |
| 12 | M08's generic square substitution theorem transfers integrability to the |
| 13 | possibly singular original density, including an initial time zero. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | -- The real tangent fibers and the selected spacetime vector model are definitionally identified. |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M14 |
| 26 | |
| 27 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 28 | {I : SpacetimeInterval} |
| 29 | |
| 30 | /-- The smooth density of an arbitrary square curve with its actual |
| 31 | within velocity, equation (6.2), p. 106. -/ |
| 32 | noncomputable def squareCurveDensity (G : GeneralizedLGeometryTransport n X time I) |
| 33 | (α : ℝ → G.Point) (J : Set ℝ) (s : ℝ) : ℝ := |
| 34 | 2 * s ^ 2 * horizontalScalarCurvature G.leafwise (α s) + |
| 35 | (1 / 2 : ℝ) * G.spacetime.horizontalMetric.inner (α s) |
| 36 | (projectedCurveVelocityWithin G α J s) (projectedCurveVelocityWithin G α J s) |
| 37 | |
| 38 | variable {G : GeneralizedLGeometryTransport n X time I} {α : ℝ → G.Point} {J : Set ℝ} |
| 39 | |
| 40 | /-- The actual square density is smooth wherever the square curve is |
| 41 | smooth with unique within derivatives, equation (6.2), p. 106. -/ |
| 42 | theorem squareCurveDensity_contDiffOn (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 43 | (hJ : UniqueDiffOn ℝ J) (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ α J) : |
| 44 | ContDiffOn ℝ ∞ (squareCurveDensity G α J) J := by |
| 45 | have hA := projectedCurveVelocityWithin_smooth (G := G) hJ hα |
| 46 | have hmetric := G.spacetime.horizontalMetric.contMDiff.comp_contMDiffOn hα |
| 47 | have hpair := hmetric.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial G.Point ℝ) hA hA |
| 48 | have hg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) ∞ |
| 49 | (fun s => G.spacetime.horizontalMetric.inner (α s) |
| 50 | (projectedCurveVelocityWithin G α J s) (projectedCurveVelocityWithin G α J s)) J := by |
| 51 | intro s hs |
| 52 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 53 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hpair s hs)).2 |
| 54 | have H := (hM12.leafwise_calculus X time I G.spacetime G.slices |
| 55 | G.timeIntervals G.gaugeCover).2 G.leafwise |
| 56 | have hscalar := (H.scalar_smooth.comp_contMDiffOn hα).contDiffOn |
| 57 | exact ((contDiffOn_const.mul (contDiffOn_id.pow 2)).mul hscalar).add |
| 58 | (contDiffOn_const.mul hg.contDiffOn) |
| 59 | |
| 60 | /-- Square-root composition of a smooth closed square curve is smooth |
| 61 | on the positive original interior, Lemma 6.8, pp. 108-109. -/ |
| 62 | theorem sqrtPullback_contMDiffOn {a b : ℝ} (ha : 0 ≤ a) |
| 63 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ α (M14SqrtParameterInterval a b)) : |
| 64 | ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun τ => α (Real.sqrt τ)) (Ioo a b) := by |
| 65 | intro τ hτ |
| 66 | have hτ0 : 0 < τ := ha.trans_lt hτ.1 |
| 67 | have hs : Real.sqrt τ ∈ Ioo (Real.sqrt a) (Real.sqrt b) := |
| 68 | ⟨Real.sqrt_lt_sqrt ha hτ.1, Real.sqrt_lt_sqrt hτ0.le hτ.2⟩ |
| 69 | have hα' := (hα _ (Ioo_subset_Icc_self hs)).contMDiffAt (Icc_mem_nhds hs.1 hs.2) |
| 70 | exact (hα'.comp τ (Real.contDiffAt_sqrt (ne_of_gt hτ0)).contMDiffAt).contMDiffWithinAt |
| 71 | |
| 72 | /-- The actual square velocity scales by 2s on the interior, without |
| 73 | asserting an equality at a zero endpoint, equation (6.2), p. 106. -/ |
| 74 | theorem projectedVelocity_sqrtPullback {a b s : ℝ} (ha : 0 ≤ a) |
| 75 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ α (M14SqrtParameterInterval a b)) |
| 76 | (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 77 | (projectedCurveVelocityWithin G α (M14SqrtParameterInterval a b) s).val = |
| 78 | (2 * s) • (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)) (s ^ 2)).val := by |
| 79 | let β : ℝ → G.Point := fun τ => α (Real.sqrt τ) |
| 80 | have hs0 : 0 < s := (Real.sqrt_nonneg a).trans_lt hs.1 |
| 81 | have hτ : s ^ 2 ∈ Ioo a b := |
| 82 | ⟨Real.lt_sq_of_sqrt_lt hs.1, (Real.lt_sqrt hs0.le).mp hs.2⟩ |
| 83 | have hβ := ((sqrtPullback_contMDiffOn ha hα _ hτ).contMDiffAt |
| 84 | (isOpen_Ioo.mem_nhds hτ)).mdifferentiableAt (by simp) |
| 85 | have hnear : α =ᶠ[𝓝 s] fun r => β (r ^ 2) := by |
| 86 | filter_upwards [Ioi_mem_nhds hs0] with r hr |
| 87 | simp only [β, Real.sqrt_sq hr.le] |
| 88 | have hg := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) |
| 89 | (hnear.mfderiv_eq (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n)) |
| 90 | have hw := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) |
| 91 | (mfderivWithin_of_mem_nhds (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n) |
| 92 | (f := α) (Icc_mem_nhds hs.1 hs.2)) |
| 93 | have hsq : HasDerivAt (fun r : ℝ => r ^ 2) (2 * s) s := by |
| 94 | simpa using hasDerivAt_pow 2 s |
| 95 | have hsqmf : mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ => r ^ 2) s (1 : ℝ) = |
| 96 | (2 * s) • (1 : TangentSpace (𝓘(ℝ, ℝ)) (s ^ 2)) := by |
| 97 | have hm := hsq.hasFDerivAt.hasMFDerivAt.mfderiv |
| 98 | have hv := congrArg (fun L : TangentSpace (𝓘(ℝ, ℝ)) s →L[ℝ] |
| 99 | TangentSpace (𝓘(ℝ, ℝ)) (s ^ 2) => L 1) hm |
| 100 | change mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ => r ^ 2) s (1 : ℝ) = |
| 101 | (ContinuousLinearMap.toSpanSingleton ℝ (2 * s)) (1 : ℝ) at hv |
| 102 | simpa only [ContinuousLinearMap.toSpanSingleton_apply, one_smul, smul_eq_mul, mul_one, one_mul] |
| 103 | using hv |
| 104 | have hchain := mfderiv_comp_apply s (f := fun r : ℝ => r ^ 2) (g := β) |
| 105 | hβ hsq.differentiableAt.mdifferentiableAt (1 : ℝ) |
| 106 | rw [hsqmf, map_smul] at hchain |
| 107 | have htan := hw.trans (hg.trans hchain) |
| 108 | have hp := congrArg (fun v : SpacetimeModelVector n => |
| 109 | (G.spacetime.horizontalProjection (α s) v).val) htan |
| 110 | let v : SpacetimeModelVector n := mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) β (s ^ 2) 1 |
| 111 | have hb : α s = β (s ^ 2) := by simp only [β, Real.sqrt_sq hs0.le] |
| 112 | calc |
| 113 | _ = (G.spacetime.horizontalProjection (α s) ((2 * s) • v)).val := hp |
| 114 | _ = (2 * s) • (G.spacetime.horizontalProjection (α s) v).val := by |
| 115 | rw [map_smul] |
| 116 | rfl |
| 117 | _ = (2 * s) • (G.spacetime.horizontalProjection (β (s ^ 2)) v).val := |
| 118 | congrArg (fun w : SpacetimeModelVector n => (2 * s) • w) |
| 119 | (congrArg (fun q : G.Point => (G.spacetime.horizontalProjection q v).val) hb) |
| 120 | |
| 121 | private theorem inner_smul_of_val_eq {q r : G.Point} (h : q = r) |
| 122 | {A : G.Horizontal q} {B : G.Horizontal r} {c : ℝ} (hv : A.val = c • B.val) : |
| 123 | G.spacetime.horizontalMetric.inner q A A = |
| 124 | c ^ 2 * G.spacetime.horizontalMetric.inner r B B := by |
| 125 | cases h |
| 126 | have hAB : A = c • B := Subtype.ext hv |
| 127 | rw [hAB] |
| 128 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 129 | ring |
| 130 | |
| 131 | /-- The smooth square density is the transformed actual original |
| 132 | density on the interior, equation (6.2), p. 106. -/ |
| 133 | theorem squareCurveDensity_eq_transformed {a b s : ℝ} (ha : 0 ≤ a) |
| 134 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ α (M14SqrtParameterInterval a b)) |
| 135 | (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 136 | squareCurveDensity G α (M14SqrtParameterInterval a b) s = |
| 137 | M14RawLIntegrand G (fun τ => α (Real.sqrt τ)) |
| 138 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ))) (s ^ 2) * (2 * s) := by |
| 139 | have hs0 : 0 < s := (Real.sqrt_nonneg a).trans_lt hs.1 |
| 140 | have hvel := projectedVelocity_sqrtPullback (G := G) ha hα hs |
| 141 | have hbase : α (Real.sqrt (s ^ 2)) = α s := by rw [Real.sqrt_sq hs0.le] |
| 142 | have hpair : G.spacetime.horizontalMetric.inner (α s) |
| 143 | (projectedCurveVelocityWithin G α (M14SqrtParameterInterval a b) s) |
| 144 | (projectedCurveVelocityWithin G α (M14SqrtParameterInterval a b) s) = |
| 145 | (2 * s) ^ 2 * G.spacetime.horizontalMetric.inner (α (Real.sqrt (s ^ 2))) |
| 146 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)) (s ^ 2)) |
| 147 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)) (s ^ 2)) := |
| 148 | inner_smul_of_val_eq hbase.symm hvel |
| 149 | unfold squareCurveDensity M14RawLIntegrand |
| 150 | rw [hpair, congrArg (horizontalScalarCurvature G.leafwise) hbase.symm] |
| 151 | let kin := G.spacetime.horizontalMetric.inner (α (Real.sqrt (s ^ 2))) |
| 152 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)) (s ^ 2)) |
| 153 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)) (s ^ 2)) |
| 154 | let pot := horizontalScalarCurvature G.leafwise (α (Real.sqrt (s ^ 2))) |
| 155 | change 2 * s ^ 2 * pot + (1 / 2 : ℝ) * ((2 * s) ^ 2 * kin) = |
| 156 | Real.sqrt (s ^ 2) * (pot + kin) * (2 * s) |
| 157 | rw [Real.sqrt_sq hs0.le] |
| 158 | ring |
| 159 | |
| 160 | /-- A smooth square curve has an integrable actual original action, |
| 161 | including a zero initial time, equation (6.2) and Lemma 6.8, pp. 106, 108-109. -/ |
| 162 | theorem sqrtPullback_action_integrable (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 163 | {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) |
| 164 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ α (M14SqrtParameterInterval a b)) : |
| 165 | IntervalIntegrable (M14RawLIntegrand G (fun τ => α (Real.sqrt τ)) |
| 166 | (projectedCurveVelocity G (fun τ => α (Real.sqrt τ)))) MeasureTheory.volume a b := by |
| 167 | have hsqrt : Real.sqrt a < Real.sqrt b := Real.sqrt_lt_sqrt ha hab |
| 168 | have hdensity := (squareCurveDensity_contDiffOn hM12 (uniqueDiffOn_Icc hsqrt) hα).continuousOn |
| 169 | exact M08.intervalIntegrable_of_square_transform ha hab.le |
| 170 | (hdensity.intervalIntegrable_of_Icc hsqrt.le) |
| 171 | (fun _ hs => squareCurveDensity_eq_transformed ha hα hs) |
| 172 | |
| 173 | end PoincareMT.M14 |