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.Minimum.Variational.Regularity.Momentum |
| 2 | |
| 3 | /-! |
| 4 | # Continuous velocity from weak momentum |
| 5 | |
| 6 | The continuous inverse momentum coefficient identifies the weak velocity |
| 7 | with a continuous representative and makes its primitive continuously |
| 8 | differentiable on the whole closed interval. |
| 9 | -/ |
| 10 | |
| 11 | /-! |
| 12 | Adapted from Mapher `Proofs/M08/WeakVelocity.lean`, commit |
| 13 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open MeasureTheory Set Filter Topology |
| 20 | open scoped intervalIntegral ContDiff |
| 21 | |
| 22 | namespace PoincareMT.ReducedLengthMinimum.Variational |
| 23 | |
| 24 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] |
| 25 | |
| 26 | theorem continuous_primitive_regular {a b : ℝ} (hab : a < b) |
| 27 | (u q : ℝ → E) (hq : ContinuousOn q (Icc a b)) |
| 28 | (hprimitive : ∀ s ∈ Icc a b, u s = u a + ∫ r in a..s, q r) : |
| 29 | (∀ s ∈ Icc a b, HasDerivWithinAt u (q s) (Icc a b) s) ∧ |
| 30 | ContDiffOn ℝ 1 u (Icc a b) := by |
| 31 | have hqint : IntervalIntegrable q volume a b := hq.intervalIntegrable_of_Icc hab.le |
| 32 | have hderiv (s : ℝ) (hs : s ∈ Icc a b) : |
| 33 | HasDerivWithinAt u (q s) (Icc a b) s := by |
| 34 | haveI : Fact (s ∈ Icc a b) := ⟨hs⟩ |
| 35 | have hint : IntervalIntegrable q volume a s := hqint.mono_set (by |
| 36 | rw [uIcc_of_le hs.1, uIcc_of_le hab.le] |
| 37 | exact Icc_subset_Icc_right hs.2) |
| 38 | have hd := (intervalIntegral.integral_hasDerivWithinAt_right |
| 39 | (s := Icc a b) (t := Icc a b) hint |
| 40 | (hq.stronglyMeasurableAtFilter_nhdsWithin measurableSet_Icc s) (hq s hs)).const_add |
| 41 | (u a) |
| 42 | exact hd.congr_of_mem hprimitive hs |
| 43 | refine ⟨hderiv, ?_⟩ |
| 44 | rw [contDiffOn_one_iff_derivWithin (uniqueDiffOn_Icc hab)] |
| 45 | refine ⟨fun s hs ↦ (hderiv s hs).differentiableWithinAt, hq.congr ?_⟩ |
| 46 | intro s hs |
| 47 | exact (hderiv s hs).derivWithin (uniqueDiffOn_Icc hab s hs) |
| 48 | |
| 49 | theorem weak_velocity_regular {a b : ℝ} (hab : a < b) |
| 50 | (u : ℝ → E) (w : IntervalL2 E a b) |
| 51 | (hprimitive : ∀ s ∈ Icc a b, u s = u a + ∫ r in a..s, w r) |
| 52 | (A B : ℝ → E →L[ℝ] E) |
| 53 | (hA : ContinuousOn A (Icc a b)) (hB : ContinuousOn B (Icc a b)) |
| 54 | (hinv : ∀ s ∈ Icc a b, ∀ v : E, B s (A s v) = v) |
| 55 | (Q : ℝ → E) (hQ : IntervalIntegrable Q volume a b) |
| 56 | (hP : IntervalIntegrable (fun s ↦ A s (w s)) volume a b) |
| 57 | (hweak : ∀ φ : ℝ → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → |
| 58 | tsupport φ ⊆ Ioo a b → (∫ s in a..b, deriv φ s • A s (w s)) = |
| 59 | -(∫ s in a..b, φ s • Q s)) : |
| 60 | ∃ (c : E) (q : ℝ → E), |
| 61 | (∀ s, q s = B s (c + ∫ r in a..s, Q r)) ∧ |
| 62 | ContinuousOn q (Icc a b) ∧ |
| 63 | (w : ℝ → E) =ᵐ[volume.restrict (Icc a b)] q ∧ |
| 64 | (∀ s ∈ Icc a b, A s (q s) = c + ∫ r in a..s, Q r) ∧ |
| 65 | (∀ s ∈ Icc a b, u s = u a + ∫ r in a..s, q r) ∧ |
| 66 | (∀ s ∈ Icc a b, HasDerivWithinAt u (q s) (Icc a b) s) ∧ |
| 67 | ContDiffOn ℝ 1 u (Icc a b) := by |
| 68 | obtain ⟨c, hc⟩ := weak_momentum_primitive hab (fun s ↦ A s (w s)) Q hP hQ hweak |
| 69 | let q : ℝ → E := fun s ↦ B s (c + ∫ r in a..s, Q r) |
| 70 | have hH : ContinuousOn (fun s ↦ c + ∫ r in a..s, Q r) (Icc a b) := by |
| 71 | have h := intervalIntegral.continuousOn_primitive_interval' hQ left_mem_uIcc |
| 72 | rw [uIcc_of_le hab.le] at h |
| 73 | exact continuousOn_const.add h |
| 74 | have hq : ContinuousOn q (Icc a b) := hB.clm_apply hH |
| 75 | have hwq : (w : ℝ → E) =ᵐ[volume.restrict (Icc a b)] q := by |
| 76 | filter_upwards [hc, ae_restrict_mem measurableSet_Icc] with s hs hmem |
| 77 | dsimp only [q] |
| 78 | rw [← hs] |
| 79 | exact (hinv s hmem (w s)).symm |
| 80 | have hmomentum : ∀ s ∈ Icc a b, A s (q s) = c + ∫ r in a..s, Q r := by |
| 81 | apply Measure.eqOn_Icc_of_ae_eq volume hab.ne |
| 82 | · filter_upwards [hc, hwq] with s hs hws |
| 83 | rw [← hws] |
| 84 | exact hs |
| 85 | · exact hA.clm_apply hq |
| 86 | · exact hH |
| 87 | have hprimitiveQ (s : ℝ) (hs : s ∈ Icc a b) : |
| 88 | u s = u a + ∫ r in a..s, q r := by |
| 89 | rw [hprimitive s hs] |
| 90 | congr 1 |
| 91 | apply intervalIntegral.integral_congr_ae_restrict |
| 92 | rw [uIoc_of_le hs.1] |
| 93 | exact ae_mono (Measure.restrict_mono |
| 94 | (Ioc_subset_Icc_self.trans (Icc_subset_Icc_right hs.2)) le_rfl) hwq |
| 95 | obtain ⟨hderiv, hC1⟩ := continuous_primitive_regular hab u q hq hprimitiveQ |
| 96 | exact ⟨c, q, fun _ ↦ rfl, hq, hwq, hmomentum, hprimitiveQ, hderiv, hC1⟩ |
| 97 | |
| 98 | end PoincareMT.ReducedLengthMinimum.Variational |
| 99 |