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.WithinVelocitySmooth |
| 2 | |
| 3 | /-! |
| 4 | # Partial tangent fields on a closed-by-open rectangle |
| 5 | |
| 6 | The field-regularity step of Morgan-Tian Lemma 6.4, pp. 107-108. |
| 7 | The open factor has its actual unrestricted partial derivative, even at |
| 8 | a boundary point of the other factor. The within chain rule suffices. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle |
| 14 | |
| 15 | variable {𝕜 E F E' H M : Type*} [NontriviallyNormedField 𝕜] |
| 16 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 17 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 18 | [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] |
| 19 | [TopologicalSpace H] {I : ModelWithCorners 𝕜 E' H} |
| 20 | [TopologicalSpace M] [ChartedSpace H M] |
| 21 | {S : Set E} {U : Set F} {α : E × F → M} {m k : ℕ∞ω} |
| 22 | |
| 23 | /-- The first-factor within derivative agrees with the corresponding |
| 24 | rectangle partial, including closed endpoints, in the reparametrization |
| 25 | step of Morgan-Tian equation (6.2), p. 106. -/ |
| 26 | theorem mfderivWithin_fst_eq_mfderivWithin_prod |
| 27 | {x : E} {y : F} (hS : UniqueDiffWithinAt 𝕜 S x) (hy : y ∈ U) |
| 28 | (hα : MDifferentiableWithinAt ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I |
| 29 | α (S ×ˢ U) (x, y)) (v : E) : |
| 30 | mfderivWithin (𝓘(𝕜, E)) I (fun r => α (r, y)) S x v = |
| 31 | mfderivWithin ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I α (S ×ˢ U) (x, y) (v, 0) := by |
| 32 | have hi : MDifferentiableAt (𝓘(𝕜, E)) ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) |
| 33 | (fun r : E => (r, y)) x := mdifferentiableAt_id.prodMk mdifferentiableAt_const |
| 34 | have hchain := mfderivWithin_comp (I := 𝓘(𝕜, E)) |
| 35 | (I' := (𝓘(𝕜, E)).prod (𝓘(𝕜, F))) (I'' := I) |
| 36 | (f := fun r : E => (r, y)) (g := α) x hα |
| 37 | hi.mdifferentiableWithinAt |
| 38 | (fun _ hr => ⟨hr, hy⟩) hS.uniqueMDiffWithinAt |
| 39 | rw [mfderivWithin_eq_mfderiv hS.uniqueMDiffWithinAt hi, mfderiv_prod_left] at hchain |
| 40 | exact congrArg (fun L => L v) hchain |
| 41 | |
| 42 | -- Rewriting the product self-model also transports its charted-space instance. |
| 43 | set_option backward.isDefEq.respectTransparency false in |
| 44 | /-- The first within partial tangent is smooth on a rectangle with unique |
| 45 | derivatives in both factors, including closed time endpoints, as used |
| 46 | in Morgan-Tian Lemma 6.4, pp. 107-108. -/ |
| 47 | theorem ContMDiffOn.contMDiffOn_partialTangentWithin_fst_prod |
| 48 | [IsManifold I 1 M] |
| 49 | (hα : ContMDiffOn ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I m α (S ×ˢ U)) |
| 50 | (hS : UniqueDiffOn 𝕜 S) (hU : UniqueDiffOn 𝕜 U) (v : E) (hkm : k + 1 ≤ m) : |
| 51 | ContMDiffOn ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I.tangent k |
| 52 | (fun z => Bundle.TotalSpace.mk' E' (α z) |
| 53 | (mfderivWithin (𝓘(𝕜, E)) I (fun r => α (r, z.2)) S z.1 v)) (S ×ˢ U) := by |
| 54 | have hα' : ContMDiffOn (𝓘(𝕜, E × F)) I m α (S ×ˢ U) := by |
| 55 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 56 | exact hα |
| 57 | have h := hα'.contMDiffOn_mfderivWithin_const_apply (hS.prod hU) (v, 0) hkm |
| 58 | have hpartial : ContMDiffOn (𝓘(𝕜, E × F)) I.tangent k |
| 59 | (fun z => Bundle.TotalSpace.mk' E' (α z) |
| 60 | (mfderivWithin (𝓘(𝕜, E)) I (fun r => α (r, z.2)) S z.1 v)) (S ×ˢ U) := by |
| 61 | apply h.congr |
| 62 | intro z hz |
| 63 | have hm : (1 : ℕ∞ω) ≤ m := le_trans le_add_self hkm |
| 64 | have heq := mfderivWithin_fst_eq_mfderivWithin_prod (hS z.1 hz.1) hz.2 |
| 65 | ((hα z hz).mdifferentiableWithinAt (ne_of_gt (zero_lt_one.trans_le hm))) v |
| 66 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at heq |
| 67 | exact congrArg (fun w : TangentSpace I (α z) => Bundle.TotalSpace.mk' E' (α z) w) heq |
| 68 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] at hpartial |
| 69 | exact hpartial |
| 70 | |
| 71 | /-- The actual second-factor derivative equals the corresponding within |
| 72 | partial derivative, including boundary points of the first factor, as |
| 73 | used in Lemma 6.4, pp. 107-108. -/ |
| 74 | theorem mfderiv_snd_eq_mfderivWithin_prod (hU : IsOpen U) |
| 75 | {x : E} {y : F} (hx : x ∈ S) (hy : y ∈ U) |
| 76 | (hα : MDifferentiableWithinAt ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I |
| 77 | α (S ×ˢ U) (x, y)) (v : F) : |
| 78 | mfderiv (𝓘(𝕜, F)) I (fun r => α (x, r)) y v = |
| 79 | mfderivWithin ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I α (S ×ˢ U) (x, y) (0, v) := by |
| 80 | have hchain := mfderivWithin_comp (I := 𝓘(𝕜, F)) |
| 81 | (I' := (𝓘(𝕜, E)).prod (𝓘(𝕜, F))) (I'' := I) |
| 82 | (f := fun r : F => (x, r)) (g := α) y hα |
| 83 | (mdifferentiableAt_const.prodMk mdifferentiableAt_id).mdifferentiableWithinAt |
| 84 | (fun _ hr => ⟨hx, hr⟩) (hU.uniqueMDiffOn y hy) |
| 85 | rw [mfderivWithin_of_mem_nhds (hU.mem_nhds hy), |
| 86 | mfderivWithin_of_mem_nhds (hU.mem_nhds hy), mfderiv_prod_right] at hchain |
| 87 | exact congrArg (fun L => L v) hchain |
| 88 | |
| 89 | -- Rewriting the product self-model also transports its charted-space instance. |
| 90 | set_option backward.isDefEq.respectTransparency false in |
| 91 | /-- Smoothness of the actual second-factor tangent field on a rectangle, |
| 92 | with unique derivatives in the first factor and an open second factor; |
| 93 | the regularity step of Lemma 6.4, pp. 107-108. -/ |
| 94 | theorem ContMDiffOn.contMDiffOn_partialTangent_snd_prod |
| 95 | [IsManifold I 1 M] |
| 96 | (hα : ContMDiffOn ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I m α (S ×ˢ U)) |
| 97 | (hS : UniqueDiffOn 𝕜 S) (hU : IsOpen U) (v : F) (hkm : k + 1 ≤ m) : |
| 98 | ContMDiffOn ((𝓘(𝕜, E)).prod (𝓘(𝕜, F))) I.tangent k |
| 99 | (fun z => Bundle.TotalSpace.mk' E' (α z) |
| 100 | (mfderiv (𝓘(𝕜, F)) I (fun r => α (z.1, r)) z.2 v)) (S ×ˢ U) := by |
| 101 | have hα' : ContMDiffOn (𝓘(𝕜, E × F)) I m α (S ×ˢ U) := by |
| 102 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 103 | exact hα |
| 104 | have h := hα'.contMDiffOn_mfderivWithin_const_apply |
| 105 | (hS.prod hU.uniqueDiffOn) (0, v) hkm |
| 106 | have hpartial : ContMDiffOn (𝓘(𝕜, E × F)) I.tangent k |
| 107 | (fun z => Bundle.TotalSpace.mk' E' (α z) |
| 108 | (mfderiv (𝓘(𝕜, F)) I (fun r => α (z.1, r)) z.2 v)) (S ×ˢ U) := by |
| 109 | apply h.congr |
| 110 | intro z hz |
| 111 | have hm : (1 : ℕ∞ω) ≤ m := le_trans (le_add_self) hkm |
| 112 | have heq := mfderiv_snd_eq_mfderivWithin_prod hU hz.1 hz.2 |
| 113 | ((hα z hz).mdifferentiableWithinAt (ne_of_gt (zero_lt_one.trans_le hm))) v |
| 114 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at heq |
| 115 | exact congrArg (fun w : TangentSpace I (α z) => Bundle.TotalSpace.mk' E' (α z) w) heq |
| 116 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] at hpartial |
| 117 | exact hpartial |