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.Surgery.StandardCap.Uniqueness.Mathlib.DiffeomorphDerivative |
| 2 | |
| 3 | /-! Totalized derivatives under the fixed pre-carrier diffeomorphism. |
| 4 | This calculus supports Morgan--Tian Definition 15.8, pp. 361-362, for the |
| 5 | transport derived in `proof-work/tasks/M51/derivations/2026-09-24-event-transport.md`. -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open scoped Manifold ContDiff |
| 10 | |
| 11 | namespace Diffeomorph |
| 12 | |
| 13 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 14 | {E₁ : Type*} [NormedAddCommGroup E₁] [NormedSpace 𝕜 E₁] |
| 15 | {E₂ : Type*} [NormedAddCommGroup E₂] [NormedSpace 𝕜 E₂] |
| 16 | {E₃ : Type*} [NormedAddCommGroup E₃] [NormedSpace 𝕜 E₃] |
| 17 | {H₁ : Type*} [TopologicalSpace H₁] {H₂ : Type*} [TopologicalSpace H₂] |
| 18 | {H₃ : Type*} [TopologicalSpace H₃] |
| 19 | {I₁ : ModelWithCorners 𝕜 E₁ H₁} {I₂ : ModelWithCorners 𝕜 E₂ H₂} |
| 20 | {I₃ : ModelWithCorners 𝕜 E₃ H₃} |
| 21 | {M₁ : Type*} [TopologicalSpace M₁] [ChartedSpace H₁ M₁] |
| 22 | {M₂ : Type*} [TopologicalSpace M₂] [ChartedSpace H₂ M₂] |
| 23 | {M₃ : Type*} [TopologicalSpace M₃] [ChartedSpace H₃ M₃] |
| 24 | {n : ℕ∞ω} |
| 25 | |
| 26 | /-- Precomposition by a diffeomorphism respects totalized derivatives. |
| 27 | This supports the reference-map transport for Definition 15.8, pp. 361-362. -/ |
| 28 | theorem mfderiv_precomp (e : Diffeomorph I₁ I₂ M₁ M₂ n) (hn : n ≠ 0) |
| 29 | (f : M₂ → M₃) (x : M₁) : |
| 30 | mfderiv I₁ I₃ (f ∘ e) x = |
| 31 | (mfderiv I₂ I₃ f (e x)).comp (mfderiv I₁ I₂ e x) := by |
| 32 | by_cases hf : MDifferentiableAt I₂ I₃ f (e x) |
| 33 | · exact _root_.mfderiv_comp x hf (e.contMDiff.mdifferentiable hn x) |
| 34 | · have hcomp : ¬ MDifferentiableAt I₁ I₃ (f ∘ e) x := by |
| 35 | intro h |
| 36 | have hback := h.comp_of_eq (e x) (e.symm.contMDiff.mdifferentiable hn _) |
| 37 | (e.symm_apply_apply x) |
| 38 | have heq : (f ∘ e) ∘ e.symm = f := funext (fun y => congrArg f (e.apply_symm_apply y)) |
| 39 | rw [heq] at hback |
| 40 | exact hf hback |
| 41 | rw [mfderiv_zero_of_not_mdifferentiableAt hcomp, |
| 42 | mfderiv_zero_of_not_mdifferentiableAt hf, ContinuousLinearMap.zero_comp] |
| 43 | |
| 44 | end Diffeomorph |