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.CurveShortening.Comparison.IntrinsicComparison.Interior.UnitSpeed |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Compact.GeodesicContinuation |
| 3 | |
| 4 | /-! |
| 5 | # Exact speed at the continuous endpoint of a confined geodesic |
| 6 | |
| 7 | Compact continuation and conservation of speed transfer the genuine |
| 8 | interior unit normalization to the outgoing right derivative. |
| 9 | Source: MT Claim 19.40, pp. 470-471; minimal-contact derivation, Section 7. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology Manifold ContDiff Bundle |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 22 | normedSpaceTangentSpaceVectorSpace |
| 23 | |
| 24 | /-- The actual right derivative of a compactly confined unit-speed geodesic retains unit |
| 25 | norm at its continuous initial endpoint. Source: MT Claim 19.40, pp. 470-471; |
| 26 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 7. -/ |
| 27 | theorem m64Intrinsic_compact_geodesic_right_derivative_unit |
| 28 | (G : RiemannianMetric 2 AnnulusCoordinates) {K : Set AnnulusCoordinates} |
| 29 | (hK : IsCompact K) {a b : ℝ} (hab : a < b) {q : ℝ → AnnulusCoordinates} |
| 30 | (hgeo : G.IsGeodesicOn q (Ioo a b)) (hmap : MapsTo q (Ioo a b) K) |
| 31 | (hc : ContinuousWithinAt q (Ici a) a) |
| 32 | (hunit : ∀ t ∈ Ioo a b, G.tangentNorm (q t) (deriv q t) = 1) |
| 33 | {v : AnnulusCoordinates} (hv : HasDerivWithinAt q v (Ioi a) a) : |
| 34 | G.tangentNorm (q a) v = 1 := by |
| 35 | obtain ⟨epsilon, hepsilon, eta, heq, heta⟩ := |
| 36 | m64Intrinsic_compact_geodesic_left_extension G hK hab hgeo hmap hc |
| 37 | have haJ : a ∈ Ioo (a - epsilon) b := ⟨by linarith, hab⟩ |
| 38 | have hd : HasDerivAt eta (deriv eta a) a := |
| 39 | (contMDiffAt_iff_contDiffAt.mp (heta.contMDiffAt haJ)).differentiableAt |
| 40 | (by simp) |>.hasDerivAt |
| 41 | have hdq : HasDerivWithinAt q (deriv eta a) (Ioi a) a := by |
| 42 | apply hd.hasDerivWithinAt.congr_of_eventuallyEq |
| 43 | · filter_upwards [Ioo_mem_nhdsGT hab] with t ht |
| 44 | exact (heq ⟨ht.1.le, ht.2⟩).symm |
| 45 | · exact (heq ⟨le_rfl, hab⟩).symm |
| 46 | have hveq : v = deriv eta a := |
| 47 | (hv.derivWithin (uniqueDiffWithinAt_Ioi a)).symm.trans |
| 48 | (hdq.derivWithin (uniqueDiffWithinAt_Ioi a)) |
| 49 | obtain ⟨C, hC⟩ := heta.exists_constant_tangentNorm (by linarith : a - epsilon < b) |
| 50 | have hconstant (t : ℝ) (ht : t ∈ Ioo (a - epsilon) b) : |
| 51 | G.tangentNorm (eta t) (deriv eta t) = C := by |
| 52 | have hh := hC t ht |
| 53 | change G.tangentNorm (eta t) (curveVelocity (n := 2) eta t) = C at hh |
| 54 | rwa [m64Intrinsic_curveVelocity_eq_deriv] at hh |
| 55 | let c := (a + b) / 2 |
| 56 | have hcI : c ∈ Ioo a b := by dsimp only [c]; constructor <;> linarith |
| 57 | have hnear : eta =ᶠ[𝓝 c] q := by |
| 58 | filter_upwards [isOpen_Ioo.mem_nhds hcI] with t ht |
| 59 | exact heq ⟨ht.1.le, ht.2⟩ |
| 60 | have hCunit : (C : ℝ) = 1 := by |
| 61 | rw [← hconstant c ⟨by linarith [hcI.1], hcI.2⟩, |
| 62 | hnear.self_of_nhds, hnear.deriv_eq] |
| 63 | exact hunit c hcI |
| 64 | rw [hveq, ← heq ⟨le_rfl, hab⟩] |
| 65 | exact (hconstant a haJ).trans hCunit |
| 66 | |
| 67 | end PoincareMT |