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.Uniform.SmoothSampledFamily |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Static.FlattenedLength |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Uniform.SampledPolygonAnnuli |
| 5 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Raw.BoundaryReparam |
| 6 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Polygon.ChordLength |
| 7 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Uniform.FillingAreaComparison |
| 8 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Close.LoopFamilyHomotopy |
| 9 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Uniform.SampledChordLength |
| 10 | |
| 11 | /-! |
| 12 | # The actual all-count raw-family approximation |
| 13 | |
| 14 | One common threshold supplies the sampled smooth family, chord estimate, |
| 15 | homotopy, filling-area comparison, and small geodesic annulus. Boundary |
| 16 | reparameterization transfers the actual disk ranges with all infima guarded. |
| 17 | |
| 18 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 19 | 450-453. |
| 20 | -/ |
| 21 | |
| 22 | set_option autoImplicit false |
| 23 | |
| 24 | open Set |
| 25 | open scoped Manifold ContDiff Bundle ENNReal |
| 26 | |
| 27 | universe u |
| 28 | |
| 29 | namespace PoincareMT |
| 30 | |
| 31 | /-- For every sufficiently large count construct the full raw approximation with its exact |
| 32 | flattening and disk fields. Source: Auxiliary step for MT Definition 19.18 and Claims |
| 33 | 19.19/19.22, pp. 450-453; project construction in |
| 34 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 35 | theorem m64_uniform_raw_family |
| 36 | {M : Type u} [TopologicalSpace M] [T2Space M] [SecondCountableTopology M] |
| 37 | [ChartedSpace LoopAmbient M] [IsManifold (𝓡 3) ∞ M] |
| 38 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 39 | (hcompact : IsCompact (univ : Set M)) |
| 40 | (Gamma : ContinuousMap LoopTwoSphere (C1FreeLoopSpace (M := M))) |
| 41 | (hnull : M61NullFamily Gamma) {zeta : ℝ} (hzeta : 0 < zeta) : |
| 42 | ∃ N0 : ℕ, 0 < N0 ∧ ∀ N : ℕ, N0 ≤ N → |
| 43 | ∃ A : M64RawFamilyApproximation g D Gamma zeta, A.count = N := by |
| 44 | classical |
| 45 | let sphereEquiv : Metric.sphere (0 : LoopAmbient) 1 ≃ₜ LoopTwoSphere := |
| 46 | Homeomorph.setCongr (by ext z; exact mem_sphere_zero_iff_norm) |
| 47 | let : CompactSpace LoopTwoSphere := sphereEquiv.compactSpace |
| 48 | obtain ⟨_hbounded, _hattained, hL, hlength⟩ := m63FamilyLengthSup_properties g Gamma |
| 49 | obtain ⟨NC, hNC, hchord⟩ := |
| 50 | M63.exists_uniform_sampled_chord_length g hcompact Gamma hzeta |
| 51 | obtain ⟨deltaH, hdeltaH, hhom⟩ := |
| 52 | M63.exists_uniform_close_loop_family_homotopy (Z := LoopTwoSphere) g hcompact |
| 53 | obtain ⟨deltaA, hdeltaA, harea⟩ := |
| 54 | m63_exists_uniform_filling_area_comparison g hcompact |
| 55 | (Lambda := 2 * m63FamilyLengthSup g Gamma) (mul_nonneg (by norm_num) hL) hzeta |
| 56 | obtain ⟨NS, hNS, hsmooth⟩ := m64_exists_uniform_sampled_smooth_loop_family |
| 57 | g D hcompact Gamma (lt_min hdeltaH hdeltaA) |
| 58 | obtain ⟨NA, hNA, hannuli⟩ := m64_uniform_sampled_polygon_annuli |
| 59 | g D hcompact Gamma Gamma.continuous hzeta |
| 60 | refine ⟨max NC (max NS NA), hNC.trans_le (le_max_left _ _), ?_⟩ |
| 61 | intro N hN0N |
| 62 | have hNCN : NC ≤ N := (le_max_left _ _).trans hN0N |
| 63 | have hNSN : NS ≤ N := (le_max_left _ _).trans ((le_max_right _ _).trans hN0N) |
| 64 | have hNAN : NA ≤ N := (le_max_right _ _).trans ((le_max_right _ _).trans hN0N) |
| 65 | have hN : 0 < N := hNC.trans_le hNCN |
| 66 | obtain ⟨polygon, hsample, family, hangular, hsmoothFamily, hfirst, hsecond, hclose⟩ := |
| 67 | hsmooth N hNSN |
| 68 | have hcloseH (z : LoopTwoSphere) (x : LoopCircle) : |
| 69 | g.edist (family z x) (Gamma z x) < ENNReal.ofReal deltaH := |
| 70 | (hclose z x).trans_le (ENNReal.ofReal_le_ofReal (min_le_left _ _)) |
| 71 | have hcloseA (z : LoopTwoSphere) (x : LoopCircle) : |
| 72 | g.edist (family z x) (Gamma z x) < ENNReal.ofReal deltaA := |
| 73 | (hclose z x).trans_le (ENNReal.ofReal_le_ofReal (min_le_right _ _)) |
| 74 | have hflatLength (z : LoopTwoSphere) : |
| 75 | freeLoopLength g (family z) = m64PolygonLength (polygon z) := |
| 76 | m64_freeLoopLength_eq_polygonLength hN (polygon z) (family z) (hangular z) |
| 77 | have hlengthEq (z : LoopTwoSphere) : freeLoopLength g (family z) = |
| 78 | ∑ j : Fin N, (g.edist |
| 79 | (periodicFreeLoop (Gamma z) (m63CellLeft N j)) |
| 80 | (periodicFreeLoop (Gamma z) (m63CellLeft N (finRotate N j)))).toReal := by |
| 81 | rw [hflatLength z] |
| 82 | exact m64PolygonLength_eq_sampled_chord_sum (polygon z) hN |
| 83 | (periodicFreeLoop (Gamma z)) (Proofs.M58.periodic_periodicFreeLoop (Gamma z)) |
| 84 | (Proofs.M58.contMDiff_periodicFreeLoop (Gamma z)) (hsample z) |
| 85 | have hloss (z : LoopTwoSphere) : |
| 86 | 0 ≤ freeLoopLength g (Gamma z) - freeLoopLength g (family z) ∧ |
| 87 | freeLoopLength g (Gamma z) - freeLoopLength g (family z) < zeta := by |
| 88 | rw [hlengthEq z] |
| 89 | exact hchord N hNCN z |
| 90 | obtain ⟨hhomotopic, htransfer⟩ := hhom Gamma family hcloseH |
| 91 | have hfamilyNull : M61NullFamily family := fun z => htransfer z (hnull z) |
| 92 | have hareaError (z : LoopTwoSphere) : |
| 93 | |fillingArea g (family z) - fillingArea g (Gamma z)| < zeta := by |
| 94 | apply harea (Gamma z) (family z) (hnull z) (hfamilyNull z) (hcloseA z) |
| 95 | linarith only [hlength z, (hloss z).1] |
| 96 | let boundary : ∀ z, M64PolygonBoundary (polygon z) := |
| 97 | fun z => Classical.choice (exists_polygon_boundary (polygon z)) |
| 98 | let reparam := m64CircleReparamFromFlattening N hN |
| 99 | have hboundary (z : LoopTwoSphere) (w : LoopCircle) : |
| 100 | (boundary z).map w = family z (reparam.map w) := |
| 101 | m64_polygon_boundary_eq_flattened_family hN (hangular z) w |
| 102 | have hboundaryCont : Continuous |
| 103 | (fun p : LoopTwoSphere × LoopCircle => (boundary p.1).map p.2) := by |
| 104 | have h : Continuous (fun p : LoopTwoSphere × LoopCircle => |
| 105 | family p.1 (reparam.map p.2)) := |
| 106 | Proofs.M58.continuous_loop_eval.comp |
| 107 | ((family.continuous.comp continuous_fst).prodMk |
| 108 | (reparam.continuous_map.comp continuous_snd)) |
| 109 | exact h.congr (fun p => (hboundary p.1 p.2).symm) |
| 110 | have hangle : Continuous m64LoopCircleParam := by |
| 111 | change Continuous (fun x : ℝ => |
| 112 | (⟨Proofs.M58.angularPoint x, Proofs.M58.norm_angularPoint x⟩ : LoopCircle)) |
| 113 | exact Proofs.M58.contDiff_angularPoint.continuous.subtype_mk _ |
| 114 | have hpolygonCont : Continuous |
| 115 | (fun p : LoopTwoSphere × ℝ => (polygon p.1).map p.2) := |
| 116 | (hboundaryCont.comp (continuous_fst.prodMk (hangle.comp continuous_snd))).congr |
| 117 | (fun p => (boundary p.1).angular_eq p.2) |
| 118 | have hsource (z : LoopTwoSphere) : FillingAreaData g (family z) := |
| 119 | Classical.choice (m60FillingData_of_null g (family z) (hfamilyNull z)) |
| 120 | let rawDisk : ∀ z : LoopTwoSphere, M64RawSpanningDisk g (boundary z).map := |
| 121 | fun z => m64RawDiskOfBoundaryReparam reparam (hboundary z) |
| 122 | (Classical.choice (hsource z).nonempty) |
| 123 | choose annulus hpiecewise hgeodesic hnonnegative hsmall using |
| 124 | fun z => hannuli N hNAN z (polygon z) (hsample z) |
| 125 | refine ⟨{ |
| 126 | count := N |
| 127 | count_positive := hN |
| 128 | polygon := polygon |
| 129 | sampled := hsample |
| 130 | boundary := boundary |
| 131 | polygon_continuous := hpolygonCont |
| 132 | boundary_continuous := hboundaryCont |
| 133 | polygon_length := fun z => m64PolygonLength_eq_sum (polygon z) hN |
| 134 | raw_null := fun z => m64RawNullLoop_of_boundary_reparam |
| 135 | (hfamilyNull z) reparam (hboundary z) |
| 136 | source_filling := fun z => |
| 137 | Classical.choice (m60FillingData_of_null g (Gamma z) (hnull z)) |
| 138 | raw_disk_nonempty := fun z => ⟨rawDisk z⟩ |
| 139 | raw_area_bounded_below := fun z => m64RawDiskAreaRange_bddBelow (rawDisk z) |
| 140 | raw_area_nonnegative := fun z => m64RawFillingArea_nonnegative (rawDisk z) |
| 141 | raw_area_error := ?_ |
| 142 | annulus := annulus |
| 143 | annulus_piecewise := hpiecewise |
| 144 | annulus_geodesic := hgeodesic |
| 145 | annulus_area := fun z => ⟨hnonnegative z, hsmall z⟩ |
| 146 | family := family |
| 147 | null_family := hfamilyNull |
| 148 | homotopic := hhomotopic |
| 149 | angular_eq := hangular |
| 150 | angular_smooth := hsmoothFamily |
| 151 | first_jet_continuous := hfirst |
| 152 | second_jet_continuous := hsecond |
| 153 | flattened_length := hflatLength |
| 154 | family_filling := hsource |
| 155 | flattening_area_range := fun z => |
| 156 | m64RawDiskAreaRange_eq_of_boundary_reparam reparam (hboundary z) |
| 157 | length_loss := hloss |
| 158 | area_error := hareaError }, rfl⟩ |
| 159 | intro z |
| 160 | rw [m64RawFillingArea_eq_fillingArea_of_boundary_reparam reparam (hboundary z)] |
| 161 | exact hareaError z |
| 162 | |
| 163 | end PoincareMT |