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.ReducedGeometry.LGeometry.Variation.VariationDerivativeData |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationIntegral |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationPaths |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.RegularizedAction |
| 5 | import PoincareLib.Geometry.RicciFlow.Curvature.Theory |
| 6 | |
| 7 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/VariationAction.lean` at |
| 8 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 9 | |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | open Set Filter Topology MeasureTheory |
| 17 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 18 | |
| 19 | universe u v |
| 20 | |
| 21 | namespace PoincareMT.LGeometry |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | local instance variationActionDualGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 27 | ContinuousLinearMap.toNormedAddCommGroup |
| 28 | local instance variationActionDualSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 29 | ContinuousLinearMap.toNormedSpace |
| 30 | local instance variationActionBilinGroup : |
| 31 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 32 | ContinuousLinearMap.toNormedAddCommGroup |
| 33 | local instance variationActionBilinSpace : |
| 34 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 35 | ContinuousLinearMap.toNormedSpace |
| 36 | |
| 37 | set_option maxHeartbeats 800000 in |
| 38 | theorem movingMetric_pair_contMDiffOn {X : Type v} |
| 39 | [NormedAddCommGroup X] [NormedSpace ℝ X] {S : Set X} {J : Set ℝ} |
| 40 | (F : RicciFlow n M J) (time : X → ℝ) (α : X → M) |
| 41 | (V W : ∀ z, TangentSpace (𝓡 n) (α z)) |
| 42 | (htime : ContMDiffOn (𝓘(ℝ, X)) (𝓘(ℝ, ℝ)) ∞ time S) |
| 43 | (hα : ContMDiffOn (𝓘(ℝ, X)) (𝓡 n) ∞ α S) |
| 44 | (hV : ContMDiffOn (𝓘(ℝ, X)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 45 | (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α z) (V z)) S) |
| 46 | (hW : ContMDiffOn (𝓘(ℝ, X)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 47 | (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α z) (W z)) S) |
| 48 | (hmem : MapsTo time S J) : |
| 49 | ContMDiffOn (𝓘(ℝ, X)) (𝓘(ℝ, ℝ)) ∞ |
| 50 | (fun z ↦ (F.metric (time z)).inner (α z) (V z) (W z)) S := by |
| 51 | have hmetric := F.smooth.comp (htime.prodMk hα) (fun z hz ↦ ⟨hmem hz, mem_univ _⟩) |
| 52 | have hp := hmetric.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) hV hW |
| 53 | intro z hz |
| 54 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 55 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hp z hz)).2 |
| 56 | |
| 57 | def variationSliceSqrtRegular {J : Set ℝ} {F : RicciFlow n M J} |
| 58 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 59 | (V : LVariation F T τ₁ τ₂ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 60 | SqrtRegularPath (variationPath V hu) where |
| 61 | curve := fun s ↦ V.squareFamily s u |
| 62 | domain := (fun s : ℝ ↦ (s, u)) ⁻¹' V.squareDomain |
| 63 | open_domain := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 64 | interval_subset := fun s hs ↦ V.square_contains ⟨hs, hu⟩ |
| 65 | smooth := V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn |
| 66 | (fun s hs ↦ hs) |
| 67 | agrees := fun s hs ↦ V.square_agrees s hs u hu |
| 68 | |
| 69 | def variationActionDensity {J : Set ℝ} {F : RicciFlow n M J} |
| 70 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 71 | (V : LVariation F T τ₁ τ₂ p) (z : ℝ × ℝ) : ℝ := |
| 72 | regularizedLIntegrand F T (fun s ↦ V.squareFamily s z.2) z.1 |
| 73 | |
| 74 | theorem variationLLength_eq_squareAction {J : Set ℝ} {F : RicciFlow n M J} |
| 75 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 76 | (V : LVariation F T τ₁ τ₂ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 77 | variationLLength V u = |
| 78 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, variationActionDensity V (s, u) := |
| 79 | (regularizedLAction_eq_backwardLLength (variationSliceSqrtRegular V hu)).symm |
| 80 | |
| 81 | set_option maxHeartbeats 1000000 in |
| 82 | theorem variationActionDensity_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 83 | {T τ₁ τ₂ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) |
| 84 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) : |
| 85 | ContDiffOn ℝ ∞ (variationActionDensity V) |
| 86 | (sqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain) := by |
| 87 | let S := sqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain |
| 88 | let H := fun z : ℝ × ℝ ↦ V.squareFamily z.1 z.2 |
| 89 | have hH : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓡 n) ∞ H S := by |
| 90 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 91 | exact V.square_smooth.mono V.square_contains |
| 92 | have hA : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 93 | (fun z : ℝ × ℝ ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (H z) |
| 94 | (curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1)) S := by |
| 95 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 96 | exact (contMDiffOn_curveVelocity_fst V.square_open H V.square_smooth).mono V.square_contains |
| 97 | have ht : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓘(ℝ, ℝ)) ∞ |
| 98 | (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) S := |
| 99 | (contDiff_const.sub (contDiff_fst.pow 2)).contMDiff.contMDiffOn |
| 100 | have hmem : MapsTo (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) S J := by |
| 101 | intro z hz |
| 102 | apply p.time_mem |
| 103 | have hz0 : 0 ≤ z.1 := (Real.sqrt_nonneg τ₁).trans hz.1.1 |
| 104 | constructor |
| 105 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hz.1.1] |
| 106 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hz.1.2] |
| 107 | have hg := (movingMetric_pair_contMDiffOn F (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) H |
| 108 | (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) |
| 109 | (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) ht hH hA hA hmem).contDiffOn |
| 110 | have hR := ((hM04.scalar_regular n M J F).comp (ht.prodMk hH) |
| 111 | (fun z hz ↦ ⟨hmem hz, mem_univ _⟩)).contDiffOn |
| 112 | exact ((contDiffOn_const.mul (contDiffOn_fst.pow 2)).mul hR).add |
| 113 | (contDiffOn_const.mul hg) |
| 114 | |
| 115 | theorem hasDerivAt_variationLLength_integral {J : Set ℝ} {F : RicciFlow n M J} |
| 116 | {T τ₁ τ₂ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) |
| 117 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) |
| 118 | {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 119 | HasDerivAt (variationLLength V) |
| 120 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 121 | variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 122 | (variationActionDensity V) (s, u)) u := by |
| 123 | have h := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 124 | isOpen_Ioo (variationActionDensity V) (variationActionDensity_contDiffOn hM04 V) hu |
| 125 | apply h.congr_of_eventuallyEq |
| 126 | filter_upwards [isOpen_Ioo.mem_nhds hu] with v hv |
| 127 | exact variationLLength_eq_squareAction V hv |
| 128 | |
| 129 | theorem hasDerivAt_deriv_variationLLength_integral {J : Set ℝ} {F : RicciFlow n M J} |
| 130 | {T τ₁ τ₂ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) |
| 131 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) |
| 132 | {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 133 | HasDerivAt (fun v ↦ deriv (variationLLength V) v) |
| 134 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 135 | variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 136 | (variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 137 | (variationActionDensity V)) (s, u)) u := by |
| 138 | have hC : UniqueDiffOn ℝ (sqrtParameterInterval τ₁ τ₂) := |
| 139 | uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 140 | have hd := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 141 | isOpen_Ioo (variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 142 | (variationActionDensity V)) |
| 143 | (variationParameterDeriv_contDiffOn hC isOpen_Ioo _ |
| 144 | (variationActionDensity_contDiffOn hM04 V)) hu |
| 145 | apply hd.congr_of_eventuallyEq |
| 146 | filter_upwards [isOpen_Ioo.mem_nhds hu] with v hv |
| 147 | exact (hasDerivAt_variationLLength_integral hM04 V hv).deriv |
| 148 | |
| 149 | def variationBoundaryPair {J : Set ℝ} {F : RicciFlow n M J} |
| 150 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 151 | (V : LVariation F T τ₁ τ₂ p) (s : ℝ) : ℝ := |
| 152 | (F.metric (T - s ^ 2)).inner (V.baseSquareCurve s) |
| 153 | (curveVelocityWithin (n := n) V.baseSquareCurve (sqrtParameterInterval τ₁ τ₂) s) |
| 154 | (squareVariationField V s) |
| 155 | |
| 156 | set_option maxHeartbeats 1000000 in |
| 157 | theorem variationBoundaryPair_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 158 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 159 | (V : LVariation F T τ₁ τ₂ p) : |
| 160 | ContDiffOn ℝ ∞ (variationBoundaryPair V) (sqrtParameterInterval τ₁ τ₂) := by |
| 161 | let C := sqrtParameterInterval τ₁ τ₂ |
| 162 | let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 163 | have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 164 | have hCU : C ⊆ U := fun s hs ↦ |
| 165 | V.square_contains ⟨hs, neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 166 | have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 167 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 168 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) |
| 169 | have hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 170 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) |
| 171 | (curveVelocityWithin (n := n) V.baseSquareCurve C s)) C := by |
| 172 | apply ((contMDiffOn_mfderiv_const_apply hU V.baseSquareCurve hα (1 : ℝ)).mono hCU).congr |
| 173 | intro s hs |
| 174 | apply congrArg (fun w : TangentSpace (𝓡 n) (V.baseSquareCurve s) ↦ |
| 175 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) w) |
| 176 | unfold curveVelocityWithin |
| 177 | rw [mfderivWithin_eq_mfderiv (hC.uniqueMDiffOn s hs) |
| 178 | (((hα s (hCU hs)).contMDiffAt (hU.mem_nhds (hCU hs))).mdifferentiableAt (by simp))] |
| 179 | have ht : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) ∞ (fun s : ℝ ↦ T - s ^ 2) C := |
| 180 | (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn |
| 181 | have hmem : MapsTo (fun s : ℝ ↦ T - s ^ 2) C J := by |
| 182 | intro s hs |
| 183 | apply p.time_mem |
| 184 | have hs0 : 0 ≤ s := (Real.sqrt_nonneg τ₁).trans hs.1 |
| 185 | constructor |
| 186 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hs.1] |
| 187 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hs.2] |
| 188 | exact (movingMetric_pair_contMDiffOn F (fun s : ℝ ↦ T - s ^ 2) V.baseSquareCurve |
| 189 | (curveVelocityWithin (n := n) V.baseSquareCurve C) (squareVariationField V) |
| 190 | ht (hα.mono hCU) hA ((squareVariationField_contMDiffOn V).mono hCU) hmem).contDiffOn |
| 191 | |
| 192 | end PoincareMT.LGeometry |