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.Adjoint |
| 2 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 3 | import Mathlib.Analysis.Normed.Module.FiniteDimension |
| 4 | |
| 5 | /-! |
| 6 | # Local critical projection for a smooth immersion |
| 7 | |
| 8 | The actual adjoint critical-point equation has an invertible parameter |
| 9 | derivative at an immersed point. MT2007 Claim 19.1, p. 437; Auroux, |
| 10 | MIT 18.966 Lecture 5 (2007), Theorem 3 and equation (1), p. 1; |
| 11 | `2026-09-21-local-critical-projection.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology ContDiff |
| 18 | |
| 19 | namespace PoincareMT.M63 |
| 20 | |
| 21 | variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] |
| 22 | [NormedAddCommGroup F] [InnerProductSpace ℝ F] [CompleteSpace F] |
| 23 | |
| 24 | /-- The actual derivative of the adjoint critical-point equation at a |
| 25 | point of the immersion. Auroux Lecture 5, p. 1, equation (1); local |
| 26 | critical projection derivation, item 1. The derivative of the adjoint |
| 27 | factor vanishes against the zero residual. -/ |
| 28 | theorem hasFDerivAt_criticalProjection {f : E → F} {c : E} |
| 29 | (hf : ContDiffAt ℝ 2 f c) : |
| 30 | HasFDerivAt (fun p : F × E => (fderiv ℝ f p.2).adjoint (p.1 - f p.2)) |
| 31 | ((fderiv ℝ f c).adjoint.comp |
| 32 | (ContinuousLinearMap.fst ℝ F E - |
| 33 | (fderiv ℝ f c).comp (ContinuousLinearMap.snd ℝ F E))) (f c, c) := by |
| 34 | let ad : (E →L[ℝ] F) →L[ℝ] (F →L[ℝ] E) := |
| 35 | ContinuousLinearMap.adjoint.toContinuousLinearEquiv.toContinuousLinearMap |
| 36 | have hdf : DifferentiableAt ℝ (fun p : F × E => ad (fderiv ℝ f p.2)) (f c, c) := |
| 37 | ad.differentiableAt.comp _ |
| 38 | (((hf.fderiv_right (m := 1) (by norm_num)).differentiableAt (by norm_num)).comp _ |
| 39 | differentiableAt_snd) |
| 40 | have hr : HasFDerivAt (fun p : F × E => p.1 - f p.2) |
| 41 | (ContinuousLinearMap.fst ℝ F E - |
| 42 | (fderiv ℝ f c).comp (ContinuousLinearMap.snd ℝ F E)) (f c, c) := |
| 43 | hasFDerivAt_fst.sub |
| 44 | ((hf.differentiableAt (by norm_num)).hasFDerivAt.comp _ hasFDerivAt_snd) |
| 45 | convert! hdf.hasFDerivAt.clm_apply hr using 1 |
| 46 | simp only [sub_self, map_zero, add_zero, ad] |
| 47 | rfl |
| 48 | |
| 49 | /-- An injective derivative gives a unique smooth nearby solution of |
| 50 | the actual critical-point equation on common open neighborhoods. Auroux |
| 51 | Lecture 5, Theorem 3, p. 1; local critical projection derivation, item 2. |
| 52 | The uniqueness is local in both variables and makes no global closest-point |
| 53 | claim. The ambient Hilbert space may be infinite dimensional. -/ |
| 54 | theorem exists_local_criticalProjection [FiniteDimensional ℝ E] |
| 55 | {f : E → F} {s : Set E} {c : E} (hs : IsOpen s) (hc : c ∈ s) |
| 56 | (hf : ContDiffOn ℝ ∞ f s) (hinj : Function.Injective (fderiv ℝ f c)) : |
| 57 | ∃ W : Set F, ∃ V : Set E, ∃ g : F → E, |
| 58 | IsOpen W ∧ f c ∈ W ∧ IsOpen V ∧ c ∈ V ∧ V ⊆ s ∧ |
| 59 | g (f c) = c ∧ MapsTo g W V ∧ ContDiffOn ℝ ∞ g W ∧ |
| 60 | (∀ z ∈ W, (fderiv ℝ f (g z)).adjoint (z - f (g z)) = 0) ∧ |
| 61 | ∀ z ∈ W, ∀ u ∈ V, (fderiv ℝ f u).adjoint (z - f u) = 0 → u = g z := by |
| 62 | let A := fderiv ℝ f c |
| 63 | let K := A.adjoint.comp A |
| 64 | have hKi : Function.Injective K := A.adjoint_comp_self_injective_iff.mpr hinj |
| 65 | let J : E ≃L[ℝ] E := (LinearEquiv.ofInjectiveEndo K.toLinearMap hKi).toContinuousLinearEquiv |
| 66 | let fst := ContinuousLinearMap.fst ℝ F E |
| 67 | let snd := ContinuousLinearMap.snd ℝ F E |
| 68 | let B0 := fst.prod (A.adjoint.comp (fst - A.comp snd)) |
| 69 | let C0 := fst.prod (J.symm.toContinuousLinearMap.comp (A.adjoint.comp fst - snd)) |
| 70 | have hleft : Function.LeftInverse C0 B0 := by |
| 71 | intro q |
| 72 | apply Prod.ext |
| 73 | · rfl |
| 74 | · change J.symm (A.adjoint q.1 - A.adjoint (q.1 - A q.2)) = q.2 |
| 75 | rw [map_sub A.adjoint, sub_sub_cancel] |
| 76 | exact J.symm_apply_apply q.2 |
| 77 | have hright : Function.RightInverse C0 B0 := by |
| 78 | intro q |
| 79 | apply Prod.ext |
| 80 | · rfl |
| 81 | · change A.adjoint (q.1 - A (J.symm (A.adjoint q.1 - q.2))) = q.2 |
| 82 | rw [map_sub] |
| 83 | change A.adjoint q.1 - J (J.symm (A.adjoint q.1 - q.2)) = q.2 |
| 84 | rw [J.apply_symm_apply, sub_sub_cancel] |
| 85 | let B := ContinuousLinearEquiv.equivOfInverse B0 C0 hleft hright |
| 86 | let P (q : F × E) := (fderiv ℝ f q.2).adjoint (q.1 - f q.2) |
| 87 | let H (q : F × E) := (q.1, P q) |
| 88 | let S : Set (F × E) := univ ×ˢ s |
| 89 | let p : F × E := (f c, c) |
| 90 | have hS : IsOpen S := isOpen_univ.prod hs |
| 91 | have hpS : p ∈ S := ⟨mem_univ _, hc⟩ |
| 92 | let ad : (E →L[ℝ] F) →L[ℝ] (F →L[ℝ] E) := |
| 93 | ContinuousLinearMap.adjoint.toContinuousLinearEquiv.toContinuousLinearMap |
| 94 | have hfs : ContDiffOn ℝ ∞ (fun q : F × E => f q.2) S := |
| 95 | hf.comp contDiffOn_snd (fun _ hq => hq.2) |
| 96 | have hdf : ContDiffOn ℝ ∞ (fun q : F × E => fderiv ℝ f q.2) S := |
| 97 | (hf.fderiv_of_isOpen hs (by simp)).comp contDiffOn_snd (fun _ hq => hq.2) |
| 98 | have hP : ContDiffOn ℝ ∞ P S := by |
| 99 | convert! (ad.contDiff.comp_contDiffOn hdf).clm_apply (contDiffOn_fst.sub hfs) using 1 |
| 100 | have hH : ContDiffOn ℝ ∞ H S := contDiffOn_fst.prodMk hP |
| 101 | have hHp : ContDiffAt ℝ ∞ H p := hH.contDiffAt (hS.mem_nhds hpS) |
| 102 | have hB : HasFDerivAt H (B : F × E →L[ℝ] F × E) p := by |
| 103 | convert! hasFDerivAt_fst.prodMk (hasFDerivAt_criticalProjection |
| 104 | ((hf.contDiffAt (hs.mem_nhds hc)).of_le |
| 105 | (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2))) using 1 |
| 106 | let h := hHp.toOpenPartialHomeomorph H hB (by simp) |
| 107 | have hcoe : (h : (F × E) → F × E) = H := rfl |
| 108 | have hp : p ∈ h.source := hHp.mem_toOpenPartialHomeomorph_source hB (by simp) |
| 109 | have hbase : h p = (f c, 0) := by |
| 110 | change (f c, (fderiv ℝ f c).adjoint (f c - f c)) = (f c, 0) |
| 111 | rw [sub_self, map_zero] |
| 112 | have hbaseinv : h.symm (f c, 0) = p := by rw [← hbase, h.left_inv hp] |
| 113 | have htarget : (f c, 0) ∈ h.target := hbase ▸ h.map_source hp |
| 114 | have hdercont : ContinuousAt (fderiv ℝ H) p := |
| 115 | (hH.continuousOn_fderiv_of_isOpen hS (by simp)).continuousAt (hS.mem_nhds hpS) |
| 116 | have hInv : {q | ∃ e : (F × E) ≃L[ℝ] (F × E), e.toContinuousLinearMap = fderiv ℝ H q} |
| 117 | ∈ 𝓝 p := by |
| 118 | change (fderiv ℝ H) ⁻¹' range |
| 119 | (fun e : (F × E) ≃L[ℝ] (F × E) => e.toContinuousLinearMap) ∈ 𝓝 p |
| 120 | apply hdercont.preimage_mem_nhds |
| 121 | rw [hB.fderiv] |
| 122 | exact B.nhds |
| 123 | obtain ⟨O, hOsub, hO, hpO⟩ := mem_nhds_iff.mp |
| 124 | (Filter.inter_mem hInv (Filter.inter_mem (h.open_source.mem_nhds hp) (hS.mem_nhds hpS))) |
| 125 | obtain ⟨W0, V, hW0, hcW0, hV, hcV, hprod⟩ := mem_nhds_prod_iff'.mp (hO.mem_nhds hpO) |
| 126 | let T := h.target ∩ h.symm ⁻¹' (O ∩ (univ ×ˢ V)) |
| 127 | have hT : IsOpen T := h.isOpen_inter_preimage_symm (hO.inter (isOpen_univ.prod hV)) |
| 128 | have hpT : (f c, 0) ∈ T := by |
| 129 | refine ⟨htarget, ?_⟩ |
| 130 | change h.symm (f c, 0) ∈ O ∩ (univ ×ˢ V) |
| 131 | rw [hbaseinv] |
| 132 | exact ⟨hpO, mem_univ _, hcV⟩ |
| 133 | let W := W0 ∩ (fun z : F => (z, (0 : E))) ⁻¹' T |
| 134 | let g (z : F) := (h.symm (z, 0)).2 |
| 135 | have hW : IsOpen W := hW0.inter (hT.preimage (continuous_id.prodMk continuous_const)) |
| 136 | have hcW : f c ∈ W := ⟨hcW0, hpT⟩ |
| 137 | have hVs : V ⊆ s := by |
| 138 | intro u hu |
| 139 | exact (hOsub (hprod (show (f c, u) ∈ W0 ×ˢ V from ⟨hcW0, hu⟩))).2.2.2 |
| 140 | have hgbase : g (f c) = c := congrArg Prod.snd hbaseinv |
| 141 | have hgV : MapsTo g W V := fun _ hz => hz.2.2.2.2 |
| 142 | have hgsmooth : ContDiffOn ℝ ∞ g W := by |
| 143 | intro z hz |
| 144 | have hqO : h.symm (z, 0) ∈ O := hz.2.2.1 |
| 145 | have hqS : h.symm (z, 0) ∈ S := (hOsub hqO).2.2 |
| 146 | have hHq := hH.contDiffAt (hS.mem_nhds hqS) |
| 147 | obtain ⟨e, he⟩ := (hOsub hqO).1 |
| 148 | have hqe : HasFDerivAt h e.toContinuousLinearMap (h.symm (z, 0)) := by |
| 149 | rw [hcoe, he] |
| 150 | exact (hHq.differentiableAt (by simp)).hasFDerivAt |
| 151 | have hi := h.contDiffAt_symm (f₀' := e) hz.2.1 hqe |
| 152 | (by simpa only [hcoe] using hHq) |
| 153 | exact (contDiffAt_snd.comp z |
| 154 | (hi.comp z (contDiffAt_id.prodMk contDiffAt_const))).contDiffWithinAt |
| 155 | have hcritical (z : F) (hz : z ∈ W) : P (z, g z) = 0 := by |
| 156 | have hright' : H (h.symm (z, 0)) = (z, 0) := h.right_inv hz.2.1 |
| 157 | have hfst : (h.symm (z, 0)).1 = z := congrArg Prod.fst hright' |
| 158 | have hsnd : P (h.symm (z, 0)) = 0 := congrArg Prod.snd hright' |
| 159 | have hpair : (z, g z) = h.symm (z, 0) := Prod.ext hfst.symm rfl |
| 160 | rw [hpair] |
| 161 | exact hsnd |
| 162 | refine ⟨W, V, g, hW, hcW, hV, hcV, hVs, hgbase, hgV, hgsmooth, hcritical, ?_⟩ |
| 163 | intro z hz u hu hcrit |
| 164 | have hzu : (z, u) ∈ h.source := (hOsub (hprod ⟨hz.1, hu⟩)).2.1 |
| 165 | have hvalue : h (z, u) = (z, 0) := by |
| 166 | change (z, P (z, u)) = (z, 0) |
| 167 | rw [show P (z, u) = 0 from hcrit] |
| 168 | have hback := h.left_inv hzu |
| 169 | rw [hvalue] at hback |
| 170 | exact (congrArg Prod.snd hback).symm |
| 171 | |
| 172 | end PoincareMT.M63 |