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.ReducedGeometry.ReducedLength.Calculus.ManifoldLocalInverse |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.TriangularBijective |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.SmoothSquareAction |
| 4 | |
| 5 | /-! |
| 6 | # Endpoint inverses of actual square-time comparison families |
| 7 | |
| 8 | Compactness controls the whole moving interval. The endpoint-time |
| 9 | differential retains its off-diagonal time term and has identity time row. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | open Filter |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 24 | [IsManifold (𝓡 n) ∞ M] |
| 25 | {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 26 | |
| 27 | def squareFamilyParameterDomain (Ω : Set (E × ℝ)) (τmax : ℝ) : Set (E × ℝ) := |
| 28 | {z | z.2 ∈ Set.Ioo 0 τmax ∧ |
| 29 | ∀ r ∈ Set.Icc (0 : ℝ) 1, (z.1, Real.sqrt z.2 * r) ∈ Ω} |
| 30 | |
| 31 | theorem isOpen_squareFamilyParameterDomain (Ω : Set (E × ℝ)) (hΩ : IsOpen Ω) |
| 32 | (τmax : ℝ) : IsOpen (squareFamilyParameterDomain Ω τmax) := by |
| 33 | rw [isOpen_iff_mem_nhds] |
| 34 | intro z hz |
| 35 | have hnear : ∀ᶠ w : E × ℝ in 𝓝 z, |
| 36 | ∀ r ∈ Set.Icc (0 : ℝ) 1, (w.1, Real.sqrt w.2 * r) ∈ Ω := by |
| 37 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 38 | intro r hr |
| 39 | have hc : Continuous (fun w : (E × ℝ) × ℝ ↦ |
| 40 | (w.1.1, Real.sqrt w.1.2 * w.2)) := |
| 41 | continuous_fst.fst.prodMk ((Real.continuous_sqrt.comp continuous_fst.snd).mul continuous_snd) |
| 42 | exact hc.continuousAt.preimage_mem_nhds (hΩ.mem_nhds (hz.2 r hr)) |
| 43 | filter_upwards [(isOpen_univ.prod isOpen_Ioo).mem_nhds |
| 44 | (show z ∈ Set.univ ×ˢ Set.Ioo 0 τmax from ⟨Set.mem_univ _, hz.1⟩), hnear] with w hw hseg |
| 45 | exact ⟨hw.2, hseg⟩ |
| 46 | |
| 47 | theorem squareFamilyParameterDomain_endpoint (Ω : Set (E × ℝ)) (τmax : ℝ) |
| 48 | (z : E × ℝ) (hz : z ∈ squareFamilyParameterDomain Ω τmax) : |
| 49 | (z.1, Real.sqrt z.2) ∈ Ω := by |
| 50 | simpa only [mul_one] using hz.2 1 ⟨zero_le_one, le_rfl⟩ |
| 51 | |
| 52 | set_option backward.isDefEq.respectTransparency false in |
| 53 | theorem squareFamilyEndpoint_contMDiffOn (f : E × ℝ → M) (Ω : Set (E × ℝ)) |
| 54 | (hf : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ f Ω) (τmax : ℝ) : |
| 55 | ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ (fun z ↦ f (z.1, Real.sqrt z.2)) |
| 56 | (squareFamilyParameterDomain Ω τmax) := by |
| 57 | have hi : ContDiffOn ℝ ∞ (fun z : E × ℝ ↦ (z.1, Real.sqrt z.2)) |
| 58 | (squareFamilyParameterDomain Ω τmax) := |
| 59 | contDiffOn_fst.prodMk (contDiffOn_snd.sqrt (fun _ hz ↦ hz.1.1.ne')) |
| 60 | exact hf.comp hi.contMDiffOn (fun z hz ↦ squareFamilyParameterDomain_endpoint Ω τmax z hz) |
| 61 | |
| 62 | set_option maxHeartbeats 1000000 in |
| 63 | -- The full product-manifold derivative is identified before invoking the inverse theorem. |
| 64 | set_option backward.isDefEq.respectTransparency false in |
| 65 | theorem exists_squareFamily_endpoint_inverse |
| 66 | (f : E × ℝ → M) (Ω : Set (E × ℝ)) (hΩ : IsOpen Ω) |
| 67 | (hf : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ f Ω) |
| 68 | (τmax : ℝ) (z : E × ℝ) (hz : z ∈ squareFamilyParameterDomain Ω τmax) |
| 69 | (hbij : Function.Bijective (mfderiv (𝓘(ℝ, E)) (𝓡 n) |
| 70 | (fun x ↦ f (x, Real.sqrt z.2)) z.1)) : |
| 71 | ∃ e : OpenPartialHomeomorph (E × ℝ) (M × ℝ), |
| 72 | z ∈ e.source ∧ e.source ⊆ squareFamilyParameterDomain Ω τmax ∧ |
| 73 | Set.EqOn e (fun w ↦ (f (w.1, Real.sqrt w.2), w.2)) e.source ∧ |
| 74 | ContMDiffOn ((𝓡 n).prod (𝓘(ℝ, ℝ))) (𝓘(ℝ, E × ℝ)) ∞ e.symm e.target := by |
| 75 | let S := squareFamilyParameterDomain Ω τmax |
| 76 | have hS := isOpen_squareFamilyParameterDomain Ω hΩ τmax |
| 77 | let H : E × ℝ → M := fun w ↦ f (w.1, Real.sqrt w.2) |
| 78 | have hH : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ H S := |
| 79 | squareFamilyEndpoint_contMDiffOn f Ω hf τmax |
| 80 | have hHprod : ContMDiffOn ((𝓘(ℝ, E)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ H S := by |
| 81 | convert! hH using 1 <;> simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 82 | have hd := (hHprod.contMDiffAt (hS.mem_nhds hz)).mdifferentiableAt (by simp) |
| 83 | let L := mfderiv ((𝓘(ℝ, E)).prod (𝓘(ℝ, ℝ))) ((𝓡 n).prod (𝓘(ℝ, ℝ))) |
| 84 | (fun w : E × ℝ ↦ (H w, w.2)) z |
| 85 | have hLb : Function.Bijective L := by |
| 86 | dsimp only [L] |
| 87 | rw [mfderiv_prodMk hd mdifferentiableAt_snd, mfderiv_snd] |
| 88 | apply (triangular_bijective_iff (E := E) (F := EuclideanSpace ℝ (Fin n)) _ |
| 89 | (mfderiv (𝓘(ℝ, E)) (𝓡 n) (fun x ↦ f (x, Real.sqrt z.2)) z.1) ?_ ?_).mpr hbij |
| 90 | · intro w |
| 91 | rfl |
| 92 | · intro w |
| 93 | change mfderiv ((𝓘(ℝ, E)).prod (𝓘(ℝ, ℝ))) (𝓡 n) H z (w, 0) = _ |
| 94 | rw [mfderiv_prod_eq_add_apply hd] |
| 95 | simp only [map_zero, add_zero, H] |
| 96 | rfl |
| 97 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n) × ℝ) (M × ℝ) := |
| 98 | prodChartedSpace (EuclideanSpace ℝ (Fin n)) M ℝ ℝ |
| 99 | letI : IsManifold (𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ)) ∞ (M × ℝ) := by |
| 100 | rw [modelWithCornersSelf_prod] |
| 101 | exact IsManifold.prod (I := 𝓡 n) (I' := 𝓘(ℝ, ℝ)) M ℝ |
| 102 | let Φ : E × ℝ → M × ℝ := fun w ↦ (H w, w.2) |
| 103 | have hΦ : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ)) ∞ Φ S := by |
| 104 | convert! hHprod.prodMk contMDiffOn_snd using 1 <;> |
| 105 | simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 106 | have hfull : Function.Bijective (mfderiv (𝓘(ℝ, E × ℝ)) |
| 107 | (𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ)) Φ z) := by |
| 108 | convert! hLb using 1 <;> simp only [L, Φ, modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 109 | congr 2 <;> simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 110 | obtain ⟨e, hze, hsub, he, hinv, _⟩ := exists_manifold_local_inverse Φ S hS hΦ z hz hfull |
| 111 | refine ⟨e, hze, hsub, he, ?_⟩ |
| 112 | convert! hinv using 1 <;> simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 113 | |
| 114 | end PoincareMT.ReducedLength |