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.CurrentDivergence |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Finite.ModulusDivergence |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Finite.MetricDerivative |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Finite.RicciTrace |
| 5 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Finite.MotionEnergyIntegral |
| 6 | |
| 7 | /-! The literal moving weighted energy has the actual conormal |
| 8 | boundary derivative minus its Ricci trace. Source: MT Lemma 19.15, |
| 9 | pp. 447-449; finite-conormal-variation derivation. -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option autoImplicit false |
| 13 | set_option warningAsError true |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter MeasureTheory Bundle |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] [CompactSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | {a b : ℝ} {d : ℕ} {c0 c1 : ℝ → M} |
| 24 | |
| 25 | /-- The attained annulus and its actual finite parameter motion give the genuine four-face |
| 26 | first variation. Only closed C1 and interior smoothness are required of the base annulus. |
| 27 | Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 28 | derivation |
| 29 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 30 | theorem m64ParameterAnnulus_boundary_first_variation |
| 31 | (F : RicciFlow n M (Icc a b)) {t : ℝ} (ht : t ∈ Ioo a b) |
| 32 | (A : M64Annulus (F.metric t) c0 c1) {r : ℝ} (hr : 0 < r) |
| 33 | (hminimum : A.area = m64LeastAnnulusArea (F.metric t) c0 c1) |
| 34 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 35 | r * m60AreaGram (F.metric t) A.map p 0 0 = |
| 36 | r⁻¹ * m60AreaGram (F.metric t) A.map p 1 1 ∧ |
| 37 | m60AreaGram (F.metric t) A.map p 0 1 = 0) |
| 38 | (hA : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map m64AnnulusInterior) |
| 39 | {epsilon : ℝ} (hepsilon : 0 < epsilon) |
| 40 | (hTF : ∀ s ∈ Ioo (-epsilon) epsilon, t + s ∈ Ioo a b) |
| 41 | {O : Set (EuclideanSpace ℝ (Fin d))} (hO : IsOpen O) |
| 42 | {Phi : ℝ × EuclideanSpace ℝ (Fin d) → M} |
| 43 | (hPhi : ContMDiffOn 𝓘(ℝ, ℝ × EuclideanSpace ℝ (Fin d)) (𝓡 n) ∞ Phi |
| 44 | (Ioo (-epsilon) epsilon ×ˢ O)) |
| 45 | {h : LoopPlane → EuclideanSpace ℝ (Fin d)} |
| 46 | (hh : ContDiffOn ℝ 1 h m64AnnulusDomain) (hmap : MapsTo h m64AnnulusDomain O) |
| 47 | (hbase : ∀ p, Phi (0, h p) = A.map p) : |
| 48 | let v := fun s p => Phi (s, h p) |
| 49 | let J0 := fun p => r * m64FiniteAnnulusCurrent (F.metric t) v 0 p |
| 50 | let J1 := fun p => r⁻¹ * m64FiniteAnnulusCurrent (F.metric t) v 1 p |
| 51 | let R := fun p => |
| 52 | r * (F.connection t).ricci (v 0 p) |
| 53 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 54 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) + |
| 55 | r⁻¹ * (F.connection t).ricci (v 0 p) |
| 56 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 57 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 58 | HasDerivAt (fun s => ∫ p in m64AnnulusDomain, |
| 59 | m64ModulusEnergyDensity (F.metric (t + s)) r (v s) p) |
| 60 | (((∫ x in Icc (0 : ℝ) curvePeriod, J1 (annulusPoint x 1)) - |
| 61 | ∫ x in Icc (0 : ℝ) curvePeriod, J1 (annulusPoint x 0)) + |
| 62 | ((∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint curvePeriod y)) - |
| 63 | ∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint 0 y)) - |
| 64 | ∫ p in m64AnnulusDomain, R p) 0 := by |
| 65 | let v := fun s p => Phi (s, h p) |
| 66 | let J := m64FiniteAnnulusCurrent (F.metric t) v |
| 67 | let J0 := fun p => r * J 0 p |
| 68 | let J1 := fun p => r⁻¹ * J 1 p |
| 69 | let R := fun p => |
| 70 | r * (F.connection t).ricci (v 0 p) |
| 71 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 72 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) + |
| 73 | r⁻¹ * (F.connection t).ricci (v 0 p) |
| 74 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 75 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 76 | let E := fun s p => m64ModulusEnergyDensity (F.metric (t + s)) r (v s) p |
| 77 | let Q := fun p => fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 78 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1) |
| 79 | have hzero : (0 : ℝ) ∈ Ioo (-epsilon) epsilon := ⟨by linarith, hepsilon⟩ |
| 80 | have hopen : IsOpen (Ioo (-epsilon) epsilon ×ˢ O) := isOpen_Ioo.prod hO |
| 81 | have hsub : m64AnnulusInterior ⊆ interior m64AnnulusDomain := |
| 82 | interior_maximal m64AnnulusInterior_subset_domain isOpen_m64AnnulusInterior |
| 83 | have hv0 : ContMDiffOn (𝓡 2) (𝓡 n) 1 (v 0) m64AnnulusDomain := |
| 84 | (hPhi.of_le (by simp)).comp (contDiffOn_const.prodMk hh).contMDiffOn |
| 85 | (fun p hp => ⟨hzero, hmap hp⟩) |
| 86 | have hvint : ContMDiffOn (𝓡 2) (𝓡 n) ∞ (v 0) m64AnnulusInterior := by |
| 87 | change ContMDiffOn (𝓡 2) (𝓡 n) ∞ (fun p => Phi (0, h p)) m64AnnulusInterior |
| 88 | rw [funext hbase] |
| 89 | exact hA |
| 90 | have hV := m64ParameterAnnulus_timeVelocity_contMDiffOn isOpen_Ioo hO hPhi hh hmap hzero |
| 91 | have hc (i : Fin 2) : ContinuousOn (J i) m64AnnulusDomain := |
| 92 | m64FiniteAnnulusCurrent_continuousOn (F.metric t) hv0 hV.continuousOn i |
| 93 | have hdiff (i : Fin 2) (p : LoopPlane) (hp : p ∈ m64AnnulusInterior) : |
| 94 | DifferentiableAt ℝ (J i) p := |
| 95 | m64FiniteAnnulusCurrent_differentiableAt (F.metric t) (hsub hp) |
| 96 | (hvint.contMDiffAt (isOpen_m64AnnulusInterior.mem_nhds hp)) |
| 97 | (hV.contMDiffAt (mem_interior_iff_mem_nhds.mp (hsub hp))) i |
| 98 | have hR : IntegrableOn R m64AnnulusDomain volume := |
| 99 | m64Annulus_modulusRicci_integrable (F.connection t) r hv0 |
| 100 | obtain ⟨hE, hd⟩ := m64AnnulusMotionEnergy_hasDerivAt F t hepsilon hTF hO Phi |
| 101 | (by simpa +instances only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] using! hPhi) |
| 102 | r hh.contMDiffOn hmap |
| 103 | have hpoint (p : LoopPlane) (hp : p ∈ m64AnnulusInterior) : |
| 104 | deriv (fun s => E s p) 0 + R p = Q p := by |
| 105 | have hcoords : annulusPoint (p 0) (p 1) = p := by |
| 106 | ext i |
| 107 | fin_cases i <;> simp [annulusPoint] |
| 108 | have hdiv := m64ParameterAnnulus_modulusEnergyDensity_eq_current_divergence |
| 109 | (F.connection t) A hr hminimum hconformal hA hopen hPhi hh hbase |
| 110 | (x := p 0) (s := p 1) |
| 111 | (by rw [hcoords]; exact ⟨hzero, hmap (m64AnnulusInterior_subset_domain hp)⟩) |
| 112 | (by rw [hcoords]; exact hp) |
| 113 | have htime := m64ParameterAnnulus_moving_metric_energy_hasDerivAt F r ht hopen hPhi |
| 114 | ((hh.contDiffAt (mem_interior_iff_mem_nhds.mp (hsub hp))).differentiableAt one_ne_zero) |
| 115 | (show (0, h p) ∈ Ioo (-epsilon) epsilon ×ˢ O from |
| 116 | ⟨hzero, hmap (m64AnnulusInterior_subset_domain hp)⟩) |
| 117 | dsimp only at hdiv htime |
| 118 | simp only [hcoords] at hdiv |
| 119 | dsimp only [E, Q, J0, J1, R] |
| 120 | rw [htime.deriv, fderiv_const_mul (hdiff 0 p hp), fderiv_const_mul (hdiff 1 p hp)] |
| 121 | simp only [smul_apply, smul_eq_mul, EuclideanSpace.basisFun_apply] |
| 122 | dsimp only [J, v] at * |
| 123 | linarith only [hdiv] |
| 124 | have hae : (fun p => deriv (fun s => E s p) 0 + R p) =ᵐ[volume.restrict m64AnnulusDomain] Q := by |
| 125 | rw [Measure.restrict_congr_set m64AnnulusDomain_ae_eq_interior] |
| 126 | filter_upwards [ae_restrict_mem isOpen_m64AnnulusInterior.measurableSet] with p hp |
| 127 | exact hpoint p hp |
| 128 | have hQ : IntegrableOn Q m64AnnulusDomain volume := (hE.add hR).congr hae |
| 129 | have hboundary := m64Annulus_integral_divergence_of_continuous |
| 130 | ((hc 0).const_mul r) ((hc 1).const_mul r⁻¹) |
| 131 | (fun p hp => (hdiff 0 p hp).const_mul r) |
| 132 | (fun p hp => (hdiff 1 p hp).const_mul r⁻¹) hQ |
| 133 | apply hd.congr_deriv |
| 134 | have heq := integral_congr_ae hae |
| 135 | rw [integral_add hE hR] at heq |
| 136 | change (∫ p in m64AnnulusDomain, deriv (fun s => E s p) 0) = _ |
| 137 | rw [← hboundary] |
| 138 | linarith only [heq] |
| 139 | |
| 140 | end PoincareMT |