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.Generalized.ReducedGeometry.Regularity.PositiveStart.PositiveStartContact |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Action.ActionFirstVariation |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Equation.SquareEuler |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Extension.FieldRealization |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.AdaptedFields.AdaptedScale |
| 6 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Manifold.SectionThroughVector |
| 7 | |
| 8 | /-! |
| 9 | # Actual differential at a smooth minimizing endpoint |
| 10 | |
| 11 | Initial-fixed variations realize every terminal horizontal vector. |
| 12 | Their action contact and first variation identify the actual differential, |
| 13 | including positive starting time. Morgan-Tian Lemma 6.22, Corollary 6.29 |
| 14 | and Lemma 6.49, pp. 115-118, 131. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | -- Scalar tangent fibers use the retained spacetime model vector. |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Bundle Topology |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M14 |
| 27 | |
| 28 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 29 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 30 | {T a b : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 31 | {R : M14SquareRootPath G p} |
| 32 | |
| 33 | private theorem scalar_transport {q r : G.Point} (h : q = r) |
| 34 | (f : G.Point → ℝ) (A : G.Horizontal q) : |
| 35 | mvfderiv (spacetimeModel n) f r (h ▸ A).val = |
| 36 | mvfderiv (spacetimeModel n) f q A.val := by |
| 37 | cases h |
| 38 | rfl |
| 39 | |
| 40 | /-- The parameter derivative of a scalar along an actual endpoint |
| 41 | curve is its differential on the retained variation field, |
| 42 | Lemma 6.22, pp. 115-116. -/ |
| 43 | theorem positiveStart_variationEndpoint_hasDerivAt |
| 44 | (V : M14LVariationData G p R) {s : ℝ} |
| 45 | (hs : s ∈ M14SqrtParameterInterval a b) {f : G.Point → ℝ} |
| 46 | (hf : MDifferentiableAt (spacetimeModel n) (𝓘(ℝ, ℝ)) f (R.curve s)) : |
| 47 | HasDerivAt (fun v => f (V.squareFamily s v)) |
| 48 | (mvfderiv (spacetimeModel n) f (R.curve s) (M14VariationField V s).val) 0 := by |
| 49 | have hzero : (0 : ℝ) ∈ V.parameterDomain := by |
| 50 | rw [V.parameterDomain_eq] |
| 51 | exact ⟨neg_lt_zero.mpr V.radius_pos, V.radius_pos⟩ |
| 52 | have hP : IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 53 | have hγ := ((variation_parameter_smooth V hs).contMDiffAt |
| 54 | (hP.mem_nhds hzero)).mdifferentiableAt (by simp) |
| 55 | have hf' : MDifferentiableAt (spacetimeModel n) (𝓘(ℝ, ℝ)) f |
| 56 | (V.squareFamily s 0) := V.square_base s ▸ hf |
| 57 | have h := (hf'.hasMFDerivAt.comp 0 hγ.hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 58 | change HasDerivAt (fun v => f (V.squareFamily s v)) |
| 59 | (mvfderiv (spacetimeModel n) f (V.squareFamily s 0) |
| 60 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (V.squareFamily s) 0 1)) 0 at h |
| 61 | rw [← endpointVariationField_val_eq_tangent V hs hzero] at h |
| 62 | exact (scalar_transport (V.square_base s) f (M14EndpointVariationField V s 0)) ▸ h |
| 63 | |
| 64 | /-- Every actual terminal horizontal vector occurs in an initial-fixed |
| 65 | variation, with the full closed field retained, Lemma 6.40, pp. 123-127. -/ |
| 66 | theorem positiveStart_exists_terminalVariation |
| 67 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 68 | (W : G.Horizontal (R.curve (Real.sqrt b))) : |
| 69 | ∃ V : M14LVariationData G p R, V.left_endpoint_fixed ∧ |
| 70 | M14VariationField V (Real.sqrt a) = 0 ∧ |
| 71 | M14VariationField V (Real.sqrt b) = W := by |
| 72 | have hab := Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt |
| 73 | obtain ⟨Z, hZ, hZend⟩ := FiberBundle.exists_contMDiff_section_through |
| 74 | (I := spacetimeModel n) (F := EuclideanSpace ℝ (Fin n)) W |
| 75 | obtain ⟨EZ⟩ := exists_pullbackExtension_Icc (G := G) (γ := R.curve) |
| 76 | (Y := fun r => Z (R.curve r)) hab |
| 77 | (hZ.comp_contMDiffOn (R.smooth.mono R.interval_subset)) |
| 78 | let Y := horizontalAdaptedField (Real.sqrt a) (Real.sqrt b) (fun r => Z (R.curve r)) |
| 79 | have hend := horizontalAdaptedField_endpoints (P := fun r => Z (R.curve r)) hab |
| 80 | have hY := pullbackExtension_field_contMDiffOn (horizontalAdaptedExtension EZ) |
| 81 | (R.smooth.mono R.interval_subset) |
| 82 | obtain ⟨V, hfix, hfield, _⟩ := |
| 83 | exists_initialFixed_variation_of_smooth_horizontalField R hM12 Y hY hend.1 |
| 84 | refine ⟨V, hfix, (hfield _ ⟨le_rfl, hab.le⟩).trans hend.1, ?_⟩ |
| 85 | exact (hfield _ ⟨hab.le, le_rfl⟩).trans (hend.2.trans hZend) |
| 86 | |
| 87 | /-- Smooth raw reduced length at an actual minimizing endpoint has |
| 88 | the square-path momentum differential, for arbitrary nonnegative start, |
| 89 | Corollary 6.29 and Lemma 6.49, pp. 118, 131. -/ |
| 90 | theorem positiveStart_horizontal_differential |
| 91 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 92 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (hp : M14IsMinimizing p) |
| 93 | (U : Set G.Point) (hU : IsOpen U) (hy : y ∈ U) |
| 94 | (hf : ContMDiffOn (spacetimeModel n) (𝓘(ℝ, ℝ)) ∞ |
| 95 | (M14ReducedLengthAt G T a x) U) |
| 96 | (W : G.Horizontal (R.curve (Real.sqrt b))) : |
| 97 | mvfderiv (spacetimeModel n) (M14ReducedLengthAt G T a x) |
| 98 | (R.curve (Real.sqrt b)) W.val = |
| 99 | G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt b)) |
| 100 | (R.horizontal_velocity (Real.sqrt b)) W / (2 * Real.sqrt b) := by |
| 101 | have hb := p.tau_nonneg.trans_lt p.tau_lt |
| 102 | have hs : Real.sqrt b ∈ M14SqrtParameterInterval a b := |
| 103 | ⟨Real.sqrt_le_sqrt p.tau_lt.le, le_rfl⟩ |
| 104 | have hpoint : R.curve (Real.sqrt b) = y := by |
| 105 | rw [R.agrees _ hs, Real.sq_sqrt hb.le, p.curve_end] |
| 106 | have hRU : R.curve (Real.sqrt b) ∈ U := by rwa [hpoint] |
| 107 | obtain ⟨V, hfix, hleft, hright⟩ := positiveStart_exists_terminalVariation hM12 W |
| 108 | obtain ⟨E⟩ := exists_squareRoot_velocity_extension R |
| 109 | have hfirst := firstVariation_euler_fixedInitial hCoordinates hM12 E |
| 110 | (fun _ ht Z => squareRootEulerResidual_eq_zero_of_minimizing hCoordinates hM12 hp E ht Z) |
| 111 | V hleft |
| 112 | rw [hright] at hfirst |
| 113 | have hscalar := positiveStart_variationEndpoint_hasDerivAt V hs |
| 114 | (((hf _ hRU).contMDiffAt (hU.mem_nhds hRU)).mdifferentiableAt |
| 115 | (by simp)) |
| 116 | rw [hright] at hscalar |
| 117 | have hgap := isLocalMin_variationAction_gap_of_smooth_minimizing hM12 V hp hfix U hU hy hf |
| 118 | have heq := hgap.hasDerivAt_eq_zero (hfirst.sub (hscalar.const_mul (2 * Real.sqrt b))) |
| 119 | apply (eq_div_iff (mul_pos zero_lt_two (Real.sqrt_pos.mpr hb)).ne').mpr |
| 120 | nlinarith [heq] |
| 121 | |
| 122 | end PoincareMT.M14 |