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.CurveShortening.Ramp.Geometry |
| 2 | import PoincareLib.Geometry.Riemannian.Curvature.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Annuli and filling-area comparison |
| 6 | |
| 7 | Areas are integrals of the actual metric Jacobian over a fundamental rectangle. |
| 8 | The circle is represented by its degree-one lift. Integer shifts at the upper |
| 9 | boundary include every relative winding class. The intrinsic annulus is the |
| 10 | ordinary planar annulus with a smooth metric; its boundary circles go around |
| 11 | exactly once. Source transport between smooth annulus parametrizations and this |
| 12 | fixed domain is part of the milestone proof. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology ENNReal intervalIntegral |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | abbrev AnnulusCoordinates := EuclideanSpace ℝ (Fin 2) |
| 24 | |
| 25 | noncomputable def annulusPoint (x s : ℝ) : AnnulusCoordinates := !₂[x, s] |
| 26 | |
| 27 | def rampAnnulusDomain : Set AnnulusCoordinates := |
| 28 | {p | 0 ≤ p 0 ∧ p 0 ≤ rampPeriod ∧ 0 ≤ p 1 ∧ p 1 ≤ 1} |
| 29 | |
| 30 | def standardAnnulusDomain : Set AnnulusCoordinates := |
| 31 | {p | 1 ≤ ‖p‖ ∧ ‖p‖ ≤ 2} |
| 32 | |
| 33 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 34 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 35 | variable {t₀ t₁ : ℝ} |
| 36 | |
| 37 | /-- Coordinate derivatives in the spatial product `M × ℝ`. -/ |
| 38 | noncomputable def rampAnnulusTangent |
| 39 | (f : AnnulusCoordinates → M × ℝ) (p : AnnulusCoordinates) |
| 40 | (i : Fin 2) : RampTangent n M (f p).1 := |
| 41 | (mfderiv (𝓡 2) (𝓡 n) (fun q => (f q).1) p |
| 42 | (EuclideanSpace.basisFun (Fin 2) ℝ i), |
| 43 | fderiv ℝ (fun q : AnnulusCoordinates => (f q).2) p |
| 44 | (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 45 | |
| 46 | noncomputable def rampAnnulusAreaDensity |
| 47 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 48 | (f : AnnulusCoordinates → M × ℝ) (t : ℝ) (p : AnnulusCoordinates) : ℝ := |
| 49 | Real.sqrt (max 0 (Matrix.det (fun i j : Fin 2 => |
| 50 | rampMetricInner A t (f p).1 (rampAnnulusTangent f p i) |
| 51 | (rampAnnulusTangent f p j)))) |
| 52 | |
| 53 | noncomputable def rampAnnulusArea |
| 54 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 55 | (f : AnnulusCoordinates → M × ℝ) (t : ℝ) : ℝ := |
| 56 | ∫ p in rampAnnulusDomain, rampAnnulusAreaDensity A f t p |
| 57 | |
| 58 | noncomputable def projectedAnnulusAreaDensity |
| 59 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 60 | (f : AnnulusCoordinates → M × ℝ) (t : ℝ) (p : AnnulusCoordinates) : ℝ := |
| 61 | let v := rampAnnulusTangent f p |
| 62 | Real.sqrt (max 0 (Matrix.det (fun i j : Fin 2 => |
| 63 | (A.flow.metric t).inner (f p).1 (v i).1 (v j).1))) |
| 64 | |
| 65 | noncomputable def projectedAnnulusArea |
| 66 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 67 | (f : AnnulusCoordinates → M × ℝ) (t : ℝ) : ℝ := |
| 68 | ∫ p in rampAnnulusDomain, projectedAnnulusAreaDensity A f t p |
| 69 | |
| 70 | /-- C1 annuli suffice for the area infimum and allow the original C1 family |
| 71 | at its boundary. Their maps need not be immersions or minimizers. -/ |
| 72 | structure LiftedRampAnnulus |
| 73 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 74 | (circumference t : ℝ) (c₀ c₁ : ℝ → M × ℝ) where |
| 75 | map : AnnulusCoordinates → M × ℝ |
| 76 | horizontal_regular : ContMDiff (𝓡 2) (𝓡 n) 1 (fun p => (map p).1) |
| 77 | vertical_regular : ContDiff ℝ 1 (fun p => (map p).2) |
| 78 | lower_boundary : ∀ x : ℝ, map (annulusPoint x 0) = c₀ x |
| 79 | winding : ℤ |
| 80 | upper_horizontal : ∀ x : ℝ, (map (annulusPoint x 1)).1 = (c₁ x).1 |
| 81 | upper_vertical : ∀ x : ℝ, |
| 82 | (map (annulusPoint x 1)).2 = (c₁ x).2 + winding * circumference |
| 83 | horizontal_periodic : ∀ x s, |
| 84 | (map (annulusPoint (x + rampPeriod) s)).1 = (map (annulusPoint x s)).1 |
| 85 | lift_degree : ∀ x s, |
| 86 | (map (annulusPoint (x + rampPeriod) s)).2 = |
| 87 | (map (annulusPoint x s)).2 + circumference |
| 88 | area_integrable : MeasureTheory.IntegrableOn |
| 89 | (rampAnnulusAreaDensity A map t) rampAnnulusDomain MeasureTheory.volume |
| 90 | projected_area_integrable : MeasureTheory.IntegrableOn |
| 91 | (projectedAnnulusAreaDensity A map t) rampAnnulusDomain MeasureTheory.volume |
| 92 | |
| 93 | noncomputable def LiftedRampAnnulus.area |
| 94 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 95 | {circumference t : ℝ} {c₀ c₁ : ℝ → M × ℝ} |
| 96 | (N : LiftedRampAnnulus A circumference t c₀ c₁) : ℝ := |
| 97 | rampAnnulusArea A N.map t |
| 98 | |
| 99 | noncomputable def LiftedRampAnnulus.projectedArea |
| 100 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 101 | {circumference t : ℝ} {c₀ c₁ : ℝ → M × ℝ} |
| 102 | (N : LiftedRampAnnulus A circumference t c₀ c₁) : ℝ := |
| 103 | projectedAnnulusArea A N.map t |
| 104 | |
| 105 | noncomputable def leastRampAnnulusArea |
| 106 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 107 | (circumference t : ℝ) (c₀ c₁ : ℝ → M × ℝ) : ℝ := |
| 108 | sInf (Set.range (fun N : LiftedRampAnnulus A circumference t c₀ c₁ => N.area)) |
| 109 | |
| 110 | structure RampSlice |
| 111 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 112 | (circumference t : ℝ) where |
| 113 | curve : ℝ → M × ℝ |
| 114 | horizontal_periodic : ∀ x, (curve (x + rampPeriod)).1 = (curve x).1 |
| 115 | lift_degree : ∀ x, (curve (x + rampPeriod)).2 = (curve x).2 + circumference |
| 116 | spatial_regular : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 2 (fun x => (curve x).1) |
| 117 | circle_regular : ContDiff ℝ 2 (fun x => (curve x).2) |
| 118 | positive_circle_component : ∀ x, |
| 119 | 0 < rampCircleComponent A (fun y _ => curve y) x t |
| 120 | |
| 121 | noncomputable def rampFlowSlice |
| 122 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 123 | {circumference : ℝ} {initial : RampInitialCurve A circumference} |
| 124 | (S : RampFlowSolution A circumference initial) (t : ℝ) |
| 125 | (ht : t ∈ Set.Icc t₀ t₁) : RampSlice A circumference t where |
| 126 | curve := fun x => S.curve x t |
| 127 | horizontal_periodic := fun x => S.parameter_period x t |
| 128 | lift_degree := fun x => S.degree_one_lift x t |
| 129 | spatial_regular := S.spatial_regular t ht |
| 130 | circle_regular := S.circle_regular t ht |
| 131 | positive_circle_component := S.positive_circle_component t ht |
| 132 | |
| 133 | noncomputable def rampSliceArcLength |
| 134 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 135 | {circumference t : ℝ} (c : RampSlice A circumference t) (a b : ℝ) : ℝ := |
| 136 | rampArcLength A (fun x _ => c.curve x) t a b |
| 137 | |
| 138 | noncomputable def rampSliceLength |
| 139 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 140 | {circumference t : ℝ} (c : RampSlice A circumference t) : ℝ := |
| 141 | rampSliceArcLength c 0 rampPeriod |
| 142 | |
| 143 | noncomputable def rampSliceCurvatureIntegral |
| 144 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 145 | {circumference t : ℝ} (c : RampSlice A circumference t) (a b : ℝ) : ℝ := |
| 146 | rampArcTotalCurvature A (fun x _ => c.curve x) t a b |
| 147 | |
| 148 | /-- A pair of actual ramp flows; annulus existence is an explicit theorem input. -/ |
| 149 | structure RampAnnulusFlowPair |
| 150 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 151 | (circumference : ℝ) where |
| 152 | initial₀ : RampInitialCurve A circumference |
| 153 | initial₁ : RampInitialCurve A circumference |
| 154 | solution₀ : RampFlowSolution A circumference initial₀ |
| 155 | solution₁ : RampFlowSolution A circumference initial₁ |
| 156 | |
| 157 | noncomputable def rampPairAnnulusArea |
| 158 | {A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 159 | {circumference : ℝ} (Q : RampAnnulusFlowPair A circumference) (t : ℝ) : ℝ := |
| 160 | leastRampAnnulusArea A circumference t |
| 161 | (fun x => Q.solution₀.curve x t) (fun x => Q.solution₁.curve x t) |
| 162 | |
| 163 | noncomputable def rampAmbientCurvatureSupremum |
| 164 | (A : RampAmbientData (n := n) (M := M) (t₀ := t₀) (t₁ := t₁)) (t : ℝ) : ℝ := |
| 165 | sSup (Set.range (fun x : M => (A.flow.connection t).curvatureTensorNorm x)) |
| 166 | |
| 167 | /-- Forward upper Dini derivative bound, with the usual arbitrary slack `eta`. -/ |
| 168 | def AnnulusForwardDerivativeBound (f : ℝ → ℝ) (b t : ℝ) : Prop := |
| 169 | ∀ eta : ℝ, 0 < eta → ∀ᶠ h : ℝ in 𝓝[>] 0, |
| 170 | (f (t + h) - f t) / h ≤ b + eta |
| 171 | |
| 172 | /-! ## The intrinsic annulus in Proposition 19.35 -/ |
| 173 | |
| 174 | noncomputable def intrinsicAnnulusBoundary (radius x : ℝ) : AnnulusCoordinates := |
| 175 | !₂[radius * Real.cos x, radius * Real.sin x] |
| 176 | |
| 177 | noncomputable def intrinsicBoundarySpeed |
| 178 | (g : RiemannianMetric 2 AnnulusCoordinates) (radius x : ℝ) : ℝ := |
| 179 | g.tangentNorm (intrinsicAnnulusBoundary radius x) |
| 180 | (curveVelocity (n := 2) (intrinsicAnnulusBoundary radius) x) |
| 181 | |
| 182 | noncomputable def intrinsicBoundaryLength |
| 183 | (g : RiemannianMetric 2 AnnulusCoordinates) (radius a b : ℝ) : ℝ := |
| 184 | ∫ x in a..b, intrinsicBoundarySpeed g radius x |
| 185 | |
| 186 | noncomputable def intrinsicBoundaryUnitTangent |
| 187 | (g : RiemannianMetric 2 AnnulusCoordinates) (radius x : ℝ) : |
| 188 | TangentSpace (𝓡 2) (intrinsicAnnulusBoundary radius x) := |
| 189 | (intrinsicBoundarySpeed g radius x)⁻¹ • |
| 190 | curveVelocity (n := 2) (intrinsicAnnulusBoundary radius) x |
| 191 | |
| 192 | /-- Absolute geodesic curvature, with differentiation in unit-speed direction. -/ |
| 193 | noncomputable def intrinsicGeodesicCurvature |
| 194 | (g : RiemannianMetric 2 AnnulusCoordinates) (D : LeviCivitaData g) |
| 195 | (radius x : ℝ) : ℝ := |
| 196 | g.tangentNorm (intrinsicAnnulusBoundary radius x) |
| 197 | ((intrinsicBoundarySpeed g radius x)⁻¹ • |
| 198 | rampHorizontalCovariantDerivative D (intrinsicAnnulusBoundary radius) |
| 199 | (fun y => intrinsicBoundaryUnitTangent g radius y) x) |
| 200 | |
| 201 | noncomputable def intrinsicGeodesicCurvatureIntegral |
| 202 | (g : RiemannianMetric 2 AnnulusCoordinates) (D : LeviCivitaData g) |
| 203 | (radius a b : ℝ) : ℝ := |
| 204 | ∫ x in a..b, intrinsicGeodesicCurvature g D radius x * |
| 205 | intrinsicBoundarySpeed g radius x |
| 206 | |
| 207 | noncomputable def intrinsicAnnulusArea |
| 208 | (g : RiemannianMetric 2 AnnulusCoordinates) : ℝ := |
| 209 | ∫ p in standardAnnulusDomain, |
| 210 | Real.sqrt (max 0 (Matrix.det (fun i j : Fin 2 => |
| 211 | g.inner p (EuclideanSpace.basisFun (Fin 2) ℝ i) |
| 212 | (EuclideanSpace.basisFun (Fin 2) ℝ j)))) |
| 213 | |
| 214 | structure IntrinsicAnnulus where |
| 215 | metric : RiemannianMetric 2 AnnulusCoordinates |
| 216 | connection : LeviCivitaData metric |
| 217 | |
| 218 | def IntrinsicAnnulus.GaussianCurvatureBound (N : IntrinsicAnnulus) (K : ℝ) : Prop := |
| 219 | ∀ p ∈ standardAnnulusDomain, N.connection.scalarCurvature p / 2 ≤ K |
| 220 | |
| 221 | def IntrinsicAnnulus.SmallBoundaryTurning (N : IntrinsicAnnulus) (delta r : ℝ) : Prop := |
| 222 | ∀ a b : ℝ, a ≤ b → b ≤ a + rampPeriod → |
| 223 | intrinsicBoundaryLength N.metric 1 a b ≤ r → |
| 224 | intrinsicGeodesicCurvatureIntegral N.metric N.connection 1 a b < delta |
| 225 | |
| 226 | end PoincareMT |
| 227 | |
| 228 | namespace PoincareMT |
| 229 | |
| 230 | variable {M : Type u} [TopologicalSpace M] |
| 231 | [ChartedSpace LoopAmbient M] [IsManifold (𝓡 3) ∞ M] |
| 232 | variable {t₀ t₁ : ℝ} |
| 233 | |
| 234 | /-- A projected loop carries the actual M31 loop and only its projection |
| 235 | identity and null-homotopy witness. -/ |
| 236 | structure NullHomotopicRampProjection |
| 237 | {A : RampAmbientData (n := 3) (M := M) (t₀ := t₀) (t₁ := t₁)} |
| 238 | {circumference : ℝ} {initial : RampInitialCurve A circumference} |
| 239 | (S : RampFlowSolution A circumference initial) where |
| 240 | loop : ℝ → C1FreeLoopSpace (M := M) |
| 241 | projection : ∀ t ∈ Set.Icc t₀ t₁, ∀ x, |
| 242 | periodicFreeLoop (loop t) x = (S.curve x t).1 |
| 243 | null_homotopic : ∀ t ∈ Set.Icc t₀ t₁, IsNullHomotopicLoop (loop t) |
| 244 | filling_data : ∀ t ∈ Set.Icc t₀ t₁, |
| 245 | FillingAreaData (A.flow.metric t) (loop t) |
| 246 | |
| 247 | /-- One finite node set is selected before the sufficiently small circle |
| 248 | circumference. -/ |
| 249 | structure RampFamilyAnnulusNet |
| 250 | (A : RampAmbientData (n := 3) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 251 | (family : FreeTwoSphereFamily (M := M)) (mu : ℝ) where |
| 252 | node_count : ℕ |
| 253 | nodes : Fin node_count → LoopTwoSphere |
| 254 | circumference_cutoff : ℝ |
| 255 | circumference_cutoff_positive : 0 < circumference_cutoff |
| 256 | circumference_cutoff_le_one : circumference_cutoff ≤ 1 |
| 257 | covers : ∀ c : LoopTwoSphere, ∃ i : Fin node_count, |
| 258 | ∀ circumference : ℝ, 0 < circumference → circumference < circumference_cutoff → |
| 259 | ∃ N : LiftedRampAnnulus A circumference t₀ |
| 260 | (canonicalRampLift (family.family c) circumference) |
| 261 | (canonicalRampLift (family.family (nodes i)) circumference), N.area < mu |
| 262 | |
| 263 | noncomputable def rampScalarCurvatureInfimum |
| 264 | (A : RampAmbientData (n := 3) (M := M) (t₀ := t₀) (t₁ := t₁)) (t : ℝ) : ℝ := |
| 265 | sInf (Set.range (fun x : M => (A.flow.connection t).scalarCurvature x)) |
| 266 | |
| 267 | /-- Integrating-factor solution of the source equation |
| 268 | `w' = -2*pi - R_min*w/2`, initialized at `a` at `t₀`. -/ |
| 269 | noncomputable def rampAreaComparisonProfile |
| 270 | (A : RampAmbientData (n := 3) (M := M) (t₀ := t₀) (t₁ := t₁)) |
| 271 | (a t : ℝ) : ℝ := |
| 272 | Real.exp (-(∫ s in t₀..t, rampScalarCurvatureInfimum A s / 2)) * |
| 273 | (a - 2 * Real.pi * (∫ s in t₀..t, |
| 274 | Real.exp (∫ v in t₀..s, rampScalarCurvatureInfimum A v / 2))) |
| 275 | |
| 276 | end PoincareMT |