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.Calculus.MeanValue |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 3 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn |
| 4 | |
| 5 | /-! |
| 6 | # Small linear approximation on a relative convex neighborhood |
| 7 | |
| 8 | The within mean value inequality turns continuity of the actual |
| 9 | derivative into an arbitrarily small linear error near a point of a |
| 10 | convex domain, including its boundary. Relative inverse step for |
| 11 | Morgan-Tian Proposition 6.28, p. 117; see the derivation |
| 12 | tasks/M14/derivations/2026-09-21-relative-inverse.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped ContDiff Topology NNReal |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 24 | |
| 25 | /-- A continuously differentiable map on a convex unique-differentiation |
| 26 | set approximates its actual derivative arbitrarily well on a relative |
| 27 | open neighborhood. Relative inverse step for Proposition 6.28, p. 117; |
| 28 | see the derivation 2026-09-21-relative-inverse.md. -/ |
| 29 | theorem exists_open_approximatesLinearOn {f : E → F} {S : Set E} |
| 30 | (hSc : Convex ℝ S) (hS : UniqueDiffOn ℝ S) (hf : ContDiffOn ℝ 1 f S) |
| 31 | {x : E} (hx : x ∈ S) (c : ℝ≥0) (hc : 0 < c) : |
| 32 | ∃ U : Set E, IsOpen U ∧ x ∈ U ∧ |
| 33 | ApproximatesLinearOn f (fderivWithin ℝ f S x) (U ∩ S) c := by |
| 34 | let L := fderivWithin ℝ f S x |
| 35 | let D : E → E →L[ℝ] F := fun y => fderivWithin ℝ f S y - L |
| 36 | have hder (y : E) (hy : y ∈ S) : |
| 37 | HasFDerivWithinAt (fun z => f z - L z) (D y) S y := |
| 38 | (hf.differentiableOn_one y hy).hasFDerivWithinAt.sub L.hasFDerivAt.hasFDerivWithinAt |
| 39 | have hcont : ContinuousWithinAt D S x := |
| 40 | (hf.continuousOn_fderivWithin hS le_rfl x hx).sub continuousWithinAt_const |
| 41 | have hzero : ‖D x‖₊ < c := by simpa only [D, L, sub_self, nnnorm_zero] using hc |
| 42 | obtain ⟨V, hV, hLip⟩ := |
| 43 | hSc.exists_nhdsWithin_lipschitzOnWith_of_hasFDerivWithinAt_of_nnnorm_lt |
| 44 | (eventually_nhdsWithin_of_forall hder) hcont c hzero |
| 45 | obtain ⟨U, hU, hxU, hUV⟩ := mem_nhdsWithin.mp hV |
| 46 | exact ⟨U, hU, hxU, (hLip.mono hUV).approximatesLinearOn⟩ |
| 47 | |
| 48 | end PoincareMT.M14 |