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 | /- |
| 2 | Provenance and modification notice (recorded 2026-09-29). |
| 3 | Notices for the adapted source: |
| 4 | Copyright 2026 The DifferentialGeometry contributors |
| 5 | Source: https://github.com/qinz1yang/differential-geometry |
| 6 | DifferentialGeometry/Analysis/Sobolev/Tools/DifferenceQuotientWeakLimitLoc.lean |
| 7 | Comparison revision: 1b535dd102b94cc42b107cca27059687888f08b3. |
| 8 | Changes: Imports, module paths, and namespaces were adapted to the subject-organized PoincareLib library. The local file extracts a subset of the upstream development. |
| 9 | License: Apache-2.0. Source licenses and notices are retained under |
| 10 | PoincareConjecture/provenance/2026-09-29/licenses/. |
| 11 | See PoincareConjecture/MODIFICATIONS.md for the reviewed source mapping. |
| 12 | -/ |
| 13 | |
| 14 | import PoincareLib.Analysis.Elliptic.Regularity.DifferenceQuotient.LocalFunctional |
| 15 | |
| 16 | /-! |
| 17 | # Weak derivatives from locally bounded difference quotients |
| 18 | |
| 19 | Adapted from Chow--Liao--Qin, `Analysis/Sobolev/Tools/DifferenceQuotientWeakLimitLoc.lean`, |
| 20 | revision `1b535dd102b94cc42b107cca27059687888f08b3`. |
| 21 | Apache-2.0; see `PoincareConjecture/provenance/2026-09-29/licenses/DifferentialGeometry/LICENSE`. |
| 22 | -/ |
| 23 | |
| 24 | noncomputable section |
| 25 | |
| 26 | open MeasureTheory Metric Filter Topology Set Function |
| 27 | open scoped ENNReal NNReal Convolution Pointwise BigOperators InnerProductSpace |
| 28 | RealInnerProductSpace |
| 29 | |
| 30 | namespace Poincare.Analysis.Sobolev |
| 31 | |
| 32 | variable {d : ℕ} [NeZero d] |
| 33 | |
| 34 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 35 | |
| 36 | omit [NeZero d] in |
| 37 | theorem hasWeakPartialDeriv_of_diffQuot_uniform_bound_loc |
| 38 | {Ω : Set E} (hΩ_open : IsOpen Ω) |
| 39 | {Ω'' : Set E} (hΩ''_open : IsOpen Ω'') |
| 40 | (hΩ''_compact_closure : IsCompact (closure Ω'')) |
| 41 | {h₀ : ℝ} (hh₀ : 0 < h₀) |
| 42 | (h_room : Metric.cthickening h₀ (closure Ω'') ⊆ Ω) |
| 43 | {w : E → ℝ} |
| 44 | (hw_l2 : MemLp w 2 ((volume : Measure E).restrict Ω)) |
| 45 | (k : Fin d) {M : ℝ} (hM_nn : 0 ≤ M) |
| 46 | (h_bdd : ∀ h : ℝ, 0 < |h| → |h| ≤ h₀ → |
| 47 | eLpNorm (diffQuot k h w) 2 ((volume : Measure E).restrict Ω'') |
| 48 | ≤ ENNReal.ofReal M) : |
| 49 | ∃ g : E → ℝ, |
| 50 | MemLp g 2 ((volume : Measure E).restrict Ω'') ∧ |
| 51 | (∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 52 | tsupport φ ⊆ Ω'' → |
| 53 | (∫ x in Ω'', w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1)) = |
| 54 | -(∫ x in Ω'', g x * φ x)) ∧ |
| 55 | eLpNorm g 2 ((volume : Measure E).restrict Ω'') ≤ ENNReal.ofReal M := by |
| 56 | have hΩ''_in_Ω : closure Ω'' ⊆ Ω := |
| 57 | (Metric.self_subset_cthickening (δ := h₀) (closure Ω'')).trans h_room |
| 58 | set g_lp : Lp ℝ 2 ((volume : Measure E).restrict Ω'') := |
| 59 | smoothTestFunctionalLocRiesz (d := d) (Ω := Ω) (Ω'' := Ω'') hw_l2 k with hg_lp_def |
| 60 | refine ⟨⇑g_lp, ?_, ?_, ?_⟩ |
| 61 | · exact Lp.memLp g_lp |
| 62 | · intro φ hφ_smooth hφ_supp hφ_supp_in |
| 63 | set φ_cs : smoothCSSupportedInSubmodule (d := d) Ω'' := |
| 64 | ⟨φ, hφ_smooth, hφ_supp, hφ_supp_in⟩ with hφ_cs_def |
| 65 | have h_ext_apply := |
| 66 | smoothTestFunctional_loc_ext_apply (d := d) hΩ_open hΩ''_open |
| 67 | hΩ''_compact_closure hh₀ h_room hw_l2 k hM_nn h_bdd φ_cs |
| 68 | have h_ext_inner := |
| 69 | smoothTestFunctional_loc_ext_eq_inner (d := d) (Ω := Ω) (Ω'' := Ω'') hw_l2 k |
| 70 | (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) |
| 71 | have h_func_val : |
| 72 | smoothTestFunctionalLoc (d := d) (Ω := Ω) (Ω'' := Ω'') hw_l2 k φ_cs = |
| 73 | -∫ x in Ω, w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 74 | ∂(volume : Measure E) := by |
| 75 | rw [smoothTestFunctional_loc_apply] |
| 76 | have h_inner_def := L2.inner_def (𝕜 := ℝ) g_lp |
| 77 | (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) |
| 78 | have h_coeFn_phi : |
| 79 | ⇑(smoothCSSupportedInToLp (d := d) Ω'' φ_cs) =ᵐ[ |
| 80 | (volume : Measure E).restrict Ω''] φ := by |
| 81 | simp only [smoothCSSupportedInToLp_apply] |
| 82 | exact MemLp.coeFn_toLp _ |
| 83 | have h_int_eq : |
| 84 | ∫ x, ⟪g_lp x, (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) x⟫_ℝ |
| 85 | ∂((volume : Measure E).restrict Ω'') = |
| 86 | ∫ x in Ω'', g_lp x * φ x ∂(volume : Measure E) := by |
| 87 | have h_eq : ∫ x, ⟪g_lp x, |
| 88 | (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) x⟫_ℝ |
| 89 | ∂((volume : Measure E).restrict Ω'') = |
| 90 | ∫ x, g_lp x * φ x ∂((volume : Measure E).restrict Ω'') := by |
| 91 | refine integral_congr_ae ?_ |
| 92 | filter_upwards [h_coeFn_phi] with x hx |
| 93 | have h_inner_eq : |
| 94 | ⟪(g_lp x : ℝ), (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) x⟫_ℝ = |
| 95 | (smoothCSSupportedInToLp (d := d) Ω'' φ_cs) x * (g_lp x : ℝ) := |
| 96 | RCLike.inner_apply (𝕜 := ℝ) (g_lp x) |
| 97 | ((smoothCSSupportedInToLp (d := d) Ω'' φ_cs) x) |
| 98 | rw [h_inner_eq, hx]; ring |
| 99 | rw [h_eq] |
| 100 | have h_chain : |
| 101 | smoothTestFunctionalLoc (d := d) (Ω := Ω) (Ω'' := Ω'') hw_l2 k φ_cs = |
| 102 | ∫ x in Ω'', g_lp x * φ x ∂(volume : Measure E) := by |
| 103 | rw [← h_ext_apply, h_ext_inner, h_inner_def, h_int_eq] |
| 104 | rw [h_func_val] at h_chain |
| 105 | have h_int_Ω_eq_Ω'' : |
| 106 | ∫ x in Ω, w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 107 | ∂(volume : Measure E) = |
| 108 | ∫ x in Ω'', w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 109 | ∂(volume : Measure E) := by |
| 110 | have h_partial_zero_off_Ω'' : ∀ x ∉ Ω'', |
| 111 | (fderiv ℝ φ x) (EuclideanSpace.single k 1) = 0 := by |
| 112 | intro x hx |
| 113 | have hxnot : x ∉ tsupport φ := fun hxt => hx (hφ_supp_in hxt) |
| 114 | have h_eq_zero : φ =ᶠ[𝓝 x] (fun _ => (0 : ℝ)) := by |
| 115 | have h_open := isClosed_tsupport φ |>.isOpen_compl |
| 116 | have h_nhd := h_open.mem_nhds hxnot |
| 117 | filter_upwards [h_nhd] with y hy |
| 118 | have hy_supp : y ∉ Function.support φ := fun hy_in_supp => |
| 119 | hy (subset_tsupport _ hy_in_supp) |
| 120 | rwa [Function.mem_support, not_not] at hy_supp |
| 121 | have h_fderiv_eq : fderiv ℝ φ x = fderiv ℝ (fun _ : E => (0 : ℝ)) x := |
| 122 | h_eq_zero.fderiv_eq |
| 123 | rw [h_fderiv_eq] |
| 124 | simp |
| 125 | have h_split : ∫ x in Ω, |
| 126 | w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 127 | ∂(volume : Measure E) = |
| 128 | ∫ x in Ω'', |
| 129 | w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 130 | ∂(volume : Measure E) := by |
| 131 | have h_zero_on_diff : ∀ x ∉ Ω'', |
| 132 | w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) = 0 := by |
| 133 | intro x hx |
| 134 | rw [h_partial_zero_off_Ω'' x hx, mul_zero] |
| 135 | have h_int_E_Ω : ∫ x in Ω, |
| 136 | w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 137 | ∂(volume : Measure E) = |
| 138 | ∫ x, Ω.indicator (fun y => w y * |
| 139 | (fderiv ℝ φ y) (EuclideanSpace.single k 1)) x |
| 140 | ∂(volume : Measure E) := |
| 141 | (integral_indicator hΩ_open.measurableSet).symm |
| 142 | have h_int_E_Ω'' : ∫ x in Ω'', |
| 143 | w x * (fderiv ℝ φ x) (EuclideanSpace.single k 1) |
| 144 | ∂(volume : Measure E) = |
| 145 | ∫ x, Ω''.indicator (fun y => w y * |
| 146 | (fderiv ℝ φ y) (EuclideanSpace.single k 1)) x |
| 147 | ∂(volume : Measure E) := |
| 148 | (integral_indicator hΩ''_open.measurableSet).symm |
| 149 | rw [h_int_E_Ω, h_int_E_Ω''] |
| 150 | refine integral_congr_ae ?_ |
| 151 | refine Filter.Eventually.of_forall ?_ |
| 152 | intro x |
| 153 | by_cases hx_Ω'' : x ∈ Ω'' |
| 154 | · have hx_Ω : x ∈ Ω := hΩ''_in_Ω (subset_closure hx_Ω'') |
| 155 | rw [Set.indicator_of_mem hx_Ω, Set.indicator_of_mem hx_Ω''] |
| 156 | · rw [Set.indicator_of_notMem hx_Ω''] |
| 157 | by_cases hx_Ω : x ∈ Ω |
| 158 | · rw [Set.indicator_of_mem hx_Ω] |
| 159 | exact h_zero_on_diff x hx_Ω'' |
| 160 | · rw [Set.indicator_of_notMem hx_Ω] |
| 161 | exact h_split |
| 162 | rw [h_int_Ω_eq_Ω''] at h_chain |
| 163 | linarith |
| 164 | · have h_norm_eq := norm_smoothTestFunctional_loc_riesz (d := d) (Ω := Ω) |
| 165 | (Ω'' := Ω'') hw_l2 k |
| 166 | have h_op_le := opNorm_smoothTestFunctional_loc_ext_le (d := d) hΩ_open |
| 167 | hΩ''_open hΩ''_compact_closure hh₀ h_room hw_l2 k hM_nn h_bdd |
| 168 | have h_g_lp_le : ‖g_lp‖ ≤ M := by |
| 169 | rw [hg_lp_def] |
| 170 | rw [h_norm_eq] |
| 171 | exact h_op_le |
| 172 | have h_g_lp_nn : 0 ≤ ‖g_lp‖ := norm_nonneg _ |
| 173 | have h_enorm_le : (‖g_lp‖ₑ : ℝ≥0∞) ≤ ENNReal.ofReal M := by |
| 174 | have hofreal : (‖g_lp‖ₑ : ℝ≥0∞) = ENNReal.ofReal ‖g_lp‖ := |
| 175 | (ofReal_norm _).symm |
| 176 | rw [hofreal] |
| 177 | exact ENNReal.ofReal_le_ofReal h_g_lp_le |
| 178 | have h_enorm_eq : ‖g_lp‖ₑ = |
| 179 | eLpNorm (⇑g_lp) 2 ((volume : Measure E).restrict Ω'') := |
| 180 | Lp.enorm_def g_lp |
| 181 | rw [← h_enorm_eq] |
| 182 | exact h_enorm_le |
| 183 | |
| 184 | |
| 185 | end Poincare.Analysis.Sobolev |