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.Regional.BoundaryFans |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Upper.Graph |
| 3 | |
| 4 | /-! |
| 5 | # Smooth return-loop boundary vertices |
| 6 | |
| 7 | The proved Jordan graph orientation constructs a regular defining |
| 8 | function at every regular interior loop parameter. Its derivative is |
| 9 | nonzero on the explicit vertical vector in the graph coordinates. |
| 10 | The actual triangulation therefore has a pi fan at that boundary point. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 13 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 14 | derivations. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Topology ContDiff Manifold Bundle |
| 23 | open PoincareMT.Topology.Surface |
| 24 | |
| 25 | namespace PoincareMT |
| 26 | |
| 27 | /-- Construct a regular defining function for the actual Jordan closure at a regular |
| 28 | interior point of a simple smooth return loop. Source: Morgan--Tian Proposition 19.35, |
| 29 | printed pp. 467-481, especially Claim 19.40, pp. 470-471; the explicit project tangent-fan |
| 30 | derivation is reviewed in |
| 31 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-fans.md`, Mathematical Checks. -/ |
| 32 | theorem m64Intrinsic_exists_loop_defining_function |
| 33 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 34 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 35 | (hp : p ∈ Ioo (0 : ℝ) T) (hregular : deriv gamma p ≠ 0) |
| 36 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 37 | (hdisj : Disjoint U V) (hfU : frontier U = gamma '' Icc 0 T) |
| 38 | (hfV : frontier V = gamma '' Icc 0 T) : |
| 39 | ∃ (phi : AnnulusCoordinates → ℝ) (ell : AnnulusCoordinates →L[ℝ] ℝ), |
| 40 | HasFDerivAt phi ell (gamma p) ∧ phi (gamma p) = 0 ∧ ell ≠ 0 ∧ |
| 41 | (∀ᶠ z in 𝓝 (gamma p), z ∈ closure U ↔ 0 ≤ phi z) := by |
| 42 | obtain ⟨L, h, S, x, hS, hx, hh, hcoord, hregion⟩ := |
| 43 | m64Intrinsic_exists_loop_upper_graph hg hend hinj hp hregular hU hV hdisj hfU hfV |
| 44 | let X : AnnulusCoordinates →L[ℝ] ℝ := |
| 45 | (ContinuousLinearMap.fst ℝ ℝ ℝ).comp L.toContinuousLinearMap |
| 46 | let Y : AnnulusCoordinates →L[ℝ] ℝ := |
| 47 | (ContinuousLinearMap.snd ℝ ℝ ℝ).comp L.toContinuousLinearMap |
| 48 | let phi := fun z => Y z - h (X z) |
| 49 | let ell : AnnulusCoordinates →L[ℝ] ℝ := Y - deriv h x • X |
| 50 | have hdh : HasDerivAt h (deriv h x) x := |
| 51 | ((hh x hx).contDiffAt (hS.mem_nhds hx)).differentiableAt (by simp) |>.hasDerivAt |
| 52 | have hXbase : X (gamma p) = x := by |
| 53 | change (L (gamma p)).1 = x |
| 54 | rw [hcoord] |
| 55 | have hYbase : Y (gamma p) = h x := by |
| 56 | change (L (gamma p)).2 = h x |
| 57 | rw [hcoord] |
| 58 | have hd : HasFDerivAt phi ell (gamma p) := by |
| 59 | exact Y.hasFDerivAt.sub |
| 60 | (hdh.comp_hasFDerivAt_of_eq (gamma p) X.hasFDerivAt hXbase.symm) |
| 61 | have hv : ell (L.symm (0, 1)) = 1 := by |
| 62 | change (L (L.symm (0, 1))).2 - deriv h x * (L (L.symm (0, 1))).1 = 1 |
| 63 | rw [L.apply_symm_apply] |
| 64 | simp |
| 65 | have hell : ell ≠ 0 := by |
| 66 | intro heq |
| 67 | have hz : ell (L.symm (0, 1)) = 0 := by rw [heq]; rfl |
| 68 | linarith |
| 69 | refine ⟨phi, ell, hd, ?_, hell, ?_⟩ |
| 70 | · dsimp only [phi] |
| 71 | rw [hXbase, hYbase, sub_self] |
| 72 | · have ht : Tendsto L (𝓝 (gamma p)) (𝓝 (x, h x)) := by |
| 73 | rw [← hcoord] |
| 74 | exact L.continuous.tendsto _ |
| 75 | filter_upwards [ht.eventually hregion] with z hz |
| 76 | change z ∈ closure U ↔ 0 ≤ (L z).2 - h (L z).1 |
| 77 | rw [sub_nonneg] |
| 78 | simpa only [L.symm_apply_apply] using hz.1 |
| 79 | |
| 80 | /-- The actual compatible triangulation of a smooth Jordan return region has no corner |
| 81 | defect at any regular interior loop parameter. Source: Morgan--Tian Proposition 19.35, |
| 82 | printed pp. 467-481, especially Claim 19.40, pp. 470-471; the explicit project tangent-fan |
| 83 | derivation is reviewed in |
| 84 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-fans.md`, Mathematical Checks. -/ |
| 85 | theorem m64Intrinsic_return_region_smooth_boundary_fan |
| 86 | {I : Type*} [Fintype I] (face : I → SmoothFace AnnulusCoordinates) |
| 87 | (F : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 88 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 89 | (hF : ∀ i, ContMDiffOn (𝓡 2) (𝓡 2) ∞ (F i) (F i).source) |
| 90 | (hFi : ∀ i, ContMDiffOn (𝓡 2) (𝓡 2) ∞ (F i).symm (F i).target) |
| 91 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (F i).source) |
| 92 | (hcarrier : ∀ i, (face i).carrier = F i '' convexHull ℝ (range (b i))) |
| 93 | (hboundary : ∀ i k, ((face i).boundary k).map = F i ∘ |
| 94 | affineChartSegment (b i (k.succAbove 0)) (b i (k.succAbove 1))) |
| 95 | (hinj : ∀ i k, InjOn ((face i).boundary k).map (Icc (0 : ℝ) 1)) |
| 96 | (hinter : ∀ i j, i ≠ j → |
| 97 | (∃ k l : Fin 3, (face i).carrier ∩ (face j).carrier = |
| 98 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 99 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 = |
| 100 | ((face j).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 101 | ∃ w : Fin 3, (face i).carrier ∩ (face j).carrier ⊆ {F i (b i w)}) |
| 102 | (hfront : ∀ i j, i ≠ j → |
| 103 | (face i).carrier ∩ (face j).carrier ⊆ frontier (face i).carrier) |
| 104 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 105 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 106 | (hend : gamma 0 = gamma T) (hginj : InjOn gamma (Ico 0 T)) |
| 107 | (hp : p ∈ Ioo (0 : ℝ) T) (hregular : deriv gamma p ≠ 0) |
| 108 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 109 | (hdisj : Disjoint U V) (hfU : frontier U = gamma '' Icc 0 T) |
| 110 | (hfV : frontier V = gamma '' Icc 0 T) |
| 111 | (hcover : (⋃ i, (face i).carrier) = closure U) |
| 112 | (q : Euler.CoordinateVertex F b) (hq : q.1 = gamma p) : |
| 113 | coordinateVertexAngleContribution g F b q.1 = Real.pi := by |
| 114 | obtain ⟨phi, ell, hd, hzero, hell, hregion⟩ := |
| 115 | m64Intrinsic_exists_loop_defining_function hg hend hginj hp hregular hU hV hdisj hfU hfV |
| 116 | apply m64Intrinsic_regional_boundary_vertex_fan face F b hF hFi hsource hcarrier |
| 117 | hboundary hinj hinter hfront g q (hq.symm ▸ hd) (hq.symm ▸ hzero) hell |
| 118 | simpa only [hq, hcover] using hregion |
| 119 | |
| 120 | end PoincareMT |