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.IntrinsicComparison.Region.Refinement |
| 2 | import PoincareLib.Geometry.Riemannian.Surface.GaussBonnet.Refinement.InitialFans |
| 3 | import PoincareLib.Geometry.Riemannian.Surface.GaussBonnet.Refinement.OriginalCorners |
| 4 | import PoincareLib.Geometry.Riemannian.Surface.GaussBonnet.Refinement.IndependentFans |
| 5 | import PoincareLib.Geometry.Riemannian.Surface.GaussBonnet.VertexContributions |
| 6 | |
| 7 | /-! |
| 8 | # Actual metric fans of the synchronized regional subdivisions |
| 9 | |
| 10 | The stored finite line-refinement ancestry determines every used vertex |
| 11 | contribution. An interior point contributes two pi, a new boundary point |
| 12 | contributes pi, and an original corner retains its actual metric angle. |
| 13 | No angle-sum identity is supplied as a hypothesis. |
| 14 | |
| 15 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 16 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 17 | derivations. |
| 18 | -/ |
| 19 | |
| 20 | noncomputable section |
| 21 | set_option autoImplicit false |
| 22 | set_option backward.isDefEq.respectTransparency false |
| 23 | |
| 24 | open Set |
| 25 | open scoped Topology ContDiff Manifold Bundle |
| 26 | open PoincareMT.Topology.Surface Poincare.Topology.Plane.Meshes |
| 27 | |
| 28 | namespace PoincareMT |
| 29 | |
| 30 | open Classical in |
| 31 | /-- The three possible metric contributions of a used vertex are derived from the actual |
| 32 | finite line-refinement construction. Source: Morgan--Tian Proposition 19.35, printed pp. |
| 33 | 467-481, especially Claim 19.40, pp. 470-471; the explicit project tangent-fan derivation is |
| 34 | reviewed in `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-fans.md`, Mathematical |
| 35 | Checks. -/ |
| 36 | theorem m64Intrinsic_subdivision_used_vertex_contribution |
| 37 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 38 | (F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 39 | (b : AffineBasis (Fin 3) ℝ AnnulusCoordinates) (S : Finset AnnulusCoordinates) |
| 40 | (R : SmoothTriangleBoundarySubdivisionWithRefinement F b S) |
| 41 | (hF : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F F.source) |
| 42 | (hFi : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F.symm F.target) |
| 43 | (hsource : convexHull ℝ (range b) ⊆ F.source) {q : AnnulusCoordinates} |
| 44 | (hused : ∃ (t : R.mesh.Triangle) (v : R.mesh.Vertex), |
| 45 | v ∈ t.1 ∧ F (R.mesh.position v) = q) : |
| 46 | meshVertexAngleContribution g F R.mesh q = |
| 47 | if q ∈ F '' interior (convexHull ℝ (range b)) then 2 * Real.pi else |
| 48 | if q ∈ F '' range b then |
| 49 | ∑ k : Fin 3, if F (b k) = q then coordinateTriangleAngle g F b k else 0 |
| 50 | else Real.pi := by |
| 51 | classical |
| 52 | rw [R.mesh_eq_refineByLines] at hused ⊢ |
| 53 | obtain ⟨t, v, hv, hvq⟩ := hused |
| 54 | let M := (TriangleMesh.single b b.ind).refineByLines R.refinement_lines |
| 55 | have hvsupport : M.position v ∈ M.toPlaneComplex.support := by |
| 56 | rw [TriangleMesh.toPlaneComplex_support] |
| 57 | exact mem_iUnion₂.mpr ⟨t.1, t.2, subset_convexHull ℝ _ ⟨v, hv, rfl⟩⟩ |
| 58 | have hvhull : M.position v ∈ convexHull ℝ (range b) := by |
| 59 | simpa only [M, TriangleMesh.refineByLines_support, TriangleMesh.single_support] |
| 60 | using hvsupport |
| 61 | have hvsource := hsource hvhull |
| 62 | by_cases hinside : q ∈ F '' interior (convexHull ℝ (range b)) |
| 63 | · rw [if_pos hinside] |
| 64 | obtain ⟨z, hz, hzq⟩ := hinside |
| 65 | have hvz : M.position v = z := F.injOn hvsource |
| 66 | (hsource (interior_subset hz)) (hvq.trans hzq.symm) |
| 67 | have hvint : M.position v ∈ interior M.toPlaneComplex.support := by |
| 68 | simpa only [M, TriangleMesh.refineByLines_support, TriangleMesh.single_support, hvz] using hz |
| 69 | rw [← hvq] |
| 70 | exact single_refineByLines_interior_vertex_fan g F b R.refinement_lines |
| 71 | hF hFi hsource t v hv hvint |
| 72 | · rw [if_neg hinside] |
| 73 | by_cases hcorner : q ∈ F '' range b |
| 74 | · rw [if_pos hcorner] |
| 75 | obtain ⟨z, ⟨k, rfl⟩, hkq⟩ := hcorner |
| 76 | rw [← hkq, single_refineByLines_original_corner g F b R.refinement_lines |
| 77 | hF hFi hsource k] |
| 78 | have heq (j : Fin 3) : F (b j) = F (b k) ↔ j = k := by |
| 79 | constructor |
| 80 | · intro h |
| 81 | exact b.ind.injective (F.injOn |
| 82 | (hsource (subset_convexHull ℝ _ (mem_range_self j))) |
| 83 | (hsource (subset_convexHull ℝ _ (mem_range_self k))) h) |
| 84 | · rintro rfl |
| 85 | rfl |
| 86 | simp only [heq, Finset.sum_ite_eq', Finset.mem_univ, if_true] |
| 87 | · rw [if_neg hcorner, ← hvq] |
| 88 | apply single_refineByLines_new_boundary_vertex_fan g F b R.refinement_lines |
| 89 | hF hFi hsource t v hv |
| 90 | · intro hint |
| 91 | exact hinside ⟨M.position v, hint, hvq⟩ |
| 92 | · intro horiginal |
| 93 | exact hcorner ⟨M.position v, horiginal, hvq⟩ |
| 94 | |
| 95 | /-- Used subdivision vertices inside a coordinate parent have their full two-pi metric fan, |
| 96 | independently of the surrounding parents. Source: Morgan--Tian Proposition 19.35, printed |
| 97 | pp. 467-481, especially Claim 19.40, pp. 470-471; the explicit project tangent-fan |
| 98 | derivation is reviewed in |
| 99 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-fans.md`, Mathematical Checks. -/ |
| 100 | theorem m64Intrinsic_subdivision_interior_fan |
| 101 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 102 | (F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 103 | (b : AffineBasis (Fin 3) ℝ AnnulusCoordinates) (S : Finset AnnulusCoordinates) |
| 104 | (R : SmoothTriangleBoundarySubdivisionWithRefinement F b S) |
| 105 | (hF : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F F.source) |
| 106 | (hFi : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F.symm F.target) |
| 107 | (hsource : convexHull ℝ (range b) ⊆ F.source) {q : AnnulusCoordinates} |
| 108 | (hused : ∃ (t : R.mesh.Triangle) (v : R.mesh.Vertex), |
| 109 | v ∈ t.1 ∧ F (R.mesh.position v) = q) |
| 110 | (hq : q ∈ F '' interior (convexHull ℝ (range b))) : |
| 111 | meshVertexAngleContribution g F R.mesh q = 2 * Real.pi := by |
| 112 | classical |
| 113 | rw [m64Intrinsic_subdivision_used_vertex_contribution g F b S R hF hFi hsource hused, |
| 114 | if_pos hq] |
| 115 | |
| 116 | /-- A used point on an open original edge has the straight metric fan pi. Original corners |
| 117 | are excluded by affine-basis geometry. Source: Morgan--Tian Proposition 19.35, printed pp. |
| 118 | 467-481, especially Claim 19.40, pp. 470-471; the explicit project tangent-fan derivation is |
| 119 | reviewed in `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-fans.md`, Mathematical |
| 120 | Checks. -/ |
| 121 | theorem m64Intrinsic_subdivision_open_edge_fan |
| 122 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 123 | (F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 124 | (b : AffineBasis (Fin 3) ℝ AnnulusCoordinates) (S : Finset AnnulusCoordinates) |
| 125 | (R : SmoothTriangleBoundarySubdivisionWithRefinement F b S) |
| 126 | (hF : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F F.source) |
| 127 | (hFi : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F.symm F.target) |
| 128 | (hsource : convexHull ℝ (range b) ⊆ F.source) {q : AnnulusCoordinates} |
| 129 | (hused : ∃ (t : R.mesh.Triangle) (v : R.mesh.Vertex), |
| 130 | v ∈ t.1 ∧ F (R.mesh.position v) = q) (k : Fin 3) |
| 131 | (hq : q ∈ F '' openSegment ℝ (b (k.succAbove 0)) (b (k.succAbove 1))) : |
| 132 | meshVertexAngleContribution g F R.mesh q = Real.pi := by |
| 133 | classical |
| 134 | obtain ⟨z, hz, hzq⟩ := hq |
| 135 | have hzfront := affineBasis_open_edge_subset_frontier b k hz |
| 136 | have hzsource := hsource |
| 137 | (((finite_range b).isCompact_convexHull ℝ).isClosed.frontier_subset hzfront) |
| 138 | have hnotint : q ∉ F '' interior (convexHull ℝ (range b)) := by |
| 139 | rintro ⟨w, hw, hwq⟩ |
| 140 | exact hzfront.2 ((F.injOn (hsource (interior_subset hw)) hzsource |
| 141 | (hwq.trans hzq.symm)) ▸ hw) |
| 142 | have hnotcorner : q ∉ F '' range b := by |
| 143 | rintro ⟨w, ⟨j, rfl⟩, hjq⟩ |
| 144 | have heq := F.injOn (hsource (subset_convexHull ℝ _ (mem_range_self j))) hzsource |
| 145 | (hjq.trans hzq.symm) |
| 146 | exact affineBasis_vertex_not_mem_open_edge b k j (heq.symm ▸ hz) |
| 147 | rw [m64Intrinsic_subdivision_used_vertex_contribution g F b S R hF hFi hsource hused, |
| 148 | if_neg hnotint, if_neg hnotcorner] |
| 149 | |
| 150 | end PoincareMT |