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.ContMDiffMFDeriv |
| 2 | |
| 3 | /-! |
| 4 | # Closed critical sets and compact critical values |
| 5 | |
| 6 | The differential of a continuously differentiable scalar function is continuous |
| 7 | in local tangent coordinates. Its nonvanishing locus is therefore open. |
| 8 | -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set Filter Bundle ChartedSpace IsManifold |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | namespace Poincare.Geometry.Manifold |
| 18 | |
| 19 | variable {E H M : Type*} [NormedAddCommGroup E] [NormedSpace Real E] |
| 20 | [TopologicalSpace H] {I : ModelWithCorners Real E H} |
| 21 | [TopologicalSpace M] [ChartedSpace H M] [IsManifold I 1 M] |
| 22 | |
| 23 | /-- The critical set of a continuously differentiable real-valued function |
| 24 | on a manifold is closed. -/ |
| 25 | theorem isClosed_setOf_mfderiv_eq_zero {h : M → Real} |
| 26 | (hh : ContMDiff I 𝓘(Real, Real) 1 h) : |
| 27 | IsClosed {p : M | mfderiv I 𝓘(Real, Real) h p = 0} := by |
| 28 | rw [← isOpen_compl_iff] |
| 29 | apply isOpen_iff_mem_nhds.mpr |
| 30 | intro p hp |
| 31 | let A := inTangentCoordinates I 𝓘(Real, Real) id h |
| 32 | (mfderiv I 𝓘(Real, Real) h) p |
| 33 | have hA : ContinuousAt A p := |
| 34 | ((hh p).mfderiv_const (m := 0) (by simp)).continuousAt |
| 35 | have hself : A p = mfderiv I 𝓘(Real, Real) h p := by |
| 36 | dsimp [A] |
| 37 | rw [inTangentCoordinates_eq id h _ (mem_chart_source _ p) (mem_chart_source _ (h p))] |
| 38 | ext u |
| 39 | change tangentCoordChange 𝓘(Real, Real) (h p) (h p) (h p) |
| 40 | (mfderiv I 𝓘(Real, Real) h p (tangentCoordChange I p p p u)) = _ |
| 41 | rw [tangentCoordChange_self (mem_extChartAt_source p), |
| 42 | tangentCoordChange_self (mem_extChartAt_source (h p))] |
| 43 | rfl |
| 44 | have ha : A p ≠ 0 := by rwa [hself] |
| 45 | filter_upwards [hA.eventually_ne ha] with q hq |
| 46 | intro hzero |
| 47 | change mfderiv I 𝓘(Real, Real) h q = 0 at hzero |
| 48 | apply hq |
| 49 | simp [A, inTangentCoordinates, ContinuousLinearMap.inCoordinates, hzero] |
| 50 | |
| 51 | /-- The critical values of a continuously differentiable scalar function on |
| 52 | a compact manifold form a compact set. -/ |
| 53 | theorem isCompact_critical_values [CompactSpace M] {h : M → Real} |
| 54 | (hh : ContMDiff I 𝓘(Real, Real) 1 h) : |
| 55 | IsCompact (h '' {p : M | mfderiv I 𝓘(Real, Real) h p = 0}) := |
| 56 | (isClosed_setOf_mfderiv_eq_zero hh).isCompact.image hh.continuous |
| 57 | |
| 58 | /-- Compactness of the source makes the set of critical values closed. -/ |
| 59 | theorem isClosed_critical_values [CompactSpace M] {h : M → Real} |
| 60 | (hh : ContMDiff I 𝓘(Real, Real) 1 h) : |
| 61 | IsClosed (h '' {p : M | mfderiv I 𝓘(Real, Real) h p = 0}) := |
| 62 | (isCompact_critical_values hh).isClosed |
| 63 | |
| 64 | end Poincare.Geometry.Manifold |