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.RicciFlow.CanonicalNeighborhood.RoundCylinder |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.Atlas |
| 4 | |
| 5 | /-! |
| 6 | # The actual round-cylinder Gram matrix at its chosen chart center |
| 7 | |
| 8 | Morgan--Tian Definition 2.16, p. 30, and Proposition 9.79, pp. 232-234. |
| 9 | Mathlib's chosen sphere chart is antipodal stereographic projection; the |
| 10 | derivative of its inverse at zero is the chosen orthogonal linear isometry. |
| 11 | No regularity of the chart choice as the basepoint varies is needed. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle BigOperators InnerProductSpace |
| 17 | |
| 18 | namespace PoincareMT.Proofs.M28.NeckAnalysis |
| 19 | |
| 20 | local instance : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin 3)) = 2 + 1) := |
| 21 | ⟨finrank_euclideanSpace_fin⟩ |
| 22 | |
| 23 | set_option backward.defeqAttrib.useBackward true in |
| 24 | set_option backward.isDefEq.respectTransparency false in |
| 25 | /-- The actual chosen sphere chart sends its basepoint to zero. -/ |
| 26 | theorem sphere_chart_center (q : UnitTwoSphere) : |
| 27 | chartAt (EuclideanSpace ℝ (Fin 2)) q q = 0 := by |
| 28 | change stereographic' 2 (-q) q = 0 |
| 29 | dsimp [stereographic'] |
| 30 | simp only [EmbeddingLike.map_eq_zero_iff] |
| 31 | exact stereographic_neg_apply q |
| 32 | |
| 33 | /-- Pulling the actual sphere inclusion back by its chosen chart gives an |
| 34 | isometric differential at the chart center. -/ |
| 35 | theorem sphere_chart_inverse_inner (q : UnitTwoSphere) |
| 36 | (v w : EuclideanSpace ℝ (Fin 2)) : |
| 37 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) q |
| 38 | inner ℝ |
| 39 | (mfderiv (𝓡 2) (𝓡 3) (fun x : UnitTwoSphere => x.1) (c.symm (c q)) |
| 40 | (mfderiv (𝓡 2) (𝓡 2) c.symm (c q) v)) |
| 41 | (mfderiv (𝓡 2) (𝓡 3) (fun x : UnitTwoSphere => x.1) (c.symm (c q)) |
| 42 | (mfderiv (𝓡 2) (𝓡 2) c.symm (c q) w)) = inner ℝ v w := by |
| 43 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) q |
| 44 | let U := (OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ) 2 |
| 45 | (ne_zero_of_mem_unit_sphere (-q))).repr |
| 46 | have hc : c q = 0 := sphere_chart_center q |
| 47 | have hderiv : HasFDerivAt |
| 48 | (fun x : EuclideanSpace ℝ (Fin 2) => (c.symm x).1) |
| 49 | ((ℝ ∙ (↑(-q) : EuclideanSpace ℝ (Fin 3)))ᗮ.subtypeL.comp |
| 50 | U.symm.toContinuousLinearEquiv.toContinuousLinearMap) 0 := by |
| 51 | have h := hasFDerivAt_stereoInvFunAux_comp_coe |
| 52 | (↑(-q) : EuclideanSpace ℝ (Fin 3)) |
| 53 | have hzero : U.symm 0 = 0 := map_zero _ |
| 54 | rw [← hzero] at h |
| 55 | exact h.comp 0 U.symm.toContinuousLinearEquiv.hasFDerivAt |
| 56 | have htarget : c q ∈ c.target := c.map_source (mem_chart_source _ q) |
| 57 | have hsymm : MDifferentiableAt (𝓡 2) (𝓡 2) c.symm (c q) := |
| 58 | mdifferentiableAt_atlas_symm (chart_mem_atlas _ q) htarget |
| 59 | have hcoe : MDifferentiableAt (𝓡 2) (𝓡 3) |
| 60 | (fun x : UnitTwoSphere => x.1) (c.symm (c q)) := |
| 61 | (contMDiff_coe_sphere (c.symm (c q))).mdifferentiableAt one_ne_zero |
| 62 | have hcomp : |
| 63 | (mfderiv (𝓡 2) (𝓡 3) (fun x : UnitTwoSphere => x.1) (c.symm (c q))).comp |
| 64 | (mfderiv (𝓡 2) (𝓡 2) c.symm (c q)) = |
| 65 | (ℝ ∙ (↑(-q) : EuclideanSpace ℝ (Fin 3)))ᗮ.subtypeL.comp |
| 66 | U.symm.toContinuousLinearEquiv.toContinuousLinearMap := by |
| 67 | rw [← mfderiv_comp (c q) hcoe hsymm, mfderiv_eq_fderiv, hc] |
| 68 | exact hderiv.fderiv |
| 69 | change inner ℝ |
| 70 | (((mfderiv (𝓡 2) (𝓡 3) (fun x : UnitTwoSphere => x.1) (c.symm (c q))).comp |
| 71 | (mfderiv (𝓡 2) (𝓡 2) c.symm (c q))) v) |
| 72 | (((mfderiv (𝓡 2) (𝓡 3) (fun x : UnitTwoSphere => x.1) (c.symm (c q))).comp |
| 73 | (mfderiv (𝓡 2) (𝓡 2) c.symm (c q))) w) = _ |
| 74 | rw [hcomp] |
| 75 | exact U.symm.inner_map_map v w |
| 76 | |
| 77 | /-- Diagonal entries of the actual chosen-center model metric. -/ |
| 78 | def cylinderGramDiagonal (u : ℝ) : Fin 3 → ℝ := |
| 79 | ![2 * (1 - u), 2 * (1 - u), 1] |
| 80 | |
| 81 | /-- The frozen Gram matrix is exactly diagonal at the evaluation point used |
| 82 | by the frozen covariant-jet error. -/ |
| 83 | theorem roundCylinderGram_chosen_center (u : ℝ) (z : RoundCylinderSpace) : |
| 84 | roundCylinderGram u (chartAt (EuclideanSpace ℝ (Fin 2)) z.1) |
| 85 | (chartAt (EuclideanSpace ℝ (Fin 2)) z.1 z.1, z.2) = |
| 86 | Matrix.diagonal (cylinderGramDiagonal u) := by |
| 87 | ext a b |
| 88 | dsimp [roundCylinderGram, roundCylinderTensorCoefficient, EvolvingRoundCylinderMetric] |
| 89 | rw [sphere_chart_inverse_inner] |
| 90 | fin_cases a <;> fin_cases b <;> |
| 91 | simp [roundCylinderCoordinateBasis, cylinderGramDiagonal, Matrix.diagonal, |
| 92 | EuclideanSpace.inner_single_left] |
| 93 | |
| 94 | /-- All model diagonal entries are positive before the cylinder's singular time. -/ |
| 95 | theorem cylinderGramDiagonal_pos {u : ℝ} (hu : u < 1) (a : Fin 3) : |
| 96 | 0 < cylinderGramDiagonal u a := by |
| 97 | fin_cases a <;> simp [cylinderGramDiagonal] <;> linarith |
| 98 | |
| 99 | /-- Actual inverse Gram formula at the chosen center. Positivity is used |
| 100 | before identifying the matrix inverse with the pointwise diagonal inverse. -/ |
| 101 | theorem roundCylinderGram_inverse_chosen_center {u : ℝ} (hu : u < 1) |
| 102 | (z : RoundCylinderSpace) : |
| 103 | (roundCylinderGram u (chartAt (EuclideanSpace ℝ (Fin 2)) z.1) |
| 104 | (chartAt (EuclideanSpace ℝ (Fin 2)) z.1 z.1, z.2))⁻¹ = |
| 105 | Matrix.diagonal (fun a => (cylinderGramDiagonal u a)⁻¹) := by |
| 106 | rw [roundCylinderGram_chosen_center] |
| 107 | apply Matrix.inv_eq_right_inv |
| 108 | rw [Matrix.diagonal_mul_diagonal] |
| 109 | ext a b |
| 110 | by_cases hab : a = b |
| 111 | · subst b |
| 112 | simp [Matrix.diagonal, ne_of_gt (cylinderGramDiagonal_pos hu a)] |
| 113 | · simp [Matrix.diagonal, hab] |
| 114 | |
| 115 | end PoincareMT.Proofs.M28.NeckAnalysis |