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.Calculus.SmoothSquarePath |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.LocalSmoothPrimitive |
| 3 | |
| 4 | /-! |
| 5 | # Smooth actions of local square-time comparison families |
| 6 | |
| 7 | Compactness keeps nearby integration segments in the genuine smooth |
| 8 | domain. The resulting primitive equals the frozen action on a neighborhood. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology intervalIntegral |
| 15 | open Filter |
| 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 | {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 25 | |
| 26 | theorem contDiffAt_smoothSquareFamily_action {J : Set ℝ} |
| 27 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 28 | (T τmax : ℝ) (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 29 | (f : E × ℝ → M) (U : Set (E × ℝ)) (hU : IsOpen U) |
| 30 | (hf : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ f U) |
| 31 | (z0 : E × ℝ) (hz0 : z0.2 ∈ Set.Ioo 0 τmax) |
| 32 | (hsegment : ∀ r ∈ Set.Icc (0 : ℝ) 1, (z0.1, Real.sqrt z0.2 * r) ∈ U) : |
| 33 | ContDiffAt ℝ ∞ |
| 34 | (fun z : E × ℝ ↦ backwardLLength F T 0 z.2 (fun τ ↦ f (z.1, Real.sqrt τ))) z0 := by |
| 35 | let W := U ∩ (Set.univ ×ˢ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 36 | let H := squareFamilyActionDensity F T f |
| 37 | have hW : IsOpen W := hU.inter (isOpen_univ.prod isOpen_Ioo) |
| 38 | have hH : ContDiffOn ℝ ∞ H W := squareFamilyActionDensity_contDiffOn F hM04 T τmax |
| 39 | hτmax hwindow f W hW (hf.mono Set.inter_subset_left) (fun z hz ↦ hz.2.2) |
| 40 | have hseg : ∀ r ∈ Set.Icc (0 : ℝ) 1, (z0.1, Real.sqrt z0.2 * r) ∈ W := by |
| 41 | intro r hr |
| 42 | have h0 : 0 ≤ Real.sqrt z0.2 * r := mul_nonneg (Real.sqrt_nonneg _) hr.1 |
| 43 | have hlt : Real.sqrt z0.2 * r < Real.sqrt τmax := |
| 44 | (mul_le_of_le_one_right (Real.sqrt_nonneg _) hr.2).trans_lt |
| 45 | (Real.sqrt_lt_sqrt hz0.1.le hz0.2) |
| 46 | exact ⟨hsegment r hr, Set.mem_univ _, |
| 47 | (neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans_le h0, hlt⟩ |
| 48 | have hnear : ∀ᶠ z : E × ℝ in 𝓝 z0, |
| 49 | ∀ r ∈ Set.Icc (0 : ℝ) 1, (z.1, Real.sqrt z.2 * r) ∈ W := by |
| 50 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 51 | intro r hr |
| 52 | have hc : Continuous (fun w : (E × ℝ) × ℝ ↦ |
| 53 | (w.1.1, Real.sqrt w.1.2 * w.2)) := |
| 54 | continuous_fst.fst.prodMk ((Real.continuous_sqrt.comp continuous_fst.snd).mul continuous_snd) |
| 55 | exact hc.continuousAt.preimage_mem_nhds (hW.mem_nhds (hseg r hr)) |
| 56 | have heq : (fun z : E × ℝ ↦ backwardLLength F T 0 z.2 (fun τ ↦ f (z.1, Real.sqrt τ))) |
| 57 | =ᶠ[𝓝 z0] (fun z : E × ℝ ↦ ∫ s in 0..Real.sqrt z.2, H (z.1, s)) := by |
| 58 | filter_upwards [hnear, (isOpen_univ.prod isOpen_Ioo).mem_nhds |
| 59 | (show z0 ∈ Set.univ ×ˢ Set.Ioo 0 τmax from ⟨Set.mem_univ _, hz0⟩)] with z hsegz hz |
| 60 | apply backwardLLength_comp_sqrt_eq F T z.2 hz.2.1 (fun s ↦ f (z.1, s)) |
| 61 | intro s hs |
| 62 | have hpos : 0 < Real.sqrt z.2 := Real.sqrt_pos.mpr hz.2.1 |
| 63 | have hr : s / Real.sqrt z.2 ∈ Set.Icc (0 : ℝ) 1 := |
| 64 | ⟨div_nonneg hs.1.le hpos.le, (div_le_one hpos).mpr hs.2.le⟩ |
| 65 | have hmem : (z.1, s) ∈ U := by |
| 66 | have hm := (hsegz (s / Real.sqrt z.2) hr).1 |
| 67 | simpa only [mul_div_cancel₀ s hpos.ne'] using hm |
| 68 | have hi : ContMDiff (𝓘(ℝ, ℝ)) (𝓘(ℝ, E × ℝ)) ∞ (fun r : ℝ ↦ (z.1, r)) := |
| 69 | (contDiff_const.prodMk contDiff_id).contMDiff |
| 70 | exact ((hf.contMDiffAt (hU.mem_nhds hmem)).comp s hi.contMDiffAt).mdifferentiableAt (by simp) |
| 71 | have hp : ContDiffAt ℝ ∞ (fun z : E × ℝ ↦ ∫ s in 0..z.2, H (z.1, s)) |
| 72 | (z0.1, Real.sqrt z0.2) := |
| 73 | contDiffAt_parameter_primitive H W hW hH (z0.1, Real.sqrt z0.2) hseg |
| 74 | have hsqrt : ContDiffAt ℝ ∞ (fun z : E × ℝ ↦ (z.1, Real.sqrt z.2)) z0 := |
| 75 | contDiffAt_fst.prodMk (contDiffAt_snd.sqrt hz0.1.ne') |
| 76 | have hsmooth : ContDiffAt ℝ ∞ |
| 77 | (fun z : E × ℝ ↦ ∫ s in 0..Real.sqrt z.2, H (z.1, s)) z0 := |
| 78 | ContDiffAt.comp (g := fun z : E × ℝ ↦ ∫ s in 0..z.2, H (z.1, s)) z0 hp hsqrt |
| 79 | exact hsmooth.congr_of_eventuallyEq heq |
| 80 | |
| 81 | end PoincareMT.ReducedLength |