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.MeanValue |
| 2 | |
| 3 | /-! |
| 4 | # Scalar comparison for attained slice minima |
| 5 | |
| 6 | Proposition 16.4, pp. 389-391. A continued minimizing Euler branch is |
| 7 | a differentiable upper competitor for the next slice's minimum. The |
| 8 | right-slope comparison propagates the dimension bound without requiring |
| 9 | the minimum value function itself to be differentiable. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace PoincareMT.Proofs.M46 |
| 18 | |
| 19 | /-- An actual differentiable upper competitor controls the right slopes |
| 20 | of the value function at their contact point. Source: Proposition 16.4, |
| 21 | pp. 389-391, in the direct attained-minimum argument. -/ |
| 22 | theorem right_slope_bound_of_upper_competitor {f phi : ℝ → ℝ} {t d v : ℝ} |
| 23 | (hphi : HasDerivAt phi d t) (heq : phi t = f t) |
| 24 | (hnear : ∀ᶠ s in 𝓝[>] t, f s ≤ phi s) (hd : d ≤ v) : |
| 25 | ∀ r, v < r → ∃ᶠ s in 𝓝[>] t, slope f t s < r := by |
| 26 | intro r hr |
| 27 | have hslope : ∃ᶠ s in 𝓝[>] t, slope phi t s < r := |
| 28 | (hphi.hasDerivWithinAt (s := Ici t)).liminf_right_slope_le (hd.trans_lt hr) |
| 29 | apply (hslope.and_eventually (hnear.and self_mem_nhdsWithin)).mono |
| 30 | intro s hs |
| 31 | have hst : t < s := hs.2.2 |
| 32 | apply lt_of_le_of_lt _ hs.1 |
| 33 | rw [slope_def_field, slope_def_field, heq] |
| 34 | exact div_le_div_of_nonneg_right (sub_le_sub_right hs.2.1 _) |
| 35 | (sub_pos.mpr hst).le |
| 36 | |
| 37 | /-- The normalized slice minimum cannot rise above `c` when each |
| 38 | positive-time contact has derivative at most `(c-f(t))/t`. Source: |
| 39 | Proposition 16.4 and Corollary 7.12, pp. 389-391 and 156. -/ |
| 40 | theorem minimum_le_of_right_upper_competitors {f : ℝ → ℝ} {a b c : ℝ} |
| 41 | (ha : 0 < a) (hf : ContinuousOn f (Icc a b)) (hstart : f a ≤ c) |
| 42 | (hcontact : ∀ t ∈ Ico a b, ∃ phi : ℝ → ℝ, ∃ d : ℝ, |
| 43 | HasDerivAt phi d t ∧ phi t = f t ∧ |
| 44 | (∀ᶠ s in 𝓝[>] t, f s ≤ phi s) ∧ d ≤ (c - f t) / t) : |
| 45 | ∀ t ∈ Icc a b, f t ≤ c := by |
| 46 | have hslope : ∀ t ∈ Ico a b, ∀ r, |
| 47 | (c - f t) / t < r → ∃ᶠ s in 𝓝[>] t, slope f t s < r := by |
| 48 | intro t ht |
| 49 | obtain ⟨phi, d, hphi, heq, hnear, hd⟩ := hcontact t ht |
| 50 | exact right_slope_bound_of_upper_competitor hphi heq hnear hd |
| 51 | intro t ht |
| 52 | apply le_of_forall_pos_le_add |
| 53 | intro epsilon hepsilon |
| 54 | apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hslope |
| 55 | (B := fun _ => c + epsilon) (B' := fun _ => 0) |
| 56 | (hstart.trans (le_add_of_nonneg_right hepsilon.le)) |
| 57 | (fun s => hasDerivAt_const s (c + epsilon)) _ ht |
| 58 | intro s hs heq |
| 59 | have hspos : 0 < s := ha.trans_le hs.1 |
| 60 | rw [heq] |
| 61 | exact div_neg_of_neg_of_pos (by linarith) hspos |
| 62 | |
| 63 | end PoincareMT.Proofs.M46 |