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.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Differential.RectanglePartialTangent |
| 2 | |
| 3 | /-! |
| 4 | # Coordinate partial derivatives on a closed-by-open rectangle |
| 5 | |
| 6 | Morgan-Tian Proposition 6.33, pp. 120-121. Projecting the actual |
| 7 | rectangle partial tangents onto the model vector gives smooth coordinate |
| 8 | partials, including closed time endpoints. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | -- The product self-model is identified with the self-model of the product. |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open scoped Manifold ContDiff |
| 16 | |
| 17 | variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] |
| 18 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 19 | {S P : Set 𝕜} {q : 𝕜 × 𝕜 → E} {m k : ℕ∞ω} |
| 20 | |
| 21 | /-- The actual within time partial is smooth on a rectangle with |
| 22 | unique derivatives in both factors, Proposition 6.33, pp. 120-121. -/ |
| 23 | theorem ContDiffOn.contDiffOn_derivWithin_fst_prod (hq : ContDiffOn 𝕜 m q (S ×ˢ P)) |
| 24 | (hS : UniqueDiffOn 𝕜 S) (hP : UniqueDiffOn 𝕜 P) (hkm : k + 1 ≤ m) : |
| 25 | ContDiffOn 𝕜 k (fun z => derivWithin (fun r => q (r, z.2)) S z.1) (S ×ˢ P) := by |
| 26 | have hM : ContMDiffOn ((𝓘(𝕜, 𝕜)).prod (𝓘(𝕜, 𝕜))) (𝓘(𝕜, E)) m q (S ×ˢ P) := by |
| 27 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 28 | exact hq.contMDiffOn |
| 29 | have htan := hM.contMDiffOn_partialTangentWithin_fst_prod hS hP (1 : 𝕜) hkm |
| 30 | have h := (contMDiff_snd_tangentBundle_modelSpace E (𝓘(𝕜, E)) (n := k)).comp_contMDiffOn htan |
| 31 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 32 | convert h.contDiffOn using 1 |
| 33 | funext z |
| 34 | simp only [Function.comp_def, mfderivWithin_eq_fderivWithin, derivWithin] |
| 35 | rfl |
| 36 | |
| 37 | /-- The unrestricted parameter partial remains smooth on the closed |
| 38 | rectangle when its parameter factor is open, Proposition 6.33, |
| 39 | pp. 120-121. Iteration gives the actual second parameter partial. -/ |
| 40 | theorem ContDiffOn.contDiffOn_deriv_snd_prod (hq : ContDiffOn 𝕜 m q (S ×ˢ P)) |
| 41 | (hS : UniqueDiffOn 𝕜 S) (hP : IsOpen P) (hkm : k + 1 ≤ m) : |
| 42 | ContDiffOn 𝕜 k (fun z => deriv (fun r => q (z.1, r)) z.2) (S ×ˢ P) := by |
| 43 | have hM : ContMDiffOn ((𝓘(𝕜, 𝕜)).prod (𝓘(𝕜, 𝕜))) (𝓘(𝕜, E)) m q (S ×ˢ P) := by |
| 44 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 45 | exact hq.contMDiffOn |
| 46 | have htan := hM.contMDiffOn_partialTangent_snd_prod hS hP (1 : 𝕜) hkm |
| 47 | have h := (contMDiff_snd_tangentBundle_modelSpace E (𝓘(𝕜, E)) (n := k)).comp_contMDiffOn htan |
| 48 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 49 | convert h.contDiffOn using 1 |
| 50 | funext z |
| 51 | simp only [Function.comp_def, mfderiv_eq_fderiv, deriv] |
| 52 | rfl |