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.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C1.ChartPullback |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Embedding.HessianVector |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Geodesic.Connection |
| 5 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 6 | |
| 7 | /-! |
| 8 | # Pushing an actual C1 field through a smooth map |
| 9 | |
| 10 | The actual chart pullback and coordinate Hessian cancel their Christoffel |
| 11 | terms with only finite C1 germs for the base curve and tangent field. |
| 12 | MT2007 Claim 19.1, p. 437, and Lemma 19.6, pp. 441-442; |
| 13 | `2026-09-22-fixed-label-spatial-witnesses.md`, statement 1. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Bundle Topology |
| 21 | |
| 22 | universe u v |
| 23 | |
| 24 | namespace PoincareMT.M63 |
| 25 | |
| 26 | open Proofs.M09 |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 30 | {ι : Type v} [Fintype ι] |
| 31 | |
| 32 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 33 | local notation "W" => EuclideanSpace ℝ ι |
| 34 | |
| 35 | /-- The actual differential of a smooth map applied to a C1 field along |
| 36 | a C1 curve has the Hessian-plus-pullback derivative. MT2007 Claim 19.1, |
| 37 | p. 437; fixed-label spatial witnesses, statement 1. -/ |
| 38 | theorem hasDerivAt_embedding_pushforward_of_contMDiffAt_one |
| 39 | {g : RiemannianMetric n M} (D : LeviCivitaData g) {e : M → W} |
| 40 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) {gamma : ℝ → M} {x : ℝ} |
| 41 | (hgamma : ContMDiffAt 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma x) |
| 42 | (Y : (s : ℝ) → TangentSpace (𝓡 n) (gamma s)) |
| 43 | (hY : ContMDiffAt 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 44 | (fun s => (⟨gamma s, Y s⟩ : TangentBundle (𝓡 n) M)) x) : |
| 45 | HasDerivAt (fun s => (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma s) (Y s) : W)) |
| 46 | (HAdd.hAdd (α := W) (β := W) (γ := W) |
| 47 | (coordinateHessian D e (gamma x) (curveVelocity gamma x) (Y x)) |
| 48 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma x) |
| 49 | (rampHorizontalCovariantDerivative D gamma Y x))) x := by |
| 50 | obtain ⟨Vg, hVg, hg⟩ := (contMDiffAt_iff_contMDiffOn_nhds (by norm_num)).mp hgamma |
| 51 | obtain ⟨VY, hVY, hYon⟩ := (contMDiffAt_iff_contMDiffOn_nhds (by norm_num)).mp hY |
| 52 | obtain ⟨O, hOsub, hO, hxO⟩ := mem_nhds_iff.mp (inter_mem hVg hVY) |
| 53 | have hgO := hg.mono (hOsub.trans inter_subset_left) |
| 54 | have hYO := hYon.mono (hOsub.trans inter_subset_right) |
| 55 | let p := gamma x |
| 56 | let c := chartAt E p |
| 57 | let U := O ∩ gamma ⁻¹' c.source |
| 58 | have hU : IsOpen U := hgO.continuousOn.isOpen_inter_preimage hO c.open_source |
| 59 | have hx : x ∈ U := ⟨hxO, mem_chart_source E p⟩ |
| 60 | have hgU : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma U := hgO.mono inter_subset_left |
| 61 | let z : ℝ → E := fun r => c (gamma r) |
| 62 | let w : ℝ → E := fun r => mfderiv (𝓡 n) (𝓡 n) c (gamma r) (Y r) |
| 63 | let f : E → W := e ∘ c.symm |
| 64 | have hz : ContDiffOn ℝ 1 z U := |
| 65 | (contMDiffOn_chart.comp hgU (fun _ hr => hr.2)).contDiffOn |
| 66 | have hchart : ContMDiffOn (𝓡 n) (𝓡 n) 2 c c.source := contMDiffOn_chart |
| 67 | have hpushField := (hchart.contMDiffOn_tangentMapWithin (m := 1) (by norm_num) |
| 68 | c.open_source.uniqueMDiffOn).comp (hYO.mono inter_subset_left) (fun _ hr => hr.2) |
| 69 | have hw : ContDiffOn ℝ 1 w U := by |
| 70 | have h := ((contMDiff_snd_tangentBundle_modelSpace (n := 1) E (𝓡 n)).comp_contMDiffOn |
| 71 | hpushField).contDiffOn |
| 72 | apply h.congr |
| 73 | intro r hr |
| 74 | change mfderiv (𝓡 n) (𝓡 n) c (gamma r) (Y r) = |
| 75 | mfderivWithin (𝓡 n) (𝓡 n) c c.source (gamma r) (Y r) |
| 76 | rw [mfderivWithin_of_isOpen c.open_source hr.2] |
| 77 | have hfield (r : ℝ) (hr : r ∈ U) : |
| 78 | chartVectorField p (w r) (gamma r) = Y r := by |
| 79 | have hi : (mfderiv (𝓡 n) (𝓡 n) c (gamma r)).IsInvertible := |
| 80 | ⟨(mdifferentiable_chart (I := 𝓡 n) p).mfderiv hr.2, rfl⟩ |
| 81 | exact hi.inverse_apply_self (Y r) |
| 82 | have hdz : HasDerivAt z (deriv z x) x := |
| 83 | ((hz.contDiffAt (hU.mem_nhds hx)).differentiableAt (by norm_num)).hasDerivAt |
| 84 | have hdw : HasDerivAt w (deriv w x) x := |
| 85 | ((hw.contDiffAt (hU.mem_nhds hx)).differentiableAt (by norm_num)).hasDerivAt |
| 86 | have hvel : chartVectorField p (deriv z x) (gamma x) = curveVelocity gamma x := |
| 87 | chartVectorField_coordinate_velocity p gamma x (deriv z x) hx.2 |
| 88 | (hgamma.mdifferentiableAt (by norm_num)) hdz |
| 89 | have hf : ContDiffOn ℝ ∞ f c.target := |
| 90 | (he.comp_contMDiffOn (contMDiffOn_chart_symm (I := 𝓡 n) (x := p))).contDiffOn |
| 91 | have hpush (r : ℝ) (hr : r ∈ U) (v : E) : |
| 92 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma r) (chartVectorField p v (gamma r)) = |
| 93 | fderiv ℝ f (z r) v := by |
| 94 | have htarget : z r ∈ c.target := c.map_source hr.2 |
| 95 | have hchain := mfderiv_comp (z r) (he.mdifferentiable (by simp)).mdifferentiableAt |
| 96 | ((mdifferentiable_chart (I := 𝓡 n) p).mdifferentiableAt_symm htarget) |
| 97 | rw [mfderiv_eq_fderiv] at hchain |
| 98 | have hv := congrArg (fun L : E →L[ℝ] W => L v) hchain |
| 99 | change fderiv ℝ f (z r) v = |
| 100 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c.symm (z r)) |
| 101 | (mfderiv (𝓡 n) (𝓡 n) c.symm (z r) v) at hv |
| 102 | rw [← chartVectorField_at_inverse p v (z r) htarget, c.left_inv hr.2] at hv |
| 103 | exact hv.symm |
| 104 | have hlocal : (fun r => mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma r) (Y r)) =ᶠ[𝓝 x] |
| 105 | (fun r => fderiv ℝ f (z r) (w r)) := by |
| 106 | filter_upwards [hU.mem_nhds hx] with r hr |
| 107 | rw [← hfield r hr] |
| 108 | exact hpush r hr (w r) |
| 109 | have hD : HasFDerivAt (fderiv ℝ f) (fderiv ℝ (fderiv ℝ f) (z x)) (z x) := |
| 110 | (((hf.contDiffAt (c.open_target.mem_nhds (c.map_source hx.2))).fderiv_right |
| 111 | (m := ∞) (by simp)).differentiableAt (by simp)).hasFDerivAt |
| 112 | have hd := ((hD.comp_hasDerivAt x hdz).clm_apply hdw).congr_of_eventuallyEq hlocal |
| 113 | have hconn := chartVectorField_coordinateChristoffel D p (z x) |
| 114 | (c.map_source hx.2) (deriv z x) (w x) |
| 115 | have hbase : c.symm (z x) = gamma x := c.left_inv hx.2 |
| 116 | rw [hbase, hvel] at hconn |
| 117 | have hcov : rampHorizontalCovariantDerivative D gamma Y x = |
| 118 | chartVectorField p (deriv w x + |
| 119 | coordinateChristoffel (g.pullbackCoefficients c.symm) (z x) (deriv z x) (w x)) |
| 120 | (gamma x) := by |
| 121 | calc |
| 122 | _ = rampHorizontalCovariantDerivative D gamma |
| 123 | (fun r => chartVectorField p (w r) (gamma r)) x := |
| 124 | M62.pullback_congr D (γ := gamma) (Y := Y) |
| 125 | (Z := fun r => chartVectorField p (w r) (gamma r)) (by |
| 126 | filter_upwards [hU.mem_nhds hx] with r hr |
| 127 | exact (hfield r hr).symm) |
| 128 | _ = chartVectorField p (deriv w x) (gamma x) + |
| 129 | D.connection (chartVectorField p (w x)) (gamma x) (curveVelocity gamma x) := |
| 130 | pullback_chart_field_of_contDiff_one D p (hgamma.mdifferentiableAt (by norm_num)) |
| 131 | hx.2 hU hx w hw |
| 132 | _ = _ := by |
| 133 | rw [← hconn] |
| 134 | simp only [chartVectorField, VectorField.mpullback, map_add, c] |
| 135 | have hhess := coordinateHessian_eq_chart D he p (gamma x) hx.2 (deriv z x) (w x) |
| 136 | dsimp only at hhess |
| 137 | rw [hvel, hfield x hx] at hhess |
| 138 | convert! hd using 1 |
| 139 | rw [hhess, hcov, hpush x hx, map_add] |
| 140 | abel |
| 141 | |
| 142 | end PoincareMT.M63 |