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.Generalized.ReducedGeometry.Calculus.ODE.Families.ClosedFamilyRestart |
| 3 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn |
| 4 | import Mathlib.Analysis.Calculus.MeanValue |
| 5 | |
| 6 | /-! |
| 7 | # A fixed image neighborhood for nearby actual flow slices |
| 8 | |
| 9 | Proposition 16.4, pp. 389-391, and Lemma 6.18, pp. 113-114. |
| 10 | The actual spatial derivative of a closed-time flow family is close to |
| 11 | the identity on one product neighborhood. The quantitative inverse |
| 12 | theorem puts a fixed state ball in every nearby fixed-time image, |
| 13 | without extending the physical time interval. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter Metric |
| 19 | open scoped Topology ContDiff NNReal |
| 20 | |
| 21 | namespace PoincareMT.M08 |
| 22 | export PoincareMT.LGeometry (spatialWithinFDeriv) |
| 23 | end PoincareMT.M08 |
| 24 | namespace PoincareMT.M08 |
| 25 | export PoincareMT.LGeometry (hasFDerivAt_spatialWithin) |
| 26 | end PoincareMT.M08 |
| 27 | namespace PoincareMT.M08 |
| 28 | export PoincareMT.LGeometry (spatialWithinFDeriv_contDiffOn) |
| 29 | end PoincareMT.M08 |
| 30 | |
| 31 | namespace PoincareMT.Proofs.M46 |
| 32 | |
| 33 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 34 | |
| 35 | /-- Derivative error at most one half on a closed ball gives the |
| 36 | corresponding half-radius image ball. This quantitative inverse step |
| 37 | is used for actual Euler phase restarts in Proposition 16.4. -/ |
| 38 | theorem surjOn_closedBall_of_derivative_close_identity |
| 39 | {f : E → E} {D : E → E →L[ℝ] E} {x₀ : E} {R : ℝ} (hR : 0 ≤ R) |
| 40 | (hder : ∀ z ∈ closedBall x₀ R, HasFDerivAt f (D z) z) |
| 41 | (hbound : ∀ z ∈ closedBall x₀ R, ‖D z - ContinuousLinearMap.id ℝ E‖ ≤ 1 / 2) : |
| 42 | SurjOn f (closedBall x₀ R) (closedBall (f x₀) (R / 2)) := by |
| 43 | have happrox : ApproximatesLinearOn f (ContinuousLinearMap.id ℝ E) |
| 44 | (closedBall x₀ R) (1 / 2 : ℝ≥0) := by |
| 45 | intro x hx y hy |
| 46 | have hd (z : E) (hz : z ∈ closedBall x₀ R) : |
| 47 | HasFDerivWithinAt (fun w => f w - w) |
| 48 | (D z - ContinuousLinearMap.id ℝ E) (closedBall x₀ R) z := |
| 49 | ((hder z hz).sub (hasFDerivAt_id z)).hasFDerivWithinAt |
| 50 | have hh := (convex_closedBall x₀ R).norm_image_sub_le_of_norm_hasFDerivWithin_le |
| 51 | hd hbound hy hx |
| 52 | have heq : (f x - x) - (f y - y) = f x - f y - (x - y) := by abel |
| 53 | simpa only [heq, ContinuousLinearMap.id_apply, NNReal.coe_div, |
| 54 | NNReal.coe_one, NNReal.coe_ofNat] using hh |
| 55 | let inv : (ContinuousLinearMap.id ℝ E).NonlinearRightInverse := { |
| 56 | toFun := id |
| 57 | nnnorm := 1 |
| 58 | bound' := by intro y; simp |
| 59 | right_inv' := by intro y; rfl |
| 60 | } |
| 61 | have hsurj := happrox.surjOn_closedBall_of_nonlinearRightInverse inv hR Subset.rfl |
| 62 | have hradius : ((inv.nnnorm : ℝ)⁻¹ - (1 / 2 : ℝ≥0)) * R = R / 2 := by |
| 63 | change ((1 : ℝ)⁻¹ - ((1 / 2 : ℝ≥0) : ℝ)) * R = R / 2 |
| 64 | norm_num |
| 65 | ring |
| 66 | rwa [hradius] at hsurj |
| 67 | |
| 68 | /-- One fixed state neighborhood lies in all nearby time-slice images |
| 69 | of a smooth family initialized by the identity. Time neighborhoods are |
| 70 | relative to the actual closed time set. Source: Proposition 16.4 and |
| 71 | Lemma 6.18, pp. 389-391 and 113-114. -/ |
| 72 | theorem closedFamily_exists_uniform_image_ball {C : Set ℝ} {U : Set E} |
| 73 | (hC : UniqueDiffOn ℝ C) (hU : IsOpen U) (alpha : E × ℝ → E) |
| 74 | (halpha : ContDiffOn ℝ ∞ alpha (U ×ˢ C)) {x₀ : E} (hx₀ : x₀ ∈ U) |
| 75 | {t₀ : ℝ} (ht₀ : t₀ ∈ C) (hinit : ∀ x ∈ U, alpha (x, t₀) = x) : |
| 76 | ∃ r : ℝ, 0 < r ∧ ∀ᶠ t in 𝓝[C] t₀, |
| 77 | SurjOn (fun x => alpha (x, t)) U (ball x₀ r) := by |
| 78 | let f : ℝ × E → E := fun z => alpha (z.2, z.1) |
| 79 | have hf : ContDiffOn ℝ ∞ f (C ×ˢ U) := |
| 80 | halpha.comp (contDiffOn_snd.prodMk contDiffOn_fst) (fun _ hz => ⟨hz.2, hz.1⟩) |
| 81 | let D := M08.spatialWithinFDeriv C U f |
| 82 | have hd (t : ℝ) (ht : t ∈ C) (x : E) (hx : x ∈ U) : |
| 83 | HasFDerivAt (fun y => alpha (y, t)) (D (t, x)) x := |
| 84 | M08.hasFDerivAt_spatialWithin hU f hf ht hx |
| 85 | have hD₀ : D (t₀, x₀) = ContinuousLinearMap.id ℝ E := by |
| 86 | have heq : (fun y => alpha (y, t₀)) =ᶠ[𝓝 x₀] id := by |
| 87 | filter_upwards [hU.mem_nhds hx₀] with y hy |
| 88 | exact hinit y hy |
| 89 | have hh := (hd t₀ ht₀ x₀ hx₀).fderiv |
| 90 | rw [heq.fderiv_eq, fderiv_id] at hh |
| 91 | exact hh.symm |
| 92 | have hc := (M08.spatialWithinFDeriv_contDiffOn hC hU f hf).continuousOn |
| 93 | have hnear : {z : ℝ × E | ‖D z - ContinuousLinearMap.id ℝ E‖ < 1 / 2} ∈ |
| 94 | 𝓝[C ×ˢ U] (t₀, x₀) := by |
| 95 | have hzero : ‖D (t₀, x₀) - ContinuousLinearMap.id ℝ E‖ < 1 / 2 := by |
| 96 | rw [hD₀, sub_self, norm_zero] |
| 97 | norm_num |
| 98 | exact (((hc (t₀, x₀) ⟨ht₀, hx₀⟩).sub continuousWithinAt_const).norm).eventually |
| 99 | (gt_mem_nhds hzero) |
| 100 | rw [nhdsWithin_prod_eq, nhdsWithin_eq_nhds.mpr (hU.mem_nhds hx₀)] at hnear |
| 101 | obtain ⟨A, hA, B, hB, hAB⟩ := mem_prod_iff.mp hnear |
| 102 | obtain ⟨R, hR, hball⟩ := Metric.mem_nhds_iff.mp (inter_mem hB (hU.mem_nhds hx₀)) |
| 103 | let rho := R / 2 |
| 104 | have hrho : 0 < rho := half_pos hR |
| 105 | have hclosed : closedBall x₀ rho ⊆ B ∩ U := by |
| 106 | intro z hz |
| 107 | exact hball ((Metric.mem_closedBall.mp hz).trans_lt (by dsimp [rho]; linarith)) |
| 108 | have hcenter : ContinuousWithinAt (fun t => alpha (x₀, t)) C t₀ := |
| 109 | (halpha.continuousOn.comp (continuous_const.prodMk continuous_id).continuousOn |
| 110 | (fun _ ht => ⟨hx₀, ht⟩)) t₀ ht₀ |
| 111 | have hcenterNear : ∀ᶠ t in 𝓝[C] t₀, dist (alpha (x₀, t)) x₀ < rho / 4 := by |
| 112 | have hh := hcenter.eventually (Metric.ball_mem_nhds (alpha (x₀, t₀)) (by positivity : |
| 113 | 0 < rho / 4)) |
| 114 | simpa only [hinit x₀ hx₀, mem_ball] using hh |
| 115 | refine ⟨rho / 4, by positivity, ?_⟩ |
| 116 | filter_upwards [hA, hcenterNear, self_mem_nhdsWithin] with t ht hcenterDist htC |
| 117 | have hsurj := surjOn_closedBall_of_derivative_close_identity hrho.le |
| 118 | (fun z hz => hd t htC z (hclosed hz).2) |
| 119 | (fun z hz => (hAB ⟨ht, (hclosed hz).1⟩).le) |
| 120 | intro y hy |
| 121 | have hy' : y ∈ closedBall (alpha (x₀, t)) (rho / 2) := by |
| 122 | apply Metric.mem_closedBall.mpr |
| 123 | have htriangle := dist_triangle y x₀ (alpha (x₀, t)) |
| 124 | rw [dist_comm x₀] at htriangle |
| 125 | have hyDist := Metric.mem_ball.mp hy |
| 126 | linarith |
| 127 | obtain ⟨z, hz, heq⟩ := hsurj hy' |
| 128 | exact ⟨z, (hclosed hz).2, heq⟩ |
| 129 | |
| 130 | end PoincareMT.Proofs.M46 |