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 | /- Adapted from Mapher `PoincareMT/Proofs/M03/CompactCoordinateChange.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.Riemannian.Connection |
| 6 | import Mathlib.MeasureTheory.Function.Jacobian |
| 7 | |
| 8 | /-! |
| 9 | # Integral comparison on compact coordinate domains |
| 10 | |
| 11 | Compactness bounds the absolute Jacobian before the test function is chosen. |
| 12 | The change-of-variables formula and monotonicity on the original compact set |
| 13 | then give a uniform comparison of the two canonical Euclidean integrals. |
| 14 | Derivation: proof-work/tasks/M03/reviews/compact-coordinate-change-derivation.md. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open scoped ContDiff Topology |
| 20 | open MeasureTheory Set |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow.Local |
| 23 | |
| 24 | theorem exists_compact_coordinate_change_integral_bound |
| 25 | {n : ℕ} {U : Set (EuclideanSpace ℝ (Fin n))} (hU : IsOpen U) |
| 26 | {T : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin n)} |
| 27 | (hT : ContDiffOn ℝ 1 T U) (hTi : InjOn T U) |
| 28 | {K : Set (EuclideanSpace ℝ (Fin n))} |
| 29 | (hK : IsCompact K) (hKU : K ⊆ U) : |
| 30 | letI : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 31 | letI : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 32 | ∃ C : ℝ, 0 ≤ C ∧ ∀ g : EuclideanSpace ℝ (Fin n) → ℝ, |
| 33 | ContinuousOn g (T '' K) → (∀ y ∈ T '' K, 0 ≤ g y) → |
| 34 | (∫ y in T '' K, g y) ≤ C * (∫ x in K, g (T x)) := by |
| 35 | let : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 36 | let : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 37 | have hdet : ContinuousOn (fun x => |(fderiv ℝ T x).det|) U := |
| 38 | (ContinuousLinearMap.continuous_det.comp_continuousOn |
| 39 | (hT.continuousOn_fderiv_of_isOpen hU le_rfl)).abs |
| 40 | obtain ⟨B, hB⟩ := hK.exists_bound_of_continuousOn (hdet.mono hKU) |
| 41 | refine ⟨max B 0, le_max_right _ _, ?_⟩ |
| 42 | intro g hg hg0 |
| 43 | have hTK : ContinuousOn T K := hT.continuousOn.mono hKU |
| 44 | have hcomp : ContinuousOn (fun x => g (T x)) K := |
| 45 | hg.comp hTK (fun x hx => mem_image_of_mem T hx) |
| 46 | have hweighted : IntegrableOn (fun x => |(fderiv ℝ T x).det| * g (T x)) K := |
| 47 | ContinuousOn.integrableOn_compact hK ((hdet.mono hKU).mul hcomp) |
| 48 | have hupper : IntegrableOn (fun x => max B 0 * g (T x)) K := |
| 49 | ContinuousOn.integrableOn_compact hK (continuousOn_const.mul hcomp) |
| 50 | have hdiff : ∀ x ∈ K, HasFDerivWithinAt T (fderiv ℝ T x) K x := by |
| 51 | intro x hx |
| 52 | exact ((hT.differentiableOn (by decide)).differentiableAt |
| 53 | (hU.mem_nhds (hKU hx))).hasFDerivAt.hasFDerivWithinAt |
| 54 | have heq := integral_image_eq_integral_abs_det_fderiv_smul volume |
| 55 | hK.isClosed.measurableSet hdiff (hTi.mono hKU) g |
| 56 | simp only [smul_eq_mul] at heq |
| 57 | change (∫ y in T '' K, g y) ≤ max B 0 * (∫ x in K, g (T x)) |
| 58 | rw [heq, ← integral_const_mul] |
| 59 | apply setIntegral_mono_on hweighted hupper hK.isClosed.measurableSet |
| 60 | intro x hx |
| 61 | have hbound : |(fderiv ℝ T x).det| ≤ max B 0 := by |
| 62 | simpa only [Real.norm_eq_abs, abs_abs] using (hB x hx).trans (le_max_left B 0) |
| 63 | exact mul_le_mul_of_nonneg_right hbound (hg0 _ (mem_image_of_mem T hx)) |
| 64 | |
| 65 | end PoincareMT.RicciFlow.Local |