Navier–Stokes: the Lean blow-up proof, cleaned up together
OpenAI's 2026 Lean proofs of blowup for forced Navier–Stokes and Euler, rerun by others, not refereed, no ruling from Clay; cleaned up together: more readable, faster to build

| 1 | import NavierStokes.Covariance |
| 2 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | import Mathlib.Topology.MetricSpace.Thickening |
| 5 | |
| 6 | /-! |
| 7 | # Smooth positive covariance solves |
| 8 | |
| 9 | For an actual real two-by-two matrix and target, the signed areas in Cramer's |
| 10 | rule give an explicit strict cone. On that cone, the inverse solution and its |
| 11 | positive square roots depend smoothly on smooth input data. A compact family |
| 12 | has a uniform positive lower bound and a uniform tolerance for perturbing both |
| 13 | the matrix and the target. |
| 14 | |
| 15 | No assertion here supplies smoothness or error estimates for the manuscript's |
| 16 | integrated columns. No assertion concerns extension through a zero-amplitude |
| 17 | edge, where the strict cone hypotheses fail. |
| 18 | -/ |
| 19 | |
| 20 | noncomputable section |
| 21 | |
| 22 | namespace NavierStokes.SmoothCovariance |
| 23 | |
| 24 | open Matrix Set |
| 25 | open scoped ContDiff Topology |
| 26 | |
| 27 | abbrev Mat2 := Matrix (Fin 2) (Fin 2) ℝ |
| 28 | abbrev Vec2 := Fin 2 → ℝ |
| 29 | |
| 30 | /- The entrywise sup norm makes all metric assertions below unambiguous. -/ |
| 31 | local instance : NormedAddCommGroup Mat2 := |
| 32 | inferInstanceAs (NormedAddCommGroup (Fin 2 → Fin 2 → ℝ)) |
| 33 | |
| 34 | local instance : NormedSpace ℝ Mat2 := |
| 35 | inferInstanceAs (NormedSpace ℝ (Fin 2 → Fin 2 → ℝ)) |
| 36 | |
| 37 | abbrev Datum := Mat2 × Vec2 |
| 38 | |
| 39 | /-- Oriented areas obtained by replacing each column by the target. -/ |
| 40 | def cramerNumerator (H : Mat2) (T : Vec2) : Vec2 := |
| 41 | ![T 0 * H 1 1 - H 0 1 * T 1, H 0 0 * T 1 - T 0 * H 1 0] |
| 42 | |
| 43 | /-- Cramer's explicit formula, including Lean's total division convention. -/ |
| 44 | def weights (H : Mat2) (T : Vec2) : Vec2 := |
| 45 | fun i => cramerNumerator H T i / H.det |
| 46 | |
| 47 | /-- Both target-column oriented areas have the same nonzero orientation as |
| 48 | the two original columns. The definition uses only polynomial inequalities. -/ |
| 49 | def StrictCone (H : Mat2) (T : Vec2) : Prop := |
| 50 | 0 < cramerNumerator H T 0 * H.det ∧ |
| 51 | 0 < cramerNumerator H T 1 * H.det |
| 52 | |
| 53 | def amplitudes (H : Mat2) (T : Vec2) : Vec2 := |
| 54 | fun i => Real.sqrt (weights H T i) |
| 55 | |
| 56 | theorem StrictCone.det_ne_zero {H : Mat2} {T : Vec2} (h : StrictCone H T) : |
| 57 | H.det ≠ 0 := |
| 58 | (mul_ne_zero_iff.mp (ne_of_gt h.1)).2 |
| 59 | |
| 60 | theorem weights_pos_iff (H : Mat2) (T : Vec2) : |
| 61 | (∀ i, 0 < weights H T i) ↔ StrictCone H T := by |
| 62 | constructor |
| 63 | · intro h |
| 64 | exact ⟨mul_pos_iff.mpr (div_pos_iff.mp (h 0)), |
| 65 | mul_pos_iff.mpr (div_pos_iff.mp (h 1))⟩ |
| 66 | · intro h i |
| 67 | fin_cases i |
| 68 | · exact div_pos_iff.mpr (mul_pos_iff.mp h.1) |
| 69 | · exact div_pos_iff.mpr (mul_pos_iff.mp h.2) |
| 70 | |
| 71 | theorem StrictCone.weights_pos {H : Mat2} {T : Vec2} (h : StrictCone H T) (i : Fin 2) : |
| 72 | 0 < weights H T i := |
| 73 | (weights_pos_iff H T).mpr h i |
| 74 | |
| 75 | theorem reconstruct (H : Mat2) (T : Vec2) (hdet : H.det ≠ 0) : |
| 76 | H.mulVec (weights H T) = T := by |
| 77 | have hc : H.mulVec (cramerNumerator H T) = H.det • T := by |
| 78 | ext i |
| 79 | fin_cases i <;> |
| 80 | simp [cramerNumerator, Matrix.mulVec, dotProduct, Fin.sum_univ_two, |
| 81 | Matrix.det_fin_two] <;> ring |
| 82 | have hw : weights H T = H.det⁻¹ • cramerNumerator H T := by |
| 83 | funext i |
| 84 | simp only [weights, Pi.smul_apply, smul_eq_mul, div_eq_mul_inv] |
| 85 | ring |
| 86 | rw [hw, Matrix.mulVec_smul, hc, smul_smul, inv_mul_cancel₀ hdet, one_smul] |
| 87 | |
| 88 | theorem inverse_formula (H : Mat2) (T : Vec2) (hdet : H.det ≠ 0) : |
| 89 | H⁻¹.mulVec T = weights H T := by |
| 90 | calc |
| 91 | H⁻¹.mulVec T = H⁻¹.mulVec (H.mulVec (weights H T)) := by |
| 92 | rw [reconstruct H T hdet] |
| 93 | _ = weights H T := by |
| 94 | rw [Matrix.mulVec_mulVec, |
| 95 | Matrix.nonsing_inv_mul H (isUnit_iff_ne_zero.mpr hdet), Matrix.one_mulVec] |
| 96 | |
| 97 | theorem StrictCone.amplitudes_pos {H : Mat2} {T : Vec2} |
| 98 | (h : StrictCone H T) (i : Fin 2) : 0 < amplitudes H T i := |
| 99 | Real.sqrt_pos.mpr (h.weights_pos i) |
| 100 | |
| 101 | theorem reconstruct_amplitudes {H : Mat2} {T : Vec2} (h : StrictCone H T) : |
| 102 | H.mulVec (fun i => amplitudes H T i ^ 2) = T := by |
| 103 | have hs : (fun i => amplitudes H T i ^ 2) = weights H T := by |
| 104 | funext i |
| 105 | exact Real.sq_sqrt (le_of_lt (h.weights_pos i)) |
| 106 | rw [hs] |
| 107 | exact reconstruct H T h.det_ne_zero |
| 108 | |
| 109 | /-- Agreement with the earlier exact signed-column formula. -/ |
| 110 | theorem weights_signed_model {a b sm sp : ℝ} (m t : ℝ) |
| 111 | (ha : 0 < a) (hb : 0 < b) (hm : 0 < sm) (hp : 0 < sp) : |
| 112 | weights (Covariance.signedMatrix a b sm sp) (Covariance.target m t) = |
| 113 | Covariance.coefficients a b sm sp m t := by |
| 114 | rw [← inverse_formula _ _ (Covariance.determinant_ne_zero ha hb hm hp)] |
| 115 | exact Covariance.inverse_formula m t ha hb hm hp |
| 116 | |
| 117 | theorem signed_model_strictCone {a b sm sp m t : ℝ} |
| 118 | (ha : 0 < a) (hb : 0 < b) (hm : 0 < sm) (hp : 0 < sp) |
| 119 | (hcone : |a * t| < b * m) : |
| 120 | StrictCone (Covariance.signedMatrix a b sm sp) (Covariance.target m t) := by |
| 121 | apply (weights_pos_iff _ _).mp |
| 122 | rw [weights_signed_model m t ha hb hm hp] |
| 123 | exact Covariance.coefficients_pos ha hb hm hp hcone |
| 124 | |
| 125 | section Smooth |
| 126 | |
| 127 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 128 | variable {s : Set E} {H : E → Mat2} {T : E → Vec2} |
| 129 | |
| 130 | end Smooth |
| 131 | |
| 132 | section Compact |
| 133 | |
| 134 | variable {X : Type*} [TopologicalSpace X] |
| 135 | variable {K : Set X} {H : X → Mat2} {T : X → Vec2} |
| 136 | |
| 137 | theorem continuousOn_determinant |
| 138 | (hH : ∀ i j, ContinuousOn (fun x => H x i j) K) : |
| 139 | ContinuousOn (fun x => (H x).det) K := by |
| 140 | simpa only [Pi.mul_apply, Pi.sub_apply, Matrix.det_fin_two] using |
| 141 | ((hH 0 0).fun_mul (hH 1 1)).fun_sub ((hH 0 1).fun_mul (hH 1 0)) |
| 142 | |
| 143 | theorem continuousOn_numerator |
| 144 | (hH : ∀ i j, ContinuousOn (fun x => H x i j) K) |
| 145 | (hT : ∀ i, ContinuousOn (fun x => T x i) K) (i : Fin 2) : |
| 146 | ContinuousOn (fun x => cramerNumerator (H x) (T x) i) K := by |
| 147 | fin_cases i |
| 148 | · simpa [Pi.mul_apply, Pi.sub_apply, cramerNumerator] using ((hT 0).fun_mul (hH 1 1)).fun_sub ((hH 0 1).fun_mul (hT 1)) |
| 149 | · simpa [Pi.mul_apply, Pi.sub_apply, cramerNumerator] using ((hH 0 0).fun_mul (hT 1)).fun_sub ((hT 0).fun_mul (hH 1 0)) |
| 150 | |
| 151 | theorem continuousOn_weights |
| 152 | (hH : ∀ i j, ContinuousOn (fun x => H x i j) K) |
| 153 | (hT : ∀ i, ContinuousOn (fun x => T x i) K) |
| 154 | (hdet : ∀ x ∈ K, (H x).det ≠ 0) (i : Fin 2) : |
| 155 | ContinuousOn (fun x => weights (H x) (T x) i) K := |
| 156 | (continuousOn_numerator hH hT i).div (continuousOn_determinant hH) hdet |
| 157 | |
| 158 | /-- Compactness supplies an actual common lower bound for the determinant |
| 159 | magnitude and both solution coordinates, including an empty parameter set. -/ |
| 160 | theorem compact_uniform_positive (hK : IsCompact K) |
| 161 | (hH : ∀ i j, ContinuousOn (fun x => H x i j) K) |
| 162 | (hT : ∀ i, ContinuousOn (fun x => T x i) K) |
| 163 | (hcone : ∀ x ∈ K, StrictCone (H x) (T x)) : |
| 164 | ∃ δ : ℝ, 0 < δ ∧ ∀ x ∈ K, |
| 165 | δ ≤ |(H x).det| ∧ ∀ i, δ ≤ weights (H x) (T x) i := by |
| 166 | have hw := continuousOn_weights hH hT (fun x hx => (hcone x hx).det_ne_zero) |
| 167 | let margin : X → ℝ := fun x => min |(H x).det| |
| 168 | (min (weights (H x) (T x) 0) (weights (H x) (T x) 1)) |
| 169 | have hm : ContinuousOn margin K := |
| 170 | continuous_min.comp_continuousOn ((continuousOn_determinant hH).abs.prodMk |
| 171 | (continuous_min.comp_continuousOn ((hw 0).prodMk (hw 1)))) |
| 172 | have hmp : ∀ x ∈ K, 0 < margin x := by |
| 173 | intro x hx |
| 174 | exact lt_min (abs_pos.mpr ((hcone x hx).det_ne_zero)) |
| 175 | (lt_min ((hcone x hx).weights_pos 0) ((hcone x hx).weights_pos 1)) |
| 176 | obtain ⟨δ, hδ, hbound⟩ := hK.exists_forall_le' hm hmp |
| 177 | refine ⟨δ, hδ, ?_⟩ |
| 178 | intro x hx |
| 179 | refine ⟨(hbound x hx).trans (min_le_left _ _), ?_⟩ |
| 180 | intro i |
| 181 | fin_cases i |
| 182 | · exact (hbound x hx).trans ((min_le_right _ _).trans (min_le_left _ _)) |
| 183 | · exact (hbound x hx).trans ((min_le_right _ _).trans (min_le_right _ _)) |
| 184 | |
| 185 | end Compact |
| 186 | |
| 187 | /-- The strict area inequalities define an open set of matrix-target pairs. -/ |
| 188 | def strictConeRegion : Set Datum := {z | StrictCone z.1 z.2} |
| 189 | |
| 190 | theorem isOpen_strictConeRegion : IsOpen strictConeRegion := by |
| 191 | have hH : ∀ i j, Continuous (fun z : Datum => z.1 i j) := fun i j => |
| 192 | (continuous_apply j).comp ((continuous_apply i).comp continuous_fst) |
| 193 | have hT : ∀ i, Continuous (fun z : Datum => z.2 i) := fun i => |
| 194 | (continuous_apply i).comp continuous_snd |
| 195 | have hd : Continuous (fun z : Datum => z.1.det) := by |
| 196 | exact continuousOn_univ.mp |
| 197 | (continuousOn_determinant (fun i j => (hH i j).continuousOn)) |
| 198 | have hn : ∀ i, Continuous (fun z : Datum => cramerNumerator z.1 z.2 i) := by |
| 199 | intro i |
| 200 | exact continuousOn_univ.mp (continuousOn_numerator |
| 201 | (fun i j => (hH i j).continuousOn) (fun i => (hT i).continuousOn) i) |
| 202 | exact (isOpen_lt continuous_const ((hn 0).fun_mul hd)).inter |
| 203 | (isOpen_lt continuous_const ((hn 1).fun_mul hd)) |
| 204 | |
| 205 | /-- A single positive perturbation radius works for every datum in a compact |
| 206 | subset of the strict cone. The perturbed data may be arbitrary actual matrices. -/ |
| 207 | theorem compact_perturbation_stability {S : Set Datum} (hS : IsCompact S) |
| 208 | (hcone : S ⊆ strictConeRegion) : |
| 209 | ∃ ρ : ℝ, 0 < ρ ∧ ∀ z ∈ S, ∀ z' : Datum, |
| 210 | dist z' z ≤ ρ → StrictCone z'.1 z'.2 := by |
| 211 | obtain ⟨ρ, hρ, hsub⟩ := |
| 212 | hS.exists_cthickening_subset_open isOpen_strictConeRegion hcone |
| 213 | exact ⟨ρ, hρ, fun z hz z' hdist => |
| 214 | hsub (Metric.mem_cthickening_of_dist_le z' z ρ S hz hdist)⟩ |
| 215 | |
| 216 | /-- Uniform perturbation stability for a continuous family on a compact |
| 217 | parameter set. Competing matrices need not form a continuous family. -/ |
| 218 | theorem compact_family_perturbation_stability |
| 219 | {X : Type*} [TopologicalSpace X] {K : Set X} (hK : IsCompact K) |
| 220 | {H : X → Mat2} {T : X → Vec2} |
| 221 | (hH : ∀ i j, ContinuousOn (fun x => H x i j) K) |
| 222 | (hT : ∀ i, ContinuousOn (fun x => T x i) K) |
| 223 | (hcone : ∀ x ∈ K, StrictCone (H x) (T x)) : |
| 224 | ∃ ρ : ℝ, 0 < ρ ∧ ∀ x ∈ K, ∀ H' : Mat2, ∀ T' : Vec2, |
| 225 | dist (H', T') (H x, T x) ≤ ρ → |
| 226 | H'.det ≠ 0 ∧ (∀ i, 0 < weights H' T' i) ∧ |
| 227 | (∀ i, 0 < amplitudes H' T' i) := by |
| 228 | let f : X → Datum := fun x => (H x, T x) |
| 229 | have hf : ContinuousOn f K := |
| 230 | (continuousOn_pi.mpr (fun i => continuousOn_pi.mpr (hH i))).prodMk |
| 231 | (continuousOn_pi.mpr hT) |
| 232 | have himage : f '' K ⊆ strictConeRegion := by |
| 233 | rintro z ⟨x, hx, rfl⟩ |
| 234 | exact hcone x hx |
| 235 | obtain ⟨ρ, hρ, hstable⟩ := |
| 236 | compact_perturbation_stability (hK.image_of_continuousOn hf) himage |
| 237 | refine ⟨ρ, hρ, ?_⟩ |
| 238 | intro x hx H' T' hdist |
| 239 | have hc := hstable (f x) (mem_image_of_mem f hx) (H', T') hdist |
| 240 | exact ⟨hc.det_ne_zero, hc.weights_pos, hc.amplitudes_pos⟩ |
| 241 | |
| 242 | end NavierStokes.SmoothCovariance |