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.Surgery.StandardCap.Persistence.SourceNames.Normalization |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Limit.Initial.InitialPhaseBounds |
| 3 | import PoincareLib.Geometry.Riemannian.Coordinates.Exponential.SmoothExtension |
| 4 | |
| 5 | /-! |
| 6 | # Geodesic transport through the actual comparison chart |
| 7 | |
| 8 | The metric pullback germ gives the coordinate geodesic equation in |
| 9 | any smooth comparison chart. This connects the physical exponential |
| 10 | families to the normalized fields of Morgan--Tian, Claim 16.6, |
| 11 | pp. 371-372; see `derivations/18-actual-geodesic-transport.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | namespace PoincareMT.RiemannianMetric |
| 21 | |
| 22 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | /-- An actual composition germ determines the pullback coefficients, |
| 28 | with both slots differentiated through the same coordinate map. |
| 29 | Source: the coordinate step in Claim 16.6, pp. 371-372. -/ |
| 30 | theorem pullbackCoefficients_eq_of_comp_germ (g : RiemannianMetric n M) |
| 31 | {a e : E → M} {f : E → E} {x : E} |
| 32 | (he : MDifferentiableAt (𝓡 n) (𝓡 n) e (f x)) |
| 33 | (hf : DifferentiableAt ℝ f x) (hcomp : e ∘ f =ᶠ[𝓝 x] a) (v w : E) : |
| 34 | g.pullbackCoefficients a x v w = |
| 35 | g.pullbackCoefficients e (f x) (fderiv ℝ f x v) (fderiv ℝ f x w) := by |
| 36 | have hd := mfderiv_comp x he hf.mdifferentiableAt |
| 37 | rw [hcomp.mfderiv_eq, mfderiv_eq_fderiv] at hd |
| 38 | have hv := congrArg (fun D => D v) hd |
| 39 | have hw := congrArg (fun D => D w) hd |
| 40 | change g.inner (a x) (mfderiv (𝓡 n) (𝓡 n) a x v) (mfderiv (𝓡 n) (𝓡 n) a x w) = |
| 41 | g.inner (e (f x)) |
| 42 | (mfderiv (𝓡 n) (𝓡 n) e (f x) (fderiv ℝ f x v)) |
| 43 | (mfderiv (𝓡 n) (𝓡 n) e (f x) (fderiv ℝ f x w)) |
| 44 | simp only [TangentSpace] at hv hw ⊢ |
| 45 | rw [hv, hw] |
| 46 | exact congrArg (fun y : M => g.inner y |
| 47 | (mfderiv (𝓡 n) (𝓡 n) e (f x) (fderiv ℝ f x v)) |
| 48 | (mfderiv (𝓡 n) (𝓡 n) e (f x) (fderiv ℝ f x w))) hcomp.self_of_nhds.symm |
| 49 | |
| 50 | private theorem partialCoordinateChange_smooth |
| 51 | (e : PartialDiffeomorph (𝓡 n) (𝓡 n) E M ∞) (p : M) |
| 52 | {x : E} (hx : x ∈ (extChartAt (𝓡 n) p).target) |
| 53 | (hxe : (extChartAt (𝓡 n) p).symm x ∈ e.target) : |
| 54 | ContDiffAt ℝ ∞ (fun y => e.symm ((extChartAt (𝓡 n) p).symm y)) x := by |
| 55 | apply contMDiffAt_iff_contDiffAt.mp |
| 56 | exact (e.symm.contMDiffOn.contMDiffAt (e.open_target.mem_nhds hxe)).comp x |
| 57 | ((contMDiffOn_extChartAt_symm p).contMDiffAt |
| 58 | ((isOpen_extChartAt_target (I := 𝓡 n) p).mem_nhds hx)) |
| 59 | |
| 60 | private theorem partialCoordinateChange_metric |
| 61 | (g : RiemannianMetric n M) |
| 62 | (e : PartialDiffeomorph (𝓡 n) (𝓡 n) E M ∞) (p : M) |
| 63 | {x : E} (hx : x ∈ (extChartAt (𝓡 n) p).target) |
| 64 | (hxe : (extChartAt (𝓡 n) p).symm x ∈ e.target) (v w : E) : |
| 65 | g.pullbackCoefficients (extChartAt (𝓡 n) p).symm x v w = |
| 66 | g.pullbackCoefficients e (e.symm ((extChartAt (𝓡 n) p).symm x)) |
| 67 | (fderiv ℝ (fun y => e.symm ((extChartAt (𝓡 n) p).symm y)) x v) |
| 68 | (fderiv ℝ (fun y => e.symm ((extChartAt (𝓡 n) p).symm y)) x w) := by |
| 69 | have hc := (contMDiffOn_extChartAt_symm (I := 𝓡 n) (n := ∞) p).contMDiffAt |
| 70 | ((isOpen_extChartAt_target (I := 𝓡 n) p).mem_nhds hx) |
| 71 | have he := e.contMDiffOn.contMDiffAt (e.open_source.mem_nhds (e.map_target hxe)) |
| 72 | apply g.pullbackCoefficients_eq_of_comp_germ (he.mdifferentiableAt (by simp)) |
| 73 | ((partialCoordinateChange_smooth e p hx hxe).differentiableAt (by simp)) |
| 74 | filter_upwards [hc.continuousAt.preimage_mem_nhds (e.open_target.mem_nhds hxe)] with y hy |
| 75 | exact e.right_inv hy |
| 76 | |
| 77 | /-- A physical chart geodesic satisfies the actual pulled-back equation |
| 78 | in a comparison chart wherever the two charts overlap. |
| 79 | Source: Claim 16.6, pp. 371-372, and the coordinate Koszul formula. -/ |
| 80 | theorem hasDerivAt_geodesic_in_partialDiffeomorph |
| 81 | (g : RiemannianMetric n M) |
| 82 | (e : PartialDiffeomorph (𝓡 n) (𝓡 n) E M ∞) (p : M) |
| 83 | {q w : ℝ → E} {t : ℝ} |
| 84 | (hqt : q t ∈ (extChartAt (𝓡 n) p).target) |
| 85 | (hqe : (extChartAt (𝓡 n) p).symm (q t) ∈ e.target) |
| 86 | (hq : HasDerivAt q (w t) t) |
| 87 | (hw : HasDerivAt w |
| 88 | (-coordinateChristoffel (g.pullbackCoefficients (extChartAt (𝓡 n) p).symm) |
| 89 | (q t) (w t) (w t)) t) : |
| 90 | let f := fun y => e.symm ((extChartAt (𝓡 n) p).symm y) |
| 91 | HasDerivAt (fun s => f (q s)) (fderiv ℝ f (q t) (w t)) t ∧ |
| 92 | HasDerivAt (fun s => fderiv ℝ f (q s) (w s)) |
| 93 | (-coordinateChristoffel (g.pullbackCoefficients e) (f (q t)) |
| 94 | (fderiv ℝ f (q t) (w t)) (fderiv ℝ f (q t) (w t))) t := by |
| 95 | let f := fun y => e.symm ((extChartAt (𝓡 n) p).symm y) |
| 96 | have hc := (contMDiffOn_extChartAt_symm (I := 𝓡 n) (n := ∞) p).contMDiffAt |
| 97 | ((isOpen_extChartAt_target (I := 𝓡 n) p).mem_nhds hqt) |
| 98 | have he := e.contMDiffOn.contMDiffAt (e.open_source.mem_nhds (e.map_target hqe)) |
| 99 | have hmetric : ∀ᶠ y in 𝓝 (q t), ∀ v w, |
| 100 | g.pullbackCoefficients (extChartAt (𝓡 n) p).symm y v w = |
| 101 | g.pullbackCoefficients e (f y) (fderiv ℝ f y v) (fderiv ℝ f y w) := by |
| 102 | filter_upwards [(isOpen_extChartAt_target (I := 𝓡 n) p).mem_nhds hqt, |
| 103 | hc.continuousAt.preimage_mem_nhds (e.open_target.mem_nhds hqe)] with y hy hye v w |
| 104 | exact partialCoordinateChange_metric g e p hy hye v w |
| 105 | have hBinv := g.isInvertible_chartCoefficients p hqt |
| 106 | have heD : e.toOpenPartialHomeomorph.MDifferentiable (𝓡 n) (𝓡 n) := |
| 107 | ⟨e.mdifferentiableOn (by simp), e.symm.mdifferentiableOn (by simp)⟩ |
| 108 | have hCinv := g.isInvertible_pullbackCoefficients (heD.mfderiv_injective (e.map_target hqe)) |
| 109 | have hsurj : Function.Surjective (fderiv ℝ f (q t)) := by |
| 110 | apply (LinearMap.injective_iff_surjective_of_finrank_eq_finrank rfl).mp |
| 111 | intro v w hvw |
| 112 | apply hBinv.injective |
| 113 | ext z |
| 114 | change fderiv ℝ f (q t) v = fderiv ℝ f (q t) w at hvw |
| 115 | rw [hmetric.self_of_nhds v z, hmetric.self_of_nhds w z, hvw] |
| 116 | exact hasDerivAt_geodesic_change_coordinates |
| 117 | ((g.contDiffAt_pullbackCoefficients hc).differentiableAt (by simp)) |
| 118 | ((g.contDiffAt_pullbackCoefficients he).differentiableAt (by simp)) hBinv hCinv |
| 119 | (fun v w => g.symm _ _ _) (partialCoordinateChange_smooth e p hqt hqe) |
| 120 | hsurj hmetric hq hw |
| 121 | |
| 122 | /-- The inverse-chart position and its actual derivative form a solution |
| 123 | of the pulled-back geodesic phase equation at every valid time, including |
| 124 | endpoints. Source: Claim 16.6, pp. 371-372. -/ |
| 125 | theorem IsGeodesicOn.hasDerivAt_phase_in_partialDiffeomorph |
| 126 | {g : RiemannianMetric n M} {γ : ℝ → M} {S : Set ℝ} |
| 127 | (hγ : g.IsGeodesicOn γ S) |
| 128 | (e : PartialDiffeomorph (𝓡 n) (𝓡 n) E M ∞) {t : ℝ} (ht : t ∈ S) |
| 129 | (he : γ t ∈ e.target) : |
| 130 | HasDerivAt (fun s => (e.symm (γ s), deriv (fun u => e.symm (γ u)) s)) |
| 131 | (coordinateGeodesicField (g.pullbackCoefficients e) |
| 132 | (e.symm (γ t), deriv (fun u => e.symm (γ u)) t)) t := by |
| 133 | let p := γ t |
| 134 | let c := extChartAt (𝓡 n) p |
| 135 | let q := fun u => c (γ u) |
| 136 | let f := fun y => e.symm (c.symm y) |
| 137 | let W := fun u => fderiv ℝ f (q u) (deriv q u) |
| 138 | obtain ⟨J, hJ, htJ, hgeo⟩ := hγ.exists_open_nhds ht |
| 139 | have hsource : γ t ∈ c.source := mem_extChartAt_source p |
| 140 | have hsrc : ∀ᶠ u in 𝓝 t, γ u ∈ c.source := |
| 141 | (hγ.contMDiffAt ht).continuousAt.preimage_mem_nhds |
| 142 | ((isOpen_extChartAt_source p).mem_nhds hsource) |
| 143 | have htarget : ∀ᶠ u in 𝓝 t, γ u ∈ e.target := |
| 144 | (hγ.contMDiffAt ht).continuousAt.preimage_mem_nhds (e.open_target.mem_nhds he) |
| 145 | have heq : (fun u => f (q u)) =ᶠ[𝓝 t] (fun u => e.symm (γ u)) := by |
| 146 | filter_upwards [hsrc] with u hu |
| 147 | exact congrArg e.symm (c.left_inv hu) |
| 148 | have hchange {u : ℝ} (huJ : u ∈ J) (hus : γ u ∈ c.source) (hue : γ u ∈ e.target) : |
| 149 | HasDerivAt (fun s => f (q s)) (W u) u ∧ |
| 150 | HasDerivAt W (-coordinateChristoffel (g.pullbackCoefficients e) |
| 151 | (f (q u)) (W u) (W u)) u := by |
| 152 | have hcoord := hgeo.hasDerivAt_chart_at huJ p hus |
| 153 | exact g.hasDerivAt_geodesic_in_partialDiffeomorph e p (c.map_source hus) |
| 154 | (by |
| 155 | change c.symm (q u) ∈ e.target |
| 156 | simpa only [q, c.left_inv hus] using hue) hcoord.1 hcoord.2 |
| 157 | have hvel : deriv (fun u => e.symm (γ u)) =ᶠ[𝓝 t] W := by |
| 158 | filter_upwards [hJ.mem_nhds htJ, hsrc, htarget, heq.deriv] with u huJ hus hue hdu |
| 159 | exact hdu.symm.trans (hchange huJ hus hue).1.deriv |
| 160 | obtain ⟨hp, hv⟩ := hchange htJ hsource he |
| 161 | have hpos : HasDerivAt (fun u => e.symm (γ u)) |
| 162 | (deriv (fun u => e.symm (γ u)) t) t := by |
| 163 | rw [hvel.self_of_nhds] |
| 164 | exact hp.congr_of_eventuallyEq heq.symm |
| 165 | have hacc : HasDerivAt (deriv (fun u => e.symm (γ u))) |
| 166 | (-coordinateChristoffel (g.pullbackCoefficients e) (e.symm (γ t)) |
| 167 | (deriv (fun u => e.symm (γ u)) t) (deriv (fun u => e.symm (γ u)) t)) t := by |
| 168 | have hpoint : f (q t) = e.symm (γ t) := heq.self_of_nhds |
| 169 | rw [hvel.self_of_nhds, ← hpoint] |
| 170 | exact hv.congr_of_eventuallyEq hvel |
| 171 | exact hpos.prodMk hacc |
| 172 | |
| 173 | end PoincareMT.RiemannianMetric |
| 174 | |
| 175 | namespace PoincareMT.SurgeryCapClose |
| 176 | |
| 177 | universe u |
| 178 | |
| 179 | /-- A physical geodesic of the normalized local-result metric satisfies |
| 180 | the very coefficient equation used in the initial convergence theorem. |
| 181 | Source: Claim 16.6, pp. 371-372. -/ |
| 182 | theorem hasDerivAt_normalized_geodesic_phase |
| 183 | {g₀ : StandardInitialMetric} {S : GeneralizedSliceCarrier.{u}} |
| 184 | {g : RiemannianMetric 3 S.carrier} {tip : S.carrier} {scale eta : ℝ} |
| 185 | (Q : SurgeryCapClose g₀ S g tip scale eta) {γ : ℝ → S.carrier} {I : Set ℝ} |
| 186 | (hγ : (m01RescaledMetric g (scale⁻¹ ^ 2) |
| 187 | (sq_pos_of_pos (inv_pos.mpr Q.scale_pos))).IsGeodesicOn γ I) |
| 188 | {t : ℝ} (ht : t ∈ I) (hchart : γ t ∈ Q.map '' g₀.metric.ball 0 eta⁻¹) : |
| 189 | HasDerivAt (fun s => (Q.inverse (γ s), deriv (fun u => Q.inverse (γ u)) s)) |
| 190 | (coordinateGeodesicField Q.normalizedCoefficients |
| 191 | (Q.inverse (γ t), deriv (fun u => Q.inverse (γ u)) t)) t := |
| 192 | hγ.hasDerivAt_phase_in_partialDiffeomorph Q.toPartialDiffeomorph ht hchart |
| 193 | |
| 194 | end PoincareMT.SurgeryCapClose |