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 Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 2 | import Mathlib.Topology.ContinuousMap.Compact |
| 3 | import Mathlib.Topology.ContinuousMap.Algebra |
| 4 | import Mathlib.Topology.Order.ProjIcc |
| 5 | |
| 6 | /-! |
| 7 | # A bounded primitive on an actual closed path interval |
| 8 | |
| 9 | Morgan-Tian Lemma 6.18, pp. 113-114. This adapts M09's path primitive |
| 10 | to any actual closed time interval and any included initial time. |
| 11 | Continuous clamping defines the integral, and its within derivative |
| 12 | at the closed endpoints retains the original path value. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Topology intervalIntegral |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | {a b : ℝ} |
| 24 | |
| 25 | /-- Integrating a continuous path from an included initial time gives |
| 26 | a bounded linear primitive on its actual closed interval, the Picard |
| 27 | operator for Lemma 6.18, pp. 113-114. -/ |
| 28 | noncomputable def closedPathPrimitive (t₀ : Icc a b) : |
| 29 | C(Icc a b, E) →L[ℝ] C(Icc a b, E) := by |
| 30 | let π : C(ℝ, Icc a b) := ⟨projIcc a b (t₀.property.1.trans t₀.property.2), continuous_projIcc⟩ |
| 31 | let L : C(Icc a b, E) →ₗ[ℝ] C(Icc a b, E) := { |
| 32 | toFun := fun v => ⟨fun r => ∫ s in (t₀ : ℝ)..(r : ℝ), v (π s), |
| 33 | (intervalIntegral.continuous_primitive |
| 34 | (fun c d => (v.continuous.comp π.continuous).intervalIntegrable c d) t₀.val).comp |
| 35 | continuous_subtype_val⟩ |
| 36 | map_add' := by |
| 37 | intro v w |
| 38 | ext r |
| 39 | exact intervalIntegral.integral_add |
| 40 | ((v.continuous.comp π.continuous).intervalIntegrable _ _) |
| 41 | ((w.continuous.comp π.continuous).intervalIntegrable _ _) |
| 42 | map_smul' := by |
| 43 | intro c v |
| 44 | ext r |
| 45 | exact intervalIntegral.integral_smul c _ } |
| 46 | refine L.mkContinuous (b - a) ?_ |
| 47 | intro v |
| 48 | apply (ContinuousMap.norm_le _ (mul_nonneg (sub_nonneg.mpr |
| 49 | (t₀.property.1.trans t₀.property.2)) (norm_nonneg v))).2 |
| 50 | intro r |
| 51 | have hbound := intervalIntegral.norm_integral_le_of_norm_le_const |
| 52 | (a := (t₀ : ℝ)) (b := (r : ℝ)) (fun s _ => v.norm_coe_le_norm (π s)) |
| 53 | have hdist : |(r : ℝ) - t₀.val| ≤ b - a := abs_le.mpr |
| 54 | ⟨by linarith [r.property.1, t₀.property.2], by linarith [r.property.2, t₀.property.1]⟩ |
| 55 | exact hbound.trans ((mul_le_mul_of_nonneg_left hdist (norm_nonneg v)).trans_eq (mul_comm _ _)) |
| 56 | |
| 57 | /-- The closed primitive is the actual integral of the continuously |
| 58 | clamped path, the Picard identity in Lemma 6.18, pp. 113-114. -/ |
| 59 | theorem closedPathPrimitive_apply (t₀ : Icc a b) (v : C(Icc a b, E)) (r : Icc a b) : |
| 60 | closedPathPrimitive t₀ v r = |
| 61 | ∫ s in (t₀ : ℝ)..(r : ℝ), v (projIcc a b (t₀.property.1.trans t₀.property.2) s) := rfl |
| 62 | |
| 63 | /-- The primitive's norm is bounded by the actual time-interval length, |
| 64 | the small-time estimate for Lemma 6.18, pp. 113-114. -/ |
| 65 | theorem closedPathPrimitive_norm_le (t₀ : Icc a b) : |
| 66 | ‖closedPathPrimitive (E := E) t₀‖ ≤ b - a := by |
| 67 | unfold closedPathPrimitive |
| 68 | exact LinearMap.mkContinuous_norm_le _ (sub_nonneg.mpr (t₀.property.1.trans t₀.property.2)) _ |
| 69 | |
| 70 | /-- The actual primitive vanishes at its included initial time, |
| 71 | the initial condition in Lemma 6.18, pp. 113-114. -/ |
| 72 | theorem closedPathPrimitive_initial (t₀ : Icc a b) (v : C(Icc a b, E)) : |
| 73 | closedPathPrimitive t₀ v t₀ = 0 := by |
| 74 | rw [closedPathPrimitive_apply, intervalIntegral.integral_same] |
| 75 | |
| 76 | variable [CompleteSpace E] |
| 77 | |
| 78 | /-- The closed primitive has the original path as its actual within |
| 79 | derivative, including both endpoints, Lemma 6.18, pp. 113-114. -/ |
| 80 | theorem closedPathPrimitive_hasDerivWithinAt (t₀ r : Icc a b) (v : C(Icc a b, E)) : |
| 81 | HasDerivWithinAt |
| 82 | (fun s => closedPathPrimitive t₀ v (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 83 | (v r) (Icc a b) r.val := by |
| 84 | let π : C(ℝ, Icc a b) := ⟨projIcc a b (t₀.property.1.trans t₀.property.2), continuous_projIcc⟩ |
| 85 | have hd := ((v.continuous.comp π.continuous).integral_hasStrictDerivAt t₀.val r.val).hasDerivAt |
| 86 | have hπ : π r.val = r := projIcc_of_mem (t₀.property.1.trans t₀.property.2) r.property |
| 87 | dsimp only [Function.comp_def] at hd |
| 88 | rw [hπ] at hd |
| 89 | apply hd.hasDerivWithinAt.congr_of_mem _ r.property |
| 90 | intro s hs |
| 91 | rw [closedPathPrimitive_apply, projIcc_of_mem (t₀.property.1.trans t₀.property.2) hs] |
| 92 | rfl |
| 93 | |
| 94 | end PoincareMT.M14 |