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.ReducedVolume.Regularity.AlmostEverywhere.TerminalGradient |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Regularity.AlmostEverywhere.RegularGerms |
| 3 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 4 | |
| 5 | /-! |
| 6 | # The derivative of reduced action along the actual exponential family |
| 7 | |
| 8 | The action derivative and terminal gradient identify the derivative along |
| 9 | a regular minimizing path with the fixed-endpoint time derivative plus |
| 10 | the squared gradient norm. This is the scalar calculation in Morgan-Tian |
| 11 | Proposition 6.81; the varying Gram Jacobian is a separate calculation. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedVolume |
| 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 | /-- The normalized actual action has its square-root quotient derivative. -/ |
| 28 | theorem normalized_action_hasDerivAt (G : LExponentialGeometry F T τmax p) |
| 29 | (Z : TangentSpace (𝓡 n) p) {τ : ℝ} (hτ : 0 < τ) (hmax : τ < τmax) : |
| 30 | HasDerivAt (fun s ↦ G.toLExponentialFamily.action Z s / (2 * Real.sqrt s)) |
| 31 | (((F.connection (T - τ)).scalarCurvature (G.gamma Z τ) + |
| 32 | (F.metric (T - τ)).inner (G.gamma Z τ) (curveVelocity (G.gamma Z) τ) |
| 33 | (curveVelocity (G.gamma Z) τ)) / 2 - |
| 34 | (G.toLExponentialFamily.action Z τ / (2 * Real.sqrt τ)) / (2 * τ)) τ := by |
| 35 | have hs : Real.sqrt τ ≠ 0 := (Real.sqrt_pos.2 hτ).ne' |
| 36 | have h := (G.action_time_derivative Z τ hτ hmax).div |
| 37 | ((Real.hasDerivAt_sqrt hτ.ne').const_mul 2) (mul_ne_zero (by norm_num) hs) |
| 38 | apply h.congr_deriv |
| 39 | dsimp only [backwardLIntegrand] |
| 40 | field_simp |
| 41 | rw [show Real.sqrt τ ^ 3 = τ * Real.sqrt τ by |
| 42 | rw [pow_succ, Real.sq_sqrt hτ.le], Real.sq_sqrt hτ.le] |
| 43 | ring |
| 44 | |
| 45 | variable [ConnectedSpace M] |
| 46 | |
| 47 | /-- The first two formulas use one Harnack integral and give the actual time identity. -/ |
| 48 | theorem reducedLength_time_gradient_identity |
| 49 | (hDifferential : ReducedLengthDifferentialTheory F T τmax) {q : M} {τ : ℝ} |
| 50 | (r : ReducedLengthRegularPoint F T τmax p q τ) : |
| 51 | 2 * deriv (fun s ↦ reducedLength F T p q s) τ = |
| 52 | (F.connection (T - τ)).scalarCurvature q - |
| 53 | reducedLengthGradientNormSq F T (fun z ↦ reducedLength F T p z.1 z.2) τ q - |
| 54 | reducedLength F T p q τ / τ := by |
| 55 | obtain ⟨hd, hg, _⟩ := hDifferential.regular_point_formulas p q τ r |
| 56 | rw [(regular_time_eventuallyEq r).deriv_eq, |
| 57 | r.representative_eq (q, τ) r.center_mem] at hd |
| 58 | rw [regular_gradientNormSq_eq r, |
| 59 | r.representative_eq (q, τ) r.center_mem] at hg |
| 60 | rw [hd, hg] |
| 61 | ring |
| 62 | |
| 63 | set_option backward.isDefEq.respectTransparency false in |
| 64 | /-- At a regular minimizing lift the frozen gradient sum is the actual terminal speed squared. -/ |
| 65 | theorem reducedLength_gradientNormSq_eq_terminal_speed |
| 66 | (hL : LGeodesicTheory F T τmax) (G : LExponentialGeometry F T τmax p) |
| 67 | (Z : TangentSpace (𝓡 n) p) {τ : ℝ} |
| 68 | (hreg : (Z, τ) ∈ G.toLExponentialFamily.regularDomain) : |
| 69 | reducedLengthGradientNormSq F T (fun z ↦ reducedLength F T p z.1 z.2) |
| 70 | τ (G.gamma Z τ) = |
| 71 | (F.metric (T - τ)).inner (G.gamma Z τ) (curveVelocity (G.gamma Z) τ) |
| 72 | (curveVelocity (G.gamma Z) τ) := by |
| 73 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 74 | ⟨(F.metric (T - τ)).toRiemannianMetric⟩ |
| 75 | obtain ⟨hτ, hmax, hmin, _⟩ := hreg.1 |
| 76 | have hsrc : (Z, τ) ∈ G.regular_chart.source := G.regular_source.symm ▸ hreg |
| 77 | have htgt : (G.gamma Z τ, τ) ∈ G.regularImage := by |
| 78 | change (G.gamma Z τ, τ) ∈ G.regular_chart.target |
| 79 | simpa only [G.regular_forward] using G.regular_chart.map_source hsrc |
| 80 | have hr := G.regular_point (G.gamma Z τ, τ) htgt |
| 81 | have hpair := reducedLength_differential_eq_terminal_pairing hL G Z hτ hmax hmin |
| 82 | ((reducedLength_space_contMDiffAt hr).mdifferentiableAt (by simp)) hreg.2.2 |
| 83 | unfold reducedLengthGradientNormSq |
| 84 | simp_rw [hpair] |
| 85 | exact (((F.metric (T - τ)).orthonormalBasis (G.gamma Z τ)).sum_sq_inner_left _).trans |
| 86 | (real_inner_self_eq_norm_sq _).symm |
| 87 | |
| 88 | /-- Along the same regular branch, the moving-endpoint derivative is D plus the gradient square. -/ |
| 89 | theorem normalized_action_regular_hasDerivAt |
| 90 | (hL : LGeodesicTheory F T τmax) |
| 91 | (hDifferential : ReducedLengthDifferentialTheory F T τmax) |
| 92 | (G : LExponentialGeometry F T τmax p) (Z : TangentSpace (𝓡 n) p) {τ : ℝ} |
| 93 | (hreg : (Z, τ) ∈ G.toLExponentialFamily.regularDomain) : |
| 94 | HasDerivAt (fun s ↦ G.toLExponentialFamily.action Z s / (2 * Real.sqrt s)) |
| 95 | (deriv (fun s ↦ reducedLength F T p (G.gamma Z τ) s) τ + |
| 96 | reducedLengthGradientNormSq F T (fun z ↦ reducedLength F T p z.1 z.2) |
| 97 | τ (G.gamma Z τ)) τ := by |
| 98 | obtain ⟨hτ, hmax, hmin, _⟩ := hreg.1 |
| 99 | have hsrc : (Z, τ) ∈ G.regular_chart.source := G.regular_source.symm ▸ hreg |
| 100 | have htgt : (G.gamma Z τ, τ) ∈ G.regularImage := by |
| 101 | change (G.gamma Z τ, τ) ∈ G.regular_chart.target |
| 102 | simpa only [G.regular_forward] using G.regular_chart.map_source hsrc |
| 103 | have hid := reducedLength_time_gradient_identity hDifferential |
| 104 | (G.regular_point (G.gamma Z τ, τ) htgt) |
| 105 | have ha := reducedLength_eq_normalized_action_of_minimizing hL G Z hτ hmax hmin |
| 106 | have hg := reducedLength_gradientNormSq_eq_terminal_speed hL G Z hreg |
| 107 | apply (normalized_action_hasDerivAt G Z hτ hmax).congr_deriv |
| 108 | rw [← ha, ← hg] |
| 109 | field_simp [hτ.ne'] |
| 110 | have hid' : 2 * deriv (fun s ↦ reducedLength F T p (G.gamma Z τ) s) τ = |
| 111 | (F.connection (T - τ)).scalarCurvature (G.gamma Z τ) - |
| 112 | reducedLengthGradientNormSq F T (fun z ↦ reducedLength F T p z.1 z.2) |
| 113 | τ (G.gamma Z τ) - reducedLength F T p (G.gamma Z τ) τ / τ := by |
| 114 | simpa only [Prod.fst, Prod.snd] using hid |
| 115 | have hidmul := congrArg (fun x : ℝ ↦ x * τ) hid' |
| 116 | field_simp [hτ.ne'] at hidmul |
| 117 | nlinarith [hidmul] |
| 118 | |
| 119 | end PoincareMT.ReducedVolume |