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.Geometry.Manifold.Diffeomorph |
| 2 | open Set |
| 3 | open scoped Manifold ContDiff |
| 4 | noncomputable section |
| 5 | set_option autoImplicit false |
| 6 | set_option backward.isDefEq.respectTransparency false |
| 7 | /-! |
| 8 | # Linear changes of manifold model spaces |
| 9 | |
| 10 | A continuous linear equivalence transports each chart and gives the identity |
| 11 | map as a smooth equivalence between the old and new manifold structures. |
| 12 | -/ |
| 13 | |
| 14 | namespace Poincare.Manifold |
| 15 | variable {E E' : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 16 | [NormedAddCommGroup E'] [NormedSpace ℝ E'] |
| 17 | {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold 𝓘(ℝ,E) ∞ M] |
| 18 | |
| 19 | @[instance_reducible] |
| 20 | def linearRechart (A : E ≃L[ℝ] E') : ChartedSpace E' M where |
| 21 | atlas := (fun e : OpenPartialHomeomorph M E => |
| 22 | e.trans A.toHomeomorph.toOpenPartialHomeomorph) '' atlas E M |
| 23 | chartAt x := (chartAt E x).trans A.toHomeomorph.toOpenPartialHomeomorph |
| 24 | mem_chart_source x := by simp only [OpenPartialHomeomorph.trans_source, |
| 25 | Homeomorph.toOpenPartialHomeomorph_source, preimage_univ, inter_univ, mem_chart_source] |
| 26 | chart_mem_atlas x := ⟨chartAt E x, chart_mem_atlas E x, rfl⟩ |
| 27 | |
| 28 | theorem isManifold_linearRechart (A : E ≃L[ℝ] E') : |
| 29 | let := linearRechart (M := M) A |
| 30 | IsManifold 𝓘(ℝ,E') ∞ M := by |
| 31 | let := linearRechart (M := M) A |
| 32 | apply isManifold_of_contDiffOn |
| 33 | rintro _ _ ⟨e, he, rfl⟩ ⟨e', he', rfl⟩ |
| 34 | have h := (𝓘(ℝ,E)).contDiffOn_extendCoordChange |
| 35 | (IsManifold.subset_maximalAtlas (I := 𝓘(ℝ,E)) (n := ∞) he) (IsManifold.subset_maximalAtlas (I := 𝓘(ℝ,E)) (n := ∞) he') |
| 36 | have h' := A.contDiff.comp_contDiffOn |
| 37 | (h.comp A.symm.contDiff.contDiffOn (by intro x hx; exact hx)) |
| 38 | convert h' using 1 <;> simp [mfld_simps, Function.comp_def] |
| 39 | rfl |
| 40 | |
| 41 | omit [IsManifold 𝓘(ℝ,E) ∞ M] in |
| 42 | theorem contMDiff_linearRechart_id (A : E ≃L[ℝ] E') : |
| 43 | let := linearRechart (M := M) A |
| 44 | ContMDiff 𝓘(ℝ,E) 𝓘(ℝ,E') ∞ (id : M → M) := by |
| 45 | let := linearRechart (M := M) A |
| 46 | dsimp only |
| 47 | intro x |
| 48 | rw [contMDiffAt_iff] |
| 49 | refine ⟨continuousAt_id, ?_⟩ |
| 50 | apply ContDiffAt.contDiffWithinAt |
| 51 | apply A.contDiff.contDiffAt.congr_of_eventuallyEq |
| 52 | filter_upwards [(chartAt E x).open_target.mem_nhds (mem_chart_target E x)] with z hz |
| 53 | simp only [extChartAt, mfld_simps] |
| 54 | change A (chartAt E x ((chartAt E x).symm z)) = A z |
| 55 | rw [(chartAt E x).right_inv hz] |
| 56 | |
| 57 | omit [IsManifold 𝓘(ℝ,E) ∞ M] in |
| 58 | theorem contMDiff_linearRechart_id_symm (A : E ≃L[ℝ] E') : |
| 59 | let := linearRechart (M := M) A |
| 60 | ContMDiff 𝓘(ℝ,E') 𝓘(ℝ,E) ∞ (id : M → M) := by |
| 61 | let := linearRechart (M := M) A |
| 62 | dsimp only |
| 63 | intro x |
| 64 | rw [contMDiffAt_iff] |
| 65 | refine ⟨continuousAt_id, ?_⟩ |
| 66 | apply ContDiffAt.contDiffWithinAt |
| 67 | apply A.symm.contDiff.contDiffAt.congr_of_eventuallyEq |
| 68 | have hnh : ∀ᶠ z in nhds (A (chartAt E x x)), |
| 69 | A.symm z ∈ (chartAt E x).target := |
| 70 | A.symm.continuous.tendsto _ |>.eventually |
| 71 | ((chartAt E x).open_target.mem_nhds (by simp)) |
| 72 | filter_upwards [hnh] with z hz |
| 73 | simp only [extChartAt, mfld_simps] |
| 74 | change chartAt E x ((chartAt E x).symm (A.symm z)) = A.symm z |
| 75 | rw [(chartAt E x).right_inv hz] |
| 76 | |
| 77 | def linearRechartDiffeomorph (A : E ≃L[ℝ] E') : |
| 78 | let := linearRechart (M := M) A |
| 79 | M ≃ₘ⟮𝓘(ℝ,E),𝓘(ℝ,E')⟯ M := by |
| 80 | let := linearRechart (M := M) A |
| 81 | exact { toEquiv := Equiv.refl M |
| 82 | contMDiff_toFun := contMDiff_linearRechart_id A |
| 83 | contMDiff_invFun := contMDiff_linearRechart_id_symm A } |
| 84 | |
| 85 | end Poincare.Manifold |
| 86 |