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.Generalized.ReducedGeometry.Exponential.InitialValue.InitialVectorVariation |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | |
| 4 | /-! |
| 5 | # Smooth coordinate velocities of actual exponential lines |
| 6 | |
| 7 | Morgan-Tian Lemma 6.22 and Proposition 6.30, pp. 115-116, 118-119. |
| 8 | The supplied family's smoothness restricts to a surviving affine line. |
| 9 | At an interior square time its actual inverse-gauge velocity is smooth |
| 10 | in the line parameter, by parameterized differentiation in Mathlib. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 23 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 24 | {T : ℝ} {x : G.Point} |
| 25 | |
| 26 | private theorem horizontal_t2Space : T2Space (G.Horizontal x) := |
| 27 | FiberBundle.t2Space (EuclideanSpace ℝ (Fin n)) G.Horizontal x |
| 28 | |
| 29 | attribute [local instance] horizontal_t2Space |
| 30 | |
| 31 | /-- Every common surviving affine line is smooth on the actual closed |
| 32 | prefix, Lemma 6.22, pp. 115-116. -/ |
| 33 | theorem exponentialLine_contMDiffOn (E : M14ExponentialFamily G T x) |
| 34 | (Z W : G.Horizontal x) {b : ℝ} {U : Set ℝ} |
| 35 | (hsurv : ∀ r ∈ U, (Z + r • W, b) ∈ E.domain) : |
| 36 | ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ |
| 37 | (fun z : ℝ × ℝ => E.gamma (Z + z.2 • W) z.1) (Icc 0 b ×ˢ U) := by |
| 38 | let metric := G.spacetime.horizontalMetric.toRiemannianMetric |
| 39 | let : NormedAddCommGroup (G.Horizontal x) := |
| 40 | (metric.toCore x).toNormedAddCommGroupOfTopology |
| 41 | (metric.continuousAt x) (metric.isVonNBounded x) |
| 42 | let : InnerProductSpace ℝ (G.Horizontal x) := |
| 43 | .ofCoreOfTopology (metric.toCore x) (metric.continuousAt x) (metric.isVonNBounded x) |
| 44 | let : Bundle.RiemannianBundle (G.Horizontal : G.Point → Type _) := ⟨metric⟩ |
| 45 | have hk : ContDiff ℝ ∞ (fun z : ℝ × ℝ => (Z + z.2 • W, z.1)) := |
| 46 | (contDiff_const.add (contDiff_snd.smul contDiff_const)).prodMk contDiff_fst |
| 47 | have hkM : ContMDiff ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) |
| 48 | ((𝓘(ℝ, G.Horizontal x)).prod (𝓘(ℝ, ℝ))) ∞ |
| 49 | (fun z : ℝ × ℝ => (Z + z.2 • W, z.1)) := by |
| 50 | rw [← modelWithCornersSelf_prod, ← modelWithCornersSelf_prod, |
| 51 | chartedSpaceSelf_prod, chartedSpaceSelf_prod] |
| 52 | exact hk.contMDiff |
| 53 | exact E.family_smooth.comp hkM.contMDiffOn |
| 54 | (fun z hz => (E.maximal_lifetime _).out (E.domain_zero _) (hsurv z.2 hz.2) hz.1) |
| 55 | |
| 56 | /-- Interior meeting points of an actual surviving exponential line |
| 57 | have ordinary joint smoothness, Proposition 6.30, pp. 118-119. -/ |
| 58 | theorem exponentialLine_contMDiffAt (E : M14ExponentialFamily G T x) |
| 59 | (Z W : G.Horizontal x) {b c r : ℝ} {U : Set ℝ} (hU : IsOpen U) |
| 60 | (hsurv : ∀ v ∈ U, (Z + v • W, b) ∈ E.domain) |
| 61 | (hc : c ∈ Ioo 0 b) (hr : r ∈ U) : |
| 62 | ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ |
| 63 | (fun z : ℝ × ℝ => E.gamma (Z + z.2 • W) z.1) (c, r) := by |
| 64 | apply (exponentialLine_contMDiffOn E Z W hsurv (c, r) |
| 65 | ⟨Ioo_subset_Icc_self hc, hr⟩).contMDiffAt |
| 66 | exact mem_of_superset ((isOpen_Ioo.prod hU).mem_nhds ⟨hc, hr⟩) |
| 67 | (fun _ hz => ⟨Ioo_subset_Icc_self hz.1, hz.2⟩) |
| 68 | |
| 69 | /-- Actual spatial coordinates and their time velocity are smooth in |
| 70 | the line parameter at every interior gauge meeting point, |
| 71 | Proposition 6.30, pp. 118-119. -/ |
| 72 | theorem exponentialLine_gauge_coordinate_velocity_contDiffAt |
| 73 | (E : M14ExponentialFamily G T x) (Z W : G.Horizontal x) |
| 74 | {b c r : ℝ} {U : Set ℝ} (hU : IsOpen U) |
| 75 | (hsurv : ∀ v ∈ U, (Z + v • W, b) ∈ E.domain) |
| 76 | (hc : c ∈ Ioo 0 b) (hr : r ∈ U) (j : G.gaugeCover.index) |
| 77 | (lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval j)).Point × |
| 78 | G.gaugeCover.spatial j) |
| 79 | (hlift : ContMDiffAt (spacetimeModel n) (spacetimeModel n) ∞ lift |
| 80 | (E.gamma (Z + r • W) c)) : |
| 81 | ContDiffAt ℝ ∞ (fun z : ℝ × ℝ => (lift (E.gamma (Z + z.2 • W) z.1)).2.val) (c, r) ∧ |
| 82 | ContDiffAt ℝ ∞ (fun v => deriv (fun s => (lift (E.gamma (Z + v • W) s)).2.val) c) r := by |
| 83 | have hF := exponentialLine_contMDiffAt E Z W hU hsurv hc hr |
| 84 | have hL := hlift.comp (c, r) hF |
| 85 | have hq : ContDiffAt ℝ ∞ |
| 86 | (fun z : ℝ × ℝ => (lift (E.gamma (Z + z.2 • W) z.1)).2.val) (c, r) := by |
| 87 | have h := (contMDiff_subtype_val.contMDiffAt.comp (c, r) |
| 88 | (contMDiff_snd.contMDiffAt.comp (c, r) hL)) |
| 89 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 90 | exact h.contDiffAt |
| 91 | refine ⟨hq, ?_⟩ |
| 92 | have hswap : ContDiffAt ℝ ∞ |
| 93 | (fun z : ℝ × ℝ => (lift (E.gamma (Z + z.1 • W) z.2)).2.val) (r, c) := by |
| 94 | have hk : ContDiffAt ℝ ∞ (fun z : ℝ × ℝ => (z.2, z.1)) (r, c) := |
| 95 | contDiffAt_snd.prodMk contDiffAt_fst |
| 96 | have h := hq.comp (r, c) hk |
| 97 | exact h |
| 98 | have hd : ContDiffAt ℝ ∞ |
| 99 | (fun v => fderiv ℝ (fun s => (lift (E.gamma (Z + v • W) s)).2.val) c) r := |
| 100 | hswap.fderiv (g := fun _ => c) contDiffAt_const (by simp) |
| 101 | simpa only [fderiv_apply_one_eq_deriv] using hd.clm_apply (contDiffAt_const (c := (1 : ℝ))) |
| 102 | |
| 103 | end PoincareMT.M14 |