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.Construction.Basic.EndReflection |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Construction.Basic.EndTruncation |
| 3 | |
| 4 | /-! |
| 5 | # The reflected overlap collar for a compact double |
| 6 | |
| 7 | Morgan-Tian Theorem 12.5, p. 297. Two truncations at height L+1 are |
| 8 | identified on the collar (L-1,L+1) by reflection about L. The transition |
| 9 | graph is the restriction of a compact closed-strip graph. Its endpoint |
| 10 | pairs leave one of the two truncations, so the restricted graph is closed. |
| 11 | See the independent compact-double requirements review. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff |
| 18 | |
| 19 | namespace PoincareMT.M34 |
| 20 | |
| 21 | variable {g : RiemannianMetric 3 StandardCapSpace} |
| 22 | |
| 23 | /-- The open collar used to glue two cap copies at height L |
| 24 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 25 | def endDoubleCollar (e : StandardCylindricalEnd g) (L : ℝ) : Set StandardCapSpace := |
| 26 | e.coordinate '' (univ ×ˢ Ioo (L - 1) (L + 1)) |
| 27 | |
| 28 | /-- The double collar is open when its whole height interval is positive |
| 29 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 30 | theorem endDoubleCollar_isOpen (e : StandardCylindricalEnd g) |
| 31 | {L : ℝ} (hL : 1 < L) : IsOpen (endDoubleCollar e L) := by |
| 32 | apply end_isOpen_coordinate_image e (isOpen_univ.prod isOpen_Ioo) |
| 33 | intro z hz |
| 34 | have hh := hz.2.1 |
| 35 | linarith |
| 36 | |
| 37 | /-- Each collar lies inside the corresponding open cap piece |
| 38 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 39 | theorem endDoubleCollar_subset_truncation (e : StandardCylindricalEnd g) |
| 40 | {L : ℝ} (hL : 1 < L) : endDoubleCollar e L ⊆ endTruncation e (L + 1) := by |
| 41 | rintro _ ⟨z, hz, rfl⟩ |
| 42 | have hzpos : 0 ≤ z.2 := by linarith [hz.2.1] |
| 43 | exact (endTruncation_coordinate_iff e (by linarith) hzpos).mpr hz.2.2 |
| 44 | |
| 45 | /-- Reflection about L maps the overlap collar to itself |
| 46 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 47 | theorem endAxialReflection_maps_collar (e : StandardCylindricalEnd g) |
| 48 | {L : ℝ} (hL : 1 < L) : |
| 49 | MapsTo (endAxialReflection e (2 * L)) (endDoubleCollar e L) (endDoubleCollar e L) := by |
| 50 | rintro _ ⟨z, hz, rfl⟩ |
| 51 | rw [endAxialReflection_coordinate e (2 * L) (by linarith [hz.2.1])] |
| 52 | refine ⟨(z.1, 2 * L - z.2), ⟨mem_univ _, ?_, ?_⟩, rfl⟩ <;> |
| 53 | dsimp only <;> linarith [hz.2.1, hz.2.2] |
| 54 | |
| 55 | /-- The overlap reflection is its own inverse on the whole collar |
| 56 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 57 | theorem endAxialReflection_collar_leftInvOn (e : StandardCylindricalEnd g) |
| 58 | {L : ℝ} (hL : 1 < L) : |
| 59 | LeftInvOn (endAxialReflection e (2 * L)) (endAxialReflection e (2 * L)) |
| 60 | (endDoubleCollar e L) := by |
| 61 | rintro _ ⟨z, hz, rfl⟩ |
| 62 | exact endAxialReflection_involutive e (2 * L) |
| 63 | (by linarith [hz.2.1]) (by linarith [hz.2.2]) |
| 64 | |
| 65 | /-- Smoothness holds throughout the actual collar overlap |
| 66 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 67 | theorem endAxialReflection_collar_contMDiffOn (e : StandardCylindricalEnd g) |
| 68 | {L : ℝ} (hL : 1 < L) : |
| 69 | ContMDiffOn (𝓡 3) (𝓡 3) ∞ (endAxialReflection e (2 * L)) (endDoubleCollar e L) := by |
| 70 | rintro _ ⟨z, hz, rfl⟩ |
| 71 | exact (endAxialReflection_contMDiffAt e (2 * L) |
| 72 | (by linarith [hz.2.1]) (by linarith [hz.2.2])).contMDiffWithinAt |
| 73 | |
| 74 | /-- The cylinder reflection with the precise open overlap as source |
| 75 | and target (Theorem 12.5 compact-double construction, p. 297). -/ |
| 76 | def endDoubleCollarHomeomorph (e : StandardCylindricalEnd g) |
| 77 | {L : ℝ} (hL : 1 < L) : OpenPartialHomeomorph StandardCapSpace StandardCapSpace where |
| 78 | toFun := endAxialReflection e (2 * L) |
| 79 | invFun := endAxialReflection e (2 * L) |
| 80 | source := endDoubleCollar e L |
| 81 | target := endDoubleCollar e L |
| 82 | map_source' := endAxialReflection_maps_collar e hL |
| 83 | map_target' := endAxialReflection_maps_collar e hL |
| 84 | left_inv' := endAxialReflection_collar_leftInvOn e hL |
| 85 | right_inv' := endAxialReflection_collar_leftInvOn e hL |
| 86 | open_source := endDoubleCollar_isOpen e hL |
| 87 | open_target := endDoubleCollar_isOpen e hL |
| 88 | continuousOn_toFun := (endAxialReflection_collar_contMDiffOn e hL).continuousOn |
| 89 | continuousOn_invFun := (endAxialReflection_collar_contMDiffOn e hL).continuousOn |
| 90 | |
| 91 | /-- The collar partial homeomorphism is literally self-inverse |
| 92 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 93 | theorem endDoubleCollarHomeomorph_symm (e : StandardCylindricalEnd g) |
| 94 | {L : ℝ} (hL : 1 < L) : (endDoubleCollarHomeomorph e hL).symm = |
| 95 | endDoubleCollarHomeomorph e hL := rfl |
| 96 | |
| 97 | /-- The compact graph on the closed collar includes its two endpoint |
| 98 | pairs before restricting to the open pieces (Theorem 12.5, p. 297). -/ |
| 99 | def endClosedReflectionGraph (e : StandardCylindricalEnd g) (L : ℝ) : |
| 100 | Set (StandardCapSpace × StandardCapSpace) := |
| 101 | (fun z : StandardCylinderSpace => |
| 102 | (e.coordinate z, e.coordinate (cylinderAxialReflection (2 * L) z))) '' |
| 103 | (univ ×ˢ Icc (L - 1) (L + 1)) |
| 104 | |
| 105 | /-- The full closed-strip reflection graph is compact |
| 106 | (Theorem 12.5 compact-double construction, p. 297). -/ |
| 107 | theorem endClosedReflectionGraph_isCompact (e : StandardCylindricalEnd g) |
| 108 | {L : ℝ} (hL : 1 < L) : IsCompact (endClosedReflectionGraph e L) := by |
| 109 | apply (isCompact_univ.prod isCompact_Icc).image_of_continuousOn |
| 110 | apply ContinuousOn.prodMk |
| 111 | · apply e.coordinate_smooth.continuousOn.mono |
| 112 | intro z hz |
| 113 | refine ⟨mem_univ _, ?_⟩ |
| 114 | change -e.collar < z.2 |
| 115 | linarith [hz.2.1, e.collar_pos] |
| 116 | · apply e.coordinate_smooth.continuousOn.comp |
| 117 | (cylinderAxialReflection_contMDiff (2 * L)).continuous.continuousOn |
| 118 | intro z hz |
| 119 | refine ⟨mem_univ _, ?_⟩ |
| 120 | change -e.collar < 2 * L - z.2 |
| 121 | linarith [hz.2.2, e.collar_pos] |
| 122 | |
| 123 | /-- Within the two truncations, the closed-strip graph is exactly the |
| 124 | graph of the open overlap reflection (Theorem 12.5, p. 297). -/ |
| 125 | theorem endClosedReflectionGraph_iff (e : StandardCylindricalEnd g) |
| 126 | {L : ℝ} (hL : 1 < L) {x y : StandardCapSpace} |
| 127 | (hx : x ∈ endTruncation e (L + 1)) (hy : y ∈ endTruncation e (L + 1)) : |
| 128 | (x, y) ∈ endClosedReflectionGraph e L ↔ |
| 129 | x ∈ endDoubleCollar e L ∧ endAxialReflection e (2 * L) x = y := by |
| 130 | constructor |
| 131 | · rintro ⟨z, hz, heq⟩ |
| 132 | have hxz : e.coordinate z = x := congrArg Prod.fst heq |
| 133 | have hyz : e.coordinate (z.1, 2 * L - z.2) = y := congrArg Prod.snd heq |
| 134 | have hzpos : 0 ≤ z.2 := by linarith [hz.2.1] |
| 135 | have hzref : 0 ≤ 2 * L - z.2 := by linarith [hz.2.2] |
| 136 | have hupper : z.2 < L + 1 := (endTruncation_coordinate_iff e (by linarith) hzpos).mp |
| 137 | (by rw [hxz]; exact hx) |
| 138 | have hlower' : 2 * L - z.2 < L + 1 := |
| 139 | (endTruncation_coordinate_iff e (L := L + 1) (by linarith) |
| 140 | (z := (z.1, 2 * L - z.2)) hzref).mp (by rw [hyz]; exact hy) |
| 141 | refine ⟨⟨z, ⟨mem_univ _, by linarith, hupper⟩, hxz⟩, ?_⟩ |
| 142 | rw [← hxz, endAxialReflection_coordinate e (2 * L) hzpos] |
| 143 | exact hyz |
| 144 | · rintro ⟨⟨z, hz, rfl⟩, hyz⟩ |
| 145 | have hzpos : 0 ≤ z.2 := by linarith [hz.2.1] |
| 146 | refine ⟨z, ⟨mem_univ _, hz.2.1.le, hz.2.2.le⟩, ?_⟩ |
| 147 | apply Prod.ext |
| 148 | · rfl |
| 149 | · exact (endAxialReflection_coordinate e (2 * L) hzpos).symm.trans hyz |
| 150 | |
| 151 | end PoincareMT.M34 |