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 Mathlib.Analysis.Calculus.ContDiff.FiniteDimension |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 3 | |
| 4 | /-! |
| 5 | # Testing smooth linear-map families in finite dimension |
| 6 | -/ |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Module Function |
| 12 | open scoped Manifold ContDiff |
| 13 | |
| 14 | namespace Poincare.Spacetime.Realization |
| 15 | |
| 16 | variable {EB : Type*} [NormedAddCommGroup EB] [NormedSpace ℝ EB] |
| 17 | {HB : Type*} [TopologicalSpace HB] {IB : ModelWithCorners ℝ EB HB} |
| 18 | {B : Type*} [TopologicalSpace B] [ChartedSpace HB B] |
| 19 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ E] |
| 21 | {k : WithTop ℕ∞} |
| 22 | |
| 23 | theorem contMDiffWithinAt_clm_of_apply {f : B → E →L[ℝ] F} {s : Set B} {p : B} |
| 24 | (h : ∀ v, ContMDiffWithinAt IB 𝓘(ℝ, F) k (fun x ↦ f x v) s p) : |
| 25 | ContMDiffWithinAt IB 𝓘(ℝ, E →L[ℝ] F) k f s p := by |
| 26 | let d := finrank ℝ E |
| 27 | have hd : d = finrank ℝ (Fin d → ℝ) := (finrank_fin_fun ℝ).symm |
| 28 | let e₁ := ContinuousLinearEquiv.ofFinrankEq hd |
| 29 | let e₂ := (e₁.arrowCongr (1 : F ≃L[ℝ] F)).trans (ContinuousLinearEquiv.piRing (Fin d)) |
| 30 | rw [← id_comp f, ← e₂.symm_comp_self] |
| 31 | exact e₂.symm.contDiff.contMDiff.contMDiffAt.comp_contMDiffWithinAt p |
| 32 | (contMDiffWithinAt_pi_space.mpr fun i ↦ h _) |
| 33 | |
| 34 | theorem contMDiffAt_clm_of_apply {f : B → E →L[ℝ] F} {p : B} |
| 35 | (h : ∀ v, ContMDiffAt IB 𝓘(ℝ, F) k (fun x ↦ f x v) p) : |
| 36 | ContMDiffAt IB 𝓘(ℝ, E →L[ℝ] F) k f p := by |
| 37 | let d := finrank ℝ E |
| 38 | have hd : d = finrank ℝ (Fin d → ℝ) := (finrank_fin_fun ℝ).symm |
| 39 | let e₁ := ContinuousLinearEquiv.ofFinrankEq hd |
| 40 | let e₂ := (e₁.arrowCongr (1 : F ≃L[ℝ] F)).trans (ContinuousLinearEquiv.piRing (Fin d)) |
| 41 | rw [← id_comp f, ← e₂.symm_comp_self] |
| 42 | exact e₂.symm.contDiff.contMDiff.contMDiffAt.comp p (contMDiffAt_pi_space.mpr fun i ↦ h _) |
| 43 | |
| 44 | theorem contMDiffOn_clm_of_apply {f : B → E →L[ℝ] F} {s : Set B} |
| 45 | (h : ∀ v, ContMDiffOn IB 𝓘(ℝ, F) k (fun x ↦ f x v) s) : |
| 46 | ContMDiffOn IB 𝓘(ℝ, E →L[ℝ] F) k f s := by |
| 47 | let d := finrank ℝ E |
| 48 | have hd : d = finrank ℝ (Fin d → ℝ) := (finrank_fin_fun ℝ).symm |
| 49 | let e₁ := ContinuousLinearEquiv.ofFinrankEq hd |
| 50 | let e₂ := (e₁.arrowCongr (1 : F ≃L[ℝ] F)).trans (ContinuousLinearEquiv.piRing (Fin d)) |
| 51 | rw [← id_comp f, ← e₂.symm_comp_self] |
| 52 | exact e₂.symm.contDiff.contMDiff.comp_contMDiffOn (contMDiffOn_pi_space.mpr fun i ↦ h _) |
| 53 | |
| 54 | end Poincare.Spacetime.Realization |