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.Surgery.StandardCap.Existence.Geometry.Energy.CanonicalDifferenceEnergy |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Geometry.CanonicalGeometry.CanonicalCoreFlow |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.RotationInvariance.EndPullbackFlow |
| 4 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.RotationInvariance.EnergyCutoffs |
| 5 | |
| 6 | /-! |
| 7 | # The actual core and end energy family |
| 8 | |
| 9 | Index zero is the core; index j+1 is the actual pullback at end shift j. |
| 10 | This is the family used by the finite-prefix uniqueness argument in |
| 11 | Morgan-Tian Section 12.5, pp. 309-319 and |
| 12 | uniqueness-assembly-interfaces.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | -- Actual curvature takes values in three nested Hom spaces. |
| 18 | set_option maxSynthPendingDepth 8 |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff |
| 22 | |
| 23 | namespace PoincareMT.M34 |
| 24 | |
| 25 | open DifferenceEnergy |
| 26 | |
| 27 | variable {g : RiemannianMetric 3 StandardCapSpace} (e : StandardCylindricalEnd g) |
| 28 | {dH dA dS : ℕ} (qH : FH 3 ≃L[ℝ] EuclideanSpace ℝ (Fin dH)) |
| 29 | (qA : FA 3 ≃L[ℝ] EuclideanSpace ℝ (Fin dA)) |
| 30 | (qS : FS 3 ≃L[ℝ] EuclideanSpace ℝ (Fin dS)) |
| 31 | {J J' : Set ℝ} (F : RicciFlow 3 StandardCapSpace J) |
| 32 | (F' : RicciFlow 3 StandardCapSpace J') (p : endReferenceRegion e) |
| 33 | |
| 34 | /-- The genuine local integral energies, with the core as the first row |
| 35 | (Section 12.5, pp. 309-319). -/ |
| 36 | noncomputable def capDifferenceEnergy : ℕ → ℝ → ℝ := |
| 37 | letI := (isOpen_univ : IsOpen (univ : Set (V 3))).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 38 | letI := (isOpen_univ : IsOpen (univ : Set (V 3))).isOpenEmbedding_subtypeVal.isManifold_singleton |
| 39 | (I := 𝓡 3) (n := ∞) |
| 40 | letI := (endReferenceRegion_isOpen e).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 41 | letI := (endReferenceRegion_isOpen e).isOpenEmbedding_subtypeVal.isManifold_singleton |
| 42 | (I := 𝓡 3) (n := ∞) |
| 43 | fun i => match i with |
| 44 | | 0 => canonicalDifferenceEnergy univ isOpen_univ qH qA qS (coreEnergyCutoff e) |
| 45 | (canonicalCoreFlow F) (canonicalCoreFlow F') ⟨0, mem_univ _⟩ |
| 46 | | j + 1 => canonicalDifferenceEnergy (endReferenceRegion e) (endReferenceRegion_isOpen e) |
| 47 | qH qA qS (endEnergyCutoff e) |
| 48 | (endPullbackFlow e F j (by have := Nat.cast_nonneg (α := ℝ) j; linarith)) |
| 49 | (endPullbackFlow e F' j (by have := Nat.cast_nonneg (α := ℝ) j; linarith)) p |
| 50 | |
| 51 | /-- Every indexed actual energy is nonnegative, including totalized times |
| 52 | (Section 12.5, pp. 309-319). -/ |
| 53 | theorem capDifferenceEnergy_nonneg (i : ℕ) (t : ℝ) : |
| 54 | 0 ≤ capDifferenceEnergy e qH qA qS F F' p i t := by |
| 55 | cases i <;> exact canonicalDifferenceEnergy_nonneg _ _ qH qA qS _ _ _ _ t |
| 56 | |
| 57 | /-- Every indexed energy is continuous on compact included common times |
| 58 | (Section 12.5, pp. 309-319). -/ |
| 59 | theorem capDifferenceEnergy_continuousOn {K : Set ℝ} (hK : IsCompact K) |
| 60 | (hKJ : K ⊆ J ∩ J') (i : ℕ) : |
| 61 | ContinuousOn (capDifferenceEnergy e qH qA qS F F' p i) K := by |
| 62 | cases i with |
| 63 | | zero => |
| 64 | exact canonicalDifferenceEnergy_continuousOn univ isOpen_univ qH qA qS |
| 65 | (energyCutoffs_contDiff e).2.continuous (energyCutoffs_hasCompactSupport e).2 |
| 66 | (subset_univ _) _ _ _ hK hKJ |
| 67 | | succ j => |
| 68 | exact canonicalDifferenceEnergy_continuousOn |
| 69 | (endReferenceRegion e) (endReferenceRegion_isOpen e) qH qA qS |
| 70 | (energyCutoffs_contDiff e).1.continuous (energyCutoffs_hasCompactSupport e).1 |
| 71 | (endEnergyCutoff_tsupport_subset_region e) _ _ _ hK hKJ |
| 72 | |
| 73 | /-- Every indexed energy has its ordinary derivative at interior common |
| 74 | times (Section 12.5, pp. 309-319). -/ |
| 75 | theorem capDifferenceEnergy_differentiableAt {t : ℝ} (ht : t ∈ interior (J ∩ J')) |
| 76 | (i : ℕ) : DifferentiableAt ℝ (capDifferenceEnergy e qH qA qS F F' p i) t := by |
| 77 | cases i with |
| 78 | | zero => |
| 79 | exact canonicalDifferenceEnergy_differentiableAt univ isOpen_univ qH qA qS |
| 80 | (energyCutoffs_contDiff e).2.continuous (energyCutoffs_hasCompactSupport e).2 |
| 81 | (subset_univ _) _ _ _ ht |
| 82 | | succ j => |
| 83 | exact canonicalDifferenceEnergy_differentiableAt |
| 84 | (endReferenceRegion e) (endReferenceRegion_isOpen e) qH qA qS |
| 85 | (energyCutoffs_contDiff e).1.continuous (energyCutoffs_hasCompactSupport e).1 |
| 86 | (endEnergyCutoff_tsupport_subset_region e) _ _ _ ht |
| 87 | |
| 88 | end PoincareMT.M34 |