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.Surgery.Metric.Construction.MetricCombination |
| 2 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 3 | import Mathlib.Geometry.Manifold.VectorBundle.Hom |
| 4 | |
| 5 | /-! |
| 6 | # Local metric pullback in tangent coordinates |
| 7 | |
| 8 | The raw bilinear pullback is smooth wherever its map is smooth. An |
| 9 | invertible differential supplies a genuine metric. These operations |
| 10 | implement the two metric terms in Morgan--Tian's surgery formula. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u v |
| 18 | |
| 19 | namespace PoincareMT.MetricSurgery |
| 20 | |
| 21 | variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) X] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) Y] |
| 24 | [IsManifold (𝓡 3) ∞ X] [IsManifold (𝓡 3) ∞ Y] |
| 25 | |
| 26 | local notation "E" => EuclideanSpace ℝ (Fin 3) |
| 27 | local notation "TX" => TangentSpace (𝓡 3) (M := X) |
| 28 | local notation "TY" => TangentSpace (𝓡 3) (M := Y) |
| 29 | |
| 30 | noncomputable def metricPullbackForm (g : RiemannianMetric 3 Y) (f : X → Y) (x : X) : |
| 31 | TX x →L[ℝ] TX x →L[ℝ] ℝ := |
| 32 | ((mfderiv (𝓡 3) (𝓡 3) f x).precomp ℝ).comp |
| 33 | ((g.inner (f x)).comp (mfderiv (𝓡 3) (𝓡 3) f x)) |
| 34 | |
| 35 | omit [IsManifold (𝓡 3) ∞ X] in |
| 36 | theorem metricPullbackForm_apply (g : RiemannianMetric 3 Y) (f : X → Y) |
| 37 | (x : X) (v w : TX x) : |
| 38 | metricPullbackForm g f x v w = |
| 39 | g.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x w) := rfl |
| 40 | |
| 41 | omit [IsManifold (𝓡 3) ∞ X] in |
| 42 | theorem metricPullbackForm_nonneg (g : RiemannianMetric 3 Y) (f : X → Y) |
| 43 | (x : X) (v : TX x) : 0 ≤ metricPullbackForm g f x v v := |
| 44 | metric_inner_nonneg g (f x) _ |
| 45 | |
| 46 | set_option backward.isDefEq.respectTransparency false in |
| 47 | theorem metricPullbackForm_coordinates (g : RiemannianMetric 3 Y) (f : X → Y) |
| 48 | {x₀ x : X} |
| 49 | (hx : x ∈ (trivializationAt E TX x₀).baseSet) |
| 50 | (hy : f x ∈ (trivializationAt E TY (f x₀)).baseSet) : |
| 51 | ContinuousLinearMap.inCoordinates E TX (E →L[ℝ] ℝ) (fun z => TX z →L[ℝ] ℝ) |
| 52 | x₀ x x₀ x (metricPullbackForm g f x) = |
| 53 | let A := inTangentCoordinates (𝓡 3) (𝓡 3) id f (mfderiv (𝓡 3) (𝓡 3) f) x₀ x |
| 54 | let B := ContinuousLinearMap.inCoordinates E TY (E →L[ℝ] ℝ) |
| 55 | (fun z => TY z →L[ℝ] ℝ) (f x₀) (f x) (f x₀) (f x) (g.inner (f x)) |
| 56 | (A.precomp ℝ).comp (B.comp A) := by |
| 57 | let ex := trivializationAt E TX x₀ |
| 58 | let ey := trivializationAt E TY (f x₀) |
| 59 | let A := inTangentCoordinates (𝓡 3) (𝓡 3) id f (mfderiv (𝓡 3) (𝓡 3) f) x₀ x |
| 60 | have hcancel (v : E) : ey.symm (f x) (A v) = |
| 61 | mfderiv (𝓡 3) (𝓡 3) f x (ex.symm x v) := by |
| 62 | change ey.symm (f x) (ey.continuousLinearMapAt ℝ (f x) |
| 63 | (mfderiv (𝓡 3) (𝓡 3) f x (ex.symmL ℝ x v))) = _ |
| 64 | rw [← ey.symmL_apply (R := ℝ) hy, |
| 65 | ey.symmL_continuousLinearMapAt (R := ℝ) hy, ex.symmL_apply (R := ℝ) hx] |
| 66 | ext v w |
| 67 | change ContinuousLinearMap.inCoordinates E TX (E →L[ℝ] ℝ) (fun z => TX z →L[ℝ] ℝ) |
| 68 | x₀ x x₀ x (metricPullbackForm g f x) v w = |
| 69 | ContinuousLinearMap.inCoordinates E TY (E →L[ℝ] ℝ) (fun z => TY z →L[ℝ] ℝ) |
| 70 | (f x₀) (f x) (f x₀) (f x) (g.inner (f x)) (A v) (A w) |
| 71 | rw [inCoordinates_apply_eq₂ (E₃ := Bundle.Trivial X ℝ) hx hx (by simp), |
| 72 | inCoordinates_apply_eq₂ (E₃ := Bundle.Trivial Y ℝ) hy hy (by simp)] |
| 73 | dsimp only [ex, ey] at hcancel |
| 74 | simp only [Bundle.Trivial.eq_trivialization, Bundle.Trivial.linearMapAt_trivialization, |
| 75 | LinearMap.id_apply, metricPullbackForm_apply, hcancel] |
| 76 | |
| 77 | set_option backward.isDefEq.respectTransparency false in |
| 78 | theorem metricPullbackForm_contMDiffAt (g : RiemannianMetric 3 Y) |
| 79 | {f : X → Y} {x₀ : X} (hf : ContMDiffAt (𝓡 3) (𝓡 3) ∞ f x₀) : |
| 80 | ContMDiffAt (𝓡 3) ((𝓡 3).prod 𝓘(ℝ, E →L[ℝ] E →L[ℝ] ℝ)) ∞ |
| 81 | (fun x => Bundle.TotalSpace.mk' (E →L[ℝ] E →L[ℝ] ℝ) x (metricPullbackForm g f x)) x₀ := by |
| 82 | rw [contMDiffAt_hom_bundle] |
| 83 | refine ⟨contMDiffAt_id, ?_⟩ |
| 84 | let A := inTangentCoordinates (𝓡 3) (𝓡 3) id f (mfderiv (𝓡 3) (𝓡 3) f) x₀ |
| 85 | let B := fun y => ContinuousLinearMap.inCoordinates E TY (E →L[ℝ] ℝ) |
| 86 | (fun z => TY z →L[ℝ] ℝ) (f x₀) y (f x₀) y (g.inner y) |
| 87 | have hA : ContMDiffAt (𝓡 3) 𝓘(ℝ, E →L[ℝ] E) ∞ A x₀ := hf.mfderiv_const (by simp) |
| 88 | have hB : ContMDiffAt (𝓡 3) 𝓘(ℝ, E →L[ℝ] E →L[ℝ] ℝ) ∞ B (f x₀) := |
| 89 | ((contMDiffAt_hom_bundle _).mp (g.contMDiff (f x₀))).2 |
| 90 | have hform := (hA.clm_precomp (F₃ := ℝ)).clm_comp ((hB.comp x₀ hf).clm_comp hA) |
| 91 | apply hform.congr_of_eventuallyEq |
| 92 | have hx := (trivializationAt E TX x₀).open_baseSet.mem_nhds |
| 93 | (mem_baseSet_trivializationAt E TX x₀) |
| 94 | have hy := hf.continuousAt.preimage_mem_nhds |
| 95 | ((trivializationAt E TY (f x₀)).open_baseSet.mem_nhds |
| 96 | (mem_baseSet_trivializationAt E TY (f x₀))) |
| 97 | filter_upwards [hx, hy] with x hx hy |
| 98 | exact metricPullbackForm_coordinates g f hx hy |
| 99 | |
| 100 | set_option backward.isDefEq.respectTransparency false in |
| 101 | noncomputable def smoothPullbackMetric (g : RiemannianMetric 3 Y) (f : X → Y) |
| 102 | (hf : ContMDiff (𝓡 3) (𝓡 3) ∞ f) |
| 103 | (hD : ∀ x, Function.Bijective (mfderiv (𝓡 3) (𝓡 3) f x)) : |
| 104 | RiemannianMetric 3 X where |
| 105 | inner := metricPullbackForm g f |
| 106 | symm x v w := g.symm (f x) _ _ |
| 107 | pos x v hv := g.pos (f x) _ (by |
| 108 | intro hz |
| 109 | apply hv |
| 110 | apply (hD x).1 |
| 111 | change (mfderiv (𝓡 3) (𝓡 3) f x : E →L[ℝ] E) v = |
| 112 | (mfderiv (𝓡 3) (𝓡 3) f x : E →L[ℝ] E) 0 |
| 113 | rw [map_zero] |
| 114 | exact hz) |
| 115 | isVonNBounded x := by |
| 116 | let D : E →L[ℝ] E := mfderiv (𝓡 3) (𝓡 3) f x |
| 117 | let e : E ≃L[ℝ] E := (LinearEquiv.ofBijective D.toLinearMap (hD x)).toContinuousLinearEquiv |
| 118 | refine ((g.isVonNBounded (f x)).image e.symm.toContinuousLinearMap).subset ?_ |
| 119 | intro v hv |
| 120 | refine ⟨e v, hv, e.symm_apply_apply v⟩ |
| 121 | contMDiff x := metricPullbackForm_contMDiffAt g (hf x) |
| 122 | |
| 123 | theorem smoothPullbackMetric_inner (g : RiemannianMetric 3 Y) (f : X → Y) |
| 124 | (hf : ContMDiff (𝓡 3) (𝓡 3) ∞ f) |
| 125 | (hD : ∀ x, Function.Bijective (mfderiv (𝓡 3) (𝓡 3) f x)) |
| 126 | (x : X) (v w : TX x) : |
| 127 | (smoothPullbackMetric g f hf hD).inner x v w = |
| 128 | g.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x w) := rfl |
| 129 | |
| 130 | end PoincareMT.MetricSurgery |