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.ReducedGeometry.ReducedLength.Variation.Fields.ParametricFieldSum |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ChartVelocity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.VelocityRestriction |
| 4 | import Mathlib.Geometry.Manifold.PartitionOfUnity |
| 5 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 6 | |
| 7 | /-! |
| 8 | # A velocity extension across a compact curve segment |
| 9 | |
| 10 | A finite partition in time patches the actual local chart velocities. |
| 11 | The resulting field is smooth on an open neighborhood of the graph and |
| 12 | realizes the frozen within-velocity, including nondegenerate endpoints. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option maxSynthPendingDepth 3 |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.ReducedLength |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 26 | [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | local notation "V" => EuclideanSpace ℝ (Fin n) |
| 29 | local notation "P" => ModelWithCorners.prod (𝓘(ℝ, ℝ)) (𝓡 n) |
| 30 | |
| 31 | theorem nonempty_velocityExtensionOn_compact (γ : ℝ → M) (U K : Set ℝ) |
| 32 | (hU : IsOpen U) (hKU : K ⊆ U) (hK : IsCompact K) (hKd : UniqueDiffOn ℝ K) |
| 33 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) : |
| 34 | Nonempty (ParametricAlongCurveExtensionOn (n := n) K γ |
| 35 | (curveVelocityWithin (n := n) γ K)) := by |
| 36 | classical |
| 37 | let W : ℝ → Set ℝ := fun t ↦ U ∩ γ ⁻¹' (chartAt V (γ t)).source |
| 38 | have hW (t : ℝ) : IsOpen (W t) := |
| 39 | hγ.continuousOn.isOpen_inter_preimage hU (chartAt V (γ t)).open_source |
| 40 | obtain ⟨S, _, hcover⟩ := hK.elim_nhds_subcover W (fun t ht ↦ |
| 41 | (hW t).mem_nhds ⟨hKU ht, mem_chart_source V (γ t)⟩) |
| 42 | have hcover' : K ⊆ ⋃ i : S, W i := by |
| 43 | intro s hs |
| 44 | obtain ⟨t, htS, ht⟩ := Set.mem_iUnion₂.mp (hcover hs) |
| 45 | exact Set.mem_iUnion.mpr ⟨⟨t, htS⟩, ht⟩ |
| 46 | obtain ⟨ρ, hρ⟩ := SmoothPartitionOfUnity.exists_isSubordinate (𝓘(ℝ, ℝ)) |
| 47 | hK.isClosed (fun i : S ↦ W i) (fun i ↦ hW i) hcover' |
| 48 | let a : S → ℝ → V := fun i s ↦ (chartAt V (γ i)) (γ s) |
| 49 | let v : S → ℝ → V := fun i ↦ deriv (a i) |
| 50 | have ha (i : S) : ContDiffOn ℝ ∞ (a i) (W i) := |
| 51 | (contMDiffOn_chart.comp (hγ.mono Set.inter_subset_left) (fun _ ht ↦ ht.2)).contDiffOn |
| 52 | have hv (i : S) : ContDiffOn ℝ ∞ (v i) (W i) := (ha i).deriv_of_isOpen (hW i) (by simp) |
| 53 | let X : S → ℝ → (x : M) → TangentSpace (𝓡 n) x := |
| 54 | fun i s ↦ chartVectorField (γ i) (v i s) |
| 55 | let D : Set (ℝ × M) := ⋂ i : S, |
| 56 | ((tsupport (ρ i))ᶜ ×ˢ Set.univ) ∪ (W i ×ˢ (chartAt V (γ i)).source) |
| 57 | have hD : IsOpen D := isOpen_iInter_of_finite fun i ↦ |
| 58 | ((isClosed_tsupport (ρ i)).isOpen_compl.prod isOpen_univ).union |
| 59 | ((hW i).prod (chartAt V (γ i)).open_source) |
| 60 | have hgraph : ∀ s ∈ K, (s, γ s) ∈ D := by |
| 61 | intro s hs |
| 62 | apply Set.mem_iInter.mpr |
| 63 | intro i |
| 64 | by_cases hi : s ∈ tsupport (ρ i) |
| 65 | · exact Or.inr ⟨hρ i hi, (hρ i hi).2⟩ |
| 66 | · exact Or.inl ⟨hi, Set.mem_univ _⟩ |
| 67 | let Y : ℝ → (x : M) → TangentSpace (𝓡 n) x := |
| 68 | fun s x ↦ ∑ i : S, ρ i s • X i s x |
| 69 | have hY : ContMDiffOn P ((𝓡 n).prod (𝓡 n)) ∞ |
| 70 | (fun z : ℝ × M ↦ (⟨z.2, Y z.1 z.2⟩ : TangentBundle (𝓡 n) M)) D := |
| 71 | weightedParametricField_smooth (fun i s ↦ ρ i s) |
| 72 | (fun i ↦ (ρ i).contMDiff.contDiff) (fun i ↦ W i) |
| 73 | (fun i ↦ (chartAt V (γ i)).source) (fun i ↦ hW i) |
| 74 | (fun i ↦ (chartAt V (γ i)).open_source) X |
| 75 | (fun i ↦ chartVectorField_param_smooth (γ i) (v i) (W i) (hv i)) |
| 76 | refine ⟨{ |
| 77 | extension := Y |
| 78 | domain := D |
| 79 | open_domain := hD |
| 80 | graph_mem := hgraph |
| 81 | smooth := hY |
| 82 | agrees := ?_ |
| 83 | }⟩ |
| 84 | intro s hs |
| 85 | have hgd : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ s := |
| 86 | (hγ.contMDiffAt (hU.mem_nhds (hKU hs))).mdifferentiableAt (by simp) |
| 87 | rw [curveVelocityWithin_eq_curveVelocity γ K s (hKd s hs) hgd] |
| 88 | have hsum : ∑ i : S, ρ i s = 1 := by |
| 89 | simpa only [finsum_eq_sum_of_fintype] using ρ.sum_eq_one hs |
| 90 | calc |
| 91 | Y s (γ s) = ∑ i : S, ρ i s • curveVelocity γ s := by |
| 92 | apply Finset.sum_congr rfl |
| 93 | intro i _ |
| 94 | by_cases hi : ρ i s = 0 |
| 95 | · simp [hi] |
| 96 | · have hsi : s ∈ W i := hρ i (subset_tsupport (ρ i) (Function.mem_support.mpr hi)) |
| 97 | have had : HasDerivAt (a i) (v i s) s := |
| 98 | ((ha i).contDiffAt ((hW i).mem_nhds hsi)).differentiableAt (by simp) |>.hasDerivAt |
| 99 | rw [show X i s (γ s) = curveVelocity γ s from |
| 100 | chartVectorField_coordinate_velocity (γ i) γ s (v i s) hsi.2 hgd had] |
| 101 | _ = (∑ i : S, ρ i s) • curveVelocity γ s := (Finset.sum_smul ..).symm |
| 102 | _ = curveVelocity γ s := by rw [hsum, one_smul] |
| 103 | |
| 104 | end PoincareMT.ReducedLength |