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.Generalized.ReducedGeometry.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.ProjectionCoordinates |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Local.MovingLinearMap |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationCoordinates |
| 5 | |
| 6 | /-! |
| 7 | # Commutation along an actual smooth surface |
| 8 | |
| 9 | Morgan-Tian Lemma 6.4, pp. 107-108, for the generalized horizontal |
| 10 | connection of Definition 3.36, pp. 60-61. M08's mixed coordinate |
| 11 | derivative theorem and projected torsion prove commutation for the |
| 12 | actual pullback derivatives. No immersion of the surface is required. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- The two slice curves have definitionally identical fibers at their intersection. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter Bundle |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M14 |
| 25 | |
| 26 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 27 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 28 | |
| 29 | /-- Horizontal projection of the first actual partial tangent of a |
| 30 | surface, in Lemma 6.4, pp. 107-108. -/ |
| 31 | noncomputable def surfaceHorizontalFst (α : ℝ × ℝ → G.Point) (s u : ℝ) : |
| 32 | G.Horizontal (α (s, u)) := |
| 33 | G.spacetime.horizontalProjection (α (s, u)) |
| 34 | (mfderiv 𝓘(ℝ) (spacetimeModel n) (fun r => α (r, u)) s (1 : ℝ)) |
| 35 | |
| 36 | /-- Horizontal projection of the second actual partial tangent of a |
| 37 | surface, in Lemma 6.4, pp. 107-108. -/ |
| 38 | noncomputable def surfaceHorizontalSnd (α : ℝ × ℝ → G.Point) (s u : ℝ) : |
| 39 | G.Horizontal (α (s, u)) := |
| 40 | G.spacetime.horizontalProjection (α (s, u)) |
| 41 | (mfderiv 𝓘(ℝ) (spacetimeModel n) (fun r => α (s, r)) u (1 : ℝ)) |
| 42 | |
| 43 | set_option maxHeartbeats 2000000 in |
| 44 | -- Two dependent slice derivatives, two bundle charts and their coordinate chain rules are compared. |
| 45 | /-- The actual horizontal pullback derivatives of the two surface |
| 46 | partial fields commute. Parameter derivatives are taken at interior |
| 47 | points of their sets; the spacetime may have a boundary. This is the |
| 48 | torsion step in Lemma 6.4, pp. 107-108. -/ |
| 49 | theorem horizontalCovariantDerivative_surface_commute |
| 50 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 51 | {α : ℝ × ℝ → G.Point} {Ω : Set (ℝ × ℝ)} (hΩ : IsOpen Ω) |
| 52 | (hα : ContMDiffOn ((𝓘(ℝ)).prod 𝓘(ℝ)) (spacetimeModel n) ∞ α Ω) |
| 53 | {s u : ℝ} (hp : (s, u) ∈ Ω) {J K : Set ℝ} |
| 54 | (hJ : J ∈ 𝓝 s) (hK : K ∈ 𝓝 u) |
| 55 | (ES : M14PullbackExtension G (fun r => α (r, u)) J |
| 56 | (fun r => surfaceHorizontalSnd α r u)) |
| 57 | (EU : M14PullbackExtension G (fun r => α (s, r)) K |
| 58 | (fun r => surfaceHorizontalFst α s r)) : |
| 59 | M14HorizontalCovariantDerivative G (fun r => α (r, u)) J |
| 60 | (fun r => surfaceHorizontalSnd α r u) ES s = |
| 61 | M14HorizontalCovariantDerivative G (fun r => α (s, r)) K |
| 62 | (fun r => surfaceHorizontalFst α s r) EU u := by |
| 63 | let x := α (s, u) |
| 64 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) G.Horizontal x |
| 65 | let c := extChartAt (spacetimeModel n) x |
| 66 | let O := Ω ∩ α ⁻¹' (c.source ∩ e.baseSet) |
| 67 | let z := c ∘ α |
| 68 | let a := fun r => deriv (fun v => z (r, v)) u |
| 69 | let b := fun v => deriv (fun r => z (r, v)) s |
| 70 | have hO : IsOpen O := hα.continuousOn.isOpen_inter_preimage hΩ |
| 71 | ((isOpen_extChartAt_source (I := spacetimeModel n) x).inter e.open_baseSet) |
| 72 | have hx : x ∈ c.source := mem_extChartAt_source x |
| 73 | have he : x ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt _ _ _ |
| 74 | have hpO : (s, u) ∈ O := ⟨hp, hx, he⟩ |
| 75 | have hA (q : ℝ × ℝ) (hq : q ∈ O) : |
| 76 | MDifferentiableAt ((𝓘(ℝ)).prod 𝓘(ℝ)) (spacetimeModel n) α q := |
| 77 | (hα.contMDiffAt (hΩ.mem_nhds hq.1)).mdifferentiableAt (by simp) |
| 78 | have hz : ContDiffOn ℝ ∞ z O := by |
| 79 | intro q hq |
| 80 | have hc : ContMDiffAt (spacetimeModel n) 𝓘(ℝ, SpacetimeModelVector n) ∞ c (α q) := |
| 81 | contMDiffAt_extChartAt' (I := spacetimeModel n) (n := ∞) |
| 82 | (by simpa only [c, extChartAt_source] using hq.2.1) |
| 83 | have h := hc.comp q (hα.contMDiffAt (hΩ.mem_nhds hq.1)) |
| 84 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 85 | exact h.contDiffAt.contDiffWithinAt |
| 86 | obtain ⟨k, hb, ha⟩ := M08.coordinate_mixed_hasDerivAt hO z hz hpO |
| 87 | have hsA : MDifferentiableAt 𝓘(ℝ) (spacetimeModel n) (fun r => α (r, u)) s := |
| 88 | (hA _ hpO).comp s (mdifferentiableAt_id.prodMk mdifferentiableAt_const) |
| 89 | have huA : MDifferentiableAt 𝓘(ℝ) (spacetimeModel n) (fun v => α (s, v)) u := |
| 90 | (hA _ hpO).comp u (mdifferentiableAt_const.prodMk mdifferentiableAt_id) |
| 91 | have hC := (horizontalProjectionInCoordinates_contMDiffAt e hx he).mdifferentiableAt |
| 92 | (by simp) |
| 93 | have hsderiv := moving_linearMap_comp_hasDerivAt hC hsA ha |
| 94 | have huderiv := moving_linearMap_comp_hasDerivAt hC huA hb |
| 95 | have hnearS : ∀ᶠ r in 𝓝 s, (r, u) ∈ O := |
| 96 | (continuous_id.prodMk continuous_const).continuousAt.preimage_mem_nhds (hO.mem_nhds hpO) |
| 97 | have hnearU : ∀ᶠ v in 𝓝 u, (s, v) ∈ O := |
| 98 | (continuous_const.prodMk continuous_id).continuousAt.preimage_mem_nhds (hO.mem_nhds hpO) |
| 99 | have hsfield : (fun r => e.continuousLinearMapAt ℝ (α (r, u)) |
| 100 | (surfaceHorizontalSnd α r u)) =ᶠ[𝓝 s] |
| 101 | (fun r => horizontalProjectionInCoordinates e x (α (r, u)) (a r)) := by |
| 102 | filter_upwards [hnearS] with r hr |
| 103 | exact (horizontalProjectionInCoordinates_curve_deriv e hr.2.1 |
| 104 | ((hA _ hr).comp u (mdifferentiableAt_const.prodMk mdifferentiableAt_id))).symm |
| 105 | have hufield : (fun v => e.continuousLinearMapAt ℝ (α (s, v)) |
| 106 | (surfaceHorizontalFst α s v)) =ᶠ[𝓝 u] |
| 107 | (fun v => horizontalProjectionInCoordinates e x (α (s, v)) (b v)) := by |
| 108 | filter_upwards [hnearU] with v hv |
| 109 | exact (horizontalProjectionInCoordinates_curve_deriv e hv.2.1 |
| 110 | ((hA _ hv).comp s (mdifferentiableAt_id.prodMk mdifferentiableAt_const))).symm |
| 111 | have hscoord := horizontalCovariantDerivative_coordinates e ES (mem_of_mem_nhds hJ) he |
| 112 | (uniqueDiffWithinAt_of_mem_nhds hJ) hsA.mdifferentiableWithinAt |
| 113 | have hucoord := horizontalCovariantDerivative_coordinates e EU (mem_of_mem_nhds hK) he |
| 114 | (uniqueDiffWithinAt_of_mem_nhds hK) huA.mdifferentiableWithinAt |
| 115 | rw [(hsderiv.congr_of_eventuallyEq hsfield).hasDerivWithinAt.derivWithin |
| 116 | (uniqueDiffWithinAt_of_mem_nhds hJ)] at hscoord |
| 117 | rw [(huderiv.congr_of_eventuallyEq hufield).hasDerivWithinAt.derivWithin |
| 118 | (uniqueDiffWithinAt_of_mem_nhds hK)] at hucoord |
| 119 | have hsvel : VectorField.chartFrame (spacetimeModel n) x (b u) x = |
| 120 | mfderiv 𝓘(ℝ) (spacetimeModel n) (fun r => α (r, u)) s (1 : ℝ) := |
| 121 | VectorField.chartFrame_curve_deriv (spacetimeModel n) |
| 122 | (by simpa only [c, extChartAt_source] using hx) hsA |
| 123 | have huvel : VectorField.chartFrame (spacetimeModel n) x (a s) x = |
| 124 | mfderiv 𝓘(ℝ) (spacetimeModel n) (fun v => α (s, v)) u (1 : ℝ) := |
| 125 | VectorField.chartFrame_curve_deriv (spacetimeModel n) |
| 126 | (by simpa only [c, extChartAt_source] using hx) huA |
| 127 | have hsval : surfaceHorizontalSnd α s u = horizontalChartFrame x (a s) x := |
| 128 | congrArg (G.spacetime.horizontalProjection x) huvel.symm |
| 129 | have huval : surfaceHorizontalFst α s u = horizontalChartFrame x (b u) x := |
| 130 | congrArg (G.spacetime.horizontalProjection x) hsvel.symm |
| 131 | have ht := horizontalProjectionInCoordinates_torsion e hCoordinates hx he (a s) (b u) |
| 132 | apply (e.continuousLinearEquivAt ℝ x he).injective |
| 133 | simp only [e.coe_continuousLinearEquivAt_eq he] |
| 134 | rw [hscoord, hucoord] |
| 135 | simp only [mfderivWithin_of_mem_nhds hJ, mfderivWithin_of_mem_nhds hK] |
| 136 | rw [hsval, huval, ← hsvel, ← huvel] |
| 137 | have hsum := congrArg (fun v => v + horizontalProjectionInCoordinates e x x k) ht |
| 138 | convert! hsum using 1 <;> abel |
| 139 | |
| 140 | end PoincareMT.M14 |