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.Adapted.AdaptedFieldOn |
| 2 | import Mathlib.Analysis.Calculus.MeanValue |
| 3 | |
| 4 | /-! |
| 5 | # Conservation of the actual metric pairing |
| 6 | |
| 7 | The local chart equations give a zero derivative of the intrinsic pairing. |
| 8 | Ordinary real-variable constancy then applies on the open time domain. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology |
| 15 | open Filter |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | set_option backward.isDefEq.respectTransparency false in |
| 28 | theorem IsAdaptedFieldOn.hasDerivAt_pairing {J : Set ℝ} (F : RicciFlow n M J) |
| 29 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 30 | (γ : ℝ → M) (P Q : ∀ t, TangentSpace (𝓡 n) (γ t)) |
| 31 | (U : Set ℝ) (hU : IsOpen U) |
| 32 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) |
| 33 | (hP : IsAdaptedFieldOn F T γ P U) (hQ : IsAdaptedFieldOn F T γ Q U) |
| 34 | (s : ℝ) (hs : s ∈ U) (htime : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) : |
| 35 | HasDerivAt (fun t ↦ (F.metric (T - t ^ 2)).inner (γ t) (P t) (Q t)) 0 s := by |
| 36 | let p := γ s |
| 37 | let e := chartAt E p |
| 38 | let V := U ∩ γ ⁻¹' e.source |
| 39 | have hV : IsOpen V := hγ.continuousOn.isOpen_inter_preimage hU e.open_source |
| 40 | have hsV : s ∈ V := ⟨hs, mem_chart_source E p⟩ |
| 41 | let y : ℝ → E := fun t ↦ e (γ t) |
| 42 | let v : ℝ → E := fun t ↦ mfderiv (𝓡 n) (𝓡 n) e (γ t) (P t) |
| 43 | let w : ℝ → E := fun t ↦ mfderiv (𝓡 n) (𝓡 n) e (γ t) (Q t) |
| 44 | have hy : ContDiffOn ℝ ∞ y V := |
| 45 | (contMDiffOn_chart.comp (hγ.mono Set.inter_subset_left) (fun _ ht ↦ ht.2)).contDiffOn |
| 46 | have hyd : HasDerivAt y (deriv y s) s := |
| 47 | ((hy.contDiffAt (hV.mem_nhds hsV)).differentiableAt (by simp)).hasDerivAt |
| 48 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, y s) := |
| 49 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 50 | ((isOpen_Ioo.prod e.open_target).mem_nhds ⟨htime, e.map_source hsV.2⟩)).differentiableAt |
| 51 | (by simp) |
| 52 | have hd := hasDerivAt_coordinateTransport_pairing (squareChartMetric F T p) y v w s |
| 53 | (deriv y s) hG |
| 54 | (Filter.Eventually.of_forall (fun z a c ↦ squareChartMetric_symm F T p z a c)) |
| 55 | (fun a ha ↦ squareChartMetric_pos F T p (s, y s) (e.map_source hsV.2) a ha) |
| 56 | hyd (hP.equation s hs p hsV.2) (hQ.equation s hs p hsV.2) |
| 57 | apply hd.congr_of_eventuallyEq |
| 58 | filter_upwards [hV.mem_nhds hsV] with t ht |
| 59 | have hv' := chartVectorField_at_inverse p (v t) (y t) (e.map_source ht.2) |
| 60 | have hw' := chartVectorField_at_inverse p (w t) (y t) (e.map_source ht.2) |
| 61 | dsimp only [y] at hv' hw' |
| 62 | rw [e.left_inv ht.2, chartVectorField_differential p (γ t) (P t) ht.2] at hv' |
| 63 | rw [e.left_inv ht.2, chartVectorField_differential p (γ t) (Q t) ht.2] at hw' |
| 64 | change (F.metric (T - t ^ 2)).inner (γ t) (P t) (Q t) = |
| 65 | (F.metric (T - t ^ 2)).inner (e.symm (e (γ t))) _ _ |
| 66 | rw [e.left_inv ht.2] |
| 67 | let a : E := mfderiv (𝓡 n) (𝓡 n) e.symm (e (γ t)) (v t) |
| 68 | let b : E := mfderiv (𝓡 n) (𝓡 n) e.symm (e (γ t)) (w t) |
| 69 | have hva : (P t : E) = a := hv' |
| 70 | have hwb : (Q t : E) = b := hw' |
| 71 | exact congrArg₂ (fun a b : E ↦ (F.metric (T - t ^ 2)).inner (γ t) a b) hva hwb |
| 72 | |
| 73 | theorem IsAdaptedFieldOn.pairing_eq {J : Set ℝ} (F : RicciFlow n M J) |
| 74 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 75 | (γ : ℝ → M) (P Q : ∀ t, TangentSpace (𝓡 n) (γ t)) |
| 76 | (U : Set ℝ) (hU : IsOpen U) (hconn : IsPreconnected U) |
| 77 | (htime : U ⊆ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 78 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) |
| 79 | (hP : IsAdaptedFieldOn F T γ P U) (hQ : IsAdaptedFieldOn F T γ Q U) |
| 80 | (s t : ℝ) (hs : s ∈ U) (ht : t ∈ U) : |
| 81 | (F.metric (T - s ^ 2)).inner (γ s) (P s) (Q s) = |
| 82 | (F.metric (T - t ^ 2)).inner (γ t) (P t) (Q t) := by |
| 83 | have hd := fun r hr ↦ IsAdaptedFieldOn.hasDerivAt_pairing F T b hb hwindow γ P Q U |
| 84 | hU hγ hP hQ r hr (htime hr) |
| 85 | exact hU.is_const_of_deriv_eq_zero hconn |
| 86 | (fun r hr ↦ (hd r hr).differentiableAt.differentiableWithinAt) |
| 87 | (fun r hr ↦ (hd r hr).deriv) hs ht |
| 88 | |
| 89 | end PoincareMT.ReducedLength |