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.CurveShortening.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Periodic.Boundary |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Polygon.Length |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Geodesic.Polygon |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Sampled.PolygonLength |
| 6 | import PoincareLib.Geometry.RicciFlow.Curvature.Estimates.Shi.Paths.Energy |
| 7 | import PoincareLib.Geometry.Riemannian.LoopSpace.Length.PeriodicSpeed |
| 8 | |
| 9 | /-! |
| 10 | # Sampled polygon existence |
| 11 | |
| 12 | The adjacent sampled vertices are placed in explicit precompact intrinsic |
| 13 | balls. The radii are one larger than the corresponding finite intrinsic |
| 14 | distance, so the closed global manifold is enough for the M63 polygon |
| 15 | supplier. This is the existence part of Definition 19.18, p. 450. |
| 16 | |
| 17 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 18 | 450-453. |
| 19 | -/ |
| 20 | |
| 21 | set_option autoImplicit false |
| 22 | |
| 23 | open Set |
| 24 | open scoped Manifold ContDiff ENNReal |
| 25 | |
| 26 | universe u |
| 27 | |
| 28 | namespace PoincareMT |
| 29 | |
| 30 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 31 | [ChartedSpace LoopAmbient M] [IsManifold (𝓡 3) ∞ M] |
| 32 | {g : RiemannianMetric 3 M} {D : LeviCivitaData g} |
| 33 | |
| 34 | /-- A positive-count sampled polygon and its actual circle boundary. Source: Auxiliary step |
| 35 | for MT Definition 19.18 and Claims 19.19/19.22, pp. 450-453; project construction in |
| 36 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 37 | theorem m64_sampled_polygon_exists |
| 38 | (hcompact : IsCompact (univ : Set M)) |
| 39 | (gamma : C1FreeLoopSpace (M := M)) (N : ℕ) (hN : 0 < N) : |
| 40 | ∃ polygon : M63GeodesicPolygon g D N, |
| 41 | M64SampledPolygon gamma polygon ∧ Nonempty (M64PolygonBoundary polygon) := by |
| 42 | let vertices : Polygon M N := |
| 43 | ⟨fun j => periodicFreeLoop gamma (m63CellLeft N j)⟩ |
| 44 | let gamma0 : ℝ → M := periodicFreeLoop gamma |
| 45 | have hgamma0 : ContMDiff 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma0 := by |
| 46 | exact Proofs.M58.contMDiff_periodicFreeLoop gamma |
| 47 | let speed : ℝ → ℝ := M04.pathSpeed g gamma0 |
| 48 | let radius : Fin N → ℝ := fun j => |
| 49 | (∫ x in m63CellLeft N j..(m63CellLeft N j + m63CellLength N), speed x) + 1 |
| 50 | have hradius : ∀ j, 0 < radius j := by |
| 51 | intro j |
| 52 | dsimp [radius] |
| 53 | have hnonneg : 0 ≤ ∫ x in m63CellLeft N j..(m63CellLeft N j + m63CellLength N), |
| 54 | speed x := by |
| 55 | apply intervalIntegral.integral_nonneg |
| 56 | · linarith [m63CellLength_pos hN] |
| 57 | · intro x _ |
| 58 | exact M04.pathSpeed_nonneg g gamma0 x |
| 59 | linarith |
| 60 | let : CompactSpace M := isCompact_univ_iff.mp hcompact |
| 61 | have hcompact_ball : ∀ j, IsCompact (closure (g.ball (vertices j) (radius j))) := by |
| 62 | intro j |
| 63 | exact hcompact.of_isClosed_subset isClosed_closure (by |
| 64 | intro x _ |
| 65 | exact mem_univ x) |
| 66 | have hnext : ∀ j, vertices (finRotate N j) ∈ g.ball (vertices j) (radius j) := by |
| 67 | intro j |
| 68 | have hdist := g.edist_le_pathELength_of_mem_Icc hgamma0.contMDiffOn |
| 69 | (show m63CellLeft N j + m63CellLength N ∈ |
| 70 | Icc (m63CellLeft N j) (m63CellLeft N j + m63CellLength N) by |
| 71 | exact ⟨le_add_of_nonneg_right (m63CellLength_pos hN).le, le_rfl⟩) |
| 72 | rw [M04.pathELength_eq_ofReal_integral_pathSpeed g hgamma0 (by |
| 73 | linarith [m63CellLength_pos hN])] at hdist |
| 74 | have hlt : (∫ x in m63CellLeft N j..(m63CellLeft N j + m63CellLength N), |
| 75 | speed x) < (∫ x in m63CellLeft N j..(m63CellLeft N j + m63CellLength N), |
| 76 | speed x) + 1 := by linarith |
| 77 | have hnonneg : 0 ≤ ∫ x in m63CellLeft N j..(m63CellLeft N j + m63CellLength N), |
| 78 | speed x := by |
| 79 | apply intervalIntegral.integral_nonneg |
| 80 | · linarith [m63CellLength_pos hN] |
| 81 | · intro x _ |
| 82 | exact M04.pathSpeed_nonneg g gamma0 x |
| 83 | have hball := hdist.trans_lt ((ENNReal.ofReal_lt_ofReal_iff (by |
| 84 | linarith)).mpr hlt) |
| 85 | change g.edist (gamma0 (m63CellLeft N j)) |
| 86 | (gamma0 (m63CellLeft N (finRotate N j))) < ENNReal.ofReal (radius j) |
| 87 | have hfinish : gamma0 (m63CellLeft N (finRotate N j)) = |
| 88 | gamma0 (m63CellLeft N j + m63CellLength N) := by |
| 89 | dsimp [gamma0] |
| 90 | exact m63PeriodicLoop_cell_finish |
| 91 | (Proofs.M58.periodic_periodicFreeLoop gamma) hN j |
| 92 | rw [hfinish] |
| 93 | simpa only [radius, speed, gamma0] using hball |
| 94 | obtain ⟨polygon, hvertices⟩ := |
| 95 | M63.geodesicPolygon_nonempty_of_precompact_balls g D hN vertices radius |
| 96 | hradius hcompact_ball hnext |
| 97 | refine ⟨polygon, ?_, exists_polygon_boundary polygon⟩ |
| 98 | intro j |
| 99 | simpa [vertices] using congrArg (fun p : Polygon M N => p.vertices j) hvertices |
| 100 | |
| 101 | /-- The sampled constructor packaged with the exact raw length identity. Source: Auxiliary |
| 102 | step for MT Definition 19.18 and Claims 19.19/19.22, pp. 450-453; project construction in |
| 103 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 104 | theorem m64_sampled_polygon_exists_with_length |
| 105 | (hcompact : IsCompact (univ : Set M)) |
| 106 | (gamma : C1FreeLoopSpace (M := M)) (N : ℕ) (hN : 0 < N) : |
| 107 | ∃ polygon : M63GeodesicPolygon g D N, |
| 108 | M64SampledPolygon gamma polygon ∧ |
| 109 | Nonempty (M64PolygonBoundary polygon) ∧ |
| 110 | m64PolygonLength polygon = |
| 111 | ∑ j : Fin N, m63CellLength N * (polygon.side j).speed := by |
| 112 | obtain ⟨polygon, hsampled, hboundary⟩ := |
| 113 | m64_sampled_polygon_exists hcompact gamma N hN |
| 114 | exact ⟨polygon, hsampled, hboundary, m64PolygonLength_eq_sum polygon hN⟩ |
| 115 | |
| 116 | /-- The two pointwise fields of `M64StaticApproximationTheory`, ready for assembly with the |
| 117 | compact-family and raw-family producers. Source: Auxiliary step for MT Definition 19.18 and |
| 118 | Claims 19.19/19.22, pp. 450-453; project construction in |
| 119 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 120 | theorem m64_static_polygon_fields |
| 121 | (hcompact : IsCompact (univ : Set M)) : |
| 122 | (∀ gamma : C1FreeLoopSpace (M := M), ∀ N : ℕ, 0 < N → |
| 123 | ∃ polygon : M63GeodesicPolygon g D N, |
| 124 | M64SampledPolygon gamma polygon ∧ Nonempty (M64PolygonBoundary polygon)) ∧ |
| 125 | (∀ N : ℕ, 0 < N → ∀ polygon : M63GeodesicPolygon g D N, |
| 126 | m64PolygonLength polygon = |
| 127 | ∑ j : Fin N, m63CellLength N * (polygon.side j).speed) := by |
| 128 | constructor |
| 129 | · intro gamma N hN |
| 130 | exact m64_sampled_polygon_exists hcompact gamma N hN |
| 131 | · intro N hN polygon |
| 132 | exact m64PolygonLength_eq_sum polygon hN |
| 133 | |
| 134 | end PoincareMT |