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.Index.FixedChartIndexDensity |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Adapted.AdaptedFieldCoordinates |
| 3 | |
| 4 | /-! |
| 5 | # Smooth index densities along actual smooth fields |
| 6 | |
| 7 | At each time, one fixed chart supplies a smooth representative on an |
| 8 | open neighborhood. The selected chart need not vary continuously. |
| 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 maxHeartbeats 1000000 in |
| 28 | -- Model-space equalities are applied only after retaining the actual chart base equality. |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | theorem pointwiseSecondVariationDensity_contDiffOn {J : Set ℝ} (F : RicciFlow n M J) |
| 31 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 32 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 33 | (α : ℝ → M) (A Y W : ∀ s, TangentSpace (𝓡 n) (α s)) |
| 34 | (U : Set ℝ) (hU : IsOpen U) (htime : U ⊆ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 35 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U) |
| 36 | (hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 37 | (fun s ↦ (⟨α s, A s⟩ : TangentBundle (𝓡 n) M)) U) |
| 38 | (hY : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 39 | (fun s ↦ (⟨α s, Y s⟩ : TangentBundle (𝓡 n) M)) U) |
| 40 | (hW : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 41 | (fun s ↦ (⟨α s, W s⟩ : TangentBundle (𝓡 n) M)) U) : |
| 42 | ContDiffOn ℝ ∞ (fun s ↦ pointwiseSecondVariationDensity F T (α s) s (A s) (Y s) (W s)) U := by |
| 43 | intro t ht |
| 44 | let p := α t |
| 45 | let e := chartAt E p |
| 46 | let V := U ∩ α ⁻¹' e.source |
| 47 | have hV : IsOpen V := hα.continuousOn.isOpen_inter_preimage hU e.open_source |
| 48 | have htV : t ∈ V := ⟨ht, mem_chart_source E p⟩ |
| 49 | let y : ℝ → E := fun s ↦ e (α s) |
| 50 | let a : ℝ → E := fun s ↦ mfderiv (𝓡 n) (𝓡 n) e (α s) (A s) |
| 51 | let v : ℝ → E := fun s ↦ mfderiv (𝓡 n) (𝓡 n) e (α s) (Y s) |
| 52 | let w : ℝ → E := fun s ↦ mfderiv (𝓡 n) (𝓡 n) e (α s) (W s) |
| 53 | have hy : ContDiffOn ℝ ∞ y V := |
| 54 | (contMDiffOn_chart.comp (hα.mono Set.inter_subset_left) (fun _ hs ↦ hs.2)).contDiffOn |
| 55 | have ha := field_chart_coordinates_smooth p α A V (hA.mono Set.inter_subset_left) |
| 56 | (fun _ hs ↦ hs.2) |
| 57 | have hv := field_chart_coordinates_smooth p α Y V (hY.mono Set.inter_subset_left) |
| 58 | (fun _ hs ↦ hs.2) |
| 59 | have hw := field_chart_coordinates_smooth p α W V (hW.mono Set.inter_subset_left) |
| 60 | (fun _ hs ↦ hs.2) |
| 61 | let f : ℝ → ℝ := fun s ↦ coordinateIndexDensity |
| 62 | (squareChartMetric F T p) (squareChartScalar F T p) (s, y s) (a s) (v s) (w s) |
| 63 | have hf : ContDiffOn ℝ ∞ f V := coordinateIndexDensity_contDiffOn |
| 64 | (squareChartMetric F T p) (squareChartScalar F T p) |
| 65 | (Set.Ioo (-Real.sqrt b) (Real.sqrt b) ×ˢ e.target) (isOpen_Ioo.prod e.open_target) |
| 66 | (squareChartMetric_smooth F T b hb hwindow p) |
| 67 | (squareChartScalar_smooth F hM04 T b hb hwindow p) |
| 68 | (fun z hz ξ hξ ↦ squareChartMetric_pos F T p z hz.2 ξ hξ) |
| 69 | V (fun s ↦ (s, y s)) a v w (contDiffOn_id.prodMk hy) ha hv hw |
| 70 | (fun s hs ↦ ⟨htime hs.1, e.map_source hs.2⟩) |
| 71 | apply ((hf.contDiffAt (hV.mem_nhds htV)).congr_of_eventuallyEq ?_).contDiffWithinAt |
| 72 | filter_upwards [hV.mem_nhds htV] with s hs |
| 73 | have h := squareChartIndexDensity_on_target F hM04 T b hb hwindow p s (htime hs.1) |
| 74 | (y s) (e.map_source hs.2) (a s) (v s) (w s) |
| 75 | change f s = pointwiseSecondVariationDensity F T (e.symm (e (α s))) s |
| 76 | (chartVectorField p (a s) (e.symm (e (α s)))) |
| 77 | (chartVectorField p (v s) (e.symm (e (α s)))) |
| 78 | (chartVectorField p (w s) (e.symm (e (α s)))) at h |
| 79 | rw [e.left_inv hs.2, chartVectorField_differential p (α s) (A s) hs.2, |
| 80 | chartVectorField_differential p (α s) (Y s) hs.2, |
| 81 | chartVectorField_differential p (α s) (W s) hs.2] at h |
| 82 | exact h.symm |
| 83 | |
| 84 | end PoincareMT.ReducedLength |