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.Geodesic.Turning |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Loop.Reparametrization |
| 3 | |
| 4 | /-! |
| 5 | # Zero turning for coordinate edges in an actual geodesic return loop |
| 6 | |
| 7 | The local parameter is constructed from the simple loop. Its possible |
| 8 | joined endpoint has at most one preimage on an embedded triangle edge, |
| 9 | which does not affect the integral. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 12 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 13 | derivations. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter MeasureTheory |
| 21 | open scoped Topology Manifold ContDiff Bundle |
| 22 | open PoincareMT.Topology.Surface |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 27 | normedSpaceTangentSpaceVectorSpace |
| 28 | |
| 29 | /-- An actual coordinate side in a regular unit geodesic return trace has zero turning |
| 30 | integral, with its possible joined point removed only as a null exception. Source: |
| 31 | Morgan--Tian Proposition 19.35, printed pp. 467-481, including the Gauss--Bonnet argument in |
| 32 | Lemma 19.45, p. 474; the explicit regional construction is reviewed in |
| 33 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 34 | Checks. -/ |
| 35 | theorem m64Intrinsic_coordinate_side_geodesic_turning_eq_zero |
| 36 | {g : RiemannianMetric 2 AnnulusCoordinates} (D : LeviCivitaData g) |
| 37 | (F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 38 | (b : AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 39 | (hF : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F F.source) |
| 40 | (hFi : ContMDiffOn (𝓡 2) (𝓡 2) ∞ F.symm F.target) |
| 41 | (hsource : convexHull ℝ (range b) ⊆ F.source) |
| 42 | (Q : RiemannianMetric.AlignedChartFrame g (coordinateTriangleChart F b)) |
| 43 | {i j : Fin 3} (hij : i ≠ j) |
| 44 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T : ℝ} |
| 45 | (hgeo : g.IsGeodesicOn gamma (Icc 0 T)) |
| 46 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 47 | (hunit : ∀ p ∈ Icc 0 T, g.inner (gamma p) (deriv gamma p) (deriv gamma p) = 1) |
| 48 | (himage : (fun t : ℝ => F (AffineMap.lineMap (b i) (b j) t)) '' Icc (0 : ℝ) 1 ⊆ |
| 49 | gamma '' Icc 0 T) : |
| 50 | coordinateTriangleTurningIntegral D F b Q i j = 0 := by |
| 51 | let eta : ℝ → AnnulusCoordinates := fun t => F (AffineMap.lineMap (b i) (b j) t) |
| 52 | let V := coordinateTriangleSideField F b i j |
| 53 | let W := coordinateTriangleSideUnitField g F b i j |
| 54 | have hsrc (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : |
| 55 | AffineMap.lineMap (b i) (b j) t ∈ F.source := |
| 56 | hsource ((convex_convexHull ℝ (range b)).lineMap_mem |
| 57 | (subset_convexHull ℝ _ (mem_range_self i)) (subset_convexHull ℝ _ (mem_range_self j)) ht) |
| 58 | have htarget (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : eta t ∈ F.target := F.map_source (hsrc t ht) |
| 59 | have hinjeta : InjOn eta (Icc (0 : ℝ) 1) := by |
| 60 | intro s hs t ht heq |
| 61 | exact AffineMap.lineMap_injective ℝ (b.ind.injective.ne hij) |
| 62 | (F.injOn (hsrc s hs) (hsrc t ht) heq) |
| 63 | have hside (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : |
| 64 | ContDiffAt ℝ ∞ eta t ∧ deriv eta t = V (eta t) := by |
| 65 | have h := coordinateTriangle_side_velocity F b hF hFi hsource i j ht |
| 66 | refine ⟨contMDiffAt_iff_contDiffAt.mp h.1, ?_⟩ |
| 67 | have hd := h.2 |
| 68 | rw [mfderiv_eq_fderiv] at hd |
| 69 | change fderiv ℝ eta t 1 = V (eta t) at hd |
| 70 | simpa only [fderiv_eq_smul_deriv, one_smul] using hd |
| 71 | have hv : standardTriangleVertex j - standardTriangleVertex i ≠ 0 := by |
| 72 | intro hz |
| 73 | have h := congrArg (triangleParameterEquiv b) (sub_eq_zero.mp hz) |
| 74 | rw [triangleParameterEquiv_vertex, triangleParameterEquiv_vertex] at h |
| 75 | exact hij (b.ind.injective h).symm |
| 76 | have hreg (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : deriv eta t ≠ 0 := by |
| 77 | rw [(hside t ht).2] |
| 78 | apply LeviCivitaData.chartField_ne_zero (coordinateTriangleChart F b) |
| 79 | (coordinateTriangleChart_smooth F b hFi) |
| 80 | (coordinateTriangleChart_smooth_symm F b hF) hv |
| 81 | rw [coordinateTriangleChart_source] |
| 82 | exact htarget t ht |
| 83 | have hzero (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) 1) (hne : eta t ≠ gamma 0) : |
| 84 | D.surfaceTurningForm Q.first Q.second W V (eta t) = 0 := by |
| 85 | obtain ⟨p, hp, hpt⟩ := himage ⟨t, Ioo_subset_Icc_self ht, rfl⟩ |
| 86 | have hp0 : 0 < p := lt_of_le_of_ne hp.1 (by |
| 87 | intro h |
| 88 | exact hne (hpt.symm.trans (congrArg gamma h.symm))) |
| 89 | have hpT : p < T := lt_of_le_of_ne hp.2 (by |
| 90 | intro h |
| 91 | exact hne (hpt.symm.trans ((congrArg gamma h).trans hend.symm))) |
| 92 | have hgammaReg : deriv gamma p ≠ 0 := by |
| 93 | intro hz |
| 94 | have hu := hunit p hp |
| 95 | simp only [hz, map_zero] at hu |
| 96 | norm_num at hu |
| 97 | obtain ⟨phi, hphi, hphip, hpd, heq⟩ := |
| 98 | m64Intrinsic_exists_local_loop_reparametrization hg hend hinj ⟨hp0, hpT⟩ hgammaReg |
| 99 | (hside t (Ioo_subset_Icc_self ht)).1 hpt.symm |
| 100 | (Filter.mem_of_superset (isOpen_Ioo.mem_nhds ht) |
| 101 | (fun s hs => himage ⟨s, Ioo_subset_Icc_self hs, rfl⟩)) |
| 102 | (hreg t (Ioo_subset_Icc_self ht)) |
| 103 | have hT : DifferentiableAt ℝ W (eta t) := by |
| 104 | have h := (coordinateTriangleSideUnitField_smooth g F b hF hFi hij).contMDiffAt |
| 105 | (F.open_target.mem_nhds (htarget t (Ioo_subset_Icc_self ht))) |
| 106 | have hh := (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 107 | have hW' : ContMDiffAt (𝓡 2) (𝓡 2) ∞ W (eta t) := by |
| 108 | simpa only [trivializationAt_model_space_apply] using hh |
| 109 | exact (contMDiffAt_iff_contDiffAt.mp hW').differentiableAt (by simp) |
| 110 | apply m64Intrinsic_normalized_geodesic_turning_eq_zero D Q.first Q.second hg hgeo |
| 111 | (hphip.symm ▸ hp) (hphi.of_le (by norm_cast)) hpd heq _ _ hT |
| 112 | · rw [hphip] |
| 113 | filter_upwards [isOpen_Ioo.mem_nhds (show p ∈ Ioo (0 : ℝ) T from ⟨hp0, hpT⟩)] with s hs |
| 114 | exact hunit s (Ioo_subset_Icc_self hs) |
| 115 | · filter_upwards [isOpen_Ioo.mem_nhds ht] with s hs |
| 116 | exact (hside s (Ioo_subset_Icc_self hs)).2.symm |
| 117 | have hfinite : {t : ℝ | t ∈ Icc (0 : ℝ) 1 ∧ eta t = gamma 0}.Finite := by |
| 118 | apply Set.Subsingleton.finite |
| 119 | intro s hs t ht |
| 120 | exact hinjeta hs.1 ht.1 (hs.2.trans ht.2.symm) |
| 121 | unfold coordinateTriangleTurningIntegral |
| 122 | apply intervalIntegral.integral_zero_ae |
| 123 | filter_upwards [hfinite.countable.ae_notMem volume, volume.ae_ne (1 : ℝ)] with t hnot h1 ht |
| 124 | have ht' : t ∈ Ioc (0 : ℝ) 1 := by simpa only [uIoc_of_le zero_le_one] using ht |
| 125 | exact hzero t ⟨ht'.1, lt_of_le_of_ne ht'.2 h1⟩ |
| 126 | (fun heq => hnot ⟨⟨ht'.1.le, ht'.2⟩, heq⟩) |
| 127 | |
| 128 | end PoincareMT |