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.ReducedGeometry.ReducedLength.Variation.Differential.SmoothSquareVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Initial.InitialVectorIdentification |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Exponential.FamilyEulerEquation |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Theory |
| 5 | |
| 6 | /-! |
| 7 | # First variation for smooth square-time comparison families |
| 8 | |
| 9 | Both endpoint momenta are retained. Closed-interval agreement identifies |
| 10 | velocities only for the two ambient-smooth square-time representatives. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 26 | |
| 27 | local notation "Q" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | theorem lExponentialFamily_variation_boundaryTerm (A : LExponentialFamily F T τmax p) |
| 31 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 32 | (V : LVariation F T 0 b (A.path Z b hb hmax)) : |
| 33 | firstVariationBoundaryTerm V = |
| 34 | (F.metric (T - b)).inner (A.squareFamily Z (Real.sqrt b)) |
| 35 | (curveVelocity (A.squareFamily Z) (Real.sqrt b)) (squareVariationField V (Real.sqrt b)) - |
| 36 | (F.metric T).inner p ((2 : ℝ) • Z) (squareVariationField V 0) := by |
| 37 | let K := sqrtParameterInterval 0 b |
| 38 | let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 39 | have hzero : (0 : ℝ) ∈ Set.Ioo (-V.radius) V.radius := |
| 40 | ⟨neg_lt_zero.mpr V.radius_pos, V.radius_pos⟩ |
| 41 | have hK : K = Set.Icc 0 (Real.sqrt b) := by simp only [K, sqrtParameterInterval, Real.sqrt_zero] |
| 42 | have hKdiff : UniqueDiffOn ℝ K := hK ▸ uniqueDiffOn_Icc (Real.sqrt_pos.mpr hb) |
| 43 | have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 44 | have hKU : K ⊆ U := fun s hs ↦ V.square_contains ⟨hs, hzero⟩ |
| 45 | have hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 46 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun _ hs ↦ hs) |
| 47 | have heq : Set.EqOn V.baseSquareCurve (A.squareFamily Z) K := by |
| 48 | intro s hs |
| 49 | have hs0 : 0 ≤ s := by simpa only [sqrtParameterInterval, Real.sqrt_zero] using hs.1 |
| 50 | have hsmax := hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax) |
| 51 | exact (V.square_agrees s hs 0 hzero).trans ((V.at_zero (s ^ 2)).trans |
| 52 | ((congrFun (A.path_eq Z b hb hmax) (s ^ 2)).trans |
| 53 | (A.square_agrees Z s ⟨hs0, hsmax⟩).symm)) |
| 54 | have hv (s : ℝ) (hs : s ∈ K) : |
| 55 | (curveVelocityWithin (n := n) V.baseSquareCurve K s : Q) = curveVelocity (A.squareFamily Z) s := by |
| 56 | have hdβ := (hβ.contMDiffAt (hU.mem_nhds (hKU hs))).mdifferentiableAt (by simp) |
| 57 | have hs0 : 0 ≤ s := by simpa only [sqrtParameterInterval, Real.sqrt_zero] using hs.1 |
| 58 | have hdA := (lExponentialFamily_squareSlice_contMDiffAt A Z s |
| 59 | ⟨hs0, hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax)⟩).mdifferentiableAt (by simp) |
| 60 | exact (curveVelocityWithin_eq_curveVelocity V.baseSquareCurve K s (hKdiff s hs) hdβ).trans |
| 61 | (curveVelocity_eq_of_eqOn heq hs (hKdiff s hs) hdβ hdA) |
| 62 | have hvalue (s : ℝ) (hs : s ∈ K) : |
| 63 | (F.metric (T - s ^ 2)).inner (V.baseSquareCurve s) |
| 64 | (curveVelocityWithin V.baseSquareCurve K s) (squareVariationField V s) = |
| 65 | (F.metric (T - s ^ 2)).inner (A.squareFamily Z s) |
| 66 | (curveVelocity (A.squareFamily Z) s) (squareVariationField V s) := by |
| 67 | have ht : (V.baseSquareCurve s, |
| 68 | ((curveVelocityWithin V.baseSquareCurve K s : Q), (squareVariationField V s : Q))) = |
| 69 | (A.squareFamily Z s, ((curveVelocity (A.squareFamily Z) s : Q), |
| 70 | (squareVariationField V s : Q))) := Prod.ext (heq hs) (Prod.ext (hv s hs) rfl) |
| 71 | exact congrArg (fun q : M × (Q × Q) ↦ (F.metric (T - s ^ 2)).inner q.1 q.2.1 q.2.2) ht |
| 72 | have h0K : (0 : ℝ) ∈ K := by rw [hK]; exact ⟨le_rfl, Real.sqrt_nonneg b⟩ |
| 73 | have hbK : Real.sqrt b ∈ K := by rw [hK]; exact ⟨Real.sqrt_nonneg b, le_rfl⟩ |
| 74 | unfold firstVariationBoundaryTerm |
| 75 | dsimp only |
| 76 | rw [Real.sqrt_zero, hvalue _ hbK, hvalue _ h0K, Real.sq_sqrt hb.le] |
| 77 | simp only [zero_pow (by norm_num : (2 : ℕ) ≠ 0), sub_zero, |
| 78 | lExponentialFamily_initial_velocity] |
| 79 | rw [A.square_at_zero Z] |
| 80 | |
| 81 | set_option backward.isDefEq.respectTransparency false in |
| 82 | theorem hasDerivAt_smoothSquareFamily_action [ConnectedSpace M] |
| 83 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 84 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 85 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 86 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 87 | (f : ℝ × ℝ → M) (U : Set (ℝ × ℝ)) (hU : IsOpen U) |
| 88 | (hf : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ f U) |
| 89 | (ρ : ℝ) (hρ : 0 < ρ) (hI : Set.Icc 0 (Real.sqrt b) ×ˢ Set.Ioo (-ρ) ρ ⊆ U) |
| 90 | (hcenter : ∀ s ∈ Set.Icc 0 (Real.sqrt b), f (s, 0) = A.squareFamily Z s) : |
| 91 | HasDerivAt (fun u ↦ backwardLLength F T 0 b (fun t ↦ f (Real.sqrt t, u))) |
| 92 | ((F.metric (T - b)).inner (A.squareFamily Z (Real.sqrt b)) |
| 93 | (curveVelocity (A.squareFamily Z) (Real.sqrt b)) |
| 94 | (curveVelocity (fun u ↦ f (Real.sqrt b, u)) 0) - |
| 95 | (F.metric T).inner p ((2 : ℝ) • Z) (curveVelocity (fun u ↦ f (0, u)) 0)) 0 := by |
| 96 | obtain ⟨V, _, hVf, _, hVa⟩ := exists_lVariation_of_smoothSquareFamily |
| 97 | hM04 hτmax hwindow A Z b hb hmax f U hU hf ρ hρ hI hcenter |
| 98 | obtain ⟨D, hfirst⟩ := hL.first_variation 0 b le_rfl hb hmax.le (A.path Z b hb hmax) V |
| 99 | rw [lExponentialFamily_firstVariationResidualIntegral_eq_zero hM04 hτmax hwindow |
| 100 | A Z b hb hmax V D, add_zero, lExponentialFamily_variation_boundaryTerm A Z b hb hmax V] at hfirst |
| 101 | have hfield (s : ℝ) : (squareVariationField V s : Q) = curveVelocity (fun u ↦ f (s, u)) 0 := |
| 102 | congrArg (fun γ : ℝ → M ↦ (curveVelocity γ 0 : Q)) (funext (hVf s)) |
| 103 | rw [hfield (Real.sqrt b), hfield 0, show variationLLength V = |
| 104 | (fun u ↦ backwardLLength F T 0 b (fun t ↦ f (Real.sqrt t, u))) from funext hVa] at hfirst |
| 105 | exact hfirst |
| 106 | |
| 107 | end PoincareMT.ReducedLength |