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.ReducedGeometry.ReducedLength.Variation.Fields.VariationRegularField |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.SmoothPartials |
| 3 | |
| 4 | /-! |
| 5 | # Coordinate representatives of actual variation fields |
| 6 | |
| 7 | On the open chart preimage the derivative of the second parameter is |
| 8 | smooth and represents the actual square-variation field. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | set_option maxHeartbeats 800000 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | {J : Set ℝ} {F : RicciFlow n M J} {T a b : ℝ} {p : BackwardTimePath F T a b} |
| 25 | |
| 26 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 27 | |
| 28 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem squareVariationField_chart_smooth (V : LVariation F T a b p) (x0 : M) : |
| 30 | let H : ℝ × ℝ → M := fun z ↦ V.squareFamily z.1 z.2 |
| 31 | let Ω := V.squareDomain ∩ H ⁻¹' (chartAt E x0).source |
| 32 | let U := (fun r : ℝ ↦ (r, (0 : ℝ))) ⁻¹' Ω |
| 33 | let v : ℝ → E := fun r ↦ deriv (fun u ↦ (chartAt E x0) (V.squareFamily r u)) 0 |
| 34 | IsOpen U ∧ |
| 35 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U ∧ |
| 36 | (∀ r ∈ U, V.baseSquareCurve r ∈ (chartAt E x0).source) ∧ |
| 37 | ContDiffOn ℝ ∞ v U ∧ |
| 38 | ∀ r ∈ U, chartVectorField x0 (v r) (V.baseSquareCurve r) = squareVariationField V r := by |
| 39 | let H : ℝ × ℝ → M := fun z ↦ V.squareFamily z.1 z.2 |
| 40 | let Ω := V.squareDomain ∩ H ⁻¹' (chartAt E x0).source |
| 41 | let U := (fun r : ℝ ↦ (r, (0 : ℝ))) ⁻¹' Ω |
| 42 | let f : ℝ × ℝ → E := fun z ↦ (chartAt E x0) (H z) |
| 43 | let v : ℝ → E := fun r ↦ deriv (fun u ↦ f (r, u)) 0 |
| 44 | have hH : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓡 n) ∞ H V.squareDomain := by |
| 45 | convert! V.square_smooth using 1 <;> |
| 46 | simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 47 | have hΩ : IsOpen Ω := hH.continuousOn.isOpen_inter_preimage V.square_open |
| 48 | (chartAt E x0).open_source |
| 49 | have hf : ContDiffOn ℝ ∞ f Ω := |
| 50 | (contMDiffOn_chart.comp (hH.mono Set.inter_subset_left) (fun z hz ↦ hz.2)).contDiffOn |
| 51 | have hi : ContDiff ℝ ∞ (fun r : ℝ ↦ (r, (0 : ℝ))) := |
| 52 | contDiff_id.prodMk contDiff_const |
| 53 | have hbase : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 54 | hH.comp hi.contMDiff.contMDiffOn (fun r hr ↦ hr.1) |
| 55 | have hv : ContDiffOn ℝ ∞ v U := |
| 56 | (contDiffOn_slice_deriv_snd f Ω hΩ hf).comp hi.contDiffOn (fun r hr ↦ hr) |
| 57 | refine ⟨hΩ.preimage hi.continuous, hbase, fun r hr ↦ hr.2, hv, ?_⟩ |
| 58 | intro r hr |
| 59 | have hsmooth : ContMDiffAt (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (V.squareFamily r) 0 := |
| 60 | (hH.contMDiffAt (V.square_open.mem_nhds hr.1)).comp 0 |
| 61 | ((contDiff_const.prodMk contDiff_id).contMDiff.contMDiffAt) |
| 62 | have hd : HasDerivAt (fun u ↦ (chartAt E x0) (V.squareFamily r u)) (v r) 0 := |
| 63 | (hasDerivAt_slice_snd f r 0 |
| 64 | ((hf.contDiffAt (hΩ.mem_nhds hr)).differentiableAt (by simp))).differentiableAt.hasDerivAt |
| 65 | exact chartVectorField_coordinate_velocity x0 (V.squareFamily r) 0 (v r) hr.2 |
| 66 | (hsmooth.mdifferentiableAt (by simp)) hd |
| 67 | |
| 68 | end PoincareMT.ReducedLength |