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.Ramp.Polygon |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Profile.Base |
| 3 | |
| 4 | /-! |
| 5 | # Periodic polygon map uniqueness from side uniqueness |
| 6 | |
| 7 | The local minimizing interpolator compares individual sides. This helper |
| 8 | propagates those equalities through the closed-cell concatenation and its |
| 9 | periodic extension, including the final cell endpoint. |
| 10 | |
| 11 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 12 | 450-453. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 26 | [IsManifold (𝓡 n) ∞ M] |
| 27 | {g : RiemannianMetric n M} {D : LeviCivitaData g} {N : ℕ} |
| 28 | |
| 29 | /-- Two periodic geodesic polygons with equal side maps have equal maps. Source: Auxiliary |
| 30 | step for MT Definition 19.18 and Claims 19.19/19.22, pp. 450-453; project construction in |
| 31 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 32 | theorem m64_polygon_map_eq_of_side_map_eq |
| 33 | (P Q : M63GeodesicPolygon g D N) (hN : 0 < N) |
| 34 | (hside : ∀ j : Fin N, ∀ s ∈ Icc (0 : ℝ) (m63CellLength N), |
| 35 | (Q.side j).map s = (P.side j).map s) : |
| 36 | ∀ x : ℝ, Q.map x = P.map x := by |
| 37 | have hell : 0 < m63CellLength N := m63CellLength_pos hN |
| 38 | have hNell : (N : ℝ) * m63CellLength N = curvePeriod := |
| 39 | m63_count_mul_cellLength hN |
| 40 | have hcover {x : ℝ} (hx : x ∈ Icc (0 : ℝ) curvePeriod) : |
| 41 | ∃ j : Fin N, ∃ s ∈ Icc (0 : ℝ) (m63CellLength N), |
| 42 | x = m63CellLeft N j + s := by |
| 43 | rcases lt_or_eq_of_le hx.2 with hlt | rfl |
| 44 | · have hxdiv : 0 ≤ x / m63CellLength N := div_nonneg hx.1 hell.le |
| 45 | have hj : Nat.floor (x / m63CellLength N) < N := |
| 46 | (Nat.floor_lt hxdiv).mpr |
| 47 | ((div_lt_iff₀ hell).mpr (by simpa only [hNell] using hlt)) |
| 48 | let j : Fin N := ⟨Nat.floor (x / m63CellLength N), hj⟩ |
| 49 | refine ⟨j, x - m63CellLeft N j, ⟨?_, ?_⟩, by ring⟩ |
| 50 | · exact sub_nonneg.mpr ((le_div_iff₀ hell).mp (Nat.floor_le hxdiv)) |
| 51 | · have hh := (div_lt_iff₀ hell).mp |
| 52 | (Nat.lt_floor_add_one (x / m63CellLength N)) |
| 53 | change x - (Nat.floor (x / m63CellLength N) : ℝ) * |
| 54 | m63CellLength N ≤ m63CellLength N |
| 55 | nlinarith only [hh] |
| 56 | · let j : Fin N := ⟨N - 1, by omega⟩ |
| 57 | refine ⟨j, m63CellLength N, ⟨hell.le, le_rfl⟩, ?_⟩ |
| 58 | have hn : ((N - 1 : ℕ) : ℝ) + 1 = N := by |
| 59 | exact_mod_cast (by omega : N - 1 + 1 = N) |
| 60 | change curvePeriod = ((N - 1 : ℕ) : ℝ) * m63CellLength N + |
| 61 | m63CellLength N |
| 62 | rw [← hNell, ← hn] |
| 63 | ring |
| 64 | intro x |
| 65 | let k : ℤ := Int.floor (x / curvePeriod) |
| 66 | let y : ℝ := x - (k : ℝ) * curvePeriod |
| 67 | have hy : y ∈ Icc (0 : ℝ) curvePeriod := by |
| 68 | have h0 := (le_div_iff₀ Real.two_pi_pos).mp |
| 69 | (Int.floor_le (x / curvePeriod)) |
| 70 | have h1 := (div_lt_iff₀ Real.two_pi_pos).mp |
| 71 | (Int.lt_floor_add_one (x / curvePeriod)) |
| 72 | dsimp only [y, k] |
| 73 | dsimp only [curvePeriod] at h0 h1 ⊢ |
| 74 | constructor <;> linarith only [h0, h1] |
| 75 | have hx : x = y + (k : ℝ) * curvePeriod := by |
| 76 | dsimp only [y] |
| 77 | ring |
| 78 | rw [hx, Q.periodic.int_mul k y, P.periodic.int_mul k y] |
| 79 | obtain ⟨j, s, hs, hy_eq⟩ := hcover hy |
| 80 | rw [hy_eq] |
| 81 | rw [Q.cell_agreement j s hs, P.cell_agreement j s hs] |
| 82 | exact hside j s hs |
| 83 | |
| 84 | end PoincareMT |