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.Riemannian.Connection |
| 2 | import Mathlib.Analysis.InnerProductSpace.Calculus |
| 3 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 4 | import Mathlib.Geometry.Manifold.MFDeriv.Atlas |
| 5 | |
| 6 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/ChartScalarBarrier.lean`, |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 8 | `references/ricci-flow/mapher/curvature/`. -/ |
| 9 | |
| 10 | /-! |
| 11 | # Radial scalar barriers inside a manifold chart |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | open Set Topology Filter Metric |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.RicciFlowAnalysis |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | theorem contMDiffOn_chart_radial (p : M) (c : EuclideanSpace ℝ (Fin n)) (r : ℝ) : |
| 27 | ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 28 | (fun x ↦ r ^ 2 - ‖extChartAt (𝓡 n) p x - c‖ ^ 2) |
| 29 | (extChartAt (𝓡 n) p).source := by |
| 30 | have he : ContMDiffOn (𝓡 n) 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∞ |
| 31 | (extChartAt (𝓡 n) p) (extChartAt (𝓡 n) p).source := by |
| 32 | simpa only [extChartAt_source] using |
| 33 | (contMDiffOn_extChartAt (I := 𝓡 n) (x := p) (n := ∞)) |
| 34 | have hφ : ContDiff ℝ ∞ (fun z : EuclideanSpace ℝ (Fin n) ↦ r ^ 2 - ‖z - c‖ ^ 2) := |
| 35 | contDiff_const.sub ((contDiff_id.sub contDiff_const).norm_sq ℝ) |
| 36 | exact hφ.contMDiff.comp_contMDiffOn he |
| 37 | |
| 38 | set_option maxHeartbeats 1000000 in |
| 39 | -- The chart chain rule and tangent-space isomorphisms need extra elaboration. |
| 40 | set_option backward.isDefEq.respectTransparency false in |
| 41 | theorem mfderiv_chart_radial_ne_zero (p : M) (c : EuclideanSpace ℝ (Fin n)) (r : ℝ) |
| 42 | {x : M} (hx : x ∈ (extChartAt (𝓡 n) p).source) |
| 43 | (hne : extChartAt (𝓡 n) p x ≠ c) : |
| 44 | mfderiv (𝓡 n) 𝓘(ℝ, ℝ) |
| 45 | (fun y ↦ r ^ 2 - ‖extChartAt (𝓡 n) p y - c‖ ^ 2) x ≠ 0 := by |
| 46 | let E := EuclideanSpace ℝ (Fin n) |
| 47 | let e := extChartAt (𝓡 n) p |
| 48 | let φ : E → ℝ := fun z ↦ r ^ 2 - ‖z - c‖ ^ 2 |
| 49 | let L : TangentSpace (𝓡 n) x →L[ℝ] E := mfderiv (𝓡 n) 𝓘(ℝ, E) e x |
| 50 | let z : E := e x - c |
| 51 | let v := L.inverse z |
| 52 | have hL : L.IsInvertible := isInvertible_mfderiv_extChartAt hx |
| 53 | have hv : L v = z := hL.self_apply_inverse z |
| 54 | have hz : z ≠ 0 := sub_ne_zero.mpr hne |
| 55 | have he : MDifferentiableAt (𝓡 n) 𝓘(ℝ, E) e x := |
| 56 | mdifferentiableAt_extChartAt (by simpa only [extChartAt_source] using hx) |
| 57 | have hφ : ContDiff ℝ ∞ φ := |
| 58 | contDiff_const.sub ((contDiff_id.sub contDiff_const).norm_sq ℝ) |
| 59 | have hc : mfderiv (𝓡 n) 𝓘(ℝ, ℝ) (fun y ↦ φ (e y)) x = |
| 60 | (fderiv ℝ φ (e x)).comp L := by |
| 61 | change mfderiv (𝓡 n) 𝓘(ℝ, ℝ) (φ ∘ e) x = _ |
| 62 | rw [mfderiv_comp x ((hφ.differentiable (by simp)) (e x)).mdifferentiableAt he, |
| 63 | mfderiv_eq_fderiv] |
| 64 | have hs := ((hasFDerivAt_id (e x)).sub_const c).norm_sq |
| 65 | have hφd : HasFDerivAt φ (0 - 2 • (innerSL ℝ) z) (e x) := by |
| 66 | simpa only [φ, z, Pi.sub_apply, id_eq, ContinuousLinearMap.comp_id] using! |
| 67 | (hasFDerivAt_const (r ^ 2) (e x)).sub hs |
| 68 | have hvalue : fderiv ℝ φ (e x) z = -2 * ‖z‖ ^ 2 := by |
| 69 | rw [hφd.fderiv] |
| 70 | simp only [sub_apply, zero_apply, two_smul, add_apply, innerSL_apply_apply] |
| 71 | rw [real_inner_self_eq_norm_sq] |
| 72 | ring |
| 73 | intro hzero |
| 74 | have h := congrArg (fun K : TangentSpace (𝓡 n) x →L[ℝ] ℝ ↦ K v) hzero |
| 75 | change (mfderiv (𝓡 n) 𝓘(ℝ, ℝ) (fun y ↦ φ (e y)) x) v = 0 at h |
| 76 | rw [hc] at h |
| 77 | change fderiv ℝ φ (e x) (L v) = 0 at h |
| 78 | rw [hv, hvalue] at h |
| 79 | have hpos : 0 < ‖z‖ ^ 2 := sq_pos_of_pos (norm_pos_iff.mpr hz) |
| 80 | linarith |
| 81 | |
| 82 | theorem chart_closedBall_properties [T2Space M] |
| 83 | (p : M) (c : EuclideanSpace ℝ (Fin n)) {R : ℝ} (_hR : 0 < R) |
| 84 | (hball : closedBall c R ⊆ (extChartAt (𝓡 n) p).target) : |
| 85 | let e := extChartAt (𝓡 n) p |
| 86 | let C := e.symm '' closedBall c R |
| 87 | IsCompact C ∧ C ⊆ e.source ∧ |
| 88 | (∀ x ∈ e.source, x ∈ C ↔ ‖e x - c‖ ≤ R) ∧ |
| 89 | (∀ x ∈ e.source, ‖e x - c‖ < R → x ∈ interior C) := by |
| 90 | let e := extChartAt (𝓡 n) p |
| 91 | let C := e.symm '' closedBall c R |
| 92 | have hC : IsCompact C := (isCompact_closedBall c R).image_of_continuousOn |
| 93 | ((continuousOn_extChartAt_symm p).mono hball) |
| 94 | have hCs : C ⊆ e.source := by |
| 95 | rintro x ⟨z, hz, rfl⟩ |
| 96 | exact e.map_target (hball hz) |
| 97 | have hmem (x : M) (hx : x ∈ e.source) : x ∈ C ↔ ‖e x - c‖ ≤ R := by |
| 98 | constructor |
| 99 | · rintro ⟨z, hz, rfl⟩ |
| 100 | rw [e.right_inv (hball hz)] |
| 101 | exact mem_closedBall_iff_norm.mp hz |
| 102 | · intro hnorm |
| 103 | exact ⟨e x, mem_closedBall_iff_norm.mpr hnorm, e.left_inv hx⟩ |
| 104 | refine ⟨hC, hCs, hmem, ?_⟩ |
| 105 | intro x hx hnorm |
| 106 | have hO : IsOpen (e.source ∩ e ⁻¹' ball c R) := |
| 107 | (continuousOn_extChartAt p).isOpen_inter_preimage (isOpen_extChartAt_source p) isOpen_ball |
| 108 | have hOC : e.source ∩ e ⁻¹' ball c R ⊆ C := by |
| 109 | intro y hy |
| 110 | exact (hmem y hy.1).2 (mem_ball_iff_norm.mp hy.2).le |
| 111 | exact mem_interior.mpr ⟨e.source ∩ e ⁻¹' ball c R, hOC, hO, |
| 112 | hx, mem_ball_iff_norm.mpr hnorm⟩ |
| 113 | |
| 114 | end PoincareMT.RicciFlowAnalysis |
| 115 |