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.PathPrefix |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.PullbackRestriction |
| 3 | |
| 4 | /-! |
| 5 | # Square-root paths on a strict prefix |
| 6 | |
| 7 | Morgan-Tian Definition 6.17 and Proposition 6.30, pp. 113, 118-119. |
| 8 | Restriction retains the square curve, horizontal velocity and Euler |
| 9 | equation, including the new closed endpoint by derivative uniqueness. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M14 |
| 20 | |
| 21 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 22 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 23 | {T a b c : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 24 | |
| 25 | /-- A square path restricts to any positive-length prefix, retaining its |
| 26 | actual curve and velocity, Definition 6.17 and Proposition 6.30, pp. 113, 118-119. -/ |
| 27 | def prefixSquarePath (R : M14SquareRootPath G p) (hac : a < c) (hcb : c ≤ b) : |
| 28 | M14SquareRootPath G (prefixPath p c hac hcb) := by |
| 29 | have hsub : M14SqrtParameterInterval a c ⊆ M14SqrtParameterInterval a b := |
| 30 | Icc_subset_Icc le_rfl (Real.sqrt_le_sqrt hcb) |
| 31 | have hC : UniqueDiffOn ℝ (M14SqrtParameterInterval a c) := |
| 32 | uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg hac) |
| 33 | refine { |
| 34 | curve := R.curve |
| 35 | domain := R.domain |
| 36 | interval_subset := hsub.trans R.interval_subset |
| 37 | smooth := R.smooth |
| 38 | agrees := fun s hs => R.agrees s (hsub hs) |
| 39 | curve_time := fun s hs => R.curve_time s (hsub hs) |
| 40 | horizontal_velocity := R.horizontal_velocity |
| 41 | horizontal_agrees := fun s hs => R.horizontal_agrees s |
| 42 | ⟨hs.1, hs.2.trans_le (Real.sqrt_le_sqrt hcb)⟩ |
| 43 | derivative_eq := ?_ } |
| 44 | intro s hs |
| 45 | rw [mfderivWithin_subset hsub (hC s hs).uniqueMDiffWithinAt |
| 46 | ((R.smooth.mono R.interval_subset s (hsub hs)).mdifferentiableWithinAt (by simp))] |
| 47 | exact R.derivative_eq s (hsub hs) |
| 48 | |
| 49 | /-- The actual square Euler equation persists under closed prefix |
| 50 | restriction with the original extension, Proposition 6.30, pp. 118-119. -/ |
| 51 | theorem prefixSquarePath_euler (R : M14SquareRootPath G p) (hac : a < c) (hcb : c ≤ b) |
| 52 | (E : M14PullbackExtension G R.curve (M14SqrtParameterInterval a b) R.horizontal_velocity) |
| 53 | (hEuler : ∀ s ∈ M14SqrtParameterInterval a b, ∀ W, |
| 54 | M14SquareRootEulerResidual G R E s W = 0) : |
| 55 | ∀ s ∈ M14SqrtParameterInterval a c, ∀ W, |
| 56 | M14SquareRootEulerResidual G (prefixSquarePath R hac hcb) |
| 57 | (pullbackExtensionRestrict E (Icc_subset_Icc le_rfl (Real.sqrt_le_sqrt hcb))) s W = 0 := by |
| 58 | intro s hs W |
| 59 | have hsub : M14SqrtParameterInterval a c ⊆ M14SqrtParameterInterval a b := |
| 60 | Icc_subset_Icc le_rfl (Real.sqrt_le_sqrt hcb) |
| 61 | have hD := horizontalCovariantDerivative_restrict_subset E hsub |
| 62 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg hac) s hs) |
| 63 | ((R.smooth.mono R.interval_subset s (hsub hs)).mdifferentiableWithinAt (by simp)) |
| 64 | unfold M14SquareRootEulerResidual M14SquareRootVelocity |
| 65 | dsimp only [prefixSquarePath] |
| 66 | rw [← hD] |
| 67 | exact hEuler s (hsub hs) W |
| 68 | |
| 69 | end PoincareMT.M14 |