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.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.Riemannian.Metric.Pullback |
| 3 | import PoincareLib.Geometry.RicciFlow.CanonicalNeighborhood.RoundCylinder |
| 4 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 5 | |
| 6 | /-! |
| 7 | # Smoothness of actual pulled-back cylinder tensors |
| 8 | |
| 9 | Morgan--Tian Proposition 9.79, pp. 232-234, and Proposition 10.7, |
| 10 | pp. 253-254. The displayed cylinder map and the smooth ambient metric |
| 11 | produce coefficient regularity; no target neck comparison is assumed. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Manifold IsManifold |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | namespace PoincareMT.Proofs.M28.NeckAnalysis |
| 20 | |
| 21 | variable {M : Type*} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 23 | |
| 24 | private theorem contDiffAt_pullback_inner |
| 25 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 26 | (g : RiemannianMetric 3 M) {f : E → M} {x : E} |
| 27 | (hf : ContMDiffAt 𝓘(ℝ, E) (𝓡 3) ∞ f x) (v w : E) : |
| 28 | ContDiffAt ℝ ∞ (fun y => g.inner (f y) |
| 29 | (mfderiv 𝓘(ℝ, E) (𝓡 3) f y v) |
| 30 | (mfderiv 𝓘(ℝ, E) (𝓡 3) f y w)) x := by |
| 31 | have hg := (g.contMDiff (f x)).comp x hf |
| 32 | have h := hg.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) |
| 33 | (RiemannianMetric.contMDiffAt_mfderiv_const_vector hf v) |
| 34 | (RiemannianMetric.contMDiffAt_mfderiv_const_vector hf w) |
| 35 | apply contMDiffAt_iff_contDiffAt.mp |
| 36 | simpa using (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 37 | |
| 38 | /-- A smooth actual cylinder map pulls a smooth metric back to a tensor |
| 39 | with all the regularity required by the frozen comparison. Source: |
| 40 | Proposition 9.79, pp. 232-234; derivation 10, section 3. -/ |
| 41 | theorem roundCylinderPullback_smooth |
| 42 | (g : RiemannianMetric 3 M) {epsilon : ℝ} {f : RoundCylinderSpace → M} |
| 43 | (hf : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) ∞ f |
| 44 | (univ ×ˢ Ioo (-epsilon⁻¹) epsilon⁻¹)) : |
| 45 | RoundCylinderTensorSmoothOn epsilon (roundCylinderPullback g f) := by |
| 46 | intro q a b p hp |
| 47 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) q |
| 48 | let h : RoundCylinderCoordinates → RoundCylinderSpace := Prod.map c.symm id |
| 49 | have hcs : ContMDiffAt (𝓡 2) (𝓡 2) ∞ c.symm p.1 := |
| 50 | contMDiffAt_symm_of_mem_maximalAtlas (chart_mem_maximalAtlas q) hp.1 |
| 51 | have hh : ContMDiffAt 𝓘(ℝ, RoundCylinderCoordinates) |
| 52 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ h p := by |
| 53 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 54 | exact hcs.prodMap (contMDiffAt_id (I := 𝓘(ℝ, ℝ)) (x := p.2)) |
| 55 | have hf' : ContMDiffAt ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) ∞ f (h p) := |
| 56 | hf.contMDiffAt ((isOpen_univ.prod isOpen_Ioo).mem_nhds ⟨mem_univ _, hp.2⟩) |
| 57 | have hs := contDiffAt_pullback_inner g (hf'.comp p hh) |
| 58 | (roundCylinderCoordinateBasis a) (roundCylinderCoordinateBasis b) |
| 59 | have heq : (fun y => g.inner ((f ∘ h) y) |
| 60 | (mfderiv 𝓘(ℝ, RoundCylinderCoordinates) (𝓡 3) (f ∘ h) y |
| 61 | (roundCylinderCoordinateBasis a)) |
| 62 | (mfderiv 𝓘(ℝ, RoundCylinderCoordinates) (𝓡 3) (f ∘ h) y |
| 63 | (roundCylinderCoordinateBasis b))) =ᶠ[𝓝 p] |
| 64 | (fun y => roundCylinderTensorCoefficient (roundCylinderPullback g f) c y a b) := by |
| 65 | filter_upwards [(c.open_target.prod isOpen_Ioo).mem_nhds hp] with y hy |
| 66 | have hcy : ContMDiffAt (𝓡 2) (𝓡 2) ∞ c.symm y.1 := |
| 67 | contMDiffAt_symm_of_mem_maximalAtlas (chart_mem_maximalAtlas q) hy.1 |
| 68 | have hhy : ContMDiffAt 𝓘(ℝ, RoundCylinderCoordinates) |
| 69 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ h y := by |
| 70 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 71 | exact hcy.prodMap (contMDiffAt_id (I := 𝓘(ℝ, ℝ)) (x := y.2)) |
| 72 | have hfy := hf.contMDiffAt |
| 73 | ((isOpen_univ.prod isOpen_Ioo).mem_nhds (show h y ∈ |
| 74 | univ ×ˢ Ioo (-epsilon⁻¹) epsilon⁻¹ from ⟨mem_univ _, hy.2⟩)) |
| 75 | rw [mfderiv_comp y (hfy.mdifferentiableAt (by simp)) |
| 76 | (hhy.mdifferentiableAt (by simp))] |
| 77 | have hderiv : mfderiv 𝓘(ℝ, RoundCylinderCoordinates) |
| 78 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) h y = |
| 79 | (mfderiv (𝓡 2) (𝓡 2) c.symm y.1).prodMap |
| 80 | (ContinuousLinearMap.id ℝ ℝ) := by |
| 81 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 82 | dsimp only [h] |
| 83 | rw [mfderiv_prodMap (hcy.mdifferentiableAt (by simp)) mdifferentiableAt_id, |
| 84 | mfderiv_id] |
| 85 | rfl |
| 86 | rw [hderiv] |
| 87 | rfl |
| 88 | exact (hs.congr_of_eventuallyEq heq.symm).contDiffWithinAt |
| 89 | |
| 90 | end PoincareMT.Proofs.M28.NeckAnalysis |