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.Annulus.ClosedConformality |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.EnergyDensity |
| 3 | |
| 4 | /-! |
| 5 | # Closed-rectangle conformality at the actual modulus |
| 6 | |
| 7 | The actual weighted Gram identities, and their first derivatives, extend |
| 8 | from almost everywhere to the closed source rectangle. No conformality |
| 9 | of the smooth extension outside the rectangle is assumed. |
| 10 | |
| 11 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 12 | 447-449. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter MeasureTheory |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {g : RiemannianMetric n M} {c0 c1 : ℝ → M} |
| 28 | |
| 29 | /-- The actual weighted Gram energy density is smooth wherever the annular map is smooth. |
| 30 | Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 31 | derivation |
| 32 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 33 | theorem m64ModulusEnergyDensity_contDiffOn |
| 34 | (r : ℝ) {f : LoopPlane → M} {O : Set LoopPlane} (hO : IsOpen O) |
| 35 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) ∞ f O) : |
| 36 | ContDiffOn ℝ ∞ (m64ModulusEnergyDensity g r f) O := by |
| 37 | intro p hp |
| 38 | have hfp := hf.contMDiffAt (hO.mem_nhds hp) |
| 39 | exact (((contDiffAt_const.mul (m64AreaGram_entry_contDiffAt hfp 0 0)).add |
| 40 | (contDiffAt_const.mul (m64AreaGram_entry_contDiffAt hfp 1 1))).div_const 2).contDiffWithinAt |
| 41 | |
| 42 | /-- Nonnegative modulus gives nonnegative totalized weighted energy density, including |
| 43 | modulus zero. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 44 | project derivation |
| 45 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 46 | theorem m64ModulusEnergyDensity_nonneg (r : ℝ) (hr : 0 ≤ r) |
| 47 | (f : LoopPlane → M) (p : LoopPlane) : 0 ≤ m64ModulusEnergyDensity g r f p := by |
| 48 | exact div_nonneg (add_nonneg |
| 49 | (mul_nonneg hr (m60AreaGram_diagonal_nonneg g f p 0)) |
| 50 | (mul_nonneg (inv_nonneg.mpr hr) (m60AreaGram_diagonal_nonneg g f p 1))) (by norm_num) |
| 51 | |
| 52 | /-- Continuity turns almost-everywhere weighted Gram identities into pointwise interior |
| 53 | conformality. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 54 | project derivation |
| 55 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 56 | theorem m64Annulus_modulus_conformal_on_interior_of_ae |
| 57 | (A : M64Annulus g c0 c1) (r : ℝ) |
| 58 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map m64AnnulusInterior) |
| 59 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 60 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 61 | m60AreaGram g A.map p 0 1 = 0) : |
| 62 | ∀ p ∈ m64AnnulusInterior, |
| 63 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 64 | m60AreaGram g A.map p 0 1 = 0 := by |
| 65 | have hcont (i j : Fin 2) : |
| 66 | ContinuousOn (fun p => m60AreaGram g A.map p i j) m64AnnulusInterior := by |
| 67 | intro p hp |
| 68 | exact (m64AreaGram_entry_contDiffAt |
| 69 | (hf.contMDiffAt (isOpen_m64AnnulusInterior.mem_nhds hp)) i j).continuousAt.continuousWithinAt |
| 70 | rw [Measure.restrict_congr_set m64AnnulusDomain_ae_eq_interior] at hconformal |
| 71 | have hclosure : m64AnnulusInterior ⊆ closure (interior m64AnnulusInterior) := by |
| 72 | rw [isOpen_m64AnnulusInterior.interior_eq] |
| 73 | exact subset_closure |
| 74 | have hdiag := MeasureTheory.Measure.eqOn_of_ae_eq (hconformal.mono fun _ h => h.1) |
| 75 | (continuousOn_const.mul (hcont 0 0)) (continuousOn_const.mul (hcont 1 1)) hclosure |
| 76 | have hcross := MeasureTheory.Measure.eqOn_of_ae_eq (hconformal.mono fun _ h => h.2) |
| 77 | (hcont 0 1) continuousOn_const hclosure |
| 78 | exact fun p hp => ⟨hdiag hp, hcross hp⟩ |
| 79 | |
| 80 | /-- Smooth Gram coefficients extend the actual modulus-conformal identities to the whole |
| 81 | closed rectangle. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 82 | project derivation |
| 83 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 84 | theorem m64Annulus_modulus_conformal_on_domain_of_ae |
| 85 | (A : M64Annulus g c0 c1) (r : ℝ) {O : Set LoopPlane} |
| 86 | (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 87 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map O) |
| 88 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 89 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 90 | m60AreaGram g A.map p 0 1 = 0) : |
| 91 | ∀ p ∈ m64AnnulusDomain, |
| 92 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 93 | m60AreaGram g A.map p 0 1 = 0 := by |
| 94 | have hsub : m64AnnulusInterior ⊆ m64AnnulusDomain := by |
| 95 | rw [← m64AnnulusInterior_closure] |
| 96 | exact subset_closure |
| 97 | have hpoint := m64Annulus_modulus_conformal_on_interior_of_ae A r |
| 98 | (hf.mono (hsub.trans hdom)) hconformal |
| 99 | have hcont (i j : Fin 2) : |
| 100 | ContinuousOn (fun p => m60AreaGram g A.map p i j) m64AnnulusDomain := by |
| 101 | intro p hp |
| 102 | exact (m64AreaGram_entry_contDiffAt |
| 103 | (hf.contMDiffAt (hO.mem_nhds (hdom hp))) i j).continuousAt.continuousWithinAt |
| 104 | have hclosure : m64AnnulusDomain ⊆ closure m64AnnulusInterior := by |
| 105 | rw [m64AnnulusInterior_closure] |
| 106 | have hdiag : EqOn (fun p => r * m60AreaGram g A.map p 0 0) |
| 107 | (fun p => r⁻¹ * m60AreaGram g A.map p 1 1) m64AnnulusInterior := |
| 108 | fun p hp => (hpoint p hp).1 |
| 109 | have hcross : EqOn (fun p => m60AreaGram g A.map p 0 1) |
| 110 | (fun _ => (0 : ℝ)) m64AnnulusInterior := fun p hp => (hpoint p hp).2 |
| 111 | exact fun p hp => ⟨hdiag.of_subset_closure (continuousOn_const.mul (hcont 0 0)) |
| 112 | (continuousOn_const.mul (hcont 1 1)) hsub hclosure hp, |
| 113 | hcross.of_subset_closure (hcont 0 1) continuousOn_const hsub hclosure hp⟩ |
| 114 | |
| 115 | /-- The actual differentiated weighted Gram identities extend from the interior to the |
| 116 | closed rectangle by continuity. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 117 | 19.16, pp. 447-449; project derivation |
| 118 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 119 | theorem m64Annulus_modulus_conformal_fderiv_on_domain_of_ae |
| 120 | (A : M64Annulus g c0 c1) (r : ℝ) {O : Set LoopPlane} |
| 121 | (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 122 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map O) |
| 123 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 124 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 125 | m60AreaGram g A.map p 0 1 = 0) : |
| 126 | ∀ p ∈ m64AnnulusDomain, |
| 127 | fderiv ℝ (m64ModulusEnergyDensity g r A.map) p = |
| 128 | fderiv ℝ (fun q => r * m60AreaGram g A.map q 0 0) p ∧ |
| 129 | fderiv ℝ (fun q => m60AreaGram g A.map q 0 1) p = 0 := by |
| 130 | have hsub : m64AnnulusInterior ⊆ m64AnnulusDomain := by |
| 131 | rw [← m64AnnulusInterior_closure] |
| 132 | exact subset_closure |
| 133 | have hpoint := m64Annulus_modulus_conformal_on_interior_of_ae A r |
| 134 | (hf.mono (hsub.trans hdom)) hconformal |
| 135 | have hGram (i j : Fin 2) : ContDiffOn ℝ ∞ (fun q => m60AreaGram g A.map q i j) O := |
| 136 | fun p hp => (m64AreaGram_entry_contDiffAt |
| 137 | (hf.contMDiffAt (hO.mem_nhds hp)) i j).contDiffWithinAt |
| 138 | have hcont (i j : Fin 2) : ContinuousOn |
| 139 | (fun p => fderiv ℝ (fun q => m60AreaGram g A.map q i j) p) m64AnnulusDomain := |
| 140 | ((hGram i j).fderiv_of_isOpen hO (m := ∞) (by simp)).continuousOn.mono hdom |
| 141 | have hdiag : EqOn |
| 142 | (fun p => fderiv ℝ (m64ModulusEnergyDensity g r A.map) p) |
| 143 | (fun p => fderiv ℝ (fun q => r * m60AreaGram g A.map q 0 0) p) |
| 144 | m64AnnulusInterior := by |
| 145 | intro p hp |
| 146 | apply Filter.EventuallyEq.fderiv_eq |
| 147 | filter_upwards [isOpen_m64AnnulusInterior.mem_nhds hp] with q hq |
| 148 | unfold m64ModulusEnergyDensity |
| 149 | rw [← (hpoint q hq).1] |
| 150 | ring |
| 151 | have hcross : EqOn |
| 152 | (fun p => fderiv ℝ (fun q => m60AreaGram g A.map q 0 1) p) |
| 153 | (fun _ => (0 : LoopPlane →L[ℝ] ℝ)) m64AnnulusInterior := by |
| 154 | intro p hp |
| 155 | have heq : (fun q => m60AreaGram g A.map q 0 1) =ᶠ[𝓝 p] fun _ => (0 : ℝ) := by |
| 156 | filter_upwards [isOpen_m64AnnulusInterior.mem_nhds hp] with q hq |
| 157 | exact (hpoint q hq).2 |
| 158 | simpa only [fderiv_const_apply] using heq.fderiv_eq (𝕜 := ℝ) |
| 159 | have hclosure : m64AnnulusDomain ⊆ closure m64AnnulusInterior := by |
| 160 | rw [m64AnnulusInterior_closure] |
| 161 | have hE := ((m64ModulusEnergyDensity_contDiffOn (g := g) r hO hf).fderiv_of_isOpen hO |
| 162 | (m := ∞) (by simp)).continuousOn.mono hdom |
| 163 | have h00 := (((contDiffOn_const (c := r)).mul (hGram 0 0)).fderiv_of_isOpen hO |
| 164 | (m := ∞) (by simp)).continuousOn.mono hdom |
| 165 | exact fun p hp => ⟨hdiag.of_subset_closure hE h00 hsub hclosure hp, |
| 166 | hcross.of_subset_closure (hcont 0 1) continuousOn_const hsub hclosure hp⟩ |
| 167 | |
| 168 | end PoincareMT |