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.Paths.SquareRoot.Families.SquareGaugeEndpoints |
| 2 | |
| 3 | /-! |
| 4 | # Constructing the actual smooth square-root representative |
| 5 | |
| 6 | Morgan-Tian Definition 6.7 and Lemma 6.8, pp. 108-109. Buffered |
| 7 | closed gauge segments prove smoothness of the actual square curve on |
| 8 | its whole closed interval. Its projected within derivative gives all |
| 9 | fields of the frozen square-root path, including the endpoint clock. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | -- The actual scalar and spacetime tangent fibers retain their frozen model identifications. |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T τ₁ τ₂ : ℝ} {x y : G.Point} (p : M14BackwardPath G T τ₁ τ₂ x y) |
| 26 | |
| 27 | /-- Every actual Euler path is smooth in square time on the entire |
| 28 | closed square interval, including initial time zero, Lemma 6.8, pp. 108-109. -/ |
| 29 | theorem squarePath_contMDiffOn_of_euler |
| 30 | (hCoordinates : M12MetricPredecessors.{0} n) (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 31 | (E : M14PullbackExtension G p.curve (Ioo τ₁ τ₂) p.horizontal_velocity) |
| 32 | (heuler : M14EulerEquation G p E) : |
| 33 | ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun s => p.curve (s ^ 2)) |
| 34 | (M14SqrtParameterInterval τ₁ τ₂) := by |
| 35 | let A := Real.sqrt τ₁ |
| 36 | let B := Real.sqrt τ₂ |
| 37 | let C := Icc A B |
| 38 | let γ := fun s => p.curve (s ^ 2) |
| 39 | have hAB : A < B := Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt |
| 40 | have hγ : ContinuousOn γ C := squarePath_continuousOn p |
| 41 | intro s hs |
| 42 | obtain ⟨b, U, lift, hU, hsU, hlift, hright, _⟩ := exists_smooth_gauge_lift G (γ s) |
| 43 | have hnear : γ ⁻¹' U ∈ 𝓝[C] s := |
| 44 | (hγ s hs).preimage_mem_nhdsWithin (hU.mem_nhds hsU) |
| 45 | obtain ⟨N, hN, hsrcN⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp hnear |
| 46 | obtain ⟨l, r, ⟨hls, hsr⟩, hlr⟩ := mem_nhds_iff_exists_Ioo_subset.mp hN |
| 47 | let l' := (l + s) / 2 |
| 48 | let r' := (s + r) / 2 |
| 49 | let c := max A l' |
| 50 | let d := min B r' |
| 51 | have hll : l < l' := by dsimp only [l']; linarith |
| 52 | have hls' : l' < s := by dsimp only [l']; linarith |
| 53 | have hsr' : s < r' := by dsimp only [r']; linarith |
| 54 | have hrr : r' < r := by dsimp only [r']; linarith |
| 55 | have hcd : c < d := max_lt |
| 56 | (lt_min hAB (hs.1.trans_lt hsr')) |
| 57 | (lt_min (hls'.trans_le hs.2) (hls'.trans hsr')) |
| 58 | have hsub : Icc c d ⊆ C := Icc_subset_Icc (le_max_left _ _) (min_le_left _ _) |
| 59 | have hsrc : ∀ t ∈ Icc c d, γ t ∈ U := by |
| 60 | intro t ht |
| 61 | exact hsrcN ⟨hlr ⟨hll.trans_le ((le_max_right _ _).trans ht.1), |
| 62 | (ht.2.trans (min_le_right _ _)).trans_lt hrr⟩, hsub ht⟩ |
| 63 | have hlocal := squareGauge_curve_contMDiffOn p b lift hCoordinates hM12 E heuler |
| 64 | hU hlift hright hcd (le_max_left _ _) (min_le_left _ _) hsrc |
| 65 | have hsLocal : s ∈ Icc c d := ⟨max_le hs.1 hls'.le, le_min hs.2 hsr'.le⟩ |
| 66 | have hLocalNear : Icc c d ∈ 𝓝[C] s := by |
| 67 | apply mem_of_superset (inter_mem self_mem_nhdsWithin |
| 68 | (mem_nhdsWithin_of_mem_nhds (Ioo_mem_nhds hls' hsr'))) |
| 69 | intro t ht |
| 70 | exact ⟨max_le ht.1.1 ht.2.1.le, le_min ht.1.2 ht.2.2.le⟩ |
| 71 | exact (hlocal s hsLocal).mono_of_mem_nhdsWithin hLocalNear |
| 72 | |
| 73 | /-- The actual smooth square curve has the required clock decomposition |
| 74 | of its within tangent at every closed point, Lemma 6.8, pp. 108-109. -/ |
| 75 | theorem squarePath_within_velocity_decomposition |
| 76 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun s => p.curve (s ^ 2)) |
| 77 | (M14SqrtParameterInterval τ₁ τ₂)) {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 78 | mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => p.curve (r ^ 2)) |
| 79 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ) = |
| 80 | -(2 * s) • G.spacetime.timeVector (p.curve (s ^ 2)) + |
| 81 | (projectedCurveVelocityWithin G (fun r => p.curve (r ^ 2)) |
| 82 | (M14SqrtParameterInterval τ₁ τ₂) s).val := by |
| 83 | let γ := fun r => p.curve (r ^ 2) |
| 84 | let C := M14SqrtParameterInterval τ₁ τ₂ |
| 85 | have htime : ContMDiff (spacetimeModel n) 𝓘(ℝ) ∞ G.spacetime.timeFunction := |
| 86 | G.spacetime.time_smooth |
| 87 | have ht := (htime.mdifferentiable (by simp) (γ s)).hasMFDerivAt.comp_hasMFDerivWithinAt s |
| 88 | ((hγ s hs).mdifferentiableWithinAt (by simp)).hasMFDerivWithinAt |
| 89 | have hd := ht.hasFDerivWithinAt.hasDerivWithinAt |
| 90 | have hc : HasDerivWithinAt (fun r => G.spacetime.timeFunction (γ r)) (-(2 * s)) C s := by |
| 91 | have hpoly : HasDerivAt (fun r : ℝ => T - r ^ 2) (-(2 * s)) s := by |
| 92 | convert! (hasDerivAt_const s T).sub (hasDerivAt_pow 2 s) using 1 |
| 93 | simp |
| 94 | exact hpoly.hasDerivWithinAt.congr_of_mem |
| 95 | (fun r hr => p.curve_time _ (squarePath_parameter_mem p hr)) hs |
| 96 | have hC := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) s hs |
| 97 | have hclock := (hd.derivWithin hC).symm.trans (hc.derivWithin hC) |
| 98 | let v := mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) γ C s (1 : ℝ) |
| 99 | change v = -(2 * s) • G.spacetime.timeVector (γ s) + |
| 100 | (G.spacetime.horizontalProjection (γ s) v).val |
| 101 | rw [G.spacetime.horizontalProjection_eq] |
| 102 | change v = -(2 * s) • G.spacetime.timeVector (γ s) + |
| 103 | (v - (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (γ s) v) • |
| 104 | G.spacetime.timeVector (γ s)) |
| 105 | rw [show (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (γ s) v) = |
| 106 | -(2 * s) from hclock, neg_smul, sub_neg_eq_add] |
| 107 | abel |
| 108 | |
| 109 | /-- The actual smooth square-root representative of every supplied |
| 110 | Euler path, with recovered endpoint velocities, Lemma 6.8, pp. 108-109. -/ |
| 111 | noncomputable def squareRootPathOfEuler |
| 112 | (hCoordinates : M12MetricPredecessors.{0} n) (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 113 | (E : M14PullbackExtension G p.curve (Ioo τ₁ τ₂) p.horizontal_velocity) |
| 114 | (heuler : M14EulerEquation G p E) : M14SquareRootPath G p where |
| 115 | curve s := p.curve (s ^ 2) |
| 116 | domain := M14SqrtParameterInterval τ₁ τ₂ |
| 117 | interval_subset := Subset.rfl |
| 118 | smooth := squarePath_contMDiffOn_of_euler p hCoordinates hM12 E heuler |
| 119 | agrees _ _ := rfl |
| 120 | curve_time s hs := p.curve_time _ (squarePath_parameter_mem p hs) |
| 121 | horizontal_velocity := projectedCurveVelocityWithin G (fun s => p.curve (s ^ 2)) |
| 122 | (M14SqrtParameterInterval τ₁ τ₂) |
| 123 | horizontal_agrees s hs := by |
| 124 | change projectedCurveVelocityWithin G (fun r => p.curve (r ^ 2)) |
| 125 | (M14SqrtParameterInterval τ₁ τ₂) s = (2 * s) • p.horizontal_velocity (s ^ 2) |
| 126 | unfold projectedCurveVelocityWithin |
| 127 | rw [mfderivWithin_of_mem_nhds (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n) |
| 128 | (show M14SqrtParameterInterval τ₁ τ₂ ∈ 𝓝 s from Icc_mem_nhds hs.1 hs.2)] |
| 129 | exact squarePath_projectedVelocity p hs |
| 130 | derivative_eq s hs := squarePath_within_velocity_decomposition p |
| 131 | (squarePath_contMDiffOn_of_euler p hCoordinates hM12 E heuler) hs |
| 132 | |
| 133 | end PoincareMT.M14 |