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.RicciFlow.Volume.Surgery.Neck.CylinderDensity |
| 2 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Analysis.GramDensity |
| 3 | import Mathlib.Analysis.Matrix.PosDef |
| 4 | |
| 5 | /-! |
| 6 | Adapted from Mapher `PoincareMT/Proofs/M49/CylinderDensityPatch.lean` at |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 8 | |
| 9 | # A fixed positive-density cylinder patch |
| 10 | |
| 11 | Morgan-Tian Definitions 2.16 and 2.18, pp. 30-31, and the neck-volume |
| 12 | estimate of Lemma 17.12, p. 410. The patch, tolerance and lower density |
| 13 | are chosen before every comparison matrix and line coordinate. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff BigOperators |
| 20 | |
| 21 | namespace PoincareMT.SurgeryVolume |
| 22 | |
| 23 | /-- One sphere-chart patch has a uniformly positive density under a |
| 24 | fixed relative metric tolerance, for every line coordinate |
| 25 | (MT Definitions 2.16 and 2.18, pp. 30-31; Lemma 17.12, p. 410). -/ |
| 26 | theorem exists_cylinder_density_patch (q : UnitTwoSphere) : |
| 27 | ∃ r d a : ℝ, 0 < r ∧ 0 < d ∧ 0 < a ∧ |
| 28 | ∀ p : RoundCylinderCoordinates, |
| 29 | p.1 ∈ Metric.ball ((chartAt (EuclideanSpace ℝ (Fin 2)) q) q) r → |
| 30 | p.1 ∈ (chartAt (EuclideanSpace ℝ (Fin 2)) q).target ∧ |
| 31 | ∀ A : Matrix (Fin 3) (Fin 3) ℝ, |
| 32 | (∀ i j, |A i j - roundCylinderGram 0 |
| 33 | (chartAt (EuclideanSpace ℝ (Fin 2)) q) p i j| ≤ |
| 34 | d * Real.sqrt (roundCylinderGram 0 |
| 35 | (chartAt (EuclideanSpace ℝ (Fin 2)) q) p i i) * |
| 36 | Real.sqrt (roundCylinderGram 0 |
| 37 | (chartAt (EuclideanSpace ℝ (Fin 2)) q) p j j)) → |
| 38 | a ≤ Real.sqrt A.det := by |
| 39 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) q |
| 40 | let p0 : RoundCylinderCoordinates := (c q, 0) |
| 41 | let G0 := roundCylinderGram 0 c p0 |
| 42 | have hcq : c q ∈ c.target := c.map_source (mem_chart_source _ _) |
| 43 | have hG0 : G0.PosDef := roundCylinderGram_posDef 0 (by norm_num) q p0 hcq |
| 44 | have hJ : 0 < Real.sqrt G0.det := Real.sqrt_pos.2 hG0.det_pos |
| 45 | obtain ⟨eta, heta, htol⟩ := Matrix.exists_pos_entrywise_sqrt_det_lower G0 hJ |
| 46 | let L : ℝ := 1 + ∑ i : Fin 3, |G0 i i| |
| 47 | have hsum : 0 ≤ ∑ i : Fin 3, |G0 i i| := Finset.sum_nonneg (fun _ _ => abs_nonneg _) |
| 48 | have hL : 0 < L := by dsimp [L]; linarith |
| 49 | have hcont : ContinuousAt (fun x : EuclideanSpace ℝ (Fin 2) => |
| 50 | roundCylinderGram 0 c (x, 0)) (c q) := |
| 51 | (continuousAt_roundCylinderGram 0 q (p := p0) hcq).comp |
| 52 | (f := fun x : EuclideanSpace ℝ (Fin 2) => (x, (0 : ℝ))) |
| 53 | (continuousAt_id.prodMk continuousAt_const) |
| 54 | have htolpos : 0 < min (eta / 2) 1 := lt_min (half_pos heta) zero_lt_one |
| 55 | obtain ⟨s, hs, hnear⟩ := (Metric.continuousAt_iff |
| 56 | (α := EuclideanSpace ℝ (Fin 2)) (β := Fin 3 → Fin 3 → ℝ)).mp hcont _ htolpos |
| 57 | obtain ⟨t, ht, htarget⟩ := Metric.mem_nhds_iff.mp (c.open_target.mem_nhds hcq) |
| 58 | refine ⟨min s t, eta / (2 * L), Real.sqrt G0.det / 2, |
| 59 | lt_min hs ht, div_pos heta (mul_pos (by norm_num) hL), half_pos hJ, ?_⟩ |
| 60 | intro p hp |
| 61 | have hps : dist p.1 (c q) < s := (Metric.mem_ball.mp hp).trans_le (min_le_left _ _) |
| 62 | have hpt : p.1 ∈ c.target := |
| 63 | htarget ((Metric.mem_ball.mp hp).trans_le (min_le_right _ _)) |
| 64 | refine ⟨hpt, ?_⟩ |
| 65 | have hclose (i j : Fin 3) : |
| 66 | |roundCylinderGram 0 c p i j - G0 i j| < min (eta / 2) 1 := by |
| 67 | have houter := dist_le_pi_dist |
| 68 | (show Fin 3 → Fin 3 → ℝ from roundCylinderGram 0 c (p.1, 0)) G0 i |
| 69 | have hinner := dist_le_pi_dist |
| 70 | (roundCylinderGram 0 c (p.1, 0) i) (G0 i) j |
| 71 | have hi := (hinner.trans houter).trans_lt (hnear hps) |
| 72 | rw [Real.dist_eq] at hi |
| 73 | simpa only [roundCylinderGram_eq_zero_line] using hi |
| 74 | have hdiag (i : Fin 3) : roundCylinderGram 0 c p i i ≤ L := by |
| 75 | have he := (abs_lt.mp ((hclose i i).trans_le (min_le_right _ _))).2 |
| 76 | have hi : |G0 i i| ≤ ∑ j : Fin 3, |G0 j j| := |
| 77 | Finset.single_le_sum (fun j _ => abs_nonneg (G0 j j)) (Finset.mem_univ i) |
| 78 | have hi0 := le_abs_self (G0 i i) |
| 79 | dsimp [L] |
| 80 | linarith |
| 81 | intro A hA |
| 82 | apply htol A |
| 83 | intro i j |
| 84 | have hsqrt : Real.sqrt (roundCylinderGram 0 c p i i) * |
| 85 | Real.sqrt (roundCylinderGram 0 c p j j) ≤ L := by |
| 86 | calc |
| 87 | _ ≤ Real.sqrt L * Real.sqrt L := mul_le_mul |
| 88 | (Real.sqrt_le_sqrt (hdiag i)) (Real.sqrt_le_sqrt (hdiag j)) |
| 89 | (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) |
| 90 | _ = L := Real.mul_self_sqrt hL.le |
| 91 | have herror : |A i j - roundCylinderGram 0 c p i j| ≤ eta / 2 := by |
| 92 | calc |
| 93 | _ ≤ eta / (2 * L) * Real.sqrt (roundCylinderGram 0 c p i i) * |
| 94 | Real.sqrt (roundCylinderGram 0 c p j j) := hA i j |
| 95 | _ = eta / (2 * L) * (Real.sqrt (roundCylinderGram 0 c p i i) * |
| 96 | Real.sqrt (roundCylinderGram 0 c p j j)) := mul_assoc _ _ _ |
| 97 | _ ≤ eta / (2 * L) * L := mul_le_mul_of_nonneg_left hsqrt |
| 98 | (div_nonneg heta.le (mul_nonneg (by norm_num) hL.le)) |
| 99 | _ = eta / 2 := by field_simp |
| 100 | have hmodel := ((hclose i j).trans_le (min_le_left _ _)).le |
| 101 | calc |
| 102 | |A i j - G0 i j| ≤ |A i j - roundCylinderGram 0 c p i j| + |
| 103 | |roundCylinderGram 0 c p i j - G0 i j| := abs_sub_le _ _ _ |
| 104 | _ ≤ eta := by linarith |
| 105 | |
| 106 | end PoincareMT.SurgeryVolume |