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.Ramp.LocalFlow.Continuous.DependenceAngularJets |
| 2 | import PoincareLib.Geometry.Riemannian.Hessian.Tensor |
| 3 | |
| 4 | /-! |
| 5 | # Angular jets for a fixed metric and connection |
| 6 | |
| 7 | The smooth retained connection gives continuity of its scalar Hessians on |
| 8 | continuous tangent fields. This recovers the actual first and second angular |
| 9 | jets from embedded derivatives without a flow parameter. |
| 10 | |
| 11 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 12 | 450-453. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Bundle |
| 20 | |
| 21 | universe u v w |
| 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} |
| 28 | |
| 29 | /-- The smooth connection's scalar Hessian is continuous on continuous tangent fields. |
| 30 | Source: Auxiliary step for MT Definition 19.18 and Claims 19.19/19.22, pp. 450-453; project |
| 31 | construction in `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 32 | theorem m64_continuous_hessian_on_tangent_field |
| 33 | (D : LeviCivitaData g) {f : M → ℝ} |
| 34 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) |
| 35 | {Z : Type w} [TopologicalSpace Z] {gamma : Z → M} |
| 36 | {V : ∀ z, TangentSpace (𝓡 n) (gamma z)} |
| 37 | (hgamma : Continuous gamma) |
| 38 | (hV : Continuous (fun z => (⟨gamma z, V z⟩ : TangentBundle (𝓡 n) M))) : |
| 39 | Continuous (fun z => D.hessian f (gamma z) (V z) (V z)) := by |
| 40 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 41 | ⟨g.toRiemannianMetric⟩ |
| 42 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 43 | (TangentSpace (𝓡 n) : M → Type _) := |
| 44 | ⟨⟨g.inner, g.contMDiff.continuous, fun _ _ _ => rfl⟩⟩ |
| 45 | have hgrad := D.contMDiff_gradient hf |
| 46 | have hconnection := D.smooth.contMDiff.contMDiff |
| 47 | (show ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 48 | (∞ + 1) (T% (D.gradient f)) univ from by simpa using hgrad.contMDiffOn) |
| 49 | have hc := (contMDiffOn_univ.mp hconnection).continuous.comp hgamma |
| 50 | have hcv := hc.clm_bundle_apply hV |
| 51 | have hi := hcv.inner_bundle hV |
| 52 | exact hi.congr (fun z => (D.hessian_eq_inner_connection_gradient (hf (gamma z)) |
| 53 | (V z) (V z)).symm) |
| 54 | |
| 55 | /-- Recover continuous intrinsic first and second angular jets from the actual embedded |
| 56 | derivatives. Source: Auxiliary step for MT Definition 19.18 and Claims 19.19/19.22, pp. |
| 57 | 450-453; project construction in |
| 58 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 59 | theorem m64_continuous_angular_jets_of_embedded_jets |
| 60 | (D : LeviCivitaData g) |
| 61 | {ι : Type v} [Fintype ι] {Z : Type w} [TopologicalSpace Z] |
| 62 | (gamma : Z → ℝ → M) |
| 63 | (hC2 : ∀ z, ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (gamma z)) |
| 64 | {e : M → EuclideanSpace ℝ ι} |
| 65 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, EuclideanSpace ℝ ι) ∞ e) |
| 66 | {U : Set (EuclideanSpace ℝ ι)} (hU : IsOpen U) (heU : range e ⊆ U) |
| 67 | {rho : EuclideanSpace ℝ ι → M} |
| 68 | (hrho : ContMDiffOn 𝓘(ℝ, EuclideanSpace ℝ ι) (𝓡 n) ∞ rho U) |
| 69 | (hrhoe : ∀ p, rho (e p) = p) |
| 70 | (hzero : Continuous (fun z : Z × ℝ => e (gamma z.1 z.2))) |
| 71 | (hfirst : Continuous (fun z : Z × ℝ => deriv (fun y => e (gamma z.1 y)) z.2)) |
| 72 | (hsecond : Continuous (fun z : Z × ℝ => |
| 73 | deriv (deriv (fun y => e (gamma z.1 y))) z.2)) : |
| 74 | Continuous (fun z : Z × ℝ => gamma z.1 z.2) ∧ |
| 75 | Continuous (fun z : Z × ℝ => m63AngularFirstJet (n := n) (gamma z.1) z.2) ∧ |
| 76 | Continuous (fun z : Z × ℝ => m63AngularSecondJet D (gamma z.1) z.2) := by |
| 77 | let W := EuclideanSpace ℝ ι |
| 78 | have hgamma : Continuous (fun z : Z × ℝ => gamma z.1 z.2) := |
| 79 | (hrho.continuousOn.comp_continuous hzero |
| 80 | (fun _ => heU (mem_range_self _))).congr (fun z => hrhoe (gamma z.1 z.2)) |
| 81 | have hspace (z : Z) : ContDiff ℝ 2 (fun x => e (gamma z x)) := |
| 82 | ((he.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp (hC2 z)).contDiff |
| 83 | have hderiv (z : Z) (x : ℝ) : HasDerivAt (fun y => e (gamma z y)) |
| 84 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z x) |
| 85 | (curveVelocity (gamma z) x) : W) x := by |
| 86 | have hchain : fderiv ℝ (fun y => e (gamma z y)) x = |
| 87 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z x)).comp |
| 88 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (gamma z) x) := by |
| 89 | rw [← mfderiv_eq_fderiv] |
| 90 | exact mfderiv_comp x (he.mdifferentiable (by simp)).mdifferentiableAt |
| 91 | ((hC2 z x).mdifferentiableAt (by norm_num)) |
| 92 | exact ((hspace z).differentiable (by norm_num) x).hasDerivAt.congr_deriv |
| 93 | (congrArg (fun L : ℝ →L[ℝ] W => L 1) hchain) |
| 94 | have hpushFirst : Continuous (fun z : Z × ℝ => |
| 95 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z.1 z.2) |
| 96 | (curveVelocity (gamma z.1) z.2) : W)) := |
| 97 | hfirst.congr (fun z => (hderiv z.1 z.2).deriv) |
| 98 | have hangularFirst : Continuous (fun z : Z × ℝ => |
| 99 | m63AngularFirstJet (n := n) (gamma z.1) z.2) := |
| 100 | continuousOn_univ.mp |
| 101 | (M63.continuousOn_tangentSection_of_retraction_pushforward he hU heU hrho hrhoe |
| 102 | (fun z : Z × ℝ => gamma z.1 z.2) |
| 103 | (fun z => curveVelocity (gamma z.1) z.2) |
| 104 | hgamma.continuousOn hpushFirst.continuousOn) |
| 105 | have hHessian : Continuous (fun z : Z × ℝ => |
| 106 | (M63.coordinateHessian D e (gamma z.1 z.2) |
| 107 | (curveVelocity (gamma z.1) z.2) (curveVelocity (gamma z.1) z.2) : W)) := by |
| 108 | apply (PiLp.continuous_toLp 2 (fun _ : ι => ℝ)).comp |
| 109 | apply continuous_pi |
| 110 | intro i |
| 111 | have hei : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => e x i) := |
| 112 | (EuclideanSpace.proj i).contDiff.contMDiff.comp he |
| 113 | exact m64_continuous_hessian_on_tangent_field D hei hgamma hangularFirst |
| 114 | have hpushSecond : Continuous (fun z : Z × ℝ => |
| 115 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z.1 z.2) |
| 116 | (rampHorizontalCovariantDerivative D (gamma z.1) |
| 117 | (fun y => curveVelocity (gamma z.1) y) z.2) : W)) := by |
| 118 | apply (hsecond.sub hHessian).congr |
| 119 | intro z |
| 120 | simp only [Pi.sub_apply] |
| 121 | rw [M63.secondDeriv_embedding_eq_hessian_add_acceleration D he (hC2 z.1) z.2] |
| 122 | abel |
| 123 | exact ⟨hgamma, hangularFirst, continuousOn_univ.mp |
| 124 | (M63.continuousOn_tangentSection_of_retraction_pushforward he hU heU hrho hrhoe |
| 125 | (fun z : Z × ℝ => gamma z.1 z.2) |
| 126 | (fun z => rampHorizontalCovariantDerivative D (gamma z.1) |
| 127 | (fun y => curveVelocity (gamma z.1) y) z.2) |
| 128 | hgamma.continuousOn hpushSecond.continuousOn)⟩ |
| 129 | |
| 130 | end PoincareMT |