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.StandardCap.Existence.InitialEstimates.EndCoordinates |
| 2 | |
| 3 | /-! |
| 4 | # Reflection in an exact cylindrical end |
| 5 | |
| 6 | Morgan-Tian Theorem 12.5, p. 297. Compact doubles are glued using |
| 7 | reflection in the supplied cylinder height. The map and its derivative |
| 8 | are computed in the actual end coordinates, where reflection preserves |
| 9 | the literal cylinder metric. This supplies the metric-compatible overlap |
| 10 | for two truncated copies of the given cap. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | namespace PoincareMT.M34 |
| 19 | |
| 20 | /-- Reflection about height s/2 in the fixed cylinder |
| 21 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 22 | def cylinderAxialReflection (s : ℝ) (z : StandardCylinderSpace) : StandardCylinderSpace := |
| 23 | (z.1, s - z.2) |
| 24 | |
| 25 | /-- The cylinder reflection is smooth (Theorem 12.5, p. 297). -/ |
| 26 | theorem cylinderAxialReflection_contMDiff (s : ℝ) : |
| 27 | ContMDiff ((𝓡 2).prod 𝓘(ℝ, ℝ)) ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ |
| 28 | (cylinderAxialReflection s) := |
| 29 | contMDiff_fst.prodMk (contMDiff_const.sub contMDiff_snd) |
| 30 | |
| 31 | set_option backward.isDefEq.respectTransparency false in |
| 32 | /-- Reflection reverses precisely the axial tangent component |
| 33 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 34 | theorem cylinderAxialReflection_mfderiv (s : ℝ) (z : StandardCylinderSpace) |
| 35 | (v : TangentSpace ((𝓡 2).prod 𝓘(ℝ, ℝ)) z) : |
| 36 | mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 37 | (cylinderAxialReflection s) z v = (v.1, -v.2) := by |
| 38 | have hs : MDifferentiableAt ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) |
| 39 | (fun q : StandardCylinderSpace => s - q.2) z := |
| 40 | mdifferentiableAt_const.sub mdifferentiableAt_snd |
| 41 | have hd : mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) |
| 42 | (fun q : StandardCylinderSpace => s - q.2) z = |
| 43 | -mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) Prod.snd z := by |
| 44 | change mvfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 45 | ((fun _ : StandardCylinderSpace => s) - Prod.snd) z = |
| 46 | -mvfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) Prod.snd z |
| 47 | rw [mvfderiv_sub mdifferentiableAt_const mdifferentiableAt_snd, |
| 48 | mvfderiv_const, zero_sub] |
| 49 | erw [cylinderAxialReflection, mfderiv_prodMk mdifferentiableAt_fst hs, |
| 50 | hd, mfderiv_fst, mfderiv_snd] |
| 51 | rfl |
| 52 | |
| 53 | /-- Reflection preserves the literal cylinder metric at every model |
| 54 | time (Theorem 12.5 compact-double construction, p. 297). -/ |
| 55 | theorem cylinderAxialReflection_metric (s t : ℝ) (z : StandardCylinderSpace) |
| 56 | (v w : TangentSpace ((𝓡 2).prod 𝓘(ℝ, ℝ)) z) : |
| 57 | standardCylinderInner t (cylinderAxialReflection s z) (v.1, -v.2) (w.1, -w.2) = |
| 58 | standardCylinderInner t z v w := by |
| 59 | unfold standardCylinderInner cylinderAxialReflection |
| 60 | dsimp only |
| 61 | rw [neg_mul_neg] |
| 62 | |
| 63 | variable {g : RiemannianMetric 3 StandardCapSpace} |
| 64 | |
| 65 | /-- Reflection expressed in the actual supplied cap coordinates |
| 66 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 67 | def endAxialReflection (e : StandardCylindricalEnd g) (s : ℝ) |
| 68 | (x : StandardCapSpace) : StandardCapSpace := |
| 69 | e.coordinate (cylinderAxialReflection s (e.inverse x)) |
| 70 | |
| 71 | /-- The reflected point has its prescribed end coordinates |
| 72 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 73 | theorem endAxialReflection_coordinate (e : StandardCylindricalEnd g) (s : ℝ) |
| 74 | {z : StandardCylinderSpace} (hz : 0 ≤ z.2) : |
| 75 | endAxialReflection e s (e.coordinate z) = e.coordinate (z.1, s - z.2) := by |
| 76 | rw [endAxialReflection, e.coordinate_left_inverse ⟨mem_univ _, hz⟩] |
| 77 | rfl |
| 78 | |
| 79 | /-- Reflection is an involution wherever both heights are nonnegative |
| 80 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 81 | theorem endAxialReflection_involutive (e : StandardCylindricalEnd g) (s : ℝ) |
| 82 | {z : StandardCylinderSpace} (hz : 0 ≤ z.2) (hsz : 0 ≤ s - z.2) : |
| 83 | endAxialReflection e s (endAxialReflection e s (e.coordinate z)) = e.coordinate z := by |
| 84 | rw [endAxialReflection_coordinate e s hz, endAxialReflection_coordinate e s hsz] |
| 85 | simp |
| 86 | |
| 87 | /-- The actual end reflection is smooth at points with two positive |
| 88 | heights (Theorem 12.5 compact-double construction, p. 297). -/ |
| 89 | theorem endAxialReflection_contMDiffAt (e : StandardCylindricalEnd g) (s : ℝ) |
| 90 | {z : StandardCylinderSpace} (hz : 0 < z.2) (hsz : 0 < s - z.2) : |
| 91 | ContMDiffAt (𝓡 3) (𝓡 3) ∞ (endAxialReflection e s) (e.coordinate z) := by |
| 92 | have hleft : e.inverse (e.coordinate z) = z := |
| 93 | e.coordinate_left_inverse ⟨mem_univ _, hz.le⟩ |
| 94 | have hc : ContMDiffAt ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) ∞ e.coordinate |
| 95 | (cylinderAxialReflection s (e.inverse (e.coordinate z))) := by |
| 96 | rw [hleft] |
| 97 | exact end_coordinate_contMDiffAt e hsz |
| 98 | have ht : ContMDiffAt ((𝓡 2).prod 𝓘(ℝ, ℝ)) ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ |
| 99 | (cylinderAxialReflection s) (e.inverse (e.coordinate z)) := |
| 100 | (cylinderAxialReflection_contMDiff s).contMDiffAt |
| 101 | exact hc.comp (e.coordinate z) (ht.comp (e.coordinate z) (end_inverse_contMDiffAt e hz)) |
| 102 | |
| 103 | set_option backward.isDefEq.respectTransparency false in |
| 104 | /-- The actual differential of end reflection reverses the axial part |
| 105 | between the inverse and direct coordinate derivatives (Theorem 12.5, p. 297). -/ |
| 106 | theorem endAxialReflection_mfderiv (e : StandardCylindricalEnd g) (s : ℝ) |
| 107 | {z : StandardCylinderSpace} (hz : 0 < z.2) (hsz : 0 < s - z.2) |
| 108 | (u : TangentSpace (𝓡 3) (e.coordinate z)) : |
| 109 | let v := mfderiv (𝓡 3) ((𝓡 2).prod 𝓘(ℝ, ℝ)) e.inverse (e.coordinate z) u |
| 110 | mfderiv (𝓡 3) (𝓡 3) (endAxialReflection e s) (e.coordinate z) u = |
| 111 | mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) e.coordinate (z.1, s - z.2) (v.1, -v.2) := by |
| 112 | dsimp only |
| 113 | have hleft : e.inverse (e.coordinate z) = z := |
| 114 | e.coordinate_left_inverse ⟨mem_univ _, hz.le⟩ |
| 115 | have hi := (end_inverse_contMDiffAt e hz).mdifferentiableAt (by simp) |
| 116 | have hs := (cylinderAxialReflection_contMDiff s).mdifferentiable (by simp) |
| 117 | have hc : MDifferentiableAt ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) e.coordinate |
| 118 | (cylinderAxialReflection s (e.inverse (e.coordinate z))) := by |
| 119 | rw [hleft] |
| 120 | exact (end_coordinate_contMDiffAt e hsz).mdifferentiableAt (by simp) |
| 121 | change mfderiv (𝓡 3) (𝓡 3) |
| 122 | (e.coordinate ∘ (cylinderAxialReflection s ∘ e.inverse)) (e.coordinate z) u = _ |
| 123 | have ht : MDifferentiableAt (𝓡 3) ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 124 | (cylinderAxialReflection s ∘ e.inverse) (e.coordinate z) := |
| 125 | (hs (e.inverse (e.coordinate z))).comp (e.coordinate z) hi |
| 126 | erw [mfderiv_comp (e.coordinate z) hc ht, |
| 127 | mfderiv_comp (e.coordinate z) (hs (e.inverse (e.coordinate z))) hi] |
| 128 | change mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) e.coordinate |
| 129 | (cylinderAxialReflection s (e.inverse (e.coordinate z))) |
| 130 | (mfderiv ((𝓡 2).prod 𝓘(ℝ, ℝ)) ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 131 | (cylinderAxialReflection s) (e.inverse (e.coordinate z)) |
| 132 | (mfderiv (𝓡 3) ((𝓡 2).prod 𝓘(ℝ, ℝ)) e.inverse (e.coordinate z) u)) = _ |
| 133 | erw [cylinderAxialReflection_mfderiv] |
| 134 | congr 2 |
| 135 | exact congrArg (cylinderAxialReflection s) hleft |
| 136 | |
| 137 | set_option backward.isDefEq.respectTransparency false in |
| 138 | /-- End reflection preserves the actual supplied metric on its valid |
| 139 | positive-height overlap (Theorem 12.5 compact-double construction, p. 297). -/ |
| 140 | theorem endAxialReflection_metric (e : StandardCylindricalEnd g) (s : ℝ) |
| 141 | {z : StandardCylinderSpace} (hz : 0 < z.2) (hsz : 0 < s - z.2) |
| 142 | (u v : TangentSpace (𝓡 3) (e.coordinate z)) : |
| 143 | g.inner (e.coordinate z) u v = |
| 144 | g.inner (endAxialReflection e s (e.coordinate z)) |
| 145 | (mfderiv (𝓡 3) (𝓡 3) (endAxialReflection e s) (e.coordinate z) u) |
| 146 | (mfderiv (𝓡 3) (𝓡 3) (endAxialReflection e s) (e.coordinate z) v) := by |
| 147 | erw [endAxialReflection_coordinate e s hz.le, |
| 148 | endAxialReflection_mfderiv e s hz hsz, endAxialReflection_mfderiv e s hz hsz, |
| 149 | e.metric_pullback _ hsz.le, end_inverse_metric e hz] |
| 150 | exact (cylinderAxialReflection_metric s 0 z _ _).symm |
| 151 | |
| 152 | end PoincareMT.M34 |