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.Index.SmoothIndexDensity |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.CompactDerivativeExtension |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Fields.VariationFieldSmooth |
| 4 | |
| 5 | /-! |
| 6 | # Integrability of every actual variation index density |
| 7 | |
| 8 | The given extension witnesses and a constructed pullback extension yield |
| 9 | a smooth representative agreeing with the frozen density on the interval. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | {J : Set ℝ} {F : RicciFlow n M J} {T b τmax : ℝ} |
| 25 | |
| 26 | set_option maxHeartbeats 1000000 in |
| 27 | -- Every extension is evaluated on the common actual graph neighborhood. |
| 28 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem secondVariationIndexDensity_intervalIntegrable |
| 30 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 31 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hb : 0 < b) (hmax : b < τmax) |
| 32 | {P : BackwardTimePath F T 0 b} (V : LVariation F T 0 b P) |
| 33 | (D : LVariationDerivativeData V) : |
| 34 | IntervalIntegrable (secondVariationIndexDensity V D) MeasureTheory.volume 0 (Real.sqrt b) := by |
| 35 | let K := sqrtParameterInterval 0 b |
| 36 | let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 37 | obtain ⟨hU, hKU, _⟩ := squareVariationField_smooth V |
| 38 | have hf : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓡 n) ∞ |
| 39 | (fun z ↦ V.squareFamily z.1 z.2) V.squareDomain := by |
| 40 | convert! V.square_smooth using 1 <;> |
| 41 | simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 42 | have hi : ContMDiff (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ × ℝ)) ∞ (fun s : ℝ ↦ (s, (0 : ℝ))) := |
| 43 | (contDiff_id.prodMk contDiff_const).contMDiff |
| 44 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 45 | hf.comp hi.contMDiffOn (fun _ hs ↦ hs) |
| 46 | have hKd : UniqueDiffOn ℝ K := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt (le_refl 0) hb) |
| 47 | have htime : K ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) := by |
| 48 | intro s hs |
| 49 | have hs0 : 0 ≤ s := by simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hs.1 |
| 50 | exact ⟨(neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans_le hs0, |
| 51 | hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax)⟩ |
| 52 | obtain ⟨H⟩ := nonempty_pullbackDerivativeExtensionOn_compact F T τmax hτmax hwindow |
| 53 | V.baseSquareCurve (squareVariationField V) U K hU hKU isCompact_Icc hKd htime hα |
| 54 | D.variation_extension |
| 55 | let g : ℝ → ℝ × M := fun s ↦ (s, V.baseSquareCurve s) |
| 56 | have hg : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ g U := |
| 57 | contMDiffOn_id.prodMk hα |
| 58 | let W := U ∩ g ⁻¹' (D.velocity_extension.domain ∩ D.variation_extension.domain ∩ H.domain) ∩ |
| 59 | Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) |
| 60 | have hW : IsOpen W := (hg.continuousOn.isOpen_inter_preimage hU |
| 61 | ((D.velocity_extension.open_domain.inter D.variation_extension.open_domain).inter |
| 62 | H.open_domain)).inter isOpen_Ioo |
| 63 | have hKW : K ⊆ W := fun s hs ↦ |
| 64 | ⟨⟨hKU hs, ⟨D.velocity_extension.graph_mem s hs, D.variation_extension.graph_mem s hs⟩, |
| 65 | H.graph_mem s hs⟩, htime hs⟩ |
| 66 | have hgW := hg.mono (show W ⊆ U from fun _ h ↦ h.1.1) |
| 67 | let A := fun s ↦ D.velocity_extension.extension s (V.baseSquareCurve s) |
| 68 | let Y := fun s ↦ D.variation_extension.extension s (V.baseSquareCurve s) |
| 69 | let Z := fun s ↦ H.extension s (V.baseSquareCurve s) |
| 70 | have hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 71 | (fun s ↦ (⟨V.baseSquareCurve s, A s⟩ : TangentBundle (𝓡 n) M)) W := |
| 72 | D.velocity_extension.smooth.comp hgW (fun _ hs ↦ hs.1.2.1.1) |
| 73 | have hY : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 74 | (fun s ↦ (⟨V.baseSquareCurve s, Y s⟩ : TangentBundle (𝓡 n) M)) W := |
| 75 | D.variation_extension.smooth.comp hgW (fun _ hs ↦ hs.1.2.1.2) |
| 76 | have hZ : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 77 | (fun s ↦ (⟨V.baseSquareCurve s, Z s⟩ : TangentBundle (𝓡 n) M)) W := |
| 78 | H.smooth.comp hgW (fun _ hs ↦ hs.1.2.2) |
| 79 | have hsmooth := pointwiseSecondVariationDensity_contDiffOn F hM04 T τmax hτmax hwindow |
| 80 | V.baseSquareCurve A Y Z W hW Set.inter_subset_right |
| 81 | (hα.mono (fun _ h ↦ h.1.1)) hA hY hZ |
| 82 | have hcont : ContinuousOn (secondVariationIndexDensity V D) K := by |
| 83 | apply (hsmooth.continuousOn.mono hKW).congr |
| 84 | intro s hs |
| 85 | rw [secondVariationIndexDensity_eq_pointwise] |
| 86 | change _ = pointwiseSecondVariationDensity F T (V.baseSquareCurve s) s |
| 87 | (D.velocity_extension.extension s (V.baseSquareCurve s)) |
| 88 | (D.variation_extension.extension s (V.baseSquareCurve s)) (H.extension s (V.baseSquareCurve s)) |
| 89 | rw [D.velocity_extension.agrees s hs, D.variation_extension.agrees s hs, H.agrees s hs] |
| 90 | apply ContinuousOn.intervalIntegrable_of_Icc (Real.sqrt_nonneg b) |
| 91 | simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hcont |
| 92 | |
| 93 | end PoincareMT.ReducedLength |