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.Analysis.Calculus.FDeriv.Extend |
| 2 | |
| 3 | /-! |
| 4 | # Extending an ODE derivative to the initial endpoint |
| 5 | |
| 6 | A continuous path with a continuous interior derivative field has the expected |
| 7 | right derivative at the initial endpoint. This permits closed-interval ODE |
| 8 | uniqueness arguments without a separate endpoint derivative hypothesis. |
| 9 | -/ |
| 10 | |
| 11 | namespace Poincare |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Topology |
| 15 | |
| 16 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 17 | |
| 18 | /-- Interior derivatives with a continuous derivative field extend to the right |
| 19 | derivative at the initial endpoint of a closed interval. -/ |
| 20 | theorem hasDerivWithinAt_Ici_of_continuousOn |
| 21 | {a b : ℝ} {f g : ℝ → E} |
| 22 | (hf : ContinuousOn f (Icc a b)) (hg : ContinuousOn g (Icc a b)) |
| 23 | (hd : ∀ t ∈ Ioo a b, HasDerivAt f (g t) t) : |
| 24 | ∀ t ∈ Ico a b, HasDerivWithinAt f (g t) (Ici t) t := by |
| 25 | intro t ht |
| 26 | rcases eq_or_lt_of_le ht.1 with rfl | hat |
| 27 | · have hab : a < b := ht.2 |
| 28 | have hgc : ContinuousWithinAt g (Ici a) a := by |
| 29 | simpa only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsGE hab] using |
| 30 | hg a ⟨le_rfl, hab.le⟩ |
| 31 | apply hasDerivWithinAt_Ici_of_tendsto_deriv |
| 32 | (fun s hs => (hd s hs).differentiableAt.differentiableWithinAt) |
| 33 | ((hf a ⟨le_rfl, hab.le⟩).mono Ioo_subset_Icc_self) |
| 34 | (Ioo_mem_nhdsGT hab) |
| 35 | apply (show Tendsto g (𝓝[>] a) (𝓝 (g a)) from |
| 36 | hgc.mono Ioi_subset_Ici_self).congr' |
| 37 | filter_upwards [Ioo_mem_nhdsGT hab] with s hs using (hd s hs).deriv.symm |
| 38 | · exact (hd t ⟨hat, ht.2⟩).hasDerivWithinAt |
| 39 | |
| 40 | end Poincare |