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.Analysis.Parabolic.Interior.Localization |
| 2 | |
| 3 | /-! |
| 4 | # Compact smooth extensions from an open domain |
| 5 | |
| 6 | On a neighborhood of a compact subset of its smoothness domain, a smooth |
| 7 | function agrees with a globally smooth compactly supported function. The |
| 8 | construction is qualitative: derivative bounds of the extension are not |
| 9 | needed to transfer local equations and jets. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open Filter Set |
| 16 | open scoped ContDiff Topology |
| 17 | |
| 18 | namespace Poincare.Parabolic.Interior |
| 19 | |
| 20 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 22 | |
| 23 | theorem exists_contDiff_compact_cutoff [FiniteDimensional ℝ E] |
| 24 | {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) : |
| 25 | ∃ χ : E → ℝ, ContDiff ℝ ∞ χ ∧ HasCompactSupport χ ∧ tsupport χ ⊆ U ∧ |
| 26 | ∀ x ∈ K, χ =ᶠ[𝓝 x] fun _ => 1 := by |
| 27 | obtain ⟨W, hWo, hKW, hWc⟩ := exists_isOpen_superset_and_isCompact_closure hK |
| 28 | obtain ⟨V, hVo, hKV, hVU⟩ := hK.exists_isOpen_closure_subset |
| 29 | ((hU.inter hWo).mem_nhdsSet.mpr (subset_inter hKU hKW)) |
| 30 | have hVc : IsCompact (closure V) := hWc.of_isClosed_subset isClosed_closure |
| 31 | (fun x hx => subset_closure (hVU hx).2) |
| 32 | obtain ⟨O, hOo, hKO, hOV⟩ := hK.exists_isOpen_closure_subset |
| 33 | (hVo.mem_nhdsSet.mpr hKV) |
| 34 | obtain ⟨u, huSupp, hu, huRange⟩ := hVo.exists_contDiff_support_eq (n := ⊤) |
| 35 | obtain ⟨v, hvSupp, hv, hvRange⟩ := |
| 36 | isClosed_closure.isOpen_compl.exists_contDiff_support_eq (n := ⊤) (s := (closure O)ᶜ) |
| 37 | have hu0 (x : E) : 0 ≤ u x := (huRange (mem_range_self x)).1 |
| 38 | have hv0 (x : E) : 0 ≤ v x := (hvRange (mem_range_self x)).1 |
| 39 | have hpos (x : E) : 0 < u x + v x := by |
| 40 | by_cases hx : x ∈ V |
| 41 | · have hx' : u x ≠ 0 := by rwa [← Function.mem_support, huSupp] |
| 42 | exact add_pos_of_pos_of_nonneg (lt_of_le_of_ne (hu0 x) hx'.symm) (hv0 x) |
| 43 | · have hx' : v x ≠ 0 := by |
| 44 | rw [← Function.mem_support, hvSupp] |
| 45 | exact fun h => hx (hOV h) |
| 46 | exact add_pos_of_nonneg_of_pos (hu0 x) (lt_of_le_of_ne (hv0 x) hx'.symm) |
| 47 | let χ : E → ℝ := fun x => u x / (u x + v x) |
| 48 | have hsupp : tsupport χ ⊆ closure V := by |
| 49 | apply closure_mono |
| 50 | intro x hx |
| 51 | by_contra hxV |
| 52 | have huX : u x = 0 := by |
| 53 | have : x ∉ Function.support u := by rwa [huSupp] |
| 54 | exact Function.notMem_support.mp this |
| 55 | exact hx (by simp [χ, huX]) |
| 56 | refine ⟨χ, hu.div (hu.add hv) (fun x => (hpos x).ne'), |
| 57 | hVc.of_isClosed_subset isClosed_closure hsupp, |
| 58 | hsupp.trans (fun x hx => (hVU hx).1), ?_⟩ |
| 59 | intro x hx |
| 60 | filter_upwards [hOo.mem_nhds (hKO hx)] with y hy |
| 61 | have hvY : v y = 0 := by |
| 62 | apply Function.notMem_support.mp |
| 63 | rw [hvSupp] |
| 64 | exact not_not.mpr (subset_closure hy) |
| 65 | have huY : u y ≠ 0 := by |
| 66 | rw [← Function.mem_support, huSupp] |
| 67 | exact hOV (subset_closure hy) |
| 68 | simp [χ, hvY, huY] |
| 69 | |
| 70 | theorem exists_compact_smooth_extension [FiniteDimensional ℝ E] |
| 71 | {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) |
| 72 | {f : E → F} (hf : ContDiffOn ℝ ∞ f U) : |
| 73 | ∃ g : E → F, ContDiff ℝ ∞ g ∧ HasCompactSupport g ∧ |
| 74 | ∀ x ∈ K, g =ᶠ[𝓝 x] f := by |
| 75 | obtain ⟨χ, hχ, hχc, hχU, hχK⟩ := exists_contDiff_compact_cutoff hK hU hKU |
| 76 | exact ⟨fun x => χ x • f x, contDiff_smul_cutoff hU hf hχ hχU, |
| 77 | hasCompactSupport_smul_cutoff hχc f, fun x hx => smul_cutoff_eventuallyEq (hχK x hx) f⟩ |
| 78 | |
| 79 | theorem timeDerivative_eq_of_eventuallyEq {f g : E × ℝ → F} {p : E × ℝ} |
| 80 | (h : f =ᶠ[𝓝 p] g) : timeDerivative f p = timeDerivative g p := by |
| 81 | exact congrArg (fun L : E × ℝ →L[ℝ] F => L (0, 1)) (h.fderiv_eq (𝕜 := ℝ)) |
| 82 | |
| 83 | theorem spatialDerivative_eventuallyEq_of_eventuallyEq |
| 84 | {f g : E × ℝ → F} {p : E × ℝ} (h : f =ᶠ[𝓝 p] g) : |
| 85 | spatialDerivative f =ᶠ[𝓝 p] spatialDerivative g := by |
| 86 | filter_upwards [h.fderiv (𝕜 := ℝ)] with q hq |
| 87 | exact congrArg (fun L : E × ℝ →L[ℝ] F => L.comp (ContinuousLinearMap.inl ℝ E ℝ)) hq |
| 88 | |
| 89 | theorem spatialDerivative_eq_of_eventuallyEq {f g : E × ℝ → F} {p : E × ℝ} |
| 90 | (h : f =ᶠ[𝓝 p] g) : spatialDerivative f p = spatialDerivative g p := |
| 91 | (spatialDerivative_eventuallyEq_of_eventuallyEq h).eq_of_nhds |
| 92 | |
| 93 | theorem spatialDerivative_spatialDerivative_eq_of_eventuallyEq |
| 94 | {f g : E × ℝ → F} {p : E × ℝ} (h : f =ᶠ[𝓝 p] g) : |
| 95 | spatialDerivative (spatialDerivative f) p = spatialDerivative (spatialDerivative g) p := |
| 96 | spatialDerivative_eq_of_eventuallyEq (spatialDerivative_eventuallyEq_of_eventuallyEq h) |
| 97 | |
| 98 | /-- Local equations and spatial second jets are preserved by a compact smooth |
| 99 | extension. No norm bound on the extension occurs in the conclusion. -/ |
| 100 | theorem exists_compact_smooth_extension_with_jets [FiniteDimensional ℝ E] |
| 101 | {K U : Set (E × ℝ)} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) |
| 102 | {f : E × ℝ → F} (hf : ContDiffOn ℝ ∞ f U) : |
| 103 | ∃ g : E × ℝ → F, ContDiff ℝ ∞ g ∧ HasCompactSupport g ∧ |
| 104 | ∀ p ∈ K, g =ᶠ[𝓝 p] f ∧ g p = f p ∧ |
| 105 | timeDerivative g p = timeDerivative f p ∧ |
| 106 | spatialDerivative g p = spatialDerivative f p ∧ |
| 107 | spatialDerivative (spatialDerivative g) p = |
| 108 | spatialDerivative (spatialDerivative f) p := by |
| 109 | obtain ⟨g, hg, hgc, hgf⟩ := exists_compact_smooth_extension hK hU hKU hf |
| 110 | refine ⟨g, hg, hgc, fun p hp => ?_⟩ |
| 111 | have h := hgf p hp |
| 112 | exact ⟨h, h.eq_of_nhds, timeDerivative_eq_of_eventuallyEq h, |
| 113 | spatialDerivative_eq_of_eventuallyEq h, |
| 114 | spatialDerivative_spatialDerivative_eq_of_eventuallyEq h⟩ |
| 115 | |
| 116 | end Poincare.Parabolic.Interior |