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.Compactness.GeometricLimit.Overlap.Smooth |
| 2 | import PoincareLib.Geometry.Riemannian.Coordinates.Coefficients |
| 3 | |
| 4 | /-! |
| 5 | # Source metric identities on local overlaps |
| 6 | |
| 7 | The coordinate transition is the actual inverse of one source chart composed |
| 8 | with another. Its pullback identity follows from this local equality and the |
| 9 | chain rule for the retained source metric. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | open Set Filter Metric Poincare.Gluing |
| 15 | open scoped Topology Manifold ContDiff |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | variable {ι : Type*} {n : ℕ} |
| 20 | (U : ι → Set (EuclideanSpace ℝ (Fin n))) (hU : ∀ i, IsOpen (U i)) |
| 21 | [∀ i, Nonempty (Piece U i)] |
| 22 | |
| 23 | noncomputable def chartParametrization {M : Type*} {i : ι} (e : Piece U i → M) : |
| 24 | EuclideanSpace ℝ (Fin n) → M := |
| 25 | e ∘ (hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm |
| 26 | |
| 27 | @[simp] theorem chartParametrization_apply {M : Type*} {i : ι} |
| 28 | (e : Piece U i → M) (x : Piece U i) : chartParametrization U hU e x = e x := by |
| 29 | simp [chartParametrization, Topology.IsOpenEmbedding.toOpenPartialHomeomorph_left_inv] |
| 30 | |
| 31 | variable {M : Type*} [TopologicalSpace M] |
| 32 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 33 | |
| 34 | omit [IsManifold (𝓡 n) ∞ M] in |
| 35 | theorem contMDiffOn_chartParametrization {i : ι} {e : Piece U i → M} |
| 36 | (he : letI := (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 37 | ContMDiff (𝓡 n) (𝓡 n) ∞ e) : |
| 38 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ (chartParametrization U hU e) (U i) := by |
| 39 | let := (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 40 | have hinv := contMDiffOn_isOpenEmbedding_symm (I := 𝓡 n) (n := ∞) |
| 41 | (hU i).isOpenEmbedding_subtypeVal |
| 42 | exact he.comp_contMDiffOn (hinv.mono (by rintro x hx; exact ⟨⟨x, hx⟩, rfl⟩)) |
| 43 | |
| 44 | theorem source_transition_pullbackCoefficients |
| 45 | (g : RiemannianMetric n M) {i j : ι} |
| 46 | {ei : Piece U i → M} {ej : Piece U j → M} |
| 47 | (hei : letI := (hU i).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 48 | ContMDiff (𝓡 n) (𝓡 n) ∞ ei) |
| 49 | (hej : letI := (hU j).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 50 | IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ ej) |
| 51 | (hinj : Function.Injective ej) (hopen : IsOpen (range ej)) |
| 52 | (x : Piece U i) (hx : ei x ∈ range ej) |
| 53 | (v w : EuclideanSpace ℝ (Fin n)) : |
| 54 | let f := coordinateRepresentative U hU (fun y => Function.invFun ej (ei y)) |
| 55 | g.pullbackCoefficients (chartParametrization U hU ej) (f x) |
| 56 | (fderiv ℝ f x v) (fderiv ℝ f x w) = |
| 57 | g.pullbackCoefficients (chartParametrization U hU ei) x v w := by |
| 58 | let : ∀ l, ChartedSpace (EuclideanSpace ℝ (Fin n)) (Piece U l) := |
| 59 | fun l => (hU l).isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 60 | let : ∀ l, IsManifold (𝓡 n) ∞ (Piece U l) := |
| 61 | fun l => (hU l).isOpenEmbedding_subtypeVal.isManifold_singleton |
| 62 | let f := coordinateRepresentative U hU (fun y => Function.invFun ej (ei y)) |
| 63 | let p := chartParametrization U hU ei |
| 64 | let q := chartParametrization U hU ej |
| 65 | have hp : ContMDiffAt (𝓡 n) (𝓡 n) ∞ p x := |
| 66 | (contMDiffOn_chartParametrization U hU hei).contMDiffAt ((hU i).mem_nhds x.property) |
| 67 | have hx' : p x ∈ range ej := by simpa [p] using hx |
| 68 | have hnear : ∀ᶠ y in 𝓝 (x : EuclideanSpace ℝ (Fin n)), p y ∈ range ej := |
| 69 | hp.continuousAt.preimage_mem_nhds (hopen.mem_nhds hx') |
| 70 | have hf : ContDiffAt ℝ ∞ f x := by |
| 71 | have hi := (contMDiffOn_invFun_of_localDiffeomorph hej hinj).contMDiffAt |
| 72 | (hopen.mem_nhds hx') |
| 73 | have hv := contMDiff_isOpenEmbedding (I := 𝓡 n) (n := ∞) |
| 74 | (hU j).isOpenEmbedding_subtypeVal |
| 75 | exact ((hv _).comp _ (hi.comp _ hp)).contDiffAt |
| 76 | have hfx : f x ∈ U j := by |
| 77 | change Subtype.val (Function.invFun ej (ei _)) ∈ U j |
| 78 | exact (Function.invFun ej (ei _)).property |
| 79 | have hq : ContMDiffAt (𝓡 n) (𝓡 n) ∞ q (f x) := |
| 80 | (contMDiffOn_chartParametrization U hU hej.contMDiff).contMDiffAt ((hU j).mem_nhds hfx) |
| 81 | have heq : q ∘ f =ᶠ[𝓝 (x : EuclideanSpace ℝ (Fin n))] p := by |
| 82 | filter_upwards [hnear] with y hy |
| 83 | change chartParametrization U hU ej (Subtype.val (Function.invFun ej (p y))) = p y |
| 84 | rw [chartParametrization_apply, Function.invFun_eq hy] |
| 85 | have hd := mfderiv_comp (x : EuclideanSpace ℝ (Fin n)) |
| 86 | (hq.mdifferentiableAt (by simp)) (hf.differentiableAt (by simp)).mdifferentiableAt |
| 87 | rw [heq.mfderiv_eq, mfderiv_eq_fderiv] at hd |
| 88 | change g.inner (q (f x)) |
| 89 | (mfderiv (𝓡 n) (𝓡 n) q (f x) (fderiv ℝ f x v)) |
| 90 | (mfderiv (𝓡 n) (𝓡 n) q (f x) (fderiv ℝ f x w)) = |
| 91 | g.inner (p x) (mfderiv (𝓡 n) (𝓡 n) p x v) (mfderiv (𝓡 n) (𝓡 n) p x w) |
| 92 | have hdv := congrArg (fun A => A v) hd |
| 93 | have hdw := congrArg (fun A => A w) hd |
| 94 | have hbase := congrArg (fun z : M => g.inner z |
| 95 | (mfderiv (𝓡 n) (𝓡 n) q (f x) (fderiv ℝ f x v)) |
| 96 | (mfderiv (𝓡 n) (𝓡 n) q (f x) (fderiv ℝ f x w))) heq.self_of_nhds |
| 97 | exact hbase.trans (congrArg₂ (fun a b : EuclideanSpace ℝ (Fin n) => |
| 98 | g.inner (p x) a b) hdv.symm hdw.symm) |
| 99 | |
| 100 | end PoincareMT.ChartDistance |