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.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Coordinates.ChartConnectionVariation |
| 3 | |
| 4 | /-! |
| 5 | # Actual mixed derivatives through closed time endpoints |
| 6 | |
| 7 | Morgan-Tian Claim 6.20, p. 114. M08's genuine closed mixed-derivative |
| 8 | identity gives a derivative witness for the unrestricted parameter |
| 9 | differential, with respect to the actual within time derivative. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped ContDiff Topology |
| 16 | |
| 17 | namespace PoincareMT.M14 |
| 18 | |
| 19 | variable {E H : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [NormedAddCommGroup H] [NormedSpace ℝ H] |
| 21 | |
| 22 | /-- The actual parameter differential is smooth through the closed |
| 23 | time endpoints of a smooth family, the regularity used in Claim 6.20, |
| 24 | p. 114. Its derivative is the genuine open-parameter derivative. -/ |
| 25 | theorem parameterDerivative_contDiffOn |
| 26 | {C : Set ℝ} {U : Set E} (hC : UniqueDiffOn ℝ C) (hU : IsOpen U) |
| 27 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f (C ×ˢ U)) |
| 28 | {x : E} (hx : x ∈ U) (v : E) : |
| 29 | ContDiffOn ℝ ∞ (fun r => fderiv ℝ (fun y => f (r, y)) x v) C := by |
| 30 | have hD := (M08.spatialWithinFDeriv_contDiffOn hC hU f hf).comp |
| 31 | (contDiff_id.prodMk contDiff_const).contDiffOn (fun _ hr => ⟨hr, hx⟩) |
| 32 | apply (hD.clm_apply (contDiffOn_const (c := v))).congr |
| 33 | intro r hr |
| 34 | exact congrArg (fun L : E →L[ℝ] H => L v) |
| 35 | (M08.hasFDerivAt_spatialWithin hU f hf hr hx).fderiv |
| 36 | |
| 37 | /-- The actual parameter differential commutes with the actual within |
| 38 | time derivative at every regular closed rectangle point, Claim 6.20, |
| 39 | p. 114. No extension of the function beyond the time set is assumed. -/ |
| 40 | theorem hasDerivWithinAt_parameterDerivative |
| 41 | {C : Set ℝ} {U : Set E} (hC : UniqueDiffOn ℝ C) (hU : IsOpen U) |
| 42 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f (C ×ˢ U)) |
| 43 | {s : ℝ} {x : E} (hs : s ∈ C) (hx : x ∈ U) |
| 44 | (hcl : (s, x) ∈ closure (interior (C ×ˢ U))) (v : E) : |
| 45 | HasDerivWithinAt (fun r => fderiv ℝ (fun y => f (r, y)) x v) |
| 46 | (fderiv ℝ (fun y => derivWithin (fun r => f (r, y)) C s) x v) C s := by |
| 47 | let D := M08.spatialWithinFDeriv C U f |
| 48 | let A := M08.timeWithinFDeriv C U f |
| 49 | have hD := M08.spatialWithinFDeriv_contDiffOn hC hU f hf |
| 50 | have hA := M08.timeWithinFDeriv_contDiffOn hC hU f hf |
| 51 | have hd := (M08.hasDerivWithinAt_timeWithin D hD hs hx).clm_apply |
| 52 | (hasDerivWithinAt_const s C v) |
| 53 | have hcomm := M08.closed_time_spatial_commute hC hU f hf ⟨hs, hx⟩ hcl v |
| 54 | have ht : (fun y => derivWithin (fun r => f (r, y)) C s) =ᶠ[𝓝 x] fun y => A (s, y) := by |
| 55 | filter_upwards [hU.mem_nhds hx] with y hy |
| 56 | exact (M08.hasDerivWithinAt_timeWithin f hf hs hy).derivWithin (hC s hs) |
| 57 | have hAderiv := (M08.hasFDerivAt_spatialWithin hU A hA hs hx).fderiv |
| 58 | have htarget : fderiv ℝ (fun y => derivWithin (fun r => f (r, y)) C s) x v = |
| 59 | M08.timeWithinFDeriv C U D (s, x) v := by |
| 60 | rw [ht.fderiv_eq, hAderiv] |
| 61 | exact hcomm.symm |
| 62 | rw [htarget] |
| 63 | apply (show HasDerivWithinAt (fun r => D (r, x) v) |
| 64 | (M08.timeWithinFDeriv C U D (s, x) v) C s by |
| 65 | simpa only [map_zero, add_zero] using hd).congr_of_mem _ hs |
| 66 | intro r hr |
| 67 | exact congrArg (fun L : E →L[ℝ] H => L v) |
| 68 | (M08.hasFDerivAt_spatialWithin hU f hf hr hx).fderiv |
| 69 | |
| 70 | /-- On a nondegenerate closed interval, the parameter differential |
| 71 | has the expected actual within derivative at both endpoints too, |
| 72 | the square-time form of Claim 6.20, p. 114. -/ |
| 73 | theorem hasDerivWithinAt_parameterDerivative_Icc |
| 74 | {a b : ℝ} (hab : a < b) {U : Set E} (hU : IsOpen U) |
| 75 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f (Icc a b ×ˢ U)) |
| 76 | {s : ℝ} {x : E} (hs : s ∈ Icc a b) (hx : x ∈ U) (v : E) : |
| 77 | HasDerivWithinAt (fun r => fderiv ℝ (fun y => f (r, y)) x v) |
| 78 | (fderiv ℝ (fun y => derivWithin (fun r => f (r, y)) (Icc a b) s) x v) |
| 79 | (Icc a b) s := |
| 80 | hasDerivWithinAt_parameterDerivative (uniqueDiffOn_Icc hab) hU f hf hs hx |
| 81 | (M08.mem_closure_interior_Icc_prod hab hU hs hx) v |
| 82 | |
| 83 | end PoincareMT.M14 |