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

refactor(Euler/Regularized): 3 small modules folded into the file that imports them (−12.9%, measured)
Browse filesPart of #14. Folds Euler/RegularizedForcingWord.lean into Euler/RegularizedEnergyFamily.lean, and Euler/RegularizedWordEquation.lean and Euler/RegularizedWordConvergence.lean into Euler/RegularizedWordTime.lean: each module had a single importer in the same folder and family, and its text moves there unchanged, under its own heading and section, before the file's own text. Also brings fold.py, ContentTail.lean and the statements section of docs/s5-folding as the series carries them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks
build Program · lake build and Comparator
Details
challenge Program · challenge files and build config
Details
ci/docs
Details
+111 −1 Euler/RegularizedEnergyFamily.lean View file
| @@ -1,9 +1,119 @@ | ||
| 1 | -import Euler.RegularizedForcingWord | |
| 1 | +import Euler.RegularizedWordTime | |
| 2 | +import Euler.TimePathApply | |
| 3 | +import Euler.TransportL2Time | |
| 2 | 4 | import Euler.TimeFamily |
| 3 | 5 | import Euler.SobolevEnergyPaths |
| 4 | 6 | |
| 5 | 7 | /-! Actual finite energy families of all required derivative words and their strong weighted limits. -/ |
| 6 | 8 | |
| 9 | +/-! ## From `Euler/RegularizedForcingWord.lean` | |
| 10 | + | |
| 11 | +The text of `Euler/RegularizedForcingWord.lean`, folded into this file, which was its only importer. -/ | |
| 12 | + | |
| 13 | +section | |
| 14 | + | |
| 15 | +/-! Concrete forcing for the regularized word PDE and its strong energy-order time limit. -/ | |
| 16 | + | |
| 17 | +noncomputable section | |
| 18 | + | |
| 19 | +namespace EulerRegularizedForcingWord | |
| 20 | + | |
| 21 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 22 | + EulerMildTopWord EulerRegularizedWordEquation EulerRegularizedWordTime EulerRegularizedTopBlocks | |
| 23 | + EulerMetricHeatEnergy EulerTimeLp EulerVolterraConvolution | |
| 24 | +open scoped Topology | |
| 25 | + | |
| 26 | +variable (period : ℝ) [Fact (0 < period)] | |
| 27 | + | |
| 28 | +/-- The actual transport-pressure forcing in the regularized energy-word PDE. -/ | |
| 29 | +def forcingWordPath {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T : ℝ) | |
| 30 | + (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 31 | + (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 32 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 33 | + (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) : C(Icc (0 : ℝ) T, LiftL2 period) := | |
| 34 | + sourceWordPath period hm n w T f + | |
| 35 | + timePathApply T A ((truncateOperator period 1).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 36 | + (regularizedWordPath period hm n w T u)) + timePathApply T G (sourceWordPath period hm n w T p) | |
| 37 | + | |
| 38 | +/-- The regularized forcing has its literal source-plus-transport-plus-pressure value. -/ | |
| 39 | +theorem forcingWordPath_apply {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T : ℝ) | |
| 40 | + (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 41 | + (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 42 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 43 | + (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) (t : Icc (0 : ℝ) T) : | |
| 44 | + forcingWordPath period hm n w T A G u f p t = | |
| 45 | + value period (regularizedWordBlock period hm n w (f t)) + | |
| 46 | + A t (truncateOperator period 1 (regularizedWordPath period hm n w T u t)) + | |
| 47 | + G t (value period (regularizedWordBlock period hm n w (p t))) := rfl | |
| 48 | + | |
| 49 | +/-- The source-plus-transport-plus-pressure definition gives the exact regularized word equation. -/ | |
| 50 | +theorem forcingWordPath_equation {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T ν : ℝ) | |
| 51 | + (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 52 | + (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 53 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 54 | + (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) (t : Icc (0 : ℝ) T) : | |
| 55 | + (ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u t)) + | |
| 56 | + value period (regularizedWordBlock period hm n w (f t))) + | |
| 57 | + A t (truncateOperator period 1 (regularizedWordPath period hm n w T u t)) + | |
| 58 | + G t (value period (regularizedWordBlock period hm n w (p t))) = | |
| 59 | + forcingWordPath period hm n w T A G u f p t + | |
| 60 | + ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u t)) := by | |
| 61 | + rw [forcingWordPath_apply] | |
| 62 | + abel | |
| 63 | + | |
| 64 | +/-- The full energy-order regularized word has the actual clamped-path heat derivative at each interior time. -/ | |
| 65 | +theorem regularized_word_hasDerivAt_clamped {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 66 | + (ν : ℝ) (hν : 0 < ν) (T : ℝ) (hT : 0 ≤ T) | |
| 67 | + (u₀ : SobolevSpace period (q+1)) (f : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 68 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 69 | + (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 70 | + u t = heatOperator period (q+1) (2*ν*t.val).toNNReal u₀ + | |
| 71 | + ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r (extendPath T hT f (t.val-r))) | |
| 72 | + (t : ℝ) (ht : t ∈ Ioo 0 T) : | |
| 73 | + HasDerivAt (fun r => value period (extendPath T hT (regularizedWordPath period hm n w T u) r)) | |
| 74 | + (ν • jetLaplacian period (toJet period (extendPath T hT (regularizedWordPath period hm n w T u) t)) + | |
| 75 | + extendPath T hT (sourceWordPath period hm n w T f) t) t := by | |
| 76 | + have h := regularized_word_hasDerivAt period hm n w ν hν T hT u₀ f u hsol t ht | |
| 77 | + change HasDerivAt _ (ν • jetLaplacian period (toJet period | |
| 78 | + (regularizedWordPath period hm n w T u (projIcc 0 T hT t))) + | |
| 79 | + value period (regularizedWordBlock period hm n w (f (projIcc 0 T hT t)))) t | |
| 80 | + rw [projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] | |
| 81 | + exact h | |
| 82 | + | |
| 83 | +/-- The literal forcing obtained from full energy-order source, state, and pressure time fields. -/ | |
| 84 | +def forcingWordTime {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) (T : ℝ) (hT : 0 ≤ T) | |
| 85 | + (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 86 | + (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 87 | + (U : TimeLp T (SobolevSpace period (2+q))) (F P : TimeLp T (SobolevSpace period (q+1))) : | |
| 88 | + TimeLp T (LiftL2 period) := | |
| 89 | + (wordOperator period (⟨⟨m, Nat.lt_succ_of_le hm⟩, w⟩ : SobolevWord (q+1))).compLpL 2 (timeMeasure T) F + | |
| 90 | + timeMultiplier T hT A ((boundedWordBlock period 1 m (by omega : 1+m ≤ 2+q) w).compLpL 2 (timeMeasure T) U) + | |
| 91 | + timeMultiplier T hT G ((wordOperator period (⟨⟨m, Nat.lt_succ_of_le hm⟩, w⟩ : SobolevWord (q+1))).compLpL 2 (timeMeasure T) P) | |
| 92 | + | |
| 93 | +/-- The concrete regularized PDE forcing converges strongly at the full energy order by maximal regularity and the actual higher-order source/pressure representatives. -/ | |
| 94 | +theorem forcingWordPath_time_tendsto {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 95 | + (T : ℝ) (hT : 0 ≤ T) | |
| 96 | + (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 97 | + (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 98 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 99 | + (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 100 | + (U : TimeLp T (SobolevSpace period (2+q))) (F P : TimeLp T (SobolevSpace period (q+1))) | |
| 101 | + (hU : Filter.Tendsto (fun n => pathLp T hT (maximalApproximation period q T n u)) Filter.atTop (𝓝 U)) | |
| 102 | + (hF : (fun t => truncateOperator period q (F t)) =ᵐ[timeMeasure T] extendPath T hT f) | |
| 103 | + (hP : (fun t => truncateOperator period q (P t)) =ᵐ[timeMeasure T] extendPath T hT p) : | |
| 104 | + Filter.Tendsto (fun n => pathLp T hT (forcingWordPath period hm n w T A G u f p)) Filter.atTop | |
| 105 | + (𝓝 (forcingWordTime period hm w T hT A G U F P)) := by | |
| 106 | + have hs := sourceWordPath_time_tendsto period hm w T hT f F hF | |
| 107 | + have ht := timePathApply_tendsto T hT A _ _ (regularizedWordPath_first_tendsto period hm w T hT u U hU) | |
| 108 | + have hp := timePathApply_tendsto T hT G _ _ (sourceWordPath_time_tendsto period hm w T hT p P hP) | |
| 109 | + have h := (hs.add ht).add hp | |
| 110 | + simpa only [forcingWordPath, pathLp_add, forcingWordTime] using h | |
| 111 | + | |
| 112 | +end EulerRegularizedForcingWord | |
| 113 | +end | |
| 114 | + | |
| 115 | +end | |
| 116 | + | |
| 7 | 117 | noncomputable section |
| 8 | 118 | |
| 9 | 119 | namespace EulerRegularizedEnergyFamily |
+0 −102 Euler/RegularizedForcingWord.lean deleted
| @@ -1,102 +0,0 @@ | ||
| 1 | -import Euler.RegularizedWordTime | |
| 2 | -import Euler.TimePathApply | |
| 3 | -import Euler.TransportL2Time | |
| 4 | - | |
| 5 | -/-! Concrete forcing for the regularized word PDE and its strong energy-order time limit. -/ | |
| 6 | - | |
| 7 | -noncomputable section | |
| 8 | - | |
| 9 | -namespace EulerRegularizedForcingWord | |
| 10 | - | |
| 11 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 12 | - EulerMildTopWord EulerRegularizedWordEquation EulerRegularizedWordTime EulerRegularizedTopBlocks | |
| 13 | - EulerMetricHeatEnergy EulerTimeLp EulerVolterraConvolution | |
| 14 | -open scoped Topology | |
| 15 | - | |
| 16 | -variable (period : ℝ) [Fact (0 < period)] | |
| 17 | - | |
| 18 | -/-- The actual transport-pressure forcing in the regularized energy-word PDE. -/ | |
| 19 | -def forcingWordPath {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T : ℝ) | |
| 20 | - (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 21 | - (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 22 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 23 | - (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) : C(Icc (0 : ℝ) T, LiftL2 period) := | |
| 24 | - sourceWordPath period hm n w T f + | |
| 25 | - timePathApply T A ((truncateOperator period 1).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 26 | - (regularizedWordPath period hm n w T u)) + timePathApply T G (sourceWordPath period hm n w T p) | |
| 27 | - | |
| 28 | -/-- The regularized forcing has its literal source-plus-transport-plus-pressure value. -/ | |
| 29 | -theorem forcingWordPath_apply {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T : ℝ) | |
| 30 | - (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 31 | - (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 32 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 33 | - (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) (t : Icc (0 : ℝ) T) : | |
| 34 | - forcingWordPath period hm n w T A G u f p t = | |
| 35 | - value period (regularizedWordBlock period hm n w (f t)) + | |
| 36 | - A t (truncateOperator period 1 (regularizedWordPath period hm n w T u t)) + | |
| 37 | - G t (value period (regularizedWordBlock period hm n w (p t))) := rfl | |
| 38 | - | |
| 39 | -/-- The source-plus-transport-plus-pressure definition gives the exact regularized word equation. -/ | |
| 40 | -theorem forcingWordPath_equation {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) (T ν : ℝ) | |
| 41 | - (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 42 | - (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 43 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 44 | - (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) (t : Icc (0 : ℝ) T) : | |
| 45 | - (ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u t)) + | |
| 46 | - value period (regularizedWordBlock period hm n w (f t))) + | |
| 47 | - A t (truncateOperator period 1 (regularizedWordPath period hm n w T u t)) + | |
| 48 | - G t (value period (regularizedWordBlock period hm n w (p t))) = | |
| 49 | - forcingWordPath period hm n w T A G u f p t + | |
| 50 | - ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u t)) := by | |
| 51 | - rw [forcingWordPath_apply] | |
| 52 | - abel | |
| 53 | - | |
| 54 | -/-- The full energy-order regularized word has the actual clamped-path heat derivative at each interior time. -/ | |
| 55 | -theorem regularized_word_hasDerivAt_clamped {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 56 | - (ν : ℝ) (hν : 0 < ν) (T : ℝ) (hT : 0 ≤ T) | |
| 57 | - (u₀ : SobolevSpace period (q+1)) (f : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 58 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 59 | - (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 60 | - u t = heatOperator period (q+1) (2*ν*t.val).toNNReal u₀ + | |
| 61 | - ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r (extendPath T hT f (t.val-r))) | |
| 62 | - (t : ℝ) (ht : t ∈ Ioo 0 T) : | |
| 63 | - HasDerivAt (fun r => value period (extendPath T hT (regularizedWordPath period hm n w T u) r)) | |
| 64 | - (ν • jetLaplacian period (toJet period (extendPath T hT (regularizedWordPath period hm n w T u) t)) + | |
| 65 | - extendPath T hT (sourceWordPath period hm n w T f) t) t := by | |
| 66 | - have h := regularized_word_hasDerivAt period hm n w ν hν T hT u₀ f u hsol t ht | |
| 67 | - change HasDerivAt _ (ν • jetLaplacian period (toJet period | |
| 68 | - (regularizedWordPath period hm n w T u (projIcc 0 T hT t))) + | |
| 69 | - value period (regularizedWordBlock period hm n w (f (projIcc 0 T hT t)))) t | |
| 70 | - rw [projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] | |
| 71 | - exact h | |
| 72 | - | |
| 73 | -/-- The literal forcing obtained from full energy-order source, state, and pressure time fields. -/ | |
| 74 | -def forcingWordTime {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) (T : ℝ) (hT : 0 ≤ T) | |
| 75 | - (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 76 | - (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 77 | - (U : TimeLp T (SobolevSpace period (2+q))) (F P : TimeLp T (SobolevSpace period (q+1))) : | |
| 78 | - TimeLp T (LiftL2 period) := | |
| 79 | - (wordOperator period (⟨⟨m, Nat.lt_succ_of_le hm⟩, w⟩ : SobolevWord (q+1))).compLpL 2 (timeMeasure T) F + | |
| 80 | - timeMultiplier T hT A ((boundedWordBlock period 1 m (by omega : 1+m ≤ 2+q) w).compLpL 2 (timeMeasure T) U) + | |
| 81 | - timeMultiplier T hT G ((wordOperator period (⟨⟨m, Nat.lt_succ_of_le hm⟩, w⟩ : SobolevWord (q+1))).compLpL 2 (timeMeasure T) P) | |
| 82 | - | |
| 83 | -/-- The concrete regularized PDE forcing converges strongly at the full energy order by maximal regularity and the actual higher-order source/pressure representatives. -/ | |
| 84 | -theorem forcingWordPath_time_tendsto {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 85 | - (T : ℝ) (hT : 0 ≤ T) | |
| 86 | - (A : C(Icc (0 : ℝ) T, SobolevSpace period 1 →L[ℝ] LiftL2 period)) | |
| 87 | - (G : C(Icc (0 : ℝ) T, LiftL2 period →L[ℝ] LiftL2 period)) | |
| 88 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 89 | - (f p : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 90 | - (U : TimeLp T (SobolevSpace period (2+q))) (F P : TimeLp T (SobolevSpace period (q+1))) | |
| 91 | - (hU : Filter.Tendsto (fun n => pathLp T hT (maximalApproximation period q T n u)) Filter.atTop (𝓝 U)) | |
| 92 | - (hF : (fun t => truncateOperator period q (F t)) =ᵐ[timeMeasure T] extendPath T hT f) | |
| 93 | - (hP : (fun t => truncateOperator period q (P t)) =ᵐ[timeMeasure T] extendPath T hT p) : | |
| 94 | - Filter.Tendsto (fun n => pathLp T hT (forcingWordPath period hm n w T A G u f p)) Filter.atTop | |
| 95 | - (𝓝 (forcingWordTime period hm w T hT A G U F P)) := by | |
| 96 | - have hs := sourceWordPath_time_tendsto period hm w T hT f F hF | |
| 97 | - have ht := timePathApply_tendsto T hT A _ _ (regularizedWordPath_first_tendsto period hm w T hT u U hU) | |
| 98 | - have hp := timePathApply_tendsto T hT G _ _ (sourceWordPath_time_tendsto period hm w T hT p P hP) | |
| 99 | - have h := (hs.add ht).add hp | |
| 100 | - simpa only [forcingWordPath, pathLp_add, forcingWordTime] using h | |
| 101 | - | |
| 102 | -end EulerRegularizedForcingWord | |
+0 −70 Euler/RegularizedWordConvergence.lean deleted
| @@ -1,70 +0,0 @@ | ||
| 1 | -import Euler.RegularizedWordEquation | |
| 2 | - | |
| 3 | -/-! The actual energy-order regularized words converge uniformly in time and preserve pressure closedness. -/ | |
| 4 | - | |
| 5 | -noncomputable section | |
| 6 | - | |
| 7 | -namespace EulerRegularizedWordEquation | |
| 8 | - | |
| 9 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 10 | - EulerMildWordEquation EulerMildTopWord EulerHeatRegularizedPaths EulerVolterraConvolution | |
| 11 | - EulerSobolevWordConstraints EulerDivergenceFreeHeat EulerGaussianCylinderHeat | |
| 12 | -open scoped Topology | |
| 13 | - | |
| 14 | -variable (period : ℝ) [Fact (0 < period)] | |
| 15 | - | |
| 16 | -/-- The unregularized energy-order word retained as an actual H⁰ time path. -/ | |
| 17 | -def energyWordPath {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 18 | - (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 19 | - C(Icc (0 : ℝ) T, SobolevSpace period 0) := | |
| 20 | - mapPath period T (boundedWordBlock period 0 m (by omega : 0+m ≤ q+1) w) u | |
| 21 | - | |
| 22 | -/-- The actual regularized energy word is exactly the L² value of its genuine H⁰ heat path. -/ | |
| 23 | -theorem regularizedWordPath_heat_value {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 24 | - (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 25 | - (valueOperator period 2).compLeftContinuous ℝ (Icc (0 : ℝ) T) (regularizedWordPath period hm n w T u) = | |
| 26 | - (valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 27 | - (pathHeat period 0 T (regularizerVariance n) (energyWordPath period hm w T u)) := by | |
| 28 | - apply ContinuousMap.ext | |
| 29 | - intro t | |
| 30 | - change value period (regularizedWordBlock period hm n w (truncateOperator period q (u t))) = | |
| 31 | - value period (heatOperator period 0 (regularizerVariance n) (boundedWordBlock period 0 m (by omega) w (u t))) | |
| 32 | - rw [regularizedWordBlock_value, heatOperator_value, boundedWordBlock_value] | |
| 33 | - | |
| 34 | -/-- Every actual energy-order word of the regularized mild solution converges uniformly in L² time paths, including the top order. -/ | |
| 35 | -theorem regularizedWordPath_value_tendsto {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 36 | - (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 37 | - Filter.Tendsto (fun n => (valueOperator period 2).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 38 | - (regularizedWordPath period hm n w T u)) Filter.atTop | |
| 39 | - (𝓝 ((valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T) (energyWordPath period hm w T u))) := by | |
| 40 | - let v := energyWordPath period hm w T u | |
| 41 | - have h := (pathHeat_continuous period T v).continuousAt.tendsto.comp regularizerVariance_tendsto | |
| 42 | - have hzero : pathHeat period 0 T 0 v = v := by | |
| 43 | - apply ContinuousMap.ext | |
| 44 | - intro t | |
| 45 | - exact heatOperator_zero period (v t) | |
| 46 | - rw [hzero] at h | |
| 47 | - have hv := ((valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T)).continuous.continuousAt.tendsto.comp h | |
| 48 | - simpa only [regularizedWordPath_heat_value, Function.comp_def] using hv | |
| 49 | - | |
| 50 | -/-- Genuine heat smoothing preserves the lifted gradient subspace. -/ | |
| 51 | -theorem cylinderHeat_gradient (κ : ℝ) (m : Vector3) (v : NNReal) (p : LiftL2 period) | |
| 52 | - (hp : p ∈ gradientSpace period κ m) : cylinderHeat period v p ∈ gradientSpace period κ m := by | |
| 53 | - apply (gradientSpace period κ m).starProjection_eq_self_iff.mp | |
| 54 | - change gradientProjection period κ m (cylinderHeat period v p) = cylinderHeat period v p | |
| 55 | - rw [gradientProjection_cylinderHeat] | |
| 56 | - have hproj : gradientProjection period κ m p = p := (gradientSpace period κ m).starProjection_eq_self_iff.mpr hp | |
| 57 | - rw [hproj] | |
| 58 | - | |
| 59 | -/-- Every regularized pressure word stays in the actual lifted gradient space, without assuming an unregularized derivative of that order. -/ | |
| 60 | -theorem regularizedWordBlock_gradient {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 61 | - (κ : ℝ) (m₀ : Vector3) (p : SobolevSpace period q) | |
| 62 | - (hp : value period p ∈ gradientSpace period κ m₀) : | |
| 63 | - value period (regularizedWordBlock period hm n w p) ∈ gradientSpace period κ m₀ := by | |
| 64 | - change value period (boundedWordBlock period 2 m (by omega) w (heatRegularizer period q n p)) ∈ _ | |
| 65 | - rw [boundedWordBlock_value] | |
| 66 | - apply word_gradient period (by omega : m ≤ q+3) κ m₀ (heatRegularizer period q n p) _ w | |
| 67 | - rw [heatRegularizer_value] | |
| 68 | - exact cylinderHeat_gradient period κ m₀ (regularizerVariance n) (value period p) hp | |
| 69 | - | |
| 70 | -end EulerRegularizedWordEquation | |
+0 −89 Euler/RegularizedWordEquation.lean deleted
| @@ -1,89 +0,0 @@ | ||
| 1 | -import Euler.RegularizedTopBlocks | |
| 2 | -import Euler.SobolevWordConstraints | |
| 3 | - | |
| 4 | -/-! Every energy-order word of the actual heat-regularized mild solution obeys its genuine L² differential equation. -/ | |
| 5 | - | |
| 6 | -noncomputable section | |
| 7 | - | |
| 8 | -namespace EulerRegularizedWordEquation | |
| 9 | - | |
| 10 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 11 | - EulerSobolevHeatGenerator EulerMildWordEquation EulerMildTopWord EulerRegularizedTopBlocks | |
| 12 | - EulerHeatRegularizedPaths EulerVolterraConvolution EulerMetricHeatEnergy EulerSobolevWordConstraints | |
| 13 | - EulerDivergenceFreeHeat EulerGaussianCylinderHeat | |
| 14 | -open scoped Topology | |
| 15 | - | |
| 16 | -variable (period : ℝ) [Fact (0 < period)] | |
| 17 | - | |
| 18 | -/-- A genuinely regularized derivative word as a bounded map from the source Sobolev space into H². -/ | |
| 19 | -def regularizedWordBlock {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) : | |
| 20 | - SobolevSpace period q →L[ℝ] SobolevSpace period 2 := | |
| 21 | - (boundedWordBlock period 2 m (by omega : 2+m ≤ q+3) w).comp (heatRegularizer period q n) | |
| 22 | - | |
| 23 | -/-- Every concrete regularized word block commutes with the actual heat semigroup. -/ | |
| 24 | -theorem regularizedWordBlock_heat {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 25 | - (v : NNReal) (u : SobolevSpace period q) : | |
| 26 | - regularizedWordBlock period hm n w (heatOperator period q v u) = | |
| 27 | - heatOperator period 2 v (regularizedWordBlock period hm n w u) := by | |
| 28 | - change boundedWordBlock period 2 m (by omega) w (heatRegularizer period q n (heatOperator period q v u)) = _ | |
| 29 | - rw [heatRegularizer_heat, boundedWordBlock_heat] | |
| 30 | - rfl | |
| 31 | - | |
| 32 | -/-- Its underlying field is exactly heat applied to the actual energy-order derivative of the unregularized state. -/ | |
| 33 | -theorem regularizedWordBlock_value {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 34 | - (u : SobolevSpace period (q+1)) : | |
| 35 | - value period (regularizedWordBlock period hm n w (truncateOperator period q u)) = | |
| 36 | - cylinderHeat period (regularizerVariance n) (word period u hm w) := by | |
| 37 | - change value period (boundedWordBlock period 2 m (by omega) w | |
| 38 | - (heatRegularizer period q n (truncateOperator period q u))) = _ | |
| 39 | - rw [boundedWordBlock_value, heatRegularizer_truncate] | |
| 40 | - exact heatRegularizer_word period n hm w u | |
| 41 | - | |
| 42 | -/-- The actual regularized energy-order word path. -/ | |
| 43 | -def regularizedWordPath {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 44 | - (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 45 | - C(Icc (0 : ℝ) T, SobolevSpace period 2) := | |
| 46 | - mapPath period T ((regularizedWordBlock period hm n w).comp (truncateOperator period q)) u | |
| 47 | - | |
| 48 | -/-- At depth two the actual Laplacian evaluation is exactly the original genuine jet Laplacian. -/ | |
| 49 | -theorem laplacianEvaluation_two (u : SobolevSpace period 2) : | |
| 50 | - laplacianEvaluation period 2 (le_refl 2) u = jetLaplacian period (toJet period u) := by | |
| 51 | - rw [laplacianEvaluation_apply, jetLaplacian] | |
| 52 | - exact Finset.sum_congr rfl (fun i _ => (toJet_word period u (le_refl 2) (fun _ : Fin 2 => i)).symm) | |
| 53 | - | |
| 54 | -/-- Every regularized word at the full solution energy order satisfies the actual time PDE, with no top-order differentiability premise. -/ | |
| 55 | -theorem regularized_word_hasDerivAt {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 56 | - (ν : ℝ) (hν : 0 < ν) (T : ℝ) (hT : 0 ≤ T) | |
| 57 | - (u₀ : SobolevSpace period (q+1)) (f : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 58 | - (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 59 | - (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 60 | - u t = heatOperator period (q+1) (2*ν*t.val).toNNReal u₀ + | |
| 61 | - ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r (extendPath T hT f (t.val-r))) | |
| 62 | - (t : ℝ) (ht : t ∈ Ioo 0 T) : | |
| 63 | - HasDerivAt (fun r => value period (extendPath T hT (regularizedWordPath period hm n w T u) r)) | |
| 64 | - (ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u ⟨t, ht.1.le, ht.2.le⟩)) + | |
| 65 | - value period (regularizedWordBlock period hm n w (f ⟨t, ht.1.le, ht.2.le⟩))) t := by | |
| 66 | - have h := viscous_mild_block_hasDerivAt period (le_refl 2) | |
| 67 | - (regularizedWordBlock period hm n w) (regularizedWordBlock_heat period hm n w) | |
| 68 | - ν hν T hT u₀ (fun t _ => f t) (f.continuous.comp continuous_fst) u hsol t ht | |
| 69 | - rw [laplacianEvaluation_two] at h | |
| 70 | - exact h | |
| 71 | - | |
| 72 | -/-- Actual energy-order word regularization preserves lifted divergence-freeness. -/ | |
| 73 | -theorem regularized_word_divergenceFree {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 74 | - (κ : ℝ) (m₀ : Vector3) (u : SobolevSpace period (q+1)) | |
| 75 | - (hu : value period u ∈ divergenceFreeSpace period κ m₀) : | |
| 76 | - value period (regularizedWordBlock period hm n w (truncateOperator period q u)) ∈ | |
| 77 | - divergenceFreeSpace period κ m₀ := by | |
| 78 | - rw [regularizedWordBlock_value] | |
| 79 | - apply (gradientSpace period κ m₀).orthogonalProjectionOnto_eq_zero_iff.mp | |
| 80 | - apply Subtype.ext | |
| 81 | - change gradientProjection period κ m₀ (cylinderHeat period (regularizerVariance n) (word period u hm w)) = 0 | |
| 82 | - rw [gradientProjection_cylinderHeat] | |
| 83 | - have hz : gradientProjection period κ m₀ (word period u hm w) = 0 := by | |
| 84 | - have h := (gradientSpace period κ m₀).orthogonalProjectionOnto_eq_zero_iff.mpr | |
| 85 | - (word_divergenceFree period hm κ m₀ u hu w) | |
| 86 | - exact congrArg Subtype.val h | |
| 87 | - rw [hz, map_zero] | |
| 88 | - | |
| 89 | -end EulerRegularizedWordEquation | |
+176 −1 Euler/RegularizedWordTime.lean View file
| @@ -1,4 +1,5 @@ | ||
| 1 | -import Euler.RegularizedWordConvergence | |
| 1 | +import Euler.RegularizedTopBlocks | |
| 2 | +import Euler.SobolevWordConstraints | |
| 2 | 3 | import Euler.SobolevMaximalRegularity |
| 3 | 4 | import Euler.TimeLpStrongOperators |
| 4 | 5 | import Euler.TimeLpLinearity |
| @@ -6,6 +7,180 @@ import Euler.TimeLpObservation | ||
| 6 | 7 | |
| 7 | 8 | /-! Strong L²-time convergence of actual energy-order regularized state, source, and pressure words. -/ |
| 8 | 9 | |
| 10 | +/-! ## From `Euler/RegularizedWordEquation.lean` | |
| 11 | + | |
| 12 | +The text of `Euler/RegularizedWordEquation.lean`, folded into this file, which was its only importer. -/ | |
| 13 | + | |
| 14 | +section | |
| 15 | + | |
| 16 | +/-! Every energy-order word of the actual heat-regularized mild solution obeys its genuine L² differential equation. -/ | |
| 17 | + | |
| 18 | +noncomputable section | |
| 19 | + | |
| 20 | +namespace EulerRegularizedWordEquation | |
| 21 | + | |
| 22 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 23 | + EulerSobolevHeatGenerator EulerMildWordEquation EulerMildTopWord EulerRegularizedTopBlocks | |
| 24 | + EulerHeatRegularizedPaths EulerVolterraConvolution EulerMetricHeatEnergy EulerSobolevWordConstraints | |
| 25 | + EulerDivergenceFreeHeat EulerGaussianCylinderHeat | |
| 26 | +open scoped Topology | |
| 27 | + | |
| 28 | +variable (period : ℝ) [Fact (0 < period)] | |
| 29 | + | |
| 30 | +/-- A genuinely regularized derivative word as a bounded map from the source Sobolev space into H². -/ | |
| 31 | +def regularizedWordBlock {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) : | |
| 32 | + SobolevSpace period q →L[ℝ] SobolevSpace period 2 := | |
| 33 | + (boundedWordBlock period 2 m (by omega : 2+m ≤ q+3) w).comp (heatRegularizer period q n) | |
| 34 | + | |
| 35 | +/-- Every concrete regularized word block commutes with the actual heat semigroup. -/ | |
| 36 | +theorem regularizedWordBlock_heat {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 37 | + (v : NNReal) (u : SobolevSpace period q) : | |
| 38 | + regularizedWordBlock period hm n w (heatOperator period q v u) = | |
| 39 | + heatOperator period 2 v (regularizedWordBlock period hm n w u) := by | |
| 40 | + change boundedWordBlock period 2 m (by omega) w (heatRegularizer period q n (heatOperator period q v u)) = _ | |
| 41 | + rw [heatRegularizer_heat, boundedWordBlock_heat] | |
| 42 | + rfl | |
| 43 | + | |
| 44 | +/-- Its underlying field is exactly heat applied to the actual energy-order derivative of the unregularized state. -/ | |
| 45 | +theorem regularizedWordBlock_value {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 46 | + (u : SobolevSpace period (q+1)) : | |
| 47 | + value period (regularizedWordBlock period hm n w (truncateOperator period q u)) = | |
| 48 | + cylinderHeat period (regularizerVariance n) (word period u hm w) := by | |
| 49 | + change value period (boundedWordBlock period 2 m (by omega) w | |
| 50 | + (heatRegularizer period q n (truncateOperator period q u))) = _ | |
| 51 | + rw [boundedWordBlock_value, heatRegularizer_truncate] | |
| 52 | + exact heatRegularizer_word period n hm w u | |
| 53 | + | |
| 54 | +/-- The actual regularized energy-order word path. -/ | |
| 55 | +def regularizedWordPath {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 56 | + (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 57 | + C(Icc (0 : ℝ) T, SobolevSpace period 2) := | |
| 58 | + mapPath period T ((regularizedWordBlock period hm n w).comp (truncateOperator period q)) u | |
| 59 | + | |
| 60 | +/-- At depth two the actual Laplacian evaluation is exactly the original genuine jet Laplacian. -/ | |
| 61 | +theorem laplacianEvaluation_two (u : SobolevSpace period 2) : | |
| 62 | + laplacianEvaluation period 2 (le_refl 2) u = jetLaplacian period (toJet period u) := by | |
| 63 | + rw [laplacianEvaluation_apply, jetLaplacian] | |
| 64 | + exact Finset.sum_congr rfl (fun i _ => (toJet_word period u (le_refl 2) (fun _ : Fin 2 => i)).symm) | |
| 65 | + | |
| 66 | +/-- Every regularized word at the full solution energy order satisfies the actual time PDE, with no top-order differentiability premise. -/ | |
| 67 | +theorem regularized_word_hasDerivAt {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 68 | + (ν : ℝ) (hν : 0 < ν) (T : ℝ) (hT : 0 ≤ T) | |
| 69 | + (u₀ : SobolevSpace period (q+1)) (f : C(Icc (0 : ℝ) T, SobolevSpace period q)) | |
| 70 | + (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 71 | + (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 72 | + u t = heatOperator period (q+1) (2*ν*t.val).toNNReal u₀ + | |
| 73 | + ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r (extendPath T hT f (t.val-r))) | |
| 74 | + (t : ℝ) (ht : t ∈ Ioo 0 T) : | |
| 75 | + HasDerivAt (fun r => value period (extendPath T hT (regularizedWordPath period hm n w T u) r)) | |
| 76 | + (ν • jetLaplacian period (toJet period (regularizedWordPath period hm n w T u ⟨t, ht.1.le, ht.2.le⟩)) + | |
| 77 | + value period (regularizedWordBlock period hm n w (f ⟨t, ht.1.le, ht.2.le⟩))) t := by | |
| 78 | + have h := viscous_mild_block_hasDerivAt period (le_refl 2) | |
| 79 | + (regularizedWordBlock period hm n w) (regularizedWordBlock_heat period hm n w) | |
| 80 | + ν hν T hT u₀ (fun t _ => f t) (f.continuous.comp continuous_fst) u hsol t ht | |
| 81 | + rw [laplacianEvaluation_two] at h | |
| 82 | + exact h | |
| 83 | + | |
| 84 | +/-- Actual energy-order word regularization preserves lifted divergence-freeness. -/ | |
| 85 | +theorem regularized_word_divergenceFree {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 86 | + (κ : ℝ) (m₀ : Vector3) (u : SobolevSpace period (q+1)) | |
| 87 | + (hu : value period u ∈ divergenceFreeSpace period κ m₀) : | |
| 88 | + value period (regularizedWordBlock period hm n w (truncateOperator period q u)) ∈ | |
| 89 | + divergenceFreeSpace period κ m₀ := by | |
| 90 | + rw [regularizedWordBlock_value] | |
| 91 | + apply (gradientSpace period κ m₀).orthogonalProjectionOnto_eq_zero_iff.mp | |
| 92 | + apply Subtype.ext | |
| 93 | + change gradientProjection period κ m₀ (cylinderHeat period (regularizerVariance n) (word period u hm w)) = 0 | |
| 94 | + rw [gradientProjection_cylinderHeat] | |
| 95 | + have hz : gradientProjection period κ m₀ (word period u hm w) = 0 := by | |
| 96 | + have h := (gradientSpace period κ m₀).orthogonalProjectionOnto_eq_zero_iff.mpr | |
| 97 | + (word_divergenceFree period hm κ m₀ u hu w) | |
| 98 | + exact congrArg Subtype.val h | |
| 99 | + rw [hz, map_zero] | |
| 100 | + | |
| 101 | +end EulerRegularizedWordEquation | |
| 102 | +end | |
| 103 | + | |
| 104 | +end | |
| 105 | + | |
| 106 | +/-! ## From `Euler/RegularizedWordConvergence.lean` | |
| 107 | + | |
| 108 | +The text of `Euler/RegularizedWordConvergence.lean`, folded into this file, which was its only importer. -/ | |
| 109 | + | |
| 110 | +section | |
| 111 | + | |
| 112 | +/-! The actual energy-order regularized words converge uniformly in time and preserve pressure closedness. -/ | |
| 113 | + | |
| 114 | +noncomputable section | |
| 115 | + | |
| 116 | +namespace EulerRegularizedWordEquation | |
| 117 | + | |
| 118 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerSobolevHeat | |
| 119 | + EulerMildWordEquation EulerMildTopWord EulerHeatRegularizedPaths EulerVolterraConvolution | |
| 120 | + EulerSobolevWordConstraints EulerDivergenceFreeHeat EulerGaussianCylinderHeat | |
| 121 | +open scoped Topology | |
| 122 | + | |
| 123 | +variable (period : ℝ) [Fact (0 < period)] | |
| 124 | + | |
| 125 | +/-- The unregularized energy-order word retained as an actual H⁰ time path. -/ | |
| 126 | +def energyWordPath {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 127 | + (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 128 | + C(Icc (0 : ℝ) T, SobolevSpace period 0) := | |
| 129 | + mapPath period T (boundedWordBlock period 0 m (by omega : 0+m ≤ q+1) w) u | |
| 130 | + | |
| 131 | +/-- The actual regularized energy word is exactly the L² value of its genuine H⁰ heat path. -/ | |
| 132 | +theorem regularizedWordPath_heat_value {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 133 | + (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 134 | + (valueOperator period 2).compLeftContinuous ℝ (Icc (0 : ℝ) T) (regularizedWordPath period hm n w T u) = | |
| 135 | + (valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 136 | + (pathHeat period 0 T (regularizerVariance n) (energyWordPath period hm w T u)) := by | |
| 137 | + apply ContinuousMap.ext | |
| 138 | + intro t | |
| 139 | + change value period (regularizedWordBlock period hm n w (truncateOperator period q (u t))) = | |
| 140 | + value period (heatOperator period 0 (regularizerVariance n) (boundedWordBlock period 0 m (by omega) w (u t))) | |
| 141 | + rw [regularizedWordBlock_value, heatOperator_value, boundedWordBlock_value] | |
| 142 | + | |
| 143 | +/-- Every actual energy-order word of the regularized mild solution converges uniformly in L² time paths, including the top order. -/ | |
| 144 | +theorem regularizedWordPath_value_tendsto {q m : ℕ} (hm : m ≤ q+1) (w : Fin m → Fin 4) | |
| 145 | + (T : ℝ) (u : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : | |
| 146 | + Filter.Tendsto (fun n => (valueOperator period 2).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 147 | + (regularizedWordPath period hm n w T u)) Filter.atTop | |
| 148 | + (𝓝 ((valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T) (energyWordPath period hm w T u))) := by | |
| 149 | + let v := energyWordPath period hm w T u | |
| 150 | + have h := (pathHeat_continuous period T v).continuousAt.tendsto.comp regularizerVariance_tendsto | |
| 151 | + have hzero : pathHeat period 0 T 0 v = v := by | |
| 152 | + apply ContinuousMap.ext | |
| 153 | + intro t | |
| 154 | + exact heatOperator_zero period (v t) | |
| 155 | + rw [hzero] at h | |
| 156 | + have hv := ((valueOperator period 0).compLeftContinuous ℝ (Icc (0 : ℝ) T)).continuous.continuousAt.tendsto.comp h | |
| 157 | + simpa only [regularizedWordPath_heat_value, Function.comp_def] using hv | |
| 158 | + | |
| 159 | +/-- Genuine heat smoothing preserves the lifted gradient subspace. -/ | |
| 160 | +theorem cylinderHeat_gradient (κ : ℝ) (m : Vector3) (v : NNReal) (p : LiftL2 period) | |
| 161 | + (hp : p ∈ gradientSpace period κ m) : cylinderHeat period v p ∈ gradientSpace period κ m := by | |
| 162 | + apply (gradientSpace period κ m).starProjection_eq_self_iff.mp | |
| 163 | + change gradientProjection period κ m (cylinderHeat period v p) = cylinderHeat period v p | |
| 164 | + rw [gradientProjection_cylinderHeat] | |
| 165 | + have hproj : gradientProjection period κ m p = p := (gradientSpace period κ m).starProjection_eq_self_iff.mpr hp | |
| 166 | + rw [hproj] | |
| 167 | + | |
| 168 | +/-- Every regularized pressure word stays in the actual lifted gradient space, without assuming an unregularized derivative of that order. -/ | |
| 169 | +theorem regularizedWordBlock_gradient {q m : ℕ} (hm : m ≤ q+1) (n : ℕ) (w : Fin m → Fin 4) | |
| 170 | + (κ : ℝ) (m₀ : Vector3) (p : SobolevSpace period q) | |
| 171 | + (hp : value period p ∈ gradientSpace period κ m₀) : | |
| 172 | + value period (regularizedWordBlock period hm n w p) ∈ gradientSpace period κ m₀ := by | |
| 173 | + change value period (boundedWordBlock period 2 m (by omega) w (heatRegularizer period q n p)) ∈ _ | |
| 174 | + rw [boundedWordBlock_value] | |
| 175 | + apply word_gradient period (by omega : m ≤ q+3) κ m₀ (heatRegularizer period q n p) _ w | |
| 176 | + rw [heatRegularizer_value] | |
| 177 | + exact cylinderHeat_gradient period κ m₀ (regularizerVariance n) (value period p) hp | |
| 178 | + | |
| 179 | +end EulerRegularizedWordEquation | |
| 180 | +end | |
| 181 | + | |
| 182 | +end | |
| 183 | + | |
| 9 | 184 | noncomputable section |
| 10 | 185 | |
| 11 | 186 | namespace EulerRegularizedWordTime |
+75 −0 docs/s5-folding/ContentTail.lean added View file
| @@ -0,0 +1,75 @@ | ||
| 1 | + | |
| 2 | +-- Every named constant of the two libraries with a hash of its type (and of its value when it is a definition) in which | |
| 3 | +-- an auxiliary constant counts by what it is, not by what it is called: private declarations, nested-proof lemmas, | |
| 4 | +-- matchers and automatically named local instances get their names from the module and from the order of elaboration, | |
| 5 | +-- and a fold changes both. A theorem met inside a term counts by its statement alone. | |
| 6 | +open Lean | |
| 7 | + | |
| 8 | +namespace FoldCheck | |
| 9 | + | |
| 10 | +def isAux (n : Name) : Bool := | |
| 11 | + n.components.any fun c => match c with | |
| 12 | + | .str _ s => s.startsWith "_" || (s.startsWith "match_" && (s.drop 6).all Char.isDigit) || (s.startsWith "proof_" && (s.drop 6).all Char.isDigit) | |
| 13 | + | .num _ _ => true | |
| 14 | + | .anonymous => false | |
| 15 | + | |
| 16 | +def userName (n : Name) : Name := | |
| 17 | + if isPrivateName n then ((n.components.dropWhile fun c => !c.isNum).drop 1).foldl (· ++ ·) `_private else n | |
| 18 | + | |
| 19 | +abbrev M := StateM (Std.HashMap Name UInt64 × Std.HashSet Name) | |
| 20 | + | |
| 21 | +mutual | |
| 22 | + partial def constHash (env : Environment) (n : Name) : M UInt64 := do | |
| 23 | + if let some h := (← get).1[n]? then return h | |
| 24 | + if (← get).2.contains n then return hash (userName n) | |
| 25 | + let some ci := env.find? n | return hash (userName n) | |
| 26 | + modify fun (m, v) => (m, v.insert n) | |
| 27 | + let th ← exprHash env ci.type | |
| 28 | + let (k, vh) ← match ci with | |
| 29 | + | .thmInfo _ => pure ((1 : UInt64), (0 : UInt64)) | |
| 30 | + | .defnInfo d => do pure (2, ← exprHash env d.value) | |
| 31 | + | .opaqueInfo d => do pure (3, ← exprHash env d.value) | |
| 32 | + | .ctorInfo c => pure (4, c.cidx.toUInt64) | |
| 33 | + | .inductInfo _ => pure (5, 0) | |
| 34 | + | .recInfo _ => pure (6, 0) | |
| 35 | + | _ => pure (7, 0) | |
| 36 | + let h := mixHash k (mixHash th vh) | |
| 37 | + modify fun (m, v) => (m.insert n h, v.erase n) | |
| 38 | + return h | |
| 39 | + partial def exprHash (env : Environment) (e : Expr) : M UInt64 := do | |
| 40 | + for u in e.getUsedConstants do | |
| 41 | + if isAux u then discard <| constHash env u | |
| 42 | + let memo := (← get).1 | |
| 43 | + let e' := e.replace fun | |
| 44 | + | .const n ls => if isAux n then some (.const (Name.mkNum `_h (memo.getD n 0).toNat) ls) else none | |
| 45 | + | _ => none | |
| 46 | + return e'.hash | |
| 47 | +end | |
| 48 | + | |
| 49 | +end FoldCheck | |
| 50 | + | |
| 51 | +open FoldCheck in | |
| 52 | +#eval show CoreM Unit from do | |
| 53 | + let env ← getEnv | |
| 54 | + let mods := env.header.moduleNames | |
| 55 | + let proj (m : Name) : Bool := m.getRoot == `NavierStokes || m.getRoot == `Euler | |
| 56 | + let h ← IO.FS.Handle.mk "/out/content.tsv" IO.FS.Mode.write | |
| 57 | + let mut st : Std.HashMap Name UInt64 × Std.HashSet Name := ({}, {}) | |
| 58 | + let mut n := 0 | |
| 59 | + for (c, ci) in env.constants.map₁.toList do | |
| 60 | + let some idx := env.getModuleIdxFor? c | continue | |
| 61 | + unless proj mods[idx.toNat]! do continue | |
| 62 | + if isAux c then continue | |
| 63 | + let (th, st1) := (exprHash env ci.type).run st | |
| 64 | + st := st1 | |
| 65 | + let mut v := "-" | |
| 66 | + match ci with | |
| 67 | + | .defnInfo d => let (vh, st2) := (exprHash env d.value).run st; st := st2; v := toString vh | |
| 68 | + | .opaqueInfo d => let (vh, st2) := (exprHash env d.value).run st; st := st2; v := toString vh | |
| 69 | + | _ => pure () | |
| 70 | + let kind := match ci with | |
| 71 | + | .thmInfo _ => "theorem" | .defnInfo _ => "def" | .axiomInfo _ => "axiom" | .opaqueInfo _ => "opaque" | |
| 72 | + | .inductInfo _ => "inductive" | .ctorInfo _ => "ctor" | .recInfo _ => "rec" | .quotInfo _ => "quot" | |
| 73 | + h.putStrLn s!"{c}\t{kind}\t{th}\t{v}" | |
| 74 | + n := n + 1 | |
| 75 | + IO.println s!"{n} named constants written" | |
+12 −0 docs/s5-folding/README.md View file
| @@ -101,3 +101,15 @@ Each pull request of the series keeps its plan in its route notes (`routes/<bran | ||
| 101 | 101 | ## What this does not show |
| 102 | 102 | |
| 103 | 103 | The wall-clock time of a build on your machine; that every file is now in its best shape for reading (P-8 splits the large ones; nothing here grows past 600 lines). |
| 104 | + | |
| 105 | +## Statements, and the series as it was opened | |
| 106 | + | |
| 107 | +The first pull request of the series was cut from a plan of 582 folds. Before the others were opened, main and the folded tree were both built and every named constant of the two libraries was listed with a hash of its type and, for a definition, of its value (`ContentTail.lean`, after one `import` line a module). In that listing an auxiliary constant inside a term (a private declaration, a nested-proof lemma, an automatically named local instance) counts by what it is, not by its name, and a theorem by its statement: a fold changes the names of such constants and nothing else about them. | |
| 108 | + | |
| 109 | +The first plan did not pass. Of 53,802 named constants, 12 differed. In one, `Euler.ComparatorBridge.compactSolenoidalTests_representation`, the word `divergence` resolved to `Euler.divergence` in the folded file and to `EulerSmoothLimit.divergence` on main: once folded, the text saw more names. The build passed all the same. In the others an instance was found by another path (`NormedCommRing ℂ` through the C⋆-algebra instances, `DistribSMul ℝ` through the semiring), or a proof inside the statement differed. | |
| 110 | + | |
| 111 | +Two changes followed. `fold.py` now puts a folded module's imports where its import line stood, so that every other module is loaded in the order it was loaded before (a plan file says which way it was cut, and `check` follows it, so the first pull request still checks). And five files keep their modules: `Euler/CompactProjectedEulerLaw.lean`, `Euler/CylinderJetLpAlgebra.lean`, `Euler/MeanCutoffDifferenceBound.lean`, `NavierStokes/R3/CompactEnergy.lean`, `NavierStokes/R3/PressureRecovery.lean`. | |
| 112 | + | |
| 113 | +The series as opened is 575 folds into 338 files. On it the two listings are equal: 53,802 named constants, none missing, none with another type or value; the first pull request's twelve folds were checked alone and are equal too. The whole tree goes from 54.73 T instructions over 2,587 files to 50.97 T over 2,012 (−6.9%), in place of the figures at the top of this page. | |
| 114 | + | |
| 115 | +What the listing does not show: that two terms with different hashes mean different things (the twelve were read one by one), or anything about proofs, which are not listed. | |
+30 −11 docs/s5-folding/fold.py View file
| @@ -111,11 +111,21 @@ def plan(src, small, cap, skip=()): | ||
| 111 | 111 | return {a: p for a, p in parts.items() if len(p) > 1} |
| 112 | 112 | |
| 113 | 113 | |
| 114 | -def folded(src, host, parts): | |
| 115 | - """the host's new text""" | |
| 114 | +def folded(src, host, parts, inplace=False): | |
| 115 | + """the host's new text. `inplace`: a folded module's import line is replaced, where it stood, by that module's own | |
| 116 | + imports, so that every other module is loaded in the order it was loaded before (Lean breaks ties between instances | |
| 117 | + by that order); otherwise the folded modules' imports come after the host's own.""" | |
| 116 | 118 | head, mods, body = split(src[host]) |
| 117 | - inside = {module(p) for p in parts} | |
| 118 | - new = [m for m in mods if m not in inside] | |
| 119 | + inside = {module(p): p for p in parts[:-1]} | |
| 120 | + if inplace: | |
| 121 | + new = [] | |
| 122 | + def take(ms): | |
| 123 | + for m in ms: | |
| 124 | + if m in inside: take(split(src[inside[m]])[1]) | |
| 125 | + elif m not in new: new.append(m) | |
| 126 | + take(mods) | |
| 127 | + else: | |
| 128 | + new = [m for m in mods if m not in inside] | |
| 119 | 129 | out_parts = [] |
| 120 | 130 | for p in parts[:-1]: |
| 121 | 131 | h, pm, pb = split(src[p]) |
| @@ -141,10 +151,16 @@ def folded(src, host, parts): | ||
| 141 | 151 | return "\n".join(out + body) |
| 142 | 152 | |
| 143 | 153 | |
| 144 | -def apply(tree, pl): | |
| 154 | +def load(path): | |
| 155 | + """(the folds, whether imports go in place) of a plan file; the first plans were a bare table of folds""" | |
| 156 | + d = json.load(open(path)) | |
| 157 | + return (d["folds"], d.get("imports") == "in place") if "folds" in d else (d, False) | |
| 158 | + | |
| 159 | + | |
| 160 | +def apply(tree, pl, inplace=False): | |
| 145 | 161 | src = read_tree(tree) |
| 146 | 162 | for host, parts in pl.items(): |
| 147 | - text = folded(src, host, parts) | |
| 163 | + text = folded(src, host, parts, inplace) | |
| 148 | 164 | # every line of every folded file and of the host is still there (imports aside) |
| 149 | 165 | want = collections.Counter(l for p in parts for l in (lambda s: s[0] + s[2])(split(src[p])) if l.strip()) |
| 150 | 166 | have = collections.Counter(l for l in text.split("\n") if l.strip() and not IMPORT.match(l)) |
| @@ -153,12 +169,12 @@ def apply(tree, pl): | ||
| 153 | 169 | for p in parts[:-1]: os.remove(os.path.join(tree, p)) |
| 154 | 170 | |
| 155 | 171 | |
| 156 | -def check(repo, pl, rev): | |
| 172 | +def check(repo, pl, rev, inplace=False): | |
| 157 | 173 | """the working tree against what `apply` makes of the revision's text: every changed file, byte for byte""" |
| 158 | 174 | show = lambda f: subprocess.run(["git", "-C", repo, "show", f"{rev}:{f}"], capture_output=True, text=True, check=True).stdout |
| 159 | 175 | bad = [] |
| 160 | 176 | for host, parts in pl.items(): |
| 161 | - want = folded({p: show(p) for p in parts}, host, parts) | |
| 177 | + want = folded({p: show(p) for p in parts}, host, parts, inplace) | |
| 162 | 178 | path = os.path.join(repo, host) |
| 163 | 179 | if not os.path.exists(path) or open(path, encoding="utf-8").read() != want: bad.append(f"{host} is not {rev}'s text folded") |
| 164 | 180 | bad += [f"{p} is still there" for p in parts[:-1] if os.path.exists(os.path.join(repo, p))] |
| @@ -178,6 +194,9 @@ def self_test(): | ||
| 178 | 194 | assert t.startswith("import Mathlib.X\nimport Euler.Bar\nimport Mathlib.Y\n\n/-! # A -/\n"), t |
| 179 | 195 | assert "end Euler.B\nend\n\nend\n" in t and t.index("theorem c") < t.index("theorem b") < t.index("theorem a"), t |
| 180 | 196 | assert unclosed(src["Euler/FooB.lean"].split("\n")) == [("section", ""), ("namespace", "Euler.B")] |
| 197 | + t2 = folded(src, "Euler/FooA.lean", pl["Euler/FooA.lean"], inplace=True) | |
| 198 | + assert t2.startswith("import Mathlib.X\nimport Mathlib.Y\nimport Euler.Bar\n\n/-! # A -/\n"), t2 | |
| 199 | + assert t2.split("\n\n", 1)[1] == t.split("\n\n", 1)[1] | |
| 181 | 200 | assert plan(src, 100, 1000, skip={"Euler/FooB.lean"}) == {} |
| 182 | 201 | assert plan(src, 2, 1000) == {}, plan(src, 2, 1000) |
| 183 | 202 | print("ok") |
| @@ -191,10 +210,10 @@ if __name__ == "__main__": | ||
| 191 | 210 | src = read_tree(a[1]) |
| 192 | 211 | skip = set(open(opt("--skip", "")).read().split()) if "--skip" in a else set() |
| 193 | 212 | pl = plan(src, int(opt("--small", 200)), int(opt("--cap", 600)), skip) |
| 194 | - json.dump(pl, open(a[2], "w"), indent=0) | |
| 213 | + json.dump({"imports": "in place", "folds": pl}, open(a[2], "w"), indent=0) | |
| 195 | 214 | n = sum(len(p) - 1 for p in pl.values()) |
| 196 | 215 | print(f"folds: {n} modules into {len(pl)} files in {len({fam(h) for h in pl})} families; largest file after: {max((sum(src[p].count(chr(10)) for p in ps), h) for h, ps in pl.items()) if pl else None}") |
| 197 | 216 | elif a[0] == "check": |
| 198 | - sys.exit(check(a[1], json.load(open(a[2])), a[3] if len(a) > 3 else "origin/main")) | |
| 217 | + pl, inplace = load(a[2]); sys.exit(check(a[1], pl, a[3] if len(a) > 3 else "origin/main", inplace)) | |
| 199 | 218 | elif a[0] == "apply": |
| 200 | - pl = json.load(open(a[2])); apply(a[1], pl); print("applied", sum(len(p) - 1 for p in pl.values()), "folds") | |
| 219 | + pl, inplace = load(a[2]); apply(a[1], pl, inplace); print("applied", sum(len(p) - 1 for p in pl.values()), "folds") | |
+20 −0 routes/s5-euler-regularized-1/README.md added View file
| @@ -0,0 +1,20 @@ | ||
| 1 | +--- | |
| 2 | +issue: 14 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | +# s5-euler-regularized-1 | |
| 6 | + | |
| 7 | +One unit of S-5 (fewer modules, as in Lean Pool's copy), the `Euler/Regularized*` family: fold 3 small modules into | |
| 8 | +the one file that imports each — `Euler/RegularizedForcingWord.lean` into `Euler/RegularizedEnergyFamily.lean`, and | |
| 9 | +`Euler/RegularizedWordEquation.lean` and `Euler/RegularizedWordConvergence.lean` into `Euler/RegularizedWordTime.lean`. | |
| 10 | +The text moves unchanged, under a heading that names where it came from and in a `section` of its own, before the | |
| 11 | +file's own text; the importer takes over the module's imports. No statement, proof or docstring changes. | |
| 12 | + | |
| 13 | +The tool `fold.py check` (brought in `docs/s5-folding/`) reproduces both files from `origin/main`'s text and compares | |
| 14 | +them byte for byte; the plan is `plan.json` here. | |
| 15 | + | |
| 16 | +## Next | |
| 17 | + | |
| 18 | +Open the pull request, then push more units of the series only once the maintainer has said the kind of change is | |
| 19 | +wanted. If a reviewer asks, the one file that may read worse folded is `Euler/RegularizedWordTime.lean` (a longer | |
| 20 | +single file); nothing was changed by hand. | |
+14 −0 routes/s5-euler-regularized-1/plan.json added View file
| @@ -0,0 +1,14 @@ | ||
| 1 | +{ | |
| 2 | +"imports": "in place", | |
| 3 | +"folds": { | |
| 4 | +"Euler/RegularizedEnergyFamily.lean": [ | |
| 5 | +"Euler/RegularizedForcingWord.lean", | |
| 6 | +"Euler/RegularizedEnergyFamily.lean" | |
| 7 | +], | |
| 8 | +"Euler/RegularizedWordTime.lean": [ | |
| 9 | +"Euler/RegularizedWordEquation.lean", | |
| 10 | +"Euler/RegularizedWordConvergence.lean", | |
| 11 | +"Euler/RegularizedWordTime.lean" | |
| 12 | +] | |
| 13 | +} | |
| 14 | +} | |