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.Compactness.GeometricLimit.Overlap.MetricLimit |
| 2 | import PoincareLib.Geometry.Riemannian.Coordinates.MetricLimit |
| 3 | import PoincareLib.Geometry.Riemannian.Metric.Gluing.Construction |
| 4 | |
| 5 | /-!+# Metrics on the constructed overlap system |
| 6 | |
| 7 | Positive coordinate limits reconstruct metrics in the canonical chart |
| 8 | structures used by gluing. Their invariance follows from the source metric |
| 9 | identity and the derivative of the actual zero-distance transition. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | open Set Filter Metric Poincare.Gluing Poincare.Analysis.Calculus |
| 15 | open scoped Topology NNReal Manifold ContDiff |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | variable {ι : Type*} {n : ℕ} |
| 20 | (U : ι → Set (EuclideanSpace ℝ (Fin n))) (hU : ∀ i, IsOpen (U i)) |
| 21 | [∀ i, Nonempty (Piece U i)] |
| 22 | |
| 23 | theorem exists_canonicalMetric_of_coordinate_limit |
| 24 | (Bseq : ℕ → EuclideanSpace ℝ (Fin n) → |
| 25 | EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 26 | (B : EuclideanSpace ℝ (Fin n) → |
| 27 | EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 28 | (i : ι) (hsmooth : ContDiffOn ℝ ∞ B (U i)) |
| 29 | (hsymm : ∀ k x, x ∈ U i → ∀ v w, Bseq k x v w = Bseq k x w v) |
| 30 | (hconv : ∀ x, x ∈ U i → ∀ v w, |
| 31 | Tendsto (fun k => Bseq k x v w) atTop (𝓝 (B x v w))) |
| 32 | (hlower : ∀ x, x ∈ U i → ∃ c : ℝ, 0 < c ∧ ∀ᶠ k in atTop, |
| 33 | ∀ v, c * ‖v‖ ^ 2 ≤ Bseq k x v v) : |
| 34 | letI := (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 35 | letI := (hU i).isOpenEmbedding_subtypeVal.isManifold_singleton (I := 𝓡 n) (n := ∞) |
| 36 | ∃ g : CanonicalMetric U hU i, ∀ (x : Piece U i) v w, g.inner x v w = B x v w := by |
| 37 | let := (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 38 | let := (hU i).isOpenEmbedding_subtypeVal.isManifold_singleton (I := 𝓡 n) (n := ∞) |
| 39 | apply RiemannianMetric.exists_of_constant_chart_limit (M := Piece U i) |
| 40 | (fun _ _ => rfl) (fun k x => Bseq k x) (fun x => B x) ?_ |
| 41 | (fun k x => hsymm k x x.property) (fun x => hconv x x.property) |
| 42 | (fun x => hlower x x.property) |
| 43 | intro x |
| 44 | exact ((hsmooth x x.property).contDiffAt ((hU i).mem_nhds x.property)).contMDiffAt.comp x |
| 45 | (contMDiff_isOpenEmbedding (I := 𝓡 n) (n := ∞) (hU i).isOpenEmbedding_subtypeVal x) |
| 46 | |
| 47 | variable {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 48 | [∀ k, ChartedSpace (EuclideanSpace ℝ (Fin n)) (M k)] |
| 49 | [∀ k, IsManifold (𝓡 n) ∞ (M k)] |
| 50 | {e : ∀ k i, Piece U i → M k} |
| 51 | {D : ∀ i j, C(Piece U i × Piece U j, ℝ)} |
| 52 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 53 | (𝓝 (D i j (x, y)))) |
| 54 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 55 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 56 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 57 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 58 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 59 | (hsmooth : letI : ∀ i, ChartedSpace (EuclideanSpace ℝ (Fin n)) (Piece U i) := |
| 60 | fun i => (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 61 | ∀ k i, IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ (e k i)) |
| 62 | |
| 63 | include hD he hc hlower hopen hconn hsmooth in |
| 64 | theorem exists_compatibleMetrics_of_coordinate_limits |
| 65 | (g : ∀ k, RiemannianMetric n (M k)) |
| 66 | (B : ι → EuclideanSpace ℝ (Fin n) → |
| 67 | EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 68 | (hB : ∀ i, TendstoLocallyUniformlyOn |
| 69 | (fun k => (g k).pullbackCoefficients (chartParametrization U hU (e k i))) |
| 70 | (B i) atTop (U i)) |
| 71 | (hBsmooth : ∀ i, ContDiffOn ℝ ∞ (B i) (U i)) |
| 72 | (hBlower : ∀ i x, x ∈ U i → ∃ a : ℝ, 0 < a ∧ ∀ᶠ k in atTop, |
| 73 | ∀ v, a * ‖v‖ ^ 2 ≤ |
| 74 | (g k).pullbackCoefficients (chartParametrization U hU (e k i)) x v v) |
| 75 | (hbound : ∀ i j, LocallyEventuallyBoundedDerivatives |
| 76 | (Subtype.val '' overlap (fun i j => D i j) i j) |
| 77 | (fun k => coordinateRepresentative U hU |
| 78 | (fun x => Function.invFun (e k j) (e k i x)))) : |
| 79 | letI : ∀ i, ChartedSpace (EuclideanSpace ℝ (Fin n)) (Piece U i) := |
| 80 | fun i => (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 81 | letI : ∀ i, IsManifold (𝓡 n) ∞ (Piece U i) := |
| 82 | fun i => (hU i).isOpenEmbedding_subtypeVal.isManifold_singleton |
| 83 | letI : ∀ i, LocallyCompactSpace (Piece U i) := fun i => (hU i).locallyCompactSpace |
| 84 | ∃ gLimit : ∀ i, CanonicalMetric U hU i, |
| 85 | (∀ i (x : Piece U i) v w, (gLimit i).inner x v w = B i x v w) ∧ |
| 86 | CompatibleMetrics U hU (overlapSystem hD L he c hc hlower hopen hconn) gLimit := by |
| 87 | let : ∀ i, ChartedSpace (EuclideanSpace ℝ (Fin n)) (Piece U i) := |
| 88 | fun i => (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 89 | let : ∀ i, IsManifold (𝓡 n) ∞ (Piece U i) := |
| 90 | fun i => (hU i).isOpenEmbedding_subtypeVal.isManifold_singleton |
| 91 | let : ∀ i, LocallyCompactSpace (Piece U i) := fun i => (hU i).locallyCompactSpace |
| 92 | have hex : ∀ i, ∃ gLimit : CanonicalMetric U hU i, |
| 93 | ∀ (x : Piece U i) v w, gLimit.inner x v w = B i x v w := by |
| 94 | intro i |
| 95 | apply exists_canonicalMetric_of_coordinate_limit U hU |
| 96 | (fun k => (g k).pullbackCoefficients (chartParametrization U hU (e k i))) |
| 97 | (B i) i (hBsmooth i) ?_ ?_ (hBlower i) |
| 98 | · intro k x hx v w |
| 99 | exact (g k).symm _ _ _ |
| 100 | · intro x hx v w |
| 101 | exact ((ContinuousLinearMap.apply ℝ ℝ w).continuous.tendsto _).comp |
| 102 | (((ContinuousLinearMap.apply ℝ (_ →L[ℝ] ℝ) v).continuous.tendsto _).comp |
| 103 | ((hB i).tendsto_at hx)) |
| 104 | choose gLimit hgLimit using hex |
| 105 | refine ⟨gLimit, hgLimit, ?_⟩ |
| 106 | have hs := overlapSystem_smooth U hU hD L he c hc hlower hopen hconn hsmooth hbound |
| 107 | intro i j x hx v w |
| 108 | have hm := limit_coefficients_transition U hU hD L he c hc hlower hopen hconn hsmooth |
| 109 | g B hB (fun i => (hBsmooth i).continuousOn) i j (hbound i j) |
| 110 | x (mem_image_of_mem Subtype.val hx) v w |
| 111 | have ht := (hs i j).contMDiffAt |
| 112 | (((overlapSystem hD L he c hc hlower hopen hconn).transition i j).open_source.mem_nhds hx) |
| 113 | have hd := mfderiv_eq_coordinateRepresentative U hU x (ht.mdifferentiableAt (by simp)) |
| 114 | simp only [hgLimit, hd] |
| 115 | change B i x v w = B j (transition (fun i j => D i j) i j x) |
| 116 | (fderiv ℝ (coordinateRepresentative U hU (transition (fun i j => D i j) i j)) x v) |
| 117 | (fderiv ℝ (coordinateRepresentative U hU (transition (fun i j => D i j) i j)) x w) |
| 118 | simpa only [coordinateRepresentative_apply] using hm.symm |
| 119 | |
| 120 | end PoincareMT.ChartDistance |