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 Mathlib.Analysis.InnerProductSpace.PiL2 |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 3 | |
| 4 | /-! |
| 5 | # Coordinate transverse projection and its derivatives |
| 6 | |
| 7 | Removing one coordinate is a linear contraction. Its first and second |
| 8 | derivatives commute with the actual smooth map, and its column energy is |
| 9 | exactly the transverse coordinate energy. Source: Heinz 1970, pp. 100-101; |
| 10 | the M64 transverse-conformality derivation for MT Lemma 19.15, pp. 447-449. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option warningAsError true |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | variable {ι : Type*} [Fintype ι] |
| 24 | local notation "E" => EuclideanSpace ℝ ι |
| 25 | |
| 26 | open Classical in |
| 27 | /-- The actual linear projection away from the selected coordinate. |
| 28 | Source: Heinz pp. 100-101; the M64 transverse-conformality derivation. -/ |
| 29 | def m64TransverseProjection (j : ι) : E →L[ℝ] E := |
| 30 | ContinuousLinearMap.id ℝ E - (EuclideanSpace.proj j).smulRight (EuclideanSpace.single j 1) |
| 31 | |
| 32 | open Classical in |
| 33 | /-- The projection leaves every transverse coordinate unchanged. Source: the M64 |
| 34 | transverse-conformality derivation. Source/construction: |
| 35 | proof-work/tasks/M64/derivations/2026-09-26-transverse-conformality.md, Construct the actual |
| 36 | transverse map. -/ |
| 37 | theorem m64TransverseProjection_apply (j : ι) (v : E) (i : ι) : |
| 38 | m64TransverseProjection j v i = if i = j then 0 else v i := by |
| 39 | classical |
| 40 | change v i - v j * (EuclideanSpace.single j 1) i = _ |
| 41 | by_cases hij : i = j |
| 42 | · subst i |
| 43 | simp only [PiLp.single_apply, ite_true, mul_one, sub_self] |
| 44 | · simp only [PiLp.single_apply, hij, ite_false, mul_zero, sub_zero] |
| 45 | |
| 46 | /-- Removing one coordinate does not increase the Euclidean norm. Source: the M64 |
| 47 | transverse-conformality derivation. Source/construction: |
| 48 | proof-work/tasks/M64/derivations/2026-09-26-transverse-conformality.md, Construct the actual |
| 49 | transverse map. -/ |
| 50 | theorem m64TransverseProjection_norm (j : ι) (v : E) : ‖m64TransverseProjection j v‖ ≤ ‖v‖ := by |
| 51 | classical |
| 52 | apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp |
| 53 | rw [EuclideanSpace.real_norm_sq_eq, EuclideanSpace.real_norm_sq_eq] |
| 54 | apply Finset.sum_le_sum |
| 55 | intro i _ |
| 56 | rw [m64TransverseProjection_apply] |
| 57 | split_ifs |
| 58 | · simpa only [zero_pow two_ne_zero] using sq_nonneg (v i) |
| 59 | · exact le_rfl |
| 60 | |
| 61 | open Classical in |
| 62 | /-- The projected column energy is exactly the transverse coordinate sum. |
| 63 | Source: Heinz pp. 100-101; the M64 transverse-conformality derivation. -/ |
| 64 | theorem m64TransverseProjection_energy {κ : Type*} [Fintype κ] (j : ι) (V : κ → E) : |
| 65 | (∑ i : κ, ‖m64TransverseProjection j (V i)‖ ^ 2) = |
| 66 | ∑ a : ι, if a = j then 0 else ∑ i : κ, (V i a) ^ 2 := by |
| 67 | classical |
| 68 | simp_rw [EuclideanSpace.real_norm_sq_eq, m64TransverseProjection_apply] |
| 69 | rw [Finset.sum_comm] |
| 70 | apply Finset.sum_congr rfl |
| 71 | intro a _ |
| 72 | by_cases haj : a = j |
| 73 | · simp only [if_pos haj, zero_pow two_ne_zero, Finset.sum_const_zero] |
| 74 | · simp only [if_neg haj] |
| 75 | |
| 76 | /-- The first derivative of the actual projected map. Source: the chain rule in the M64 |
| 77 | transverse-conformality derivation. Source/construction: |
| 78 | proof-work/tasks/M64/derivations/2026-09-26-transverse-conformality.md, Construct the actual |
| 79 | transverse map. -/ |
| 80 | theorem m64TransverseProjection_fderiv |
| 81 | {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] |
| 82 | (j : ι) {f : X → E} {x : X} (hf : DifferentiableAt ℝ f x) : |
| 83 | fderiv ℝ (m64TransverseProjection j ∘ f) x = |
| 84 | (m64TransverseProjection j).comp (fderiv ℝ f x) := |
| 85 | ((m64TransverseProjection j).hasFDerivAt.comp x hf.hasFDerivAt).fderiv |
| 86 | |
| 87 | /-- The second derivative also commutes with the transverse projection. Source: the chain |
| 88 | rule in the M64 transverse-conformality derivation. Source/construction: |
| 89 | proof-work/tasks/M64/derivations/2026-09-26-transverse-conformality.md, Construct the actual |
| 90 | transverse map. -/ |
| 91 | theorem m64TransverseProjection_hessian |
| 92 | {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] |
| 93 | (j : ι) {f : X → E} {U : Set X} (hU : IsOpen U) (hf : ContDiffOn ℝ 2 f U) |
| 94 | {x : X} (hx : x ∈ U) (v w : X) : |
| 95 | fderiv ℝ (fderiv ℝ (m64TransverseProjection j ∘ f)) x v w = |
| 96 | m64TransverseProjection j (fderiv ℝ (fderiv ℝ f) x v w) := by |
| 97 | have hnear : fderiv ℝ (m64TransverseProjection j ∘ f) =ᶠ[𝓝 x] |
| 98 | fun z => (m64TransverseProjection j).comp (fderiv ℝ f z) := by |
| 99 | filter_upwards [hU.mem_nhds hx] with z hz |
| 100 | exact m64TransverseProjection_fderiv j |
| 101 | ((hf.contDiffAt (hU.mem_nhds hz)).differentiableAt (by simp)) |
| 102 | have hD : DifferentiableAt ℝ (fderiv ℝ f) x := |
| 103 | ((hf.fderiv_of_isOpen (m := 1) hU (by norm_num)).contDiffAt |
| 104 | (hU.mem_nhds hx)).differentiableAt (by simp) |
| 105 | rw [hnear.fderiv_eq] |
| 106 | have hh := (ContinuousLinearMap.compL ℝ X E E |
| 107 | (m64TransverseProjection j)).hasFDerivAt.comp x hD.hasFDerivAt |
| 108 | simpa only [Function.comp_def, ContinuousLinearMap.compL_apply, |
| 109 | ContinuousLinearMap.comp_apply] using |
| 110 | congrArg (fun A : X →L[ℝ] X →L[ℝ] E => A v w) hh.fderiv |
| 111 | |
| 112 | end PoincareMT |