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.ReducedGeometry.ReducedLength.Coordinates.ConnectionFrame |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Add |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 4 | |
| 5 | /-! |
| 6 | # Coefficients of a parametric section in a fixed local frame |
| 7 | |
| 8 | The coefficients are the actual localFrameCoeff functions. Their local |
| 9 | trivialization expression yields differentiability in parameter and position. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 15 | |
| 16 | open Filter |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local notation "V" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | set_option backward.isDefEq.respectTransparency false in |
| 27 | theorem mdifferentiableAt_parametric_frameCoeff {ι : Type*} |
| 28 | (b : Module.Basis ι ℝ V) (p q : M) (s : ℝ) |
| 29 | (H : ℝ → (x : M) → TangentSpace (𝓡 n) x) |
| 30 | (hq : q ∈ (trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p).baseSet) |
| 31 | (hH : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓡 n)) |
| 32 | (fun z : ℝ × M ↦ Bundle.TotalSpace.mk' V z.2 (H z.1 z.2)) (s, q)) (i : ι) : |
| 33 | let e := trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p |
| 34 | MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) |
| 35 | (fun z : ℝ × M ↦ e.localFrameCoeff (𝓡 n) b i z.2 (H z.1 z.2)) (s, q) := by |
| 36 | let e := trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p |
| 37 | let B : ℝ × M → TangentBundle (𝓡 n) M := |
| 38 | fun z ↦ Bundle.TotalSpace.mk' V z.2 (H z.1 z.2) |
| 39 | have hB : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 n) |
| 40 | (fun z ↦ (e (B z)).2) (s, q) := |
| 41 | ((e.mdifferentiableAt_totalSpace_iff (𝓡 n) B (e.mem_source.mpr hq)).mp hH).2 |
| 42 | let c : V →L[ℝ] ℝ := (b.coord i).toContinuousLinearMap |
| 43 | have hc := c.mdifferentiableAt.comp (s, q) hB |
| 44 | apply hc.congr_of_eventuallyEq |
| 45 | filter_upwards [continuous_snd.continuousAt.preimage_mem_nhds (e.open_baseSet.mem_nhds hq)] |
| 46 | with z hz |
| 47 | exact e.localFrameCoeff_eq_coeff (I := 𝓡 n) (b := b) (s := H z.1) hz |
| 48 | |
| 49 | set_option backward.isDefEq.respectTransparency false in |
| 50 | theorem parametric_frame_time_derivative {ι : Type*} [Fintype ι] |
| 51 | (g : RiemannianMetric n M) (b : Module.Basis ι ℝ V) (p q : M) (s : ℝ) |
| 52 | (H : ℝ → (x : M) → TangentSpace (𝓡 n) x) |
| 53 | (hq : q ∈ (trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p).baseSet) |
| 54 | (hH : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓡 n)) |
| 55 | (fun z : ℝ × M ↦ Bundle.TotalSpace.mk' V z.2 (H z.1 z.2)) (s, q)) : |
| 56 | let e := trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p |
| 57 | HasDerivAt (fun t ↦ H t q) |
| 58 | (∑ i, deriv (fun t ↦ e.localFrameCoeff (𝓡 n) b i q (H t q)) s • |
| 59 | e.localFrame b i q) s := by |
| 60 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 61 | ⟨g.toRiemannianMetric⟩ |
| 62 | let e := trivializationAt V (TangentSpace (𝓡 n) : M → Type _) p |
| 63 | have hc (i : ι) : DifferentiableAt ℝ |
| 64 | (fun t ↦ e.localFrameCoeff (𝓡 n) b i q (H t q)) s := |
| 65 | ((mdifferentiableAt_parametric_frameCoeff b p q s H hq hH i).comp s |
| 66 | (mdifferentiableAt_id.prodMk mdifferentiableAt_const)).differentiableAt |
| 67 | have hsum := HasDerivAt.fun_sum (u := Finset.univ) |
| 68 | (fun i _ ↦ (hc i).hasDerivAt.smul_const (e.localFrame b i q)) |
| 69 | convert! hsum using 1 |
| 70 | funext t |
| 71 | exact e.eq_sum_localFrameCoeff_smul (s := H t) (b := b) hq |
| 72 | |
| 73 | end PoincareMT.ReducedLength |