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.OpenSubset |
| 2 | |
| 3 | /-! |
| 4 | # Smooth maps into regular levels |
| 5 | |
| 6 | Smoothness of a map into the constructed level manifold can be checked after |
| 7 | composing with its ambient inclusion. |
| 8 | -/ |
| 9 | |
| 10 | open Set Function TopologicalSpace |
| 11 | open scoped Manifold ContDiff Topology |
| 12 | |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | namespace Poincare.Geometry.Manifold.RegularLevel |
| 16 | |
| 17 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 18 | [FiniteDimensional ℝ E] {H : Type*} [TopologicalSpace H] |
| 19 | {I : ModelWithCorners ℝ E H} {M : Type*} [TopologicalSpace M] |
| 20 | [ChartedSpace H M] [IsManifold I ∞ M] [I.Boundaryless] |
| 21 | {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] |
| 22 | {H' : Type*} [TopologicalSpace H'] {J : ModelWithCorners ℝ E' H'} |
| 23 | {N : Type*} [TopologicalSpace N] [ChartedSpace H' N] |
| 24 | {f : M → ℝ} (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) |
| 25 | (n : ℕ) [Fact (Module.finrank ℝ E = n + 1)] (c : ℝ) |
| 26 | (hreg : ∀ x : M, f x = c → mfderiv I 𝓘(ℝ, ℝ) f x ≠ 0) |
| 27 | |
| 28 | theorem contMDiffAt_into_levelSet_iff (F : N → (f ⁻¹' {c} : Set M)) (x : N) : |
| 29 | letI := levelSetChartedSpace hf n c hreg |
| 30 | ContMDiffAt J (𝓡 n) ∞ F x ↔ |
| 31 | ContMDiffAt J I ∞ (fun y => (F y : M)) x := by |
| 32 | letI := levelSetChartedSpace hf n c hreg |
| 33 | constructor |
| 34 | · intro hF |
| 35 | exact (contMDiff_levelSet_val hf n c hreg (F x)).comp x hF |
| 36 | · intro hF |
| 37 | rw [contMDiffAt_iff_target] |
| 38 | refine ⟨Topology.IsInducing.subtypeVal.continuousAt_iff.mpr hF.continuousAt, ?_⟩ |
| 39 | let y : M := (F x : M) |
| 40 | let hdf : mfderiv I 𝓘(ℝ, ℝ) f y ≠ 0 := hreg y (F x).2 |
| 41 | have hchart : ContMDiffAt J 𝓘(ℝ, E) ∞ |
| 42 | (fun z => extChartAt I y (F z : M)) x := |
| 43 | contMDiffAt_extChartAt.comp x hF |
| 44 | have hG : ContDiffAt ℝ ∞ (adaptedStraightening hf y hdf) (extChartAt I y y) := |
| 45 | (contDiffOn_adaptedStraightening hf y hdf).contDiffAt |
| 46 | ((adaptedStraightening hf y hdf).open_source.mem_nhds |
| 47 | (mem_adaptedStraightening_source hf y hdf)) |
| 48 | have hcomp := hG.contMDiffAt.comp x hchart |
| 49 | have hsub : ContMDiffAt J 𝓘(ℝ, E) ∞ |
| 50 | (fun z => adaptedStraightening hf y hdf (extChartAt I y (F z : M)) - |
| 51 | extChartAt I y y) x := |
| 52 | (contDiff_id.sub (contDiff_const (c := extChartAt I y y))).contDiffAt.contMDiffAt.comp x hcomp |
| 53 | have hproj := (sliceProj (I := I) n hdf).contDiff.contDiffAt.contMDiffAt.comp x hsub |
| 54 | convert! hproj using 1 |
| 55 | |
| 56 | theorem contMDiffAt_into_openLevelSet_iff (U : Opens M) |
| 57 | (hregU : ∀ x ∈ U, mfderiv I 𝓘(ℝ, ℝ) f x ≠ 0) |
| 58 | (F : N → openLevelSet f U c) (x : N) : |
| 59 | letI := openLevelSetChartedSpace hf U hregU n c |
| 60 | ContMDiffAt J (𝓡 n) ∞ F x ↔ |
| 61 | ContMDiffAt J I ∞ (openLevelIncl f U c ∘ F) x := by |
| 62 | letI := openLevelSetChartedSpace hf U hregU n c |
| 63 | have h := contMDiffAt_into_levelSet_iff (J := J) |
| 64 | (hf.comp contMDiff_subtype_val) n c |
| 65 | (fun y _ => openLevelRestrict_regular hf U hregU y) F x |
| 66 | exact h.trans (ContMDiffAt.subtypeVal_comp_iff U |
| 67 | (fun y => (F y : U)) x).symm |
| 68 | |
| 69 | end Poincare.Geometry.Manifold.RegularLevel |