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 PoincareLib.Analysis.InnerProductSpace.Coordinates.FinSucc |
| 3 | |
| 4 | /-! |
| 5 | # Slices of regular coordinates |
| 6 | |
| 7 | An ambient coordinate parametrization whose first coordinate is the defining |
| 8 | function restricts to a smooth chart on each nonempty regular level. |
| 9 | -/ |
| 10 | |
| 11 | open Set Function TopologicalSpace Poincare.EuclideanSpace |
| 12 | open scoped Manifold ContDiff Topology |
| 13 | |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | namespace Poincare.Geometry.Manifold.RegularLevel |
| 19 | |
| 20 | variable {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [FiniteDimensional ℝ E] {H : Type*} [TopologicalSpace H] |
| 22 | {I : ModelWithCorners ℝ E H} {M : Type*} [TopologicalSpace M] |
| 23 | [ChartedSpace H M] [IsManifold I ∞ M] [I.Boundaryless] |
| 24 | [Fact (Module.finrank ℝ E = n + 1)] |
| 25 | {f : M → ℝ} (U : Opens M) (c : ℝ) |
| 26 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin (n + 1))) M) |
| 27 | (heU : e.target ⊆ U) (hef : ∀ y ∈ e.source, f (e y) = y 0) |
| 28 | (z₀ : openLevelSet f U c) |
| 29 | |
| 30 | open scoped Classical in |
| 31 | /-- The parametrization of a regular level obtained by fixing its first coordinate. -/ |
| 32 | def sliceChart : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) (openLevelSet f U c) where |
| 33 | toFun y := if hy : euclideanCons c y ∈ e.source then |
| 34 | ⟨⟨e (euclideanCons c y), heU (e.map_source hy)⟩, by |
| 35 | change f (e (euclideanCons c y)) = c |
| 36 | rw [hef _ hy, euclideanCons_zero]⟩ else z₀ |
| 37 | invFun z := euclideanTail (e.symm (openLevelIncl f U c z)) |
| 38 | source := euclideanCons c ⁻¹' e.source |
| 39 | target := openLevelIncl f U c ⁻¹' e.target |
| 40 | map_source' y hy := by |
| 41 | change euclideanCons c y ∈ e.source at hy |
| 42 | simp only [mem_preimage, dif_pos hy, openLevelIncl] |
| 43 | exact e.map_source hy |
| 44 | map_target' z hz := by |
| 45 | have hs := e.map_target hz |
| 46 | have hzero : e.symm (openLevelIncl f U c z) 0 = c := by |
| 47 | rw [← hef _ hs, e.right_inv hz] |
| 48 | exact z.2 |
| 49 | change euclideanCons c (euclideanTail (e.symm (openLevelIncl f U c z))) ∈ e.source |
| 50 | rw [show euclideanCons c (euclideanTail (e.symm (openLevelIncl f U c z))) = |
| 51 | e.symm (openLevelIncl f U c z) from by |
| 52 | simpa only [hzero] using euclideanCons_tail (e.symm (openLevelIncl f U c z))] |
| 53 | exact hs |
| 54 | left_inv' y hy := by |
| 55 | change euclideanCons c y ∈ e.source at hy |
| 56 | simp only [dif_pos hy, openLevelIncl] |
| 57 | rw [e.left_inv hy, euclideanTail_cons] |
| 58 | right_inv' z hz := by |
| 59 | have hs := e.map_target hz |
| 60 | have hzero : e.symm (openLevelIncl f U c z) 0 = c := by |
| 61 | rw [← hef _ hs, e.right_inv hz] |
| 62 | exact z.2 |
| 63 | have hcons : euclideanCons c (euclideanTail (e.symm (openLevelIncl f U c z))) = |
| 64 | e.symm (openLevelIncl f U c z) := by |
| 65 | simpa only [hzero] using euclideanCons_tail (e.symm (openLevelIncl f U c z)) |
| 66 | simp only [hcons, dif_pos hs] |
| 67 | apply Subtype.ext |
| 68 | apply Subtype.ext |
| 69 | exact e.right_inv hz |
| 70 | open_source := e.open_source.preimage (contDiff_euclideanCons c).continuous |
| 71 | open_target := e.open_target.preimage |
| 72 | (continuous_subtype_val.comp continuous_subtype_val) |
| 73 | continuousOn_toFun := by |
| 74 | rw [continuousOn_iff_continuous_domRestrict] |
| 75 | have hc : Continuous (fun y : (euclideanCons c ⁻¹' e.source : Set _) => |
| 76 | e (euclideanCons c (y : EuclideanSpace ℝ (Fin n)))) := |
| 77 | e.continuousOn.comp_continuous |
| 78 | ((contDiff_euclideanCons c).continuous.comp continuous_subtype_val) |
| 79 | (fun y => y.2) |
| 80 | have hl : Continuous (fun y : (euclideanCons c ⁻¹' e.source : Set _) => |
| 81 | (⟨⟨e (euclideanCons c (y : EuclideanSpace ℝ (Fin n))), |
| 82 | heU (e.map_source y.2)⟩, by |
| 83 | change f (e (euclideanCons c (y : EuclideanSpace ℝ (Fin n)))) = c |
| 84 | rw [hef _ y.2, euclideanCons_zero]⟩ : openLevelSet f U c)) := |
| 85 | (hc.subtype_mk _).subtype_mk _ |
| 86 | convert hl using 1 |
| 87 | funext y |
| 88 | exact dif_pos y.2 |
| 89 | continuousOn_invFun := |
| 90 | (continuous_euclideanTail n).comp_continuousOn |
| 91 | (e.symm.continuousOn.comp |
| 92 | (continuous_subtype_val.comp continuous_subtype_val).continuousOn (fun _ hz => hz)) |
| 93 | |
| 94 | @[simp] theorem sliceChart_source : |
| 95 | (sliceChart U c e heU hef z₀).source = euclideanCons c ⁻¹' e.source := rfl |
| 96 | |
| 97 | @[simp] theorem sliceChart_target : |
| 98 | (sliceChart U c e heU hef z₀).target = openLevelIncl f U c ⁻¹' e.target := rfl |
| 99 | |
| 100 | theorem sliceChart_apply {y : EuclideanSpace ℝ (Fin n)} |
| 101 | (hy : euclideanCons c y ∈ e.source) : |
| 102 | openLevelIncl f U c (sliceChart U c e heU hef z₀ y) = e (euclideanCons c y) := by |
| 103 | simp only [sliceChart, OpenPartialHomeomorph.coe_mk, dif_pos hy, |
| 104 | openLevelIncl] |
| 105 | |
| 106 | @[simp] theorem sliceChart_symm_apply (z : openLevelSet f U c) : |
| 107 | (sliceChart U c e heU hef z₀).symm z = |
| 108 | euclideanTail (e.symm (openLevelIncl f U c z)) := rfl |
| 109 | |
| 110 | variable (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) |
| 111 | (hreg : ∀ x ∈ U, mfderiv I 𝓘(ℝ, ℝ) f x ≠ 0) |
| 112 | |
| 113 | theorem contMDiffOn_sliceChart (he : ContMDiffOn (𝓡 (n + 1)) I ∞ e e.source) : |
| 114 | letI := openLevelSetChartedSpace hf U hreg n c |
| 115 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ (sliceChart U c e heU hef z₀) |
| 116 | (sliceChart U c e heU hef z₀).source := by |
| 117 | let := openLevelSetChartedSpace hf U hreg n c |
| 118 | intro y hy |
| 119 | apply ContMDiffAt.contMDiffWithinAt |
| 120 | apply (contMDiffAt_into_openLevelSet_iff hf n c U hreg _ y).mpr |
| 121 | have hcomp := ((he _ hy).contMDiffAt (e.open_source.mem_nhds hy)).comp y |
| 122 | (contDiff_euclideanCons c).contDiffAt.contMDiffAt |
| 123 | apply hcomp.congr_of_eventuallyEq |
| 124 | filter_upwards [((sliceChart U c e heU hef z₀).open_source.mem_nhds hy)] with z hz |
| 125 | exact sliceChart_apply U c e heU hef z₀ hz |
| 126 | |
| 127 | theorem contMDiffOn_sliceChart_symm |
| 128 | (he : ContMDiffOn I (𝓡 (n + 1)) ∞ e.symm e.target) : |
| 129 | letI := openLevelSetChartedSpace hf U hreg n c |
| 130 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ (sliceChart U c e heU hef z₀).symm |
| 131 | (sliceChart U c e heU hef z₀).target := by |
| 132 | let := openLevelSetChartedSpace hf U hreg n c |
| 133 | intro z hz |
| 134 | have hcomp := ((he _ hz).contMDiffAt (e.open_target.mem_nhds hz)).comp z |
| 135 | (contMDiff_openLevelIncl hf U hreg n c z) |
| 136 | exact ((contDiff_euclideanTail n).contDiffAt.contMDiffAt.comp z hcomp).contMDiffWithinAt |
| 137 | |
| 138 | end Poincare.Geometry.Manifold.RegularLevel |