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.Soliton.ThreeDimensional.Noncompact.Rigidity.Levels.Graph.Implicit |
| 2 | import PoincareLib.Geometry.Manifold.RegularLevel.Equivalence |
| 3 | |
| 4 | /-! |
| 5 | # Regular level graphs in a product slab |
| 6 | |
| 7 | Positive vertical derivative and opposite endpoint signs construct one unique |
| 8 | root on every vertical line. The parameter implicit-function theorem supplies |
| 9 | its smoothness, and projection identifies the actual regular level with the |
| 10 | transverse manifold. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter Function TopologicalSpace |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | open Poincare.Geometry.Manifold.RegularLevel |
| 20 | |
| 21 | namespace Poincare.Manifold |
| 22 | |
| 23 | variable {n : ℕ} {N : Type*} [TopologicalSpace N] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 25 | |
| 26 | /-- The open product slab used to construct a regular-level graph. -/ |
| 27 | def graphSlab (ε : ℝ) : Opens (ℝ × N) := |
| 28 | ⟨Ioo (-ε) ε ×ˢ univ, isOpen_Ioo.prod isOpen_univ⟩ |
| 29 | |
| 30 | variable {F : ℝ × N → ℝ} |
| 31 | (hF : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ F) |
| 32 | |
| 33 | include hF |
| 34 | |
| 35 | /-- Positive vertical derivative gives a unique smooth graph of the zero |
| 36 | level between the two endpoints. Compactness of the parameter is unnecessary. -/ |
| 37 | theorem exists_unique_smooth_level_height |
| 38 | {ε : ℝ} (hε : 0 < ε) |
| 39 | (hpos : ∀ y : N, ∀ s ∈ Ioo (-ε) ε, 0 < deriv (fun r ↦ F (r, y)) s) |
| 40 | (hleft : ∀ y : N, F (-ε, y) < 0) (hright : ∀ y : N, 0 < F (ε, y)) : |
| 41 | ∃ u : N → ℝ, ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ u ∧ |
| 42 | (∀ y, u y ∈ Ioo (-ε) ε ∧ F (u y, y) = 0) ∧ |
| 43 | ∀ y s, s ∈ Ioo (-ε) ε → (F (s, y) = 0 ↔ s = u y) := by |
| 44 | classical |
| 45 | have hcont (y : N) : Continuous (fun s : ℝ ↦ F (s, y)) := |
| 46 | hF.continuous.comp (continuous_id.prodMk continuous_const) |
| 47 | have hmono (y : N) : StrictMonoOn (fun s ↦ F (s, y)) (Icc (-ε) ε) := by |
| 48 | apply strictMonoOn_of_deriv_pos (convex_Icc _ _) (hcont y).continuousOn |
| 49 | simpa only [interior_Icc] using hpos y |
| 50 | have hex (y : N) : ∃ s ∈ Ioo (-ε) ε, F (s, y) = 0 := by |
| 51 | obtain ⟨s, hs, hzero⟩ := intermediate_value_Icc (by linarith : -ε ≤ ε) |
| 52 | (hcont y).continuousOn ⟨(hleft y).le, (hright y).le⟩ |
| 53 | change F (s, y) = 0 at hzero |
| 54 | refine ⟨s, ⟨?_, ?_⟩, hzero⟩ |
| 55 | · exact lt_of_le_of_ne hs.1 (by intro heq; have := hleft y; rw [heq, hzero] at this; exact this.false) |
| 56 | · exact lt_of_le_of_ne hs.2 (by intro heq; have := hright y; rw [← heq, hzero] at this; exact this.false) |
| 57 | choose u hu hzero using hex |
| 58 | refine ⟨u, ?_, fun y ↦ ⟨hu y, hzero y⟩, ?_⟩ |
| 59 | · intro y |
| 60 | apply contMDiffAt_of_unique_time_root isOpen_Ioo isOpen_univ hF.contMDiffOn |
| 61 | (σ := u) (v := deriv (fun r ↦ F (r, y)) (u y)) |
| 62 | (fun z _ ↦ ⟨hu z, hzero z⟩) |
| 63 | (fun z _ ↦ (hmono z).injOn.mono Ioo_subset_Icc_self) (mem_univ y) |
| 64 | (hpos y _ (hu y)).ne' |
| 65 | exact (differentiableAt_of_deriv_ne_zero (hpos y _ (hu y)).ne').hasDerivAt |
| 66 | · intro y s hs |
| 67 | constructor |
| 68 | · intro hzero' |
| 69 | exact (hmono y).injOn (Ioo_subset_Icc_self hs) (Ioo_subset_Icc_self (hu y)) |
| 70 | (hzero'.trans (hzero y).symm) |
| 71 | · rintro rfl |
| 72 | exact hzero y |
| 73 | |
| 74 | omit [IsManifold (𝓡 n) ∞ N] in |
| 75 | /-- A positive time derivative makes the defining function regular on the |
| 76 | whole product slab. -/ |
| 77 | theorem graphSlab_regular {ε : ℝ} |
| 78 | (hpos : ∀ y : N, ∀ s ∈ Ioo (-ε) ε, 0 < deriv (fun r ↦ F (r, y)) s) : |
| 79 | ∀ p ∈ graphSlab (N := N) ε, |
| 80 | mfderiv (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) F p ≠ 0 := by |
| 81 | rintro ⟨s, y⟩ hp hzero |
| 82 | have hcomp := mfderiv_comp s ((hF (s, y)).mdifferentiableAt (by simp)) |
| 83 | (mdifferentiableAt_id.prodMk (mdifferentiableAt_const (c := y))) |
| 84 | change mfderiv 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) (fun r ↦ F (r, y)) s = _ at hcomp |
| 85 | simp only [id_eq] at hcomp |
| 86 | rw [hzero, ContinuousLinearMap.zero_comp, mfderiv_eq_fderiv] at hcomp |
| 87 | have hd : deriv (fun r ↦ F (r, y)) s = 0 := by |
| 88 | rw [← fderiv_apply_one_eq_deriv, hcomp, zero_apply] |
| 89 | exact (hpos y s hp.1).ne' hd |
| 90 | |
| 91 | local instance : Fact (Module.finrank ℝ (ℝ × EuclideanSpace ℝ (Fin n)) = n + 1) := |
| 92 | ⟨by simp [Module.finrank_prod, Nat.add_comm]⟩ |
| 93 | |
| 94 | /-- Projection from the actual regular zero level onto the transverse |
| 95 | manifold is a diffeomorphism. Its inverse is the uniquely constructed smooth |
| 96 | height graph. -/ |
| 97 | theorem exists_levelGraphDiffeomorph |
| 98 | {ε : ℝ} (hε : 0 < ε) |
| 99 | (hpos : ∀ y : N, ∀ s ∈ Ioo (-ε) ε, 0 < deriv (fun r ↦ F (r, y)) s) |
| 100 | (hleft : ∀ y : N, F (-ε, y) < 0) (hright : ∀ y : N, 0 < F (ε, y)) : |
| 101 | letI := openLevelSetChartedSpace hF (graphSlab ε) (graphSlab_regular hF hpos) n 0 |
| 102 | ∃ e : N ≃ₘ⟮𝓡 n, 𝓡 n⟯ openLevelSet F (graphSlab ε) 0, |
| 103 | ∀ p, e.symm p = (openLevelIncl F (graphSlab ε) 0 p).2 := by |
| 104 | let := openLevelSetChartedSpace hF (graphSlab ε) (graphSlab_regular hF hpos) n 0 |
| 105 | obtain ⟨u, hu, hroot, huniq⟩ := exists_unique_smooth_level_height hF hε hpos hleft hright |
| 106 | let e : N ≃ openLevelSet F (graphSlab ε) 0 := |
| 107 | { toFun := fun y ↦ ⟨⟨(u y, y), ⟨(hroot y).1, mem_univ y⟩⟩, (hroot y).2⟩ |
| 108 | invFun := fun p ↦ p.1.1.2 |
| 109 | left_inv := fun _ ↦ rfl |
| 110 | right_inv := by |
| 111 | intro p |
| 112 | apply Subtype.ext |
| 113 | apply Subtype.ext |
| 114 | apply Prod.ext |
| 115 | · exact ((huniq p.1.1.2 p.1.1.1 p.1.2.1).mp p.2).symm |
| 116 | · rfl } |
| 117 | refine ⟨{ e with contMDiff_toFun := ?_, contMDiff_invFun := ?_ }, fun _ ↦ rfl⟩ |
| 118 | · intro y |
| 119 | apply (contMDiffAt_into_openLevelSet_iff hF n 0 (graphSlab ε) |
| 120 | (graphSlab_regular hF hpos) e y).mpr |
| 121 | exact (hu y).prodMk contMDiffAt_id |
| 122 | · exact contMDiff_snd.comp |
| 123 | (contMDiff_openLevelIncl hF (graphSlab ε) (graphSlab_regular hF hpos) n 0) |
| 124 | |
| 125 | end Poincare.Manifold |