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 | # Comparison for a reduced-length minimum |
| 5 | |
| 6 | The real-variable argument for Morgan--Tian, Theorem 7.10 and Claim 7.11, |
| 7 | pp. 154--156, applies once continuity, the initial bound, and local upper |
| 8 | barriers have been obtained from the reduced-length variational problem. |
| 9 | This file proves the comparison argument, without asserting those geometric |
| 10 | inputs. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology |
| 17 | |
| 18 | namespace PoincareMT.ReducedLengthMinimum |
| 19 | |
| 20 | /-- Arbitrarily accurate differentiable upper barriers bound the right-hand |
| 21 | lower limit of difference quotients. Only upper barriers to the right of the |
| 22 | contact point are needed. -/ |
| 23 | theorem frequently_slope_lt_of_upper_barriers {f : ℝ → ℝ} {x a : ℝ} |
| 24 | (hbarrier : ∀ ε > 0, ∃ (b : ℝ → ℝ) (d : ℝ), |
| 25 | b x = f x ∧ HasDerivAt b d x ∧ |
| 26 | (∀ᶠ y in 𝓝[>] x, f y ≤ b y) ∧ d ≤ a + ε) |
| 27 | {r : ℝ} (hr : a < r) : ∃ᶠ y in 𝓝[>] x, slope f x y < r := by |
| 28 | obtain ⟨b, d, hbx, hbd, hupper, hd⟩ := hbarrier ((r - a) / 2) (by linarith) |
| 29 | have hdr : d < r := by linarith |
| 30 | have hfreq : ∃ᶠ y in 𝓝[>] x, slope b x y < r := |
| 31 | hbd.hasDerivWithinAt.liminf_right_slope_le hdr |
| 32 | refine (hfreq.and_eventually (hupper.and self_mem_nhdsWithin)).mono ?_ |
| 33 | intro y hy |
| 34 | apply lt_of_le_of_lt _ hy.1 |
| 35 | rw [slope_def_field, slope_def_field, hbx] |
| 36 | exact div_le_div_of_nonneg_right (sub_le_sub_right hy.2.1 _) (le_of_lt (sub_pos.mpr hy.2.2)) |
| 37 | |
| 38 | /-- If a continuous function on positive times has initial upper limit at most |
| 39 | `c`, and arbitrarily accurate local upper barriers with derivative at most |
| 40 | `(c - m t) / t`, then it stays at most `c`. |
| 41 | |
| 42 | The initial condition is stated using eventual upper bounds, so no value or |
| 43 | continuity of `m` at time zero is required. -/ |
| 44 | theorem le_of_approximate_upper_barriers {m : ℝ → ℝ} {c : ℝ} |
| 45 | (hcont : ContinuousOn m (Ioi 0)) |
| 46 | (hinitial : ∀ ε > 0, ∀ᶠ t in 𝓝[>] (0 : ℝ), m t ≤ c + ε) |
| 47 | (hbarrier : ∀ t > 0, ∀ ε > 0, ∃ (b : ℝ → ℝ) (d : ℝ), |
| 48 | b t = m t ∧ HasDerivAt b d t ∧ |
| 49 | (∀ᶠ s in 𝓝[>] t, m s ≤ b s) ∧ d ≤ (c - m t) / t + ε) |
| 50 | {T : ℝ} (hT : 0 < T) : m T ≤ c := by |
| 51 | refine le_of_forall_pos_le_add fun ε hε => ?_ |
| 52 | obtain ⟨a, hma, ha⟩ := ((hinitial ε hε).and (Ioo_mem_nhdsGT hT)).exists |
| 53 | have hcont' : ContinuousOn m (Icc a T) := |
| 54 | hcont.mono fun t ht => lt_of_lt_of_le ha.1 ht.1 |
| 55 | have hslope : ∀ t ∈ Ico a T, ∀ r, (c - m t) / t < r → |
| 56 | ∃ᶠ s in 𝓝[>] t, slope m t s < r := by |
| 57 | intro t ht r hr |
| 58 | exact frequently_slope_lt_of_upper_barriers |
| 59 | (hbarrier t (lt_of_lt_of_le ha.1 ht.1)) hr |
| 60 | apply image_le_of_liminf_slope_right_lt_deriv_boundary hcont' hslope hma |
| 61 | (fun t => hasDerivAt_const t (c + ε)) ?_ ⟨ha.2.le, le_rfl⟩ |
| 62 | intro t ht hmt |
| 63 | have htpos : 0 < t := lt_of_lt_of_le ha.1 ht.1 |
| 64 | apply div_neg_of_neg_of_pos _ htpos |
| 65 | change m t = c + ε at hmt |
| 66 | linarith |
| 67 | |
| 68 | /-- A right-continuous initial value bounded by `c` supplies the initial |
| 69 | condition in the minimum comparison theorem. -/ |
| 70 | theorem le_of_approximate_upper_barriers_of_continuousWithinAt |
| 71 | {m : ℝ → ℝ} {c : ℝ} |
| 72 | (hcont : ContinuousOn m (Ioi 0)) |
| 73 | (hzero : ContinuousWithinAt m (Ioi 0) 0) (hmzero : m 0 ≤ c) |
| 74 | (hbarrier : ∀ t > 0, ∀ ε > 0, ∃ (b : ℝ → ℝ) (d : ℝ), |
| 75 | b t = m t ∧ HasDerivAt b d t ∧ |
| 76 | (∀ᶠ s in 𝓝[>] t, m s ≤ b s) ∧ d ≤ (c - m t) / t + ε) |
| 77 | {T : ℝ} (hT : 0 < T) : m T ≤ c := by |
| 78 | apply le_of_approximate_upper_barriers hcont _ hbarrier hT |
| 79 | intro ε hε |
| 80 | have hbound : m 0 < c + ε := lt_of_le_of_lt hmzero (lt_add_of_pos_right c hε) |
| 81 | have hevent : ∀ᶠ t in 𝓝[>] (0 : ℝ), m t < c + ε := hzero (Iio_mem_nhds hbound) |
| 82 | exact hevent.mono fun _ h => le_of_lt h |
| 83 | |
| 84 | end PoincareMT.ReducedLengthMinimum |