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.Adapted.ExponentialAdaptedFrame |
| 2 | |
| 3 | /-! |
| 4 | # Adapted frames with prescribed terminal values |
| 5 | -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option maxSynthPendingDepth 3 |
| 9 | |
| 10 | open scoped Manifold ContDiff Bundle Topology |
| 11 | |
| 12 | universe u |
| 13 | |
| 14 | namespace PoincareMT.ReducedLength |
| 15 | |
| 16 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 17 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 18 | |
| 19 | set_option backward.isDefEq.respectTransparency false in |
| 20 | theorem exists_orthonormal_vectors_containing_unit (g : RiemannianMetric n M) (p : M) |
| 21 | (v : TangentSpace (𝓡 n) p) (hv : g.inner p v v = 1) : |
| 22 | ∃ (e : Fin n → TangentSpace (𝓡 n) p) (i : Fin n), e i = v ∧ |
| 23 | ∀ j k, g.inner p (e j) (e k) = if j = k then 1 else 0 := by |
| 24 | classical |
| 25 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 26 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 27 | inferInstanceAs (FiniteDimensional ℝ (EuclideanSpace ℝ (Fin n))) |
| 28 | have hdim : Module.finrank ℝ (TangentSpace (𝓡 n) p) = n := by |
| 29 | change Module.finrank ℝ (EuclideanSpace ℝ (Fin n)) = n |
| 30 | simp |
| 31 | have hon : Orthonormal ℝ ((↑) : ({v} : Set (TangentSpace (𝓡 n) p)) → TangentSpace (𝓡 n) p) := by |
| 32 | apply orthonormal_iff_ite.mpr |
| 33 | intro x y |
| 34 | have hx : (x : TangentSpace (𝓡 n) p) = v := Set.mem_singleton_iff.mp x.property |
| 35 | have hy : (y : TangentSpace (𝓡 n) p) = v := Set.mem_singleton_iff.mp y.property |
| 36 | have hxy : x = y := Subtype.ext (hx.trans hy.symm) |
| 37 | simp only [hxy, if_true, hx, hy] |
| 38 | exact hv |
| 39 | obtain ⟨S, b, hS, hb⟩ := hon.exists_orthonormalBasis_extension |
| 40 | have hcard : Fintype.card S = n := by |
| 41 | rw [← Module.finrank_eq_card_basis b.toBasis, hdim] |
| 42 | let σ : S ≃ Fin n := Fintype.equivFinOfCardEq hcard |
| 43 | let e := b.reindex σ |
| 44 | let j : S := ⟨v, hS (Set.mem_singleton v)⟩ |
| 45 | refine ⟨e, σ j, ?_, orthonormal_iff_ite.mp e.orthonormal⟩ |
| 46 | simp only [e, OrthonormalBasis.coe_reindex, Function.comp_apply, σ.symm_apply_apply, hb] |
| 47 | rfl |
| 48 | |
| 49 | theorem lExponentialFamily_exists_terminal_adapted_frame {J : Set ℝ} [T2Space M] |
| 50 | {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 51 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 52 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 53 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 54 | (e : Fin n → TangentSpace (𝓡 n) (A.squareFamily Z (Real.sqrt b))) |
| 55 | (he : ∀ i j, (F.metric (T - (Real.sqrt b) ^ 2)).inner (A.squareFamily Z (Real.sqrt b)) |
| 56 | (e i) (e j) = if i = j then 1 else 0) : |
| 57 | ∃ (D : Set ℝ) (P : Fin n → ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s)), |
| 58 | IsOpen D ∧ IsPreconnected D ∧ Set.Icc 0 (Real.sqrt b) ⊆ D ∧ |
| 59 | D ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ∧ |
| 60 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (A.squareFamily Z) D ∧ |
| 61 | (∀ i, P i (Real.sqrt b) = e i) ∧ |
| 62 | (∀ i, IsAdaptedFieldOn F T (A.squareFamily Z) (P i) D) ∧ |
| 63 | ∀ s ∈ D, ∀ i j, (F.metric (T - s ^ 2)).inner (A.squareFamily Z s) |
| 64 | (P i s) (P j s) = if i = j then 1 else 0 := by |
| 65 | obtain ⟨U, _, hU, hconn, hKU, htime, hα, _⟩ := |
| 66 | lExponentialFamily_exists_adapted_frame hτmax hwindow A Z b hb hmax |
| 67 | obtain ⟨D, P, hD, hconnD, hKD, hDU, hPe, hP, hpair⟩ := |
| 68 | exists_adapted_orthonormal_frame F T τmax hτmax hwindow (A.squareFamily Z) U hU |
| 69 | hconn htime hα 0 (Real.sqrt b) (Real.sqrt b) hKU ⟨Real.sqrt_nonneg b, le_rfl⟩ e he |
| 70 | exact ⟨D, P, hD, hconnD, hKD, hDU.trans htime, hα.mono hDU, hPe, hP, hpair⟩ |
| 71 | |
| 72 | end PoincareMT.ReducedLength |