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.AnnularEvolution.Finite.MotionTangent |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.ClosedConformality |
| 3 | |
| 4 | /-! The actual within Gram matrix of a closed C1 annulus. |
| 5 | Continuity transfers weighted conformality to every boundary point. |
| 6 | Source: MT Lemma 19.15, pp. 447-449; M64 affine phase derivation. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option warningAsError true |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set Filter MeasureTheory Bundle |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 20 | |
| 21 | /-- Gram coefficients of the genuine derivative within the closed source. Source: |
| 22 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 23 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 24 | def m64AnnulusWithinGram (g : RiemannianMetric n M) (f : LoopPlane → M) |
| 25 | (p : LoopPlane) (i j : Fin 2) : ℝ := |
| 26 | g.inner (f p) |
| 27 | (mfderivWithin (𝓡 2) (𝓡 n) f m64AnnulusDomain p |
| 28 | (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 29 | (mfderivWithin (𝓡 2) (𝓡 n) f m64AnnulusDomain p |
| 30 | (EuclideanSpace.basisFun (Fin 2) ℝ j)) |
| 31 | |
| 32 | /-- The actual within Gram coefficients are continuous on the entire closed rectangle for a |
| 33 | C1 annulus. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 34 | project derivation |
| 35 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 36 | theorem m64AnnulusWithinGram_continuousOn (g : RiemannianMetric n M) |
| 37 | {f : LoopPlane → M} (hf : ContMDiffOn (𝓡 2) (𝓡 n) 1 f m64AnnulusDomain) |
| 38 | (i j : Fin 2) : |
| 39 | ContinuousOn (fun p => m64AnnulusWithinGram g f p i j) m64AnnulusDomain := by |
| 40 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 41 | ⟨g.toRiemannianMetric⟩ |
| 42 | exact (m64AnnulusWithinColumn_continuousOn hf i).inner_bundle |
| 43 | (m64AnnulusWithinColumn_continuousOn hf j) |
| 44 | |
| 45 | /-- Inside the open rectangle the within Gram coefficients equal the ordinary actual Gram |
| 46 | coefficients. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 47 | project derivation |
| 48 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 49 | theorem m64AnnulusWithinGram_eq_gram (g : RiemannianMetric n M) |
| 50 | (f : LoopPlane → M) {p : LoopPlane} (hp : p ∈ m64AnnulusInterior) (i j : Fin 2) : |
| 51 | m64AnnulusWithinGram g f p i j = m60AreaGram g f p i j := by |
| 52 | have hsub : m64AnnulusInterior ⊆ m64AnnulusDomain := by |
| 53 | rw [← m64AnnulusInterior_closure] |
| 54 | exact subset_closure |
| 55 | have hpi := (interior_maximal hsub isOpen_m64AnnulusInterior) hp |
| 56 | unfold m64AnnulusWithinGram m60AreaGram |
| 57 | rw [mfderivWithin_of_mem_nhds (mem_interior_iff_mem_nhds.mp hpi)] |
| 58 | |
| 59 | /-- Almost-everywhere weighted conformality extends to the actual within derivatives on the |
| 60 | whole closed rectangle. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. |
| 61 | 447-449; project derivation |
| 62 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 63 | theorem m64AnnulusWithinGram_modulus_conformal |
| 64 | {g : RiemannianMetric n M} {c0 c1 : ℝ → M} (A : M64Annulus g c0 c1) (r : ℝ) |
| 65 | (hAc : ContMDiffOn (𝓡 2) (𝓡 n) 1 A.map m64AnnulusDomain) |
| 66 | (hAi : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map m64AnnulusInterior) |
| 67 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 68 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 69 | m60AreaGram g A.map p 0 1 = 0) : |
| 70 | ∀ p ∈ m64AnnulusDomain, |
| 71 | r * m64AnnulusWithinGram g A.map p 0 0 = |
| 72 | r⁻¹ * m64AnnulusWithinGram g A.map p 1 1 ∧ |
| 73 | m64AnnulusWithinGram g A.map p 0 1 = 0 := by |
| 74 | have hi := m64Annulus_modulus_conformal_on_interior_of_ae A r hAi hconformal |
| 75 | have hc := m64AnnulusWithinGram_continuousOn g hAc |
| 76 | have hsub : m64AnnulusInterior ⊆ m64AnnulusDomain := by |
| 77 | rw [← m64AnnulusInterior_closure] |
| 78 | exact subset_closure |
| 79 | have hclosure : m64AnnulusDomain ⊆ closure m64AnnulusInterior := by |
| 80 | rw [m64AnnulusInterior_closure] |
| 81 | have hdiag : EqOn (fun p => r * m64AnnulusWithinGram g A.map p 0 0) |
| 82 | (fun p => r⁻¹ * m64AnnulusWithinGram g A.map p 1 1) m64AnnulusInterior := by |
| 83 | intro p hp |
| 84 | dsimp only |
| 85 | rw [m64AnnulusWithinGram_eq_gram g A.map hp 0 0, |
| 86 | m64AnnulusWithinGram_eq_gram g A.map hp 1 1] |
| 87 | exact (hi p hp).1 |
| 88 | have hcross : EqOn (fun p => m64AnnulusWithinGram g A.map p 0 1) |
| 89 | (fun _ => (0 : ℝ)) m64AnnulusInterior := by |
| 90 | intro p hp |
| 91 | dsimp only |
| 92 | rw [m64AnnulusWithinGram_eq_gram g A.map hp 0 1] |
| 93 | exact (hi p hp).2 |
| 94 | exact fun p hp => ⟨hdiag.of_subset_closure (continuousOn_const.mul (hc 0 0)) |
| 95 | (continuousOn_const.mul (hc 1 1)) hsub hclosure hp, |
| 96 | hcross.of_subset_closure (hc 0 1) continuousOn_const hsub hclosure hp⟩ |
| 97 | |
| 98 | end PoincareMT |