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.Curvature.Integral.Reduction.Connected |
| 2 | import PoincareLib.Geometry.Riemannian.Surface.Regularity |
| 3 | import PoincareLib.Geometry.Riemannian.Measure.LocalFinite |
| 4 | |
| 5 | /-! |
| 6 | # Integrals over finitely many connected components |
| 7 | |
| 8 | The canonical restricted metrics carry exactly the restricted ambient volume. |
| 9 | A finite partition into components therefore decomposes every integrable |
| 10 | function. On compact manifolds this applies to positive scalar curvature |
| 11 | without an integrability premise. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | open Set MeasureTheory TopologicalSpace Function |
| 18 | open scoped Manifold ContDiff Bundle BigOperators |
| 19 | namespace PoincareMT.RiemannianMetric |
| 20 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T3Space M] |
| 21 | [MeasurableSpace M] [BorelSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | /-- The canonical component metric computes the restricted ambient integral, |
| 25 | including the totalized nonintegrable case. -/ |
| 26 | theorem integral_connectedComponentMetric |
| 27 | (g : RiemannianMetric n M) (p : M) (f : M → ℝ) : |
| 28 | (∫ x, f x ∂(g.connectedComponentMetric p).volumeMeasure) = |
| 29 | ∫ x in connectedComponent p, f x ∂g.volumeMeasure := by |
| 30 | let U := Poincare.connectedComponentOpens (EuclideanSpace ℝ (Fin n)) p |
| 31 | have hi : MeasurableEmbedding (Subtype.val : U → M) := |
| 32 | MeasurableEmbedding.subtype_coe U.isOpen.measurableSet |
| 33 | have hmap := map_volumeMeasure_subtype_val isClosed_connectedComponent g |
| 34 | (g.connectedComponentMetric p) (fun _ _ _ => rfl) |
| 35 | have he := hi.integral_map (μ := (g.connectedComponentMetric p).volumeMeasure) f |
| 36 | rw [hmap] at he |
| 37 | exact he.symm |
| 38 | |
| 39 | /-- Sum the actual component-metric integrals over the finite component partition. -/ |
| 40 | theorem integral_eq_sum_connectedComponentMetric |
| 41 | [Finite (ConnectedComponents M)] |
| 42 | (g : RiemannianMetric n M) (f : M → ℝ) (hf : Integrable f g.volumeMeasure) : |
| 43 | letI := Fintype.ofFinite (ConnectedComponents M) |
| 44 | (∫ x, f x ∂g.volumeMeasure) = |
| 45 | ∑ c : ConnectedComponents M, |
| 46 | ∫ x, f x ∂(g.connectedComponentMetric (Quotient.out c)).volumeMeasure := by |
| 47 | classical |
| 48 | let := Fintype.ofFinite (ConnectedComponents M) |
| 49 | have hmem (x:M) (c:ConnectedComponents M) : |
| 50 | x∈connectedComponent (Quotient.out c) ↔ ConnectedComponents.mk x=c := by |
| 51 | rw [←ConnectedComponents.coe_eq_coe'] |
| 52 | change ConnectedComponents.mk x=Quotient.mk'' (Quotient.out c) ↔ _ |
| 53 | rw [Quotient.out_eq'] |
| 54 | have hcover : (⋃ c:ConnectedComponents M, connectedComponent (Quotient.out c))=univ := by |
| 55 | ext x |
| 56 | simp only [mem_iUnion,mem_univ,iff_true] |
| 57 | exact ⟨ConnectedComponents.mk x,(hmem x _).mpr rfl⟩ |
| 58 | have hdisj : Pairwise (Disjoint on (fun c:ConnectedComponents M => |
| 59 | connectedComponent (Quotient.out c))) := by |
| 60 | intro c d hcd |
| 61 | apply disjoint_left.mpr |
| 62 | intro x hx hx' |
| 63 | exact hcd (((hmem x c).mp hx).symm.trans ((hmem x d).mp hx')) |
| 64 | have he := integral_iUnion_fintype |
| 65 | (fun c:ConnectedComponents M => (isClosed_connectedComponent (x := Quotient.out c)).measurableSet) |
| 66 | hdisj (fun _ => hf.integrableOn) |
| 67 | rw [hcover,setIntegral_univ] at he |
| 68 | simpa only [integral_connectedComponentMetric] using he |
| 69 | |
| 70 | /-- Compactness supplies scalar integrability; the component curvatures are |
| 71 | those of the canonical restricted metrics and their actual connections. -/ |
| 72 | theorem integral_pos_scalarCurvature_eq_sum_connectedComponentMetric |
| 73 | [CompactSpace M] (g : RiemannianMetric n M) (D : LeviCivitaData g) : |
| 74 | letI : LocallyConnectedSpace M := |
| 75 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin n)) M |
| 76 | letI := Fintype.ofFinite (ConnectedComponents M) |
| 77 | (∫ x, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) = |
| 78 | ∑ c : ConnectedComponents M, |
| 79 | ∫ x, max 0 ((g.connectedComponentMetric (Quotient.out c)).leviCivitaData.scalarCurvature x) |
| 80 | ∂(g.connectedComponentMetric (Quotient.out c)).volumeMeasure := by |
| 81 | classical |
| 82 | let : LocallyConnectedSpace M := |
| 83 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin n)) M |
| 84 | let := Fintype.ofFinite (ConnectedComponents M) |
| 85 | have hf : Integrable (fun x => max 0 (D.scalarCurvature x)) g.volumeMeasure := |
| 86 | (continuous_const.max D.continuous_scalarCurvature).integrable_of_hasCompactSupport |
| 87 | (HasCompactSupport.of_compactSpace _) |
| 88 | rw [integral_eq_sum_connectedComponentMetric g _ hf] |
| 89 | apply Finset.sum_congr rfl |
| 90 | intro c _ |
| 91 | apply integral_congr_ae |
| 92 | filter_upwards [] with x |
| 93 | congr 1 |
| 94 | symm |
| 95 | exact (g.connectedComponentMetric (Quotient.out c)).leviCivitaData.scalarCurvature_eq_of_local_isometry |
| 96 | D isOpen_univ contMDiff_subtype_val.contMDiffOn (fun _ _ _ _ => rfl) (mem_univ x) |
| 97 | /-- Assemble estimates on actual components, charging the constant term once |
| 98 | per component and summing the integral error exactly. -/ |
| 99 | theorem integral_pos_scalarCurvature_le_of_connectedComponent_bounds |
| 100 | [CompactSpace M] (g : RiemannianMetric n M) (D : LeviCivitaData g) |
| 101 | (E : M → ℝ) (hE : Integrable E g.volumeMeasure) |
| 102 | {A C : ℝ} (hA : 0≤A) (hC : 0≤C) (N : ℕ) |
| 103 | (hcount : Nat.card (ConnectedComponents M)≤N) |
| 104 | (hbound : ∀ p:M, |
| 105 | (∫ x, max 0 ((g.connectedComponentMetric p).leviCivitaData.scalarCurvature x) |
| 106 | ∂(g.connectedComponentMetric p).volumeMeasure) ≤ |
| 107 | C*(A+∫ x, E x ∂(g.connectedComponentMetric p).volumeMeasure)) : |
| 108 | (∫ x, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) ≤ |
| 109 | C*((N:ℝ)*A+∫ x, E x ∂g.volumeMeasure) := by |
| 110 | classical |
| 111 | let : LocallyConnectedSpace M := |
| 112 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin n)) M |
| 113 | let := Fintype.ofFinite (ConnectedComponents M) |
| 114 | rw [integral_pos_scalarCurvature_eq_sum_connectedComponentMetric g D] |
| 115 | calc |
| 116 | _ ≤ ∑ c:ConnectedComponents M, |
| 117 | C*(A+∫ x, E x ∂(g.connectedComponentMetric (Quotient.out c)).volumeMeasure) := |
| 118 | Finset.sum_le_sum (fun c _ => hbound (Quotient.out c)) |
| 119 | _ = C*((Nat.card (ConnectedComponents M):ℝ)*A+∫ x, E x ∂g.volumeMeasure) := by |
| 120 | rw [←Finset.mul_sum,Finset.sum_add_distrib,Finset.sum_const, |
| 121 | Finset.card_univ,nsmul_eq_mul,←Nat.card_eq_fintype_card, |
| 122 | ←integral_eq_sum_connectedComponentMetric g E hE] |
| 123 | _ ≤ _ := by |
| 124 | gcongr |
| 125 | |
| 126 | end PoincareMT.RiemannianMetric |
| 127 |