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.Geometry.Manifold.PartitionOfUnity |
| 2 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 3 | import Mathlib.Geometry.Manifold.Notation |
| 4 | import Mathlib.Geometry.Manifold.Instances.Real |
| 5 | |
| 6 | /-! |
| 7 | # Derivative cancellation for smooth partitions of unity |
| 8 | |
| 9 | The derivative of the partition sums to zero. Consequently, derivatives of a |
| 10 | patched approximation involve the local approximation errors, rather than the |
| 11 | possibly unbounded function being approximated. This is the gluing step needed |
| 12 | for Chow et al., Part III, Proposition 26.49, equation (26.131), printed p. 378. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 18 | |
| 19 | namespace Poincare |
| 20 | |
| 21 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | {ι : Type*} |
| 24 | |
| 25 | /-- Differentiate a finite sum of scalar functions along a tangent vector. -/ |
| 26 | theorem mvfderiv_finset_sum (s : Finset ι) (f : ι → M → ℝ) (x : M) |
| 27 | (v : TangentSpace (𝓡 n) x) |
| 28 | (hf : ∀ i ∈ s, MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (f i) x) : |
| 29 | mvfderiv (𝓡 n) (fun y ↦ ∑ i ∈ s, f i y) x v = |
| 30 | ∑ i ∈ s, mvfderiv (𝓡 n) (f i) x v := by |
| 31 | classical |
| 32 | suffices MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (fun y ↦ ∑ i ∈ s, f i y) x ∧ |
| 33 | mvfderiv (𝓡 n) (fun y ↦ ∑ i ∈ s, f i y) x v = |
| 34 | ∑ i ∈ s, mvfderiv (𝓡 n) (f i) x v from this.2 |
| 35 | induction s using Finset.induction_on with |
| 36 | | empty => simpa [mvfderiv_const] using mdifferentiableAt_const (c := (0 : ℝ)) |
| 37 | | @insert i s hi ih => |
| 38 | obtain ⟨hs, hsum⟩ := ih (fun j hj ↦ hf j (Finset.mem_insert_of_mem hj)) |
| 39 | have hfi := hf i (Finset.mem_insert_self _ _) |
| 40 | simp only [Finset.sum_insert hi] |
| 41 | refine ⟨hfi.add hs, ?_⟩ |
| 42 | rw [mvfderiv_fun_add hfi hs] |
| 43 | simp only [add_apply, hsum] |
| 44 | |
| 45 | /-- Scalar manifold derivatives depend only on the germ of the function. -/ |
| 46 | theorem mvfderiv_eq_of_eventuallyEq {f h : M → ℝ} {x : M} |
| 47 | (heq : f =ᶠ[𝓝 x] h) : mvfderiv (𝓡 n) f x = mvfderiv (𝓡 n) h x := by |
| 48 | unfold mvfderiv |
| 49 | rw [heq.mfderiv_eq] |
| 50 | rw [heq.eq_of_nhds] |
| 51 | |
| 52 | /-- The derivatives of a smooth partition of unity sum to zero at every point. -/ |
| 53 | theorem sum_mvfderiv_partition_eq_zero (ρ : SmoothPartitionOfUnity ι (𝓡 n) M) |
| 54 | (x : M) (v : TangentSpace (𝓡 n) x) : |
| 55 | ∑ i ∈ ρ.fintsupport x, mvfderiv (𝓡 n) (ρ i) x v = 0 := by |
| 56 | rw [← mvfderiv_finset_sum _ _ x v (fun i _ ↦ (ρ i).contMDiff.mdifferentiable (by simp) x)] |
| 57 | have heq : (fun y ↦ ∑ i ∈ ρ.fintsupport x, ρ i y) =ᶠ[𝓝 x] fun _ ↦ (1 : ℝ) := by |
| 58 | filter_upwards [ρ.eventually_finsupport_subset x] with y hy |
| 59 | exact ρ.sum_finsupport' y (Set.mem_univ y) hy |
| 60 | rw [mvfderiv_eq_of_eventuallyEq heq, mvfderiv_const] |
| 61 | rfl |
| 62 | |
| 63 | /-- Write the derivative of a patched function using local errors relative to |
| 64 | any scalar value. No derivative of the function being approximated is needed. -/ |
| 65 | theorem mvfderiv_partition_mul_eq (ρ : SmoothPartitionOfUnity ι (𝓡 n) M) |
| 66 | (f : ι → M → ℝ) (x : M) (v : TangentSpace (𝓡 n) x) (a : ℝ) |
| 67 | (hf : ∀ i, x ∈ tsupport (ρ i) → MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (f i) x) : |
| 68 | mvfderiv (𝓡 n) (fun y ↦ ∑ᶠ i, ρ i y * f i y) x v = |
| 69 | ∑ i ∈ ρ.fintsupport x, |
| 70 | (ρ i x * mvfderiv (𝓡 n) (f i) x v + |
| 71 | (f i x - a) * mvfderiv (𝓡 n) (ρ i) x v) := by |
| 72 | classical |
| 73 | have heq : (fun y ↦ ∑ᶠ i, ρ i y * f i y) =ᶠ[𝓝 x] |
| 74 | (fun y ↦ ∑ i ∈ ρ.fintsupport x, ρ i y * f i y) := by |
| 75 | filter_upwards [ρ.eventually_finsupport_subset x] with y hy |
| 76 | apply finsum_eq_sum_of_support_subset |
| 77 | intro i hi |
| 78 | apply hy |
| 79 | rw [ρ.mem_finsupport] |
| 80 | exact (mul_ne_zero_iff.mp hi).1 |
| 81 | rw [mvfderiv_eq_of_eventuallyEq heq] |
| 82 | rw [mvfderiv_finset_sum _ (fun i y ↦ ρ i y * f i y) x v (fun i hi ↦ |
| 83 | ((ρ i).contMDiff.mdifferentiable (by simp) x).mul |
| 84 | (hf i ((ρ.mem_fintsupport_iff x i).mp hi)))] |
| 85 | have hterm : ∀ i ∈ ρ.fintsupport x, |
| 86 | mvfderiv (𝓡 n) (fun y ↦ ρ i y * f i y) x v = |
| 87 | ρ i x * mvfderiv (𝓡 n) (f i) x v + f i x * mvfderiv (𝓡 n) (ρ i) x v := by |
| 88 | intro i hi |
| 89 | rw [mvfderiv_fun_mul ((ρ i).contMDiff.mdifferentiable (by simp) x) |
| 90 | (hf i ((ρ.mem_fintsupport_iff x i).mp hi))] |
| 91 | simp |
| 92 | simp_rw [Finset.sum_congr rfl hterm] |
| 93 | have hzero := sum_mvfderiv_partition_eq_zero ρ x v |
| 94 | simp only [sub_mul, Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 95 | ← Finset.mul_sum, hzero, mul_zero, sub_zero] |
| 96 | |
| 97 | /-- A partition-weighted approximation satisfies the common pointwise error |
| 98 | bound of its local functions. -/ |
| 99 | theorem abs_partition_mul_sub_le (ρ : SmoothPartitionOfUnity ι (𝓡 n) M) |
| 100 | (f : ι → M → ℝ) (x : M) (a ε : ℝ) |
| 101 | (hf : ∀ i, x ∈ tsupport (ρ i) → |f i x - a| ≤ ε) : |
| 102 | |(∑ᶠ i, ρ i x * f i x) - a| ≤ ε := by |
| 103 | have hmem : (∑ᶠ i, ρ i x • f i x) ∈ Metric.closedBall a ε := |
| 104 | ρ.finsum_smul_mem_convex (Set.mem_univ x) |
| 105 | (fun i hi ↦ by |
| 106 | simpa only [Metric.mem_closedBall, Real.dist_eq] using |
| 107 | hf i (subset_closure hi)) (convex_closedBall a ε) |
| 108 | simpa only [smul_eq_mul, Metric.mem_closedBall, Real.dist_eq] using hmem |
| 109 | |
| 110 | /-- The derivative bound for a patched approximation includes exactly the |
| 111 | weighted local errors contributed by derivatives of the partition. -/ |
| 112 | theorem abs_mvfderiv_partition_mul_le (ρ : SmoothPartitionOfUnity ι (𝓡 n) M) |
| 113 | (f : ι → M → ℝ) (x : M) (v : TangentSpace (𝓡 n) x) (a L N : ℝ) |
| 114 | (hf : ∀ i, x ∈ tsupport (ρ i) → MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (f i) x) |
| 115 | (hd : ∀ i, x ∈ tsupport (ρ i) → |mvfderiv (𝓡 n) (f i) x v| ≤ L * N) : |
| 116 | |mvfderiv (𝓡 n) (fun y ↦ ∑ᶠ i, ρ i y * f i y) x v| ≤ |
| 117 | L * N + ∑ i ∈ ρ.fintsupport x, |
| 118 | |f i x - a| * |mvfderiv (𝓡 n) (ρ i) x v| := by |
| 119 | rw [mvfderiv_partition_mul_eq ρ f x v a hf] |
| 120 | calc |
| 121 | |∑ i ∈ ρ.fintsupport x, |
| 122 | (ρ i x * mvfderiv (𝓡 n) (f i) x v + |
| 123 | (f i x - a) * mvfderiv (𝓡 n) (ρ i) x v)| |
| 124 | ≤ ∑ i ∈ ρ.fintsupport x, |
| 125 | |ρ i x * mvfderiv (𝓡 n) (f i) x v + |
| 126 | (f i x - a) * mvfderiv (𝓡 n) (ρ i) x v| := |
| 127 | Finset.abs_sum_le_sum_abs _ _ |
| 128 | _ ≤ ∑ i ∈ ρ.fintsupport x, |
| 129 | (ρ i x * (L * N) + |f i x - a| * |mvfderiv (𝓡 n) (ρ i) x v|) := by |
| 130 | apply Finset.sum_le_sum |
| 131 | intro i hi |
| 132 | apply (abs_add_le _ _).trans |
| 133 | rw [abs_mul, abs_mul, abs_of_nonneg (ρ.nonneg i x)] |
| 134 | exact add_le_add |
| 135 | (mul_le_mul_of_nonneg_left (hd i ((ρ.mem_fintsupport_iff x i).mp hi)) |
| 136 | (ρ.nonneg i x)) le_rfl |
| 137 | _ = L * N + ∑ i ∈ ρ.fintsupport x, |
| 138 | |f i x - a| * |mvfderiv (𝓡 n) (ρ i) x v| := by |
| 139 | rw [Finset.sum_add_distrib, ← Finset.sum_mul, |
| 140 | ρ.sum_finsupport' x (Set.mem_univ x) (ρ.finsupport_subset_fintsupport x), one_mul] |
| 141 | |
| 142 | end Poincare |