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.RegularLevel.UniversalProperty |
| 2 | import Mathlib.Geometry.Manifold.Diffeomorph |
| 3 | |
| 4 | /-! |
| 5 | # Identifying equal regular levels |
| 6 | |
| 7 | The identity on the ambient subset gives a canonical diffeomorphism even when |
| 8 | the defining function, level value, and open regular domain differ. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Function TopologicalSpace |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | namespace Poincare.Geometry.Manifold.RegularLevel |
| 19 | |
| 20 | variable {M : Type*} [TopologicalSpace M] |
| 21 | {f h : M → ℝ} {U V : Opens M} {c d : ℝ} |
| 22 | |
| 23 | /-- Equal ambient level subsets have a canonical equivalence. -/ |
| 24 | def openLevelEquivOfEq |
| 25 | (he : ∀ x, (x ∈ U ∧ f x = c) ↔ (x ∈ V ∧ h x = d)) : |
| 26 | openLevelSet f U c ≃ openLevelSet h V d where |
| 27 | toFun x := ⟨⟨x.1.1, (he x.1.1).mp ⟨x.1.2, x.2⟩ |>.1⟩, |
| 28 | (he x.1.1).mp ⟨x.1.2, x.2⟩ |>.2⟩ |
| 29 | invFun x := ⟨⟨x.1.1, (he x.1.1).mpr ⟨x.1.2, x.2⟩ |>.1⟩, |
| 30 | (he x.1.1).mpr ⟨x.1.2, x.2⟩ |>.2⟩ |
| 31 | left_inv _ := rfl |
| 32 | right_inv _ := rfl |
| 33 | |
| 34 | @[simp] theorem openLevelIncl_openLevelEquivOfEq |
| 35 | (he : ∀ x, (x ∈ U ∧ f x = c) ↔ (x ∈ V ∧ h x = d)) |
| 36 | (x : openLevelSet f U c) : |
| 37 | openLevelIncl h V d (openLevelEquivOfEq he x) = openLevelIncl f U c x := rfl |
| 38 | |
| 39 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 40 | [FiniteDimensional ℝ E] {H : Type*} [TopologicalSpace H] |
| 41 | {I : ModelWithCorners ℝ E H} [ChartedSpace H M] [IsManifold I ∞ M] |
| 42 | [I.Boundaryless] |
| 43 | (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) (hh : ContMDiff I 𝓘(ℝ, ℝ) ∞ h) |
| 44 | (n : ℕ) [Fact (Module.finrank ℝ E = n + 1)] |
| 45 | (hregf : ∀ x ∈ U, mfderiv I 𝓘(ℝ, ℝ) f x ≠ 0) |
| 46 | (hregh : ∀ x ∈ V, mfderiv I 𝓘(ℝ, ℝ) h x ≠ 0) |
| 47 | |
| 48 | /-- The ambient identity identifies the smooth structures of equal regular levels. -/ |
| 49 | def openLevelDiffeomorphOfEq |
| 50 | (he : ∀ x, (x ∈ U ∧ f x = c) ↔ (x ∈ V ∧ h x = d)) : |
| 51 | letI := openLevelSetChartedSpace hf U hregf n c |
| 52 | letI := openLevelSetChartedSpace hh V hregh n d |
| 53 | openLevelSet f U c ≃ₘ⟮𝓡 n, 𝓡 n⟯ openLevelSet h V d := by |
| 54 | letI := openLevelSetChartedSpace hf U hregf n c |
| 55 | letI := openLevelSetChartedSpace hh V hregh n d |
| 56 | refine { openLevelEquivOfEq he with contMDiff_toFun := ?_, contMDiff_invFun := ?_ } |
| 57 | · intro x |
| 58 | apply (contMDiffAt_into_openLevelSet_iff hh n d V hregh |
| 59 | (openLevelEquivOfEq he) x).mpr |
| 60 | exact contMDiff_openLevelIncl hf U hregf n c x |
| 61 | · intro x |
| 62 | apply (contMDiffAt_into_openLevelSet_iff hf n c U hregf |
| 63 | (openLevelEquivOfEq he).symm x).mpr |
| 64 | exact contMDiff_openLevelIncl hh V hregh n d x |
| 65 | |
| 66 | end Poincare.Geometry.Manifold.RegularLevel |
| 67 |