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.CurveShortening.Comparison.IntrinsicComparison.Curve.EndpointMeasure |
| 2 | |
| 3 | /-! |
| 4 | # Actual target-arc endpoint sets in one inverse chart |
| 5 | |
| 6 | The graph of the stopping height is only measurable. A smooth local |
| 7 | inverse of the normal map nevertheless constructs the measurable target |
| 8 | parameter set and its exact base image. The Jacobian estimate applies |
| 9 | to any embedded target curve, as required by Morgan--Tian, Lemma 19.46, |
| 10 | Case (ii), pp. 475-478. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped Topology Manifold ContDiff Bundle Matrix ENNReal |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 23 | normedSpaceTangentSpaceVectorSpace |
| 24 | |
| 25 | /-- Actual parameters on a target arc attained by the selected stopping |
| 26 | graph, used for the endpoint sweep in Lemma 19.46, p. 477. -/ |
| 27 | def m64IntrinsicCurveEndpointParameters |
| 28 | (e : AnnulusCoordinates → AnnulusCoordinates) (height : ℝ → ℝ) |
| 29 | (S : Set ℝ) (target : ℝ → AnnulusCoordinates) (T : Set ℝ) : Set ℝ := |
| 30 | {t | t ∈ T ∧ ∃ a ∈ S, e !₂[a, height a] = target t} |
| 31 | |
| 32 | /-- Construct the measurable endpoint set and its actual length bound |
| 33 | from one smooth inverse chart; Lemma 19.46, pp. 475-478. -/ |
| 34 | theorem m64Intrinsic_curve_endpoint_chart_measure_le |
| 35 | (N : IntrinsicAnnulus) (e : AnnulusCoordinates → AnnulusCoordinates) |
| 36 | (he : Differentiable ℝ e) |
| 37 | (F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 38 | (hF : (F : AnnulusCoordinates → AnnulusCoordinates) = e) |
| 39 | (hFi : ContDiffOn ℝ ∞ F.symm F.target) |
| 40 | {S T : Set ℝ} (hS : MeasurableSet S) (hT : MeasurableSet T) |
| 41 | {height : ℝ → ℝ} (hh : Measurable height) |
| 42 | {target : ℝ → AnnulusCoordinates} (htarget : ContDiff ℝ ∞ target) |
| 43 | (htargetInj : InjOn target T) |
| 44 | (hsource : ∀ a ∈ S, !₂[a, height a] ∈ F.source) |
| 45 | (hend : ∀ a ∈ S, e !₂[a, height a] ∈ target '' T) |
| 46 | {c : ℝ} (hc : 0 ≤ c) |
| 47 | (hbound : ∀ a ∈ S, ∀ v : AnnulusCoordinates, |
| 48 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 a ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 49 | N.metric.inner (e !₂[a, height a]) |
| 50 | (fderiv ℝ e !₂[a, height a] v) (fderiv ℝ e !₂[a, height a] v)) : |
| 51 | MeasurableSet (m64IntrinsicCurveEndpointParameters e height S target T) ∧ |
| 52 | ENNReal.ofReal c * (∫⁻ a in S, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 53 | ∫⁻ t in m64IntrinsicCurveEndpointParameters e height S target T, |
| 54 | ENNReal.ofReal (Real.sqrt |
| 55 | (N.metric.inner (target t) (deriv target t) (deriv target t))) := by |
| 56 | classical |
| 57 | let J := target ⁻¹' F.target |
| 58 | let raw : ℝ → AnnulusCoordinates := F.symm ∘ target |
| 59 | have hJ : IsOpen J := F.open_target.preimage htarget.continuous |
| 60 | have hraw : ContDiffOn ℝ ∞ raw J := |
| 61 | hFi.comp htarget.contDiffOn (fun _ hs => hs) |
| 62 | let gamma : ℝ → AnnulusCoordinates := J.piecewise raw 0 |
| 63 | have heq (t : ℝ) (ht : t ∈ J) : gamma t = raw t := by |
| 64 | simp only [gamma, piecewise_eq_of_mem J raw 0 ht] |
| 65 | have hgm : Measurable gamma := hraw.continuousOn.measurable_piecewise |
| 66 | continuous_zero.continuousOn hJ.measurableSet |
| 67 | have hg : ContDiffOn ℝ ∞ gamma J := hraw.congr (fun t ht => heq t ht) |
| 68 | have hg0 : Measurable (fun t => gamma t 0) := by fun_prop |
| 69 | have hg1 : Measurable (fun t => gamma t 1) := by fun_prop |
| 70 | have hlift (t : ℝ) (ht : t ∈ J) : e (gamma t) = target t := by |
| 71 | rw [heq t ht, ← hF] |
| 72 | exact F.right_inv ht |
| 73 | have hbase (a : ℝ) (ha : a ∈ S) (t : ℝ) |
| 74 | (hat : e !₂[a, height a] = target t) : |
| 75 | t ∈ J ∧ gamma t = !₂[a, height a] := by |
| 76 | have ht : t ∈ J := by |
| 77 | change target t ∈ F.target |
| 78 | rw [← hat, ← hF] |
| 79 | exact F.map_source (hsource a ha) |
| 80 | refine ⟨ht, ?_⟩ |
| 81 | rw [heq t ht] |
| 82 | change F.symm (target t) = !₂[a, height a] |
| 83 | rw [← hat, ← hF] |
| 84 | exact F.left_inv (hsource a ha) |
| 85 | let B := (T ∩ J) ∩ {t | gamma t 0 ∈ S} ∩ |
| 86 | {t | gamma t 1 = height (gamma t 0)} |
| 87 | have hB : MeasurableSet B := |
| 88 | ((hT.inter hJ.measurableSet).inter (hS.preimage hg0)).inter |
| 89 | (measurableSet_eq_fun hg1 (hh.comp hg0)) |
| 90 | have hBJ : B ⊆ J := fun _ ht => ht.1.1.2 |
| 91 | have hBT : B ⊆ T := fun _ ht => ht.1.1.1 |
| 92 | have hgraph (t : ℝ) (ht : t ∈ B) : gamma t 1 = height (gamma t 0) := ht.2 |
| 93 | have hrepr (t : ℝ) (ht : t ∈ B) : !₂[gamma t 0, height (gamma t 0)] = gamma t := by |
| 94 | rw [← hgraph t ht] |
| 95 | ext i |
| 96 | fin_cases i <;> rfl |
| 97 | have hBexact : B = m64IntrinsicCurveEndpointParameters e height S target T := by |
| 98 | ext t |
| 99 | constructor |
| 100 | · intro ht |
| 101 | refine ⟨hBT ht, gamma t 0, ht.1.2, ?_⟩ |
| 102 | rw [hrepr t ht] |
| 103 | exact hlift t (hBJ ht) |
| 104 | · rintro ⟨ht, a, ha, hat⟩ |
| 105 | obtain ⟨htJ, hgbase⟩ := hbase a ha t hat |
| 106 | exact ⟨⟨⟨ht, htJ⟩, by simpa only [mem_ofPred_eq, hgbase, Matrix.cons_val_zero] using ha⟩, |
| 107 | by simp only [mem_ofPred_eq, hgbase, Matrix.cons_val_zero, |
| 108 | Matrix.cons_val_one, Matrix.cons_val_fin_one]⟩ |
| 109 | have himage : (fun t => gamma t 0) '' B = S := by |
| 110 | apply Subset.antisymm |
| 111 | · rintro _ ⟨t, ht, rfl⟩ |
| 112 | exact ht.1.2 |
| 113 | · intro a ha |
| 114 | obtain ⟨t, ht, hta⟩ := hend a ha |
| 115 | obtain ⟨_, hgbase⟩ := hbase a ha t hta.symm |
| 116 | refine ⟨t, ?_, ?_⟩ |
| 117 | · rw [hBexact] |
| 118 | exact ⟨ht, a, ha, hta.symm⟩ |
| 119 | · simp only [hgbase, Matrix.cons_val_zero] |
| 120 | have hlength := m64Intrinsic_lifted_curve_endpoint_graph_measure_le N hJ hg |
| 121 | (fun t _ => he (gamma t)) hlift hB hBJ hBT htargetInj hgraph hc (by |
| 122 | intro t ht v |
| 123 | have h := hbound (gamma t 0) ht.1.2 v |
| 124 | rw [hrepr t ht] at h |
| 125 | exact h) |
| 126 | rw [himage, hBexact] at hlength |
| 127 | exact ⟨hBexact ▸ hB, hlength⟩ |
| 128 | |
| 129 | end PoincareMT |