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.Manifold.OpenEmbedding |
| 2 | import PoincareLib.Geometry.Manifold.LocalDiffeomorph |
| 3 | import PoincareLib.Geometry.Riemannian.Metric.LocalDiffeomorph |
| 4 | |
| 5 | /-! |
| 6 | # Original chart maps restricted to an actual open target |
| 7 | |
| 8 | The local inverse of the target inclusion proves the restricted map |
| 9 | is a local diffeomorphism. Its literal commuting inclusion square |
| 10 | identifies both actual differentials used by metric descent. |
| 11 | Source: MT Proposition 5.14, pp. 90-91; |
| 12 | derivations/terminal-germs-overlap.md, Stage A5j2. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter TopologicalSpace |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT.M47 |
| 22 | |
| 23 | variable {n : ℕ} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] |
| 26 | |
| 27 | /-- Cancelling the actual open target inclusion preserves the local |
| 28 | diffeomorphism property, including for empty open targets. -/ |
| 29 | theorem terminalGerms_open_codomain_localDiffeomorph (V : Opens N) {f : M → V} |
| 30 | (hf : IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ (Subtype.val ∘ f)) : |
| 31 | IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ f := by |
| 32 | intro x |
| 33 | have hinc := Poincare.isLocalDiffeomorph_opensSubtypeVal (𝓡 n) V (f x) |
| 34 | have hcomp := (hf x).comp (𝓡 n) V hinc.localInverse_isLocalDiffeomorphAt |
| 35 | apply hcomp.congr_of_eventuallyEq |
| 36 | have hfc : Continuous f := hf.contMDiff.continuous.subtype_mk (fun x => (f x).property) |
| 37 | filter_upwards [hfc.continuousAt hinc.localInverse_eventuallyEq_left] with y hy |
| 38 | exact hy.symm |
| 39 | |
| 40 | /-- The source of the retained chart over an actual open target. -/ |
| 41 | def terminalGermsOpenChartSource (q : M → N) |
| 42 | (hq : IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ q) (V : Opens N) : Opens M := |
| 43 | ⟨q ⁻¹' (V : Set N), V.isOpen.preimage hq.contMDiff.continuous⟩ |
| 44 | |
| 45 | /-- The original chart map with its codomain restricted literally. -/ |
| 46 | def terminalGermsOpenChartMap (q : M → N) |
| 47 | (hq : IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ q) (V : Opens N) : |
| 48 | terminalGermsOpenChartSource q hq V → V := |
| 49 | fun x => ⟨q x.val, x.property⟩ |
| 50 | |
| 51 | theorem terminalGerms_openChartMap_localDiffeomorph (q : M → N) |
| 52 | (hq : IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ q) (V : Opens N) : |
| 53 | IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ (terminalGermsOpenChartMap q hq V) := by |
| 54 | apply terminalGerms_open_codomain_localDiffeomorph |
| 55 | intro x |
| 56 | exact (Poincare.isLocalDiffeomorph_opensSubtypeVal (𝓡 n) |
| 57 | (terminalGermsOpenChartSource q hq V) x).comp (𝓡 n) N (hq x.val) |
| 58 | |
| 59 | /-- The differentiated inclusion square uses the actual restricted |
| 60 | map, source inclusion, target inclusion, and original chart. -/ |
| 61 | theorem terminalGerms_openChartMap_differential (q : M → N) |
| 62 | (hq : IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ q) (V : Opens N) |
| 63 | (x : terminalGermsOpenChartSource q hq V) : |
| 64 | (mfderiv (𝓡 n) (𝓡 n) (Subtype.val : V → N) |
| 65 | (terminalGermsOpenChartMap q hq V x)).comp |
| 66 | (mfderiv (𝓡 n) (𝓡 n) (terminalGermsOpenChartMap q hq V) x) = |
| 67 | (mfderiv (𝓡 n) (𝓡 n) q x.val).comp |
| 68 | (mfderiv (𝓡 n) (𝓡 n) |
| 69 | (Subtype.val : terminalGermsOpenChartSource q hq V → M) x) := by |
| 70 | rw [← mfderiv_comp x ((contMDiff_subtype_val (n := ∞)).mdifferentiable (by simp) _) |
| 71 | ((terminalGerms_openChartMap_localDiffeomorph q hq V).mdifferentiable (by simp) x)] |
| 72 | rw [← mfderiv_comp x (hq.mdifferentiable (by simp) x.val) |
| 73 | ((contMDiff_subtype_val (n := ∞)).mdifferentiable (by simp) x)] |
| 74 | rfl |
| 75 | |
| 76 | end PoincareMT.M47 |