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.Paths.Action.PathCongruence |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Theory |
| 3 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 4 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 5 | |
| 6 | /-! |
| 7 | # Admissible generalized variation slices |
| 8 | |
| 9 | Morgan-Tian Definitions 6.1-6.2 and Lemma 6.4, pp. 105-108. Composition |
| 10 | with the square root supplies closed-interval continuity and interior |
| 11 | regularity. Fixed endpoints then give an actual local minimum of the |
| 12 | scalar action. The proof follows the ordinary M08 VariationPaths argument. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 26 | {R : M14SquareRootPath G p} |
| 27 | |
| 28 | /-- Each valid variation slice with the specified actual endpoints is an |
| 29 | admissible generalized backward path, Definitions 6.1-6.2, pp. 105-106. -/ |
| 30 | def variationPath (V : M14LVariationData G p R) {u : ℝ} (hu : u ∈ V.parameterDomain) |
| 31 | (hx : V.family τ₁ u = x) (hy : V.family τ₂ u = y) : |
| 32 | M14BackwardPath G T τ₁ τ₂ x y := by |
| 33 | have hmaps : Set.MapsTo (fun τ : ℝ => (Real.sqrt τ, u)) |
| 34 | (Set.Icc τ₁ τ₂) V.squareDomain := by |
| 35 | intro τ hτ |
| 36 | exact V.square_contains ⟨⟨Real.sqrt_le_sqrt hτ.1, Real.sqrt_le_sqrt hτ.2⟩, hu⟩ |
| 37 | have hagrees (τ : ℝ) (hτ : τ ∈ Set.Icc τ₁ τ₂) : |
| 38 | V.squareFamily (Real.sqrt τ) u = V.family τ u := by |
| 39 | simpa only [Real.sq_sqrt (p.tau_nonneg.trans hτ.1)] using V.square_agrees (Real.sqrt τ) |
| 40 | ⟨Real.sqrt_le_sqrt hτ.1, Real.sqrt_le_sqrt hτ.2⟩ u hu |
| 41 | refine { |
| 42 | tau_nonneg := p.tau_nonneg |
| 43 | tau_lt := p.tau_lt |
| 44 | base_time := p.base_time |
| 45 | endpoint_time := p.endpoint_time |
| 46 | curve := fun τ => V.family τ u |
| 47 | curve_start := hx |
| 48 | curve_end := hy |
| 49 | curve_time := V.family_time u hu |
| 50 | curve_continuous := ?_ |
| 51 | curve_regular := ?_ |
| 52 | horizontal_velocity := V.family_velocity u |
| 53 | derivative_eq := V.family_derivative u hu |
| 54 | action_integrable := V.action_integrable u hu } |
| 55 | · exact (V.square_smooth.continuousOn.comp |
| 56 | (Real.continuous_sqrt.prodMk continuous_const).continuousOn hmaps).congr |
| 57 | (fun τ hτ => (hagrees τ hτ).symm) |
| 58 | · have hsqrt : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) 1 Real.sqrt (Set.Ioo τ₁ τ₂) := by |
| 59 | intro τ hτ |
| 60 | exact (Real.contDiffAt_sqrt |
| 61 | (ne_of_gt (p.tau_nonneg.trans_lt hτ.1))).contMDiffAt.contMDiffWithinAt |
| 62 | exact ((V.square_smooth.of_le (by simp)).comp |
| 63 | (hsqrt.prodMk contMDiffOn_const) (hmaps.mono_left Set.Ioo_subset_Icc_self)).congr |
| 64 | (fun τ hτ => (hagrees τ (Set.Ioo_subset_Icc_self hτ)).symm) |
| 65 | |
| 66 | /-- The zero-parameter action is the base path's actual action even when |
| 67 | endpoint velocity values differ, Definition 6.2 and Lemma 6.4, pp. 106-108. -/ |
| 68 | theorem variationAction_zero (V : M14LVariationData G p R) : |
| 69 | M14VariationAction V 0 = M14BackwardLAction G p := by |
| 70 | have hz : (0 : ℝ) ∈ V.parameterDomain := by |
| 71 | rw [V.parameterDomain_eq] |
| 72 | exact ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 73 | let q := variationPath V hz ((V.family_at_zero τ₁).trans p.curve_start) |
| 74 | ((V.family_at_zero τ₂).trans p.curve_end) |
| 75 | exact action_eq_of_curve_eqOn q p (fun τ _ => V.family_at_zero τ) |
| 76 | |
| 77 | /-- Minimality of the base path gives a local minimum of the actual |
| 78 | fixed-endpoint variation action, Lemma 6.4, pp. 107-108. -/ |
| 79 | theorem isLocalMin_variationAction (V : M14LVariationData G p R) |
| 80 | (hmin : M14IsMinimizing p) (hfix : M14BothEndpointsFixed V) : |
| 81 | IsLocalMin (M14VariationAction V) 0 := by |
| 82 | have hP : IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 83 | have hz : (0 : ℝ) ∈ V.parameterDomain := by |
| 84 | rw [V.parameterDomain_eq] |
| 85 | exact ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 86 | apply Filter.eventually_of_mem (hP.mem_nhds hz) |
| 87 | intro u hu |
| 88 | change M14VariationAction V 0 ≤ M14VariationAction V u |
| 89 | rw [variationAction_zero V] |
| 90 | exact hmin (variationPath V hu |
| 91 | (((V.left_endpoint_fixed_spec.mp hfix.1) u hu).trans p.curve_start) |
| 92 | (((V.right_endpoint_fixed_spec.mp hfix.2) u hu).trans p.curve_end)) |
| 93 | |
| 94 | /-- Any actual first derivative of a fixed-endpoint minimizing variation |
| 95 | vanishes, the stationarity step of Lemma 6.4, pp. 107-108. -/ |
| 96 | theorem hasDerivAt_variationAction_eq_zero (V : M14LVariationData G p R) |
| 97 | (hmin : M14IsMinimizing p) (hfix : M14BothEndpointsFixed V) |
| 98 | {d : ℝ} (hd : HasDerivAt (M14VariationAction V) d 0) : d = 0 := |
| 99 | (isLocalMin_variationAction V hmin hfix).hasDerivAt_eq_zero hd |
| 100 | |
| 101 | end PoincareMT.M14 |