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.Comparison.Analysis.Positive.MetricExtension |
| 2 | import PoincareLib.Geometry.Riemannian.Metric.Pullback |
| 3 | |
| 4 | /-! Actual induced metrics near closed subsets of an immersed coordinate domain. |
| 5 | Source: MT Lemma 19.31, pp. 464-466; trimmed-intrinsic-transport derivation, |
| 6 | Section 6. Source and target dimensions may differ. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter |
| 13 | open scoped Topology ContDiff Manifold Bundle |
| 14 | |
| 15 | namespace PoincareMT |
| 16 | |
| 17 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 18 | normedSpaceTangentSpaceVectorSpace |
| 19 | |
| 20 | variable {m n : ℕ} {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | |
| 23 | /-- The actual pullback bilinear form for a map of possibly different |
| 24 | dimensions. Source: MT Lemma 19.31, pp. 464-466; transport derivation, Section 6. -/ |
| 25 | def m64ImmersionCoefficients (g : RiemannianMetric n M) |
| 26 | (f : EuclideanSpace ℝ (Fin m) → M) (x : EuclideanSpace ℝ (Fin m)) : |
| 27 | EuclideanSpace ℝ (Fin m) →L[ℝ] EuclideanSpace ℝ (Fin m) →L[ℝ] ℝ := by |
| 28 | let : NormedAddCommGroup (TangentSpace (𝓡 n) (f x)) := by |
| 29 | unfold TangentSpace |
| 30 | infer_instance |
| 31 | let : NormedSpace ℝ (TangentSpace (𝓡 n) (f x)) := by |
| 32 | unfold TangentSpace |
| 33 | infer_instance |
| 34 | exact ContinuousLinearMap.bilinearComp (g.inner (f x)) |
| 35 | (mfderiv (𝓡 m) (𝓡 n) f x) (mfderiv (𝓡 m) (𝓡 n) f x) |
| 36 | |
| 37 | /-- Smoothness of the genuine induced bilinear form at a smooth point. |
| 38 | Source: MT Lemma 19.31, pp. 464-466; transport derivation, Section 6. -/ |
| 39 | theorem m64_contDiffAt_immersionCoefficients (g : RiemannianMetric n M) |
| 40 | {f : EuclideanSpace ℝ (Fin m) → M} {x : EuclideanSpace ℝ (Fin m)} |
| 41 | (hf : ContMDiffAt (𝓡 m) (𝓡 n) ∞ f x) : |
| 42 | ContDiffAt ℝ ∞ (m64ImmersionCoefficients g f) x := by |
| 43 | apply contMDiffAt_iff_contDiffAt.mp |
| 44 | apply contMDiffAt_clm_of_apply |
| 45 | intro v |
| 46 | apply contMDiffAt_clm_of_apply |
| 47 | intro w |
| 48 | have hg := (g.contMDiff (f x)).comp x hf |
| 49 | have h := hg.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) |
| 50 | (RiemannianMetric.contMDiffAt_mfderiv_const_vector hf v) |
| 51 | (RiemannianMetric.contMDiffAt_mfderiv_const_vector hf w) |
| 52 | have hh := (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 53 | simp only [Bundle.Trivial.fiberBundle_trivializationAt', |
| 54 | Bundle.Trivial.trivialization_apply] at hh |
| 55 | convert! hh using 1 |
| 56 | |
| 57 | /-- A smooth immersion near a closed coordinate set has a genuine global |
| 58 | source metric and Levi-Civita connection, with the actual induced metric |
| 59 | on a neighborhood of every point of the set. Source: MT Lemma 19.31, |
| 60 | pp. 464-466; transport derivation, Sections 3 and 6. -/ |
| 61 | theorem m64_exists_induced_metric_near (g : RiemannianMetric n M) |
| 62 | {f : EuclideanSpace ℝ (Fin m) → M} {S U : Set (EuclideanSpace ℝ (Fin m))} |
| 63 | (hS : IsClosed S) (hU : IsOpen U) (hSU : S ⊆ U) |
| 64 | (hf : ContMDiffOn (𝓡 m) (𝓡 n) ∞ f U) |
| 65 | (hinj : ∀ x ∈ U, Function.Injective (mfderiv (𝓡 m) (𝓡 n) f x)) : |
| 66 | ∃ (h : RiemannianMetric m (EuclideanSpace ℝ (Fin m))) (_D : LeviCivitaData h), |
| 67 | ∀ x ∈ S, ∀ᶠ y in 𝓝 x, ∀ v w, |
| 68 | h.inner y v w = g.inner (f y) (mfderiv (𝓡 m) (𝓡 n) f y v) |
| 69 | (mfderiv (𝓡 m) (𝓡 n) f y w) := by |
| 70 | have hB : ContDiffOn ℝ ∞ (m64ImmersionCoefficients g f) U := by |
| 71 | intro x hx |
| 72 | exact (m64_contDiffAt_immersionCoefficients g |
| 73 | ((hf x hx).contMDiffAt (hU.mem_nhds hx))).contDiffWithinAt |
| 74 | have hpos : ∀ x ∈ U, ∀ v, v ≠ 0 → 0 < m64ImmersionCoefficients g f x v v := by |
| 75 | intro x hx v hv |
| 76 | have hAv : mfderiv (𝓡 m) (𝓡 n) f x v ≠ 0 := by |
| 77 | intro hz |
| 78 | exact hv ((hinj x hx) (by simpa using hz)) |
| 79 | exact g.pos (f x) _ hAv |
| 80 | obtain ⟨h, D, heq⟩ := m64_exists_metric_eq_nhds_of_isClosed hS hU hSU |
| 81 | (m64ImmersionCoefficients g f) hB |
| 82 | (fun x _ v w => g.symm (f x) _ _) hpos |
| 83 | refine ⟨h, D, ?_⟩ |
| 84 | intro x hx |
| 85 | filter_upwards [heq x hx] with y hy |
| 86 | intro v w |
| 87 | exact congrArg (fun B => B v w) hy |
| 88 | |
| 89 | end PoincareMT |