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

Comparing changes
Choose two branches to see what changed, then open a pull request to bring the work across.
Able to merge. These branches can be merged automatically.
A pull request is already open: #673 refactor(Euler/Correction): 6 small modules folded into the file that imports them (−16.3%, measured)
1 commit
+0 −78 Euler/CorrectionAssemblyCommon.lean deleted
| @@ -1,78 +0,0 @@ | ||
| 1 | -import Euler.CorrectionAssemblyCompatibility | |
| 2 | -import Euler.ClassicalDivergence | |
| 3 | -import Euler.SobolevJointEvaluation | |
| 4 | - | |
| 5 | -/-! A common actual smooth lifted correction assembled from finite solves and proved uniqueness. -/ | |
| 6 | - | |
| 7 | -noncomputable section | |
| 8 | - | |
| 9 | -namespace EulerCorrectionAssembly | |
| 10 | - | |
| 11 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 12 | - EulerSpatialSobolevInverse EulerCorrectionOperators EulerAllOrderCorrectionData | |
| 13 | - EulerVolterraConvolution EulerMetricTransport EulerTransportDerivatives | |
| 14 | - EulerSmoothPressureRepresentative EulerClassicalDivergence EulerSobolevPointEvaluation | |
| 15 | - EulerSobolevJointEvaluation | |
| 16 | -open scoped ContDiff | |
| 17 | - | |
| 18 | -variable (period : ℝ) [Fact (0 < period)] | |
| 19 | -variable {T : ℝ} {hT : 0 < T} {A : Data period T} | |
| 20 | - | |
| 21 | -/-- The actual common continuous L² path, defined from the base finite correction. -/ | |
| 22 | -def FiniteFamily.commonPath (F : FiniteFamily period hT A) : C(Icc (0 : ℝ) T, LiftL2 period) := | |
| 23 | - (valueOperator period 7).compLeftContinuous ℝ (Icc (0 : ℝ) T) (F.solution 6 le_rfl) | |
| 24 | - | |
| 25 | -/-- Every supplied finite correction realizes the common actual L² path. -/ | |
| 26 | -theorem FiniteFamily.value_common (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 27 | - (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 28 | - value period (F.solution q hq t) = F.commonPath period t := | |
| 29 | - F.value_base period C q hq t | |
| 30 | - | |
| 31 | -/-- The common correction has zero initial trace. -/ | |
| 32 | -theorem FiniteFamily.commonPath_initial (F : FiniteFamily period hT A) : | |
| 33 | - F.commonPath period ⟨0, le_rfl, hT.le⟩ = 0 := by | |
| 34 | - change value period (F.solution 6 le_rfl ⟨0, le_rfl, hT.le⟩) = 0 | |
| 35 | - rw [F.initial] | |
| 36 | - rfl | |
| 37 | - | |
| 38 | -/-- The common correction satisfies the actual closed lifted divergence constraint. -/ | |
| 39 | -theorem FiniteFamily.commonPath_divergence (F : FiniteFamily period hT A) (t : Icc (0 : ℝ) T) : | |
| 40 | - F.commonPath period t ∈ divergenceFreeSpace period A.κ A.direction := | |
| 41 | - F.divergence 6 le_rfl t | |
| 42 | - | |
| 43 | -/-- The common correction has an actual strong spatial jet at every derivative order. -/ | |
| 44 | -def FiniteFamily.commonJet (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 45 | - (n : ℕ) (t : Icc (0 : ℝ) T) : SpatialJet period standardDirection n (F.commonPath period t) := by | |
| 46 | - rw [← F.value_common period C (n+6) (by omega) t] | |
| 47 | - exact EulerH6Pressure.SpatialJet.restrict | |
| 48 | - (toJet period (F.solution (n+6) (by omega) t)) n (by omega) | |
| 49 | - | |
| 50 | -/-- Bounded H3 evaluation fixes a canonical actual pointwise representative of the common correction. -/ | |
| 51 | -def FiniteFamily.pointField (F : FiniteFamily period hT A) | |
| 52 | - (t : Icc (0 : ℝ) T) (x : LiftDomain period) : Vector3 := | |
| 53 | - pointEvaluation period x (restrictOperator period (by omega : 3 ≤ 7) (F.solution 6 le_rfl t)) | |
| 54 | - | |
| 55 | -/-- The canonical common field is an actual representative of its L² path. -/ | |
| 56 | -theorem FiniteFamily.pointField_ae (F : FiniteFamily period hT A) (t : Icc (0 : ℝ) T) : | |
| 57 | - (F.commonPath period t : LiftDomain period → Vector3) =ᵐ[liftMeasure period] F.pointField period t := | |
| 58 | - representative_ae period (restrictOperator period (by omega : 3 ≤ 7) (F.solution 6 le_rfl t)) | |
| 59 | - | |
| 60 | -/-- The canonical common field is jointly continuous in time and the cylinder point. -/ | |
| 61 | -theorem FiniteFamily.pointField_joint_continuous (F : FiniteFamily period hT A) : | |
| 62 | - Continuous (F.pointField period).uncurry := | |
| 63 | - path_representative_joint_continuous period | |
| 64 | - ((restrictOperator period (by omega : 3 ≤ 7)).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 65 | - (F.solution 6 le_rfl)) | |
| 66 | - | |
| 67 | -/-- Proved compatibility and all finite genuine jets make the canonical common field spatially smooth. -/ | |
| 68 | -theorem FiniteFamily.pointField_smooth (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 69 | - (t : Icc (0 : ℝ) T) (x : LiftDomain period) : | |
| 70 | - ContDiff ℝ ∞ (localFieldLift period (F.pointField period t) x) := by | |
| 71 | - obtain ⟨g, hg, ha⟩ := exists_smooth_representative period (F.commonPath period t) | |
| 72 | - (fun n => F.commonJet period C n t) | |
| 73 | - have he : F.pointField period t = g := | |
| 74 | - representative_eq period _ g (smoothField_continuous period g hg) ha | |
| 75 | - rw [he] | |
| 76 | - exact hg x | |
| 77 | - | |
| 78 | -end EulerCorrectionAssembly | |
+0 −57 Euler/CorrectionAssemblyCompatibility.lean deleted
| @@ -1,57 +0,0 @@ | ||
| 1 | -import Euler.CorrectionAssemblyData | |
| 2 | - | |
| 3 | -/-! Compatibility of independently supplied actual finite-order corrections, proved from their equations. -/ | |
| 4 | - | |
| 5 | -noncomputable section | |
| 6 | - | |
| 7 | -namespace EulerCorrectionAssembly | |
| 8 | - | |
| 9 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace | |
| 10 | - EulerCorrectionOperators EulerCorrectionLowerData EulerAllOrderCorrectionData | |
| 11 | - EulerCorrectionStabilityBudget EulerInviscidCorrectionCompatibility | |
| 12 | - EulerInviscidCorrectionUniqueness EulerVolterraConvolution | |
| 13 | - | |
| 14 | -variable (period : ℝ) [Fact (0 < period)] | |
| 15 | -variable {T : ℝ} {hT : 0 < T} {A : Data period T} | |
| 16 | - | |
| 17 | -/-- Adjacent supplied finite corrections coincide after restriction, by actual inviscid uniqueness. -/ | |
| 18 | -theorem FiniteFamily.compatible (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 19 | - (q : ℕ) (hq : 6 ≤ q) : | |
| 20 | - (truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 21 | - (F.solution (q+1) (hq.trans (Nat.le_succ q))) = F.solution q hq := by | |
| 22 | - have hs : StabilityBudget period hT.le | |
| 23 | - (lowerData period (A.atOrder period (q+1)) (A.metric.jet q) (A.linear.jet q) | |
| 24 | - (fun i => (A.quadratic i).jet q) (A.metric.continuous q) (A.linear.continuous q) | |
| 25 | - (fun i => (A.quadratic i).continuous q)) := by | |
| 26 | - rw [A.lower_atOrder period q] | |
| 27 | - exact C.stabilityBudget period q | |
| 28 | - apply inviscid_corrections_compatible period hq T hT.le (A.atOrder period (q+1)) | |
| 29 | - (A.metric.jet q) (A.linear.jet q) (fun i => (A.quadratic i).jet q) | |
| 30 | - (A.metric.continuous q) (A.linear.continuous q) (fun i => (A.quadratic i).continuous q) | |
| 31 | - (F.solution (q+1) (hq.trans (Nat.le_succ q))) | |
| 32 | - (F.equation (q+1) (hq.trans (Nat.le_succ q))) hs (F.solution q hq) | |
| 33 | - · simpa only [A.lower_atOrder period q] using F.equation q hq | |
| 34 | - · rw [F.initial, F.initial, map_zero] | |
| 35 | - · intro t | |
| 36 | - change value period (A.approximation.realization ((q+1)+1) t) ∈ _ | |
| 37 | - rw [A.approximation.value_eq] | |
| 38 | - exact C.divergence t | |
| 39 | - · exact F.divergence (q+1) (hq.trans (Nat.le_succ q)) | |
| 40 | - · exact F.divergence q hq | |
| 41 | - | |
| 42 | -/-- Adjacent actual finite corrections have the same underlying L² field. -/ | |
| 43 | -theorem FiniteFamily.value_succ (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 44 | - (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 45 | - value period (F.solution (q+1) (hq.trans (Nat.le_succ q)) t) = | |
| 46 | - value period (F.solution q hq t) := | |
| 47 | - congrArg (fun f => value period (f t)) (F.compatible period C q hq) | |
| 48 | - | |
| 49 | -/-- All supplied finite corrections have the same actual base L² field. -/ | |
| 50 | -theorem FiniteFamily.value_base (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 51 | - (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 52 | - value period (F.solution q hq t) = value period (F.solution 6 le_rfl t) := by | |
| 53 | - exact Nat.le_induction (P := fun n hn => value period (F.solution n hn t) = | |
| 54 | - value period (F.solution 6 le_rfl t)) rfl | |
| 55 | - (fun n hn ih => (F.value_succ period C n hn t).trans ih) q hq | |
| 56 | - | |
| 57 | -end EulerCorrectionAssembly | |
+152 −1 Euler/CorrectionAssemblyPressure.lean View file
| @@ -1,8 +1,159 @@ | ||
| 1 | -import Euler.CorrectionAssemblyCommon | |
| 1 | +import Euler.CorrectionAssemblyData | |
| 2 | +import Euler.ClassicalDivergence | |
| 3 | +import Euler.SobolevJointEvaluation | |
| 2 | 4 | import Euler.CorrectionSourceRestriction |
| 3 | 5 | |
| 4 | 6 | /-! Coherence and all-order regularity of the actual pressure associated with a finite correction family. -/ |
| 5 | 7 | |
| 8 | +/-! ## From `Euler/CorrectionAssemblyCompatibility.lean` | |
| 9 | + | |
| 10 | +The text of `Euler/CorrectionAssemblyCompatibility.lean`, folded into this file, which was its only importer. -/ | |
| 11 | + | |
| 12 | +section | |
| 13 | + | |
| 14 | +/-! Compatibility of independently supplied actual finite-order corrections, proved from their equations. -/ | |
| 15 | + | |
| 16 | +noncomputable section | |
| 17 | + | |
| 18 | +namespace EulerCorrectionAssembly | |
| 19 | + | |
| 20 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace | |
| 21 | + EulerCorrectionOperators EulerCorrectionLowerData EulerAllOrderCorrectionData | |
| 22 | + EulerCorrectionStabilityBudget EulerInviscidCorrectionCompatibility | |
| 23 | + EulerInviscidCorrectionUniqueness EulerVolterraConvolution | |
| 24 | + | |
| 25 | +variable (period : ℝ) [Fact (0 < period)] | |
| 26 | +variable {T : ℝ} {hT : 0 < T} {A : Data period T} | |
| 27 | + | |
| 28 | +/-- Adjacent supplied finite corrections coincide after restriction, by actual inviscid uniqueness. -/ | |
| 29 | +theorem FiniteFamily.compatible (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 30 | + (q : ℕ) (hq : 6 ≤ q) : | |
| 31 | + (truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 32 | + (F.solution (q+1) (hq.trans (Nat.le_succ q))) = F.solution q hq := by | |
| 33 | + have hs : StabilityBudget period hT.le | |
| 34 | + (lowerData period (A.atOrder period (q+1)) (A.metric.jet q) (A.linear.jet q) | |
| 35 | + (fun i => (A.quadratic i).jet q) (A.metric.continuous q) (A.linear.continuous q) | |
| 36 | + (fun i => (A.quadratic i).continuous q)) := by | |
| 37 | + rw [A.lower_atOrder period q] | |
| 38 | + exact C.stabilityBudget period q | |
| 39 | + apply inviscid_corrections_compatible period hq T hT.le (A.atOrder period (q+1)) | |
| 40 | + (A.metric.jet q) (A.linear.jet q) (fun i => (A.quadratic i).jet q) | |
| 41 | + (A.metric.continuous q) (A.linear.continuous q) (fun i => (A.quadratic i).continuous q) | |
| 42 | + (F.solution (q+1) (hq.trans (Nat.le_succ q))) | |
| 43 | + (F.equation (q+1) (hq.trans (Nat.le_succ q))) hs (F.solution q hq) | |
| 44 | + · simpa only [A.lower_atOrder period q] using F.equation q hq | |
| 45 | + · rw [F.initial, F.initial, map_zero] | |
| 46 | + · intro t | |
| 47 | + change value period (A.approximation.realization ((q+1)+1) t) ∈ _ | |
| 48 | + rw [A.approximation.value_eq] | |
| 49 | + exact C.divergence t | |
| 50 | + · exact F.divergence (q+1) (hq.trans (Nat.le_succ q)) | |
| 51 | + · exact F.divergence q hq | |
| 52 | + | |
| 53 | +/-- Adjacent actual finite corrections have the same underlying L² field. -/ | |
| 54 | +theorem FiniteFamily.value_succ (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 55 | + (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 56 | + value period (F.solution (q+1) (hq.trans (Nat.le_succ q)) t) = | |
| 57 | + value period (F.solution q hq t) := | |
| 58 | + congrArg (fun f => value period (f t)) (F.compatible period C q hq) | |
| 59 | + | |
| 60 | +/-- All supplied finite corrections have the same actual base L² field. -/ | |
| 61 | +theorem FiniteFamily.value_base (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 62 | + (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 63 | + value period (F.solution q hq t) = value period (F.solution 6 le_rfl t) := by | |
| 64 | + exact Nat.le_induction (P := fun n hn => value period (F.solution n hn t) = | |
| 65 | + value period (F.solution 6 le_rfl t)) rfl | |
| 66 | + (fun n hn ih => (F.value_succ period C n hn t).trans ih) q hq | |
| 67 | + | |
| 68 | +end EulerCorrectionAssembly | |
| 69 | +end | |
| 70 | + | |
| 71 | +end | |
| 72 | + | |
| 73 | +/-! ## From `Euler/CorrectionAssemblyCommon.lean` | |
| 74 | + | |
| 75 | +The text of `Euler/CorrectionAssemblyCommon.lean`, folded into this file, which was its only importer. -/ | |
| 76 | + | |
| 77 | +section | |
| 78 | + | |
| 79 | +/-! A common actual smooth lifted correction assembled from finite solves and proved uniqueness. -/ | |
| 80 | + | |
| 81 | +noncomputable section | |
| 82 | + | |
| 83 | +namespace EulerCorrectionAssembly | |
| 84 | + | |
| 85 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 86 | + EulerSpatialSobolevInverse EulerCorrectionOperators EulerAllOrderCorrectionData | |
| 87 | + EulerVolterraConvolution EulerMetricTransport EulerTransportDerivatives | |
| 88 | + EulerSmoothPressureRepresentative EulerClassicalDivergence EulerSobolevPointEvaluation | |
| 89 | + EulerSobolevJointEvaluation | |
| 90 | +open scoped ContDiff | |
| 91 | + | |
| 92 | +variable (period : ℝ) [Fact (0 < period)] | |
| 93 | +variable {T : ℝ} {hT : 0 < T} {A : Data period T} | |
| 94 | + | |
| 95 | +/-- The actual common continuous L² path, defined from the base finite correction. -/ | |
| 96 | +def FiniteFamily.commonPath (F : FiniteFamily period hT A) : C(Icc (0 : ℝ) T, LiftL2 period) := | |
| 97 | + (valueOperator period 7).compLeftContinuous ℝ (Icc (0 : ℝ) T) (F.solution 6 le_rfl) | |
| 98 | + | |
| 99 | +/-- Every supplied finite correction realizes the common actual L² path. -/ | |
| 100 | +theorem FiniteFamily.value_common (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 101 | + (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : | |
| 102 | + value period (F.solution q hq t) = F.commonPath period t := | |
| 103 | + F.value_base period C q hq t | |
| 104 | + | |
| 105 | +/-- The common correction has zero initial trace. -/ | |
| 106 | +theorem FiniteFamily.commonPath_initial (F : FiniteFamily period hT A) : | |
| 107 | + F.commonPath period ⟨0, le_rfl, hT.le⟩ = 0 := by | |
| 108 | + change value period (F.solution 6 le_rfl ⟨0, le_rfl, hT.le⟩) = 0 | |
| 109 | + rw [F.initial] | |
| 110 | + rfl | |
| 111 | + | |
| 112 | +/-- The common correction satisfies the actual closed lifted divergence constraint. -/ | |
| 113 | +theorem FiniteFamily.commonPath_divergence (F : FiniteFamily period hT A) (t : Icc (0 : ℝ) T) : | |
| 114 | + F.commonPath period t ∈ divergenceFreeSpace period A.κ A.direction := | |
| 115 | + F.divergence 6 le_rfl t | |
| 116 | + | |
| 117 | +/-- The common correction has an actual strong spatial jet at every derivative order. -/ | |
| 118 | +def FiniteFamily.commonJet (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 119 | + (n : ℕ) (t : Icc (0 : ℝ) T) : SpatialJet period standardDirection n (F.commonPath period t) := by | |
| 120 | + rw [← F.value_common period C (n+6) (by omega) t] | |
| 121 | + exact EulerH6Pressure.SpatialJet.restrict | |
| 122 | + (toJet period (F.solution (n+6) (by omega) t)) n (by omega) | |
| 123 | + | |
| 124 | +/-- Bounded H3 evaluation fixes a canonical actual pointwise representative of the common correction. -/ | |
| 125 | +def FiniteFamily.pointField (F : FiniteFamily period hT A) | |
| 126 | + (t : Icc (0 : ℝ) T) (x : LiftDomain period) : Vector3 := | |
| 127 | + pointEvaluation period x (restrictOperator period (by omega : 3 ≤ 7) (F.solution 6 le_rfl t)) | |
| 128 | + | |
| 129 | +/-- The canonical common field is an actual representative of its L² path. -/ | |
| 130 | +theorem FiniteFamily.pointField_ae (F : FiniteFamily period hT A) (t : Icc (0 : ℝ) T) : | |
| 131 | + (F.commonPath period t : LiftDomain period → Vector3) =ᵐ[liftMeasure period] F.pointField period t := | |
| 132 | + representative_ae period (restrictOperator period (by omega : 3 ≤ 7) (F.solution 6 le_rfl t)) | |
| 133 | + | |
| 134 | +/-- The canonical common field is jointly continuous in time and the cylinder point. -/ | |
| 135 | +theorem FiniteFamily.pointField_joint_continuous (F : FiniteFamily period hT A) : | |
| 136 | + Continuous (F.pointField period).uncurry := | |
| 137 | + path_representative_joint_continuous period | |
| 138 | + ((restrictOperator period (by omega : 3 ≤ 7)).compLeftContinuous ℝ (Icc (0 : ℝ) T) | |
| 139 | + (F.solution 6 le_rfl)) | |
| 140 | + | |
| 141 | +/-- Proved compatibility and all finite genuine jets make the canonical common field spatially smooth. -/ | |
| 142 | +theorem FiniteFamily.pointField_smooth (F : FiniteFamily period hT A) (C : ComparisonData period hT A) | |
| 143 | + (t : Icc (0 : ℝ) T) (x : LiftDomain period) : | |
| 144 | + ContDiff ℝ ∞ (localFieldLift period (F.pointField period t) x) := by | |
| 145 | + obtain ⟨g, hg, ha⟩ := exists_smooth_representative period (F.commonPath period t) | |
| 146 | + (fun n => F.commonJet period C n t) | |
| 147 | + have he : F.pointField period t = g := | |
| 148 | + representative_eq period _ g (smoothField_continuous period g hg) ha | |
| 149 | + rw [he] | |
| 150 | + exact hg x | |
| 151 | + | |
| 152 | +end EulerCorrectionAssembly | |
| 153 | +end | |
| 154 | + | |
| 155 | +end | |
| 156 | + | |
| 6 | 157 | noncomputable section |
| 7 | 158 | |
| 8 | 159 | namespace EulerCorrectionAssembly |
+0 −126 Euler/CorrectionDifferenceMetric.lean deleted
| @@ -1,126 +0,0 @@ | ||
| 1 | -import Euler.CorrectionDifferencePDE | |
| 2 | -import Euler.SobolevDifferenceEnergy | |
| 3 | - | |
| 4 | -/-! The actual nonlinear viscosity-difference PDE implies a fixed squared metric energy inequality. -/ | |
| 5 | - | |
| 6 | -noncomputable section | |
| 7 | - | |
| 8 | -namespace EulerCorrectionDifferenceMetric | |
| 9 | - | |
| 10 | -open MeasureTheory Set InnerProductSpace EulerLiftedGradientSpace EulerLiftedPressure | |
| 11 | - EulerSpatialSobolevInverse EulerCylinderSobolevSpace EulerCorrectionOperators EulerCorrectionDifference | |
| 12 | - EulerCorrectionDifferencePDE EulerCorrectionStabilityConstants EulerSobolevTransport | |
| 13 | - EulerSobolevMetricTransport EulerSobolevHeatGenerator EulerMetricHeatEnergy EulerSobolevL2Product | |
| 14 | - EulerSquaredMetricStability EulerSobolevDifferenceEnergy | |
| 15 | -open scoped Topology | |
| 16 | - | |
| 17 | -variable (period : ℝ) [Fact (0 < period)] | |
| 18 | - | |
| 19 | -/-- The existing Sobolev normed-group instance for the literal metric difference equation. -/ | |
| 20 | -local instance metricSobolevGroup (q : ℕ) : NormedAddCommGroup (SobolevSpace period q) := inferInstance | |
| 21 | -/-- The existing real Sobolev module instance for the literal metric difference equation. -/ | |
| 22 | -local instance metricSobolevSpace (q : ℕ) : NormedSpace ℝ (SobolevSpace period q) := inferInstance | |
| 23 | - | |
| 24 | -/-- The actual correction-difference PDE gives the quantitative squared L² metric bound, with no assumed energy inequality. -/ | |
| 25 | -theorem difference_metric_deriv_bound {q : ℕ} {T : Type*} [TopologicalSpace T] | |
| 26 | - (D : CorrectionData period q T) (hq : 6 ≤ q) (τ : T) | |
| 27 | - (u v : SobolevSpace period (q+1)) (A : SmoothCoefficient period) | |
| 28 | - (K : ℝ → LiftL2 period →L[ℝ] LiftL2 period) (e : ℝ → LiftL2 period) | |
| 29 | - (t ν μ c Kb Kx Kt A0 A2 Z R : ℝ) (K' : LiftL2 period →L[ℝ] LiftL2 period) | |
| 30 | - (hc : 0 < c) (hν : 0 ≤ ν) (hν1 : ν ≤ 1) | |
| 31 | - (hKv : K t=A.operator) (hev : e t=value period (u-v)) | |
| 32 | - (hK : HasDerivAt K K' t) (he : HasDerivAt e (differenceRhs period D hq ν μ τ u v) t) | |
| 33 | - (hKb : ‖A.operator‖ ≤ Kb) (hKx : (A.firstBound : ℝ) ≤ Kx) (hKt : ‖K'‖ ≤ Kt) | |
| 34 | - (hA0 : ((D.linear.coefficient τ).bound : ℝ) ≤ A0) | |
| 35 | - (hA2 : (∑ i : Fin 3, (((D.quadratic i).coefficient τ).bound : ℝ)) ≤ A2) | |
| 36 | - (hZ : ‖D.approximation τ‖ ≤ Z) (hu : ‖u‖ ≤ R) (hv : ‖v‖ ≤ R) | |
| 37 | - (hsym : ∀ x a b, ⟪A.coefficient x a,b⟫_ℝ=⟪a,A.coefficient x b⟫_ℝ) | |
| 38 | - (hpos : ∀ x a, c^2*‖a‖^2 ≤ ⟪A.coefficient x a,a⟫_ℝ) | |
| 39 | - (hinv : ∀ x a, A.coefficient x ((D.metric.coefficient τ).coefficient x a)=a) | |
| 40 | - (hz : value period (D.approximation τ) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 41 | - (hud : value period u ∈ divergenceFreeSpace period D.κ D.direction) | |
| 42 | - (hvd : value period v ∈ divergenceFreeSpace period D.κ D.direction) : | |
| 43 | - deriv (fun s => ⟪K s (e s),e s⟫_ℝ) t ≤ | |
| 44 | - growthConstant c Kb Kx Kt (velocityBound period q Z R) (lowerConstant period q A0 A2 Z R)* | |
| 45 | - ⟪K t (e t),e t⟫_ℝ+defectConstant Kb R*|ν-μ|^2 := by | |
| 46 | - let d := u-v | |
| 47 | - let top := value period (transportBilinear period hq (velocityComponents D.κ D.direction) | |
| 48 | - (velocityComponents_norm D.κ D.direction D.scale_bound D.direction_bound) (D.approximation τ+u) d) | |
| 49 | - let p := value period (D.pressure period hq τ u)-value period (D.pressure period hq τ v) | |
| 50 | - let F := -value period (differenceRemainder period D hq τ u v)+ | |
| 51 | - (ν-μ) • laplacianEvaluation period (q+1) (by omega) v | |
| 52 | - let L := lowerConstant period q A0 A2 Z R | |
| 53 | - let V := velocityBound period q Z R | |
| 54 | - have hr0 := (norm_nonneg u).trans hu | |
| 55 | - have hz0 := (norm_nonneg (D.approximation τ)).trans hZ | |
| 56 | - have ha00 := (D.linear.coefficient τ).bound.coe_nonneg.trans hA0 | |
| 57 | - have ha20 := (Finset.sum_nonneg (fun i _ => ((D.quadratic i).coefficient τ).bound.coe_nonneg)).trans hA2 | |
| 58 | - have hL : 0 ≤ L := lowerConstant_nonneg period q A0 A2 Z R ha00 ha20 hz0 hr0 | |
| 59 | - have hV : 0 ≤ V := velocityBound_nonneg period q Z R hz0 hr0 | |
| 60 | - have hkx0 := A.firstBound.coe_nonneg.trans hKx | |
| 61 | - have hkb0 := (norm_nonneg A.operator).trans hKb | |
| 62 | - have hkt0 := (norm_nonneg K').trans hKt | |
| 63 | - have heq : differenceRhs period D hq ν μ τ u v+top+(D.metric.coefficient τ).operator p = | |
| 64 | - F+ν • laplacianEvaluation period (q+1) (by omega) d := by | |
| 65 | - dsimp only [differenceRhs,p,F,d] | |
| 66 | - abel | |
| 67 | - have hdiv : value period d ∈ divergenceFreeSpace period D.κ D.direction := | |
| 68 | - (divergenceFreeSpace period D.κ D.direction).sub_mem hud hvd | |
| 69 | - have hpgrad : p ∈ gradientSpace period D.κ D.direction := | |
| 70 | - (gradientSpace period D.κ D.direction).sub_mem (D.pressure_mem_gradient period hq τ u) | |
| 71 | - (D.pressure_mem_gradient period hq τ v) | |
| 72 | - have hp : ⟪K t (e t),(D.metric.coefficient τ).operator p⟫_ℝ=0 := by | |
| 73 | - rw [hKv,hev] | |
| 74 | - exact metric_pressure_cancellation period D.κ D.direction A.coefficient (D.metric.coefficient τ).coefficient | |
| 75 | - A.measurable (D.metric.coefficient τ).measurable A.bound (D.metric.coefficient τ).bound | |
| 76 | - A.norm_bound (D.metric.coefficient τ).norm_bound hsym hinv hdiv hpgrad | |
| 77 | - have ht : |⟪K t (e t),top⟫_ℝ| ≤ (Kx*V)*‖e t‖^2 := by | |
| 78 | - rw [hKv,hev] | |
| 79 | - exact difference_transport_bound period D hq τ A u v Kx Z R hKx hZ hu hsym hz hud | |
| 80 | - have hheat : ⟪K t (e t),laplacianEvaluation period (q+1) (by omega) d⟫_ℝ ≤ | |
| 81 | - (2*Kx^2/c^2)*‖e t‖^2 := by | |
| 82 | - rw [hKv,hev] | |
| 83 | - exact difference_heat_bound period (by omega : 2 ≤ q+1) A d c Kx hc hKx hpos | |
| 84 | - have hforce : ‖F‖ ≤ L*‖e t‖+|ν-μ| *(4*R) := by | |
| 85 | - rw [hev] | |
| 86 | - have hrem := differenceRemainder_uniform period D hq τ u v A0 A2 Z R hA0 hA2 hZ hu hv | |
| 87 | - have hlap := (laplacianEvaluation_bound period (by omega : 2 ≤ q+1) v).trans | |
| 88 | - (mul_le_mul_of_nonneg_left hv (by norm_num : (0 : ℝ) ≤ 4)) | |
| 89 | - have hh := norm_add_le (-value period (differenceRemainder period D hq τ u v)) | |
| 90 | - ((ν-μ) • laplacianEvaluation period (q+1) (by omega) v) | |
| 91 | - rw [norm_neg,norm_smul,Real.norm_eq_abs] at hh | |
| 92 | - exact hh.trans (add_le_add hrem (mul_le_mul_of_nonneg_left hlap (abs_nonneg _))) | |
| 93 | - have hcoer : c^2*‖e t‖^2 ≤ ⟪K t (e t),e t⟫_ℝ := by | |
| 94 | - rw [hKv] | |
| 95 | - exact coefficientOperator_coercive A.coefficient A.measurable A.bound A.norm_bound (c^2) hpos (e t) | |
| 96 | - have hsymL : ∀ a b, ⟪K t a,b⟫_ℝ=⟪a,K t b⟫_ℝ := by | |
| 97 | - rw [hKv] | |
| 98 | - exact coefficientOperator_inner_swap A.coefficient A.measurable A.bound A.norm_bound hsym | |
| 99 | - have hgen := metric_derivative_bound K e t ν c (Kx*V) (2*Kx^2/c^2) L |ν-μ| (4*R) K' | |
| 100 | - (differenceRhs period D hq ν μ τ u v) top ((D.metric.coefficient τ).operator p) F | |
| 101 | - (laplacianEvaluation period (q+1) (by omega) d) hc hν (mul_nonneg hkx0 hV) (by positivity) hL | |
| 102 | - hK he hsymL hcoer heq hp ht hheat hforce | |
| 103 | - have he0 : 0 ≤ ⟪K t (e t),e t⟫_ℝ := (mul_nonneg (sq_nonneg c) (sq_nonneg ‖e t‖)).trans hcoer | |
| 104 | - have hkn : ‖K t‖ ≤ Kb := by rw [hKv]; exact hKb | |
| 105 | - have hg : (‖K'‖+2*(Kx*V)+2*ν*(2*Kx^2/c^2)+2*‖K t‖*L+1)/c^2 ≤ | |
| 106 | - growthConstant c Kb Kx Kt V L := by | |
| 107 | - unfold growthConstant | |
| 108 | - apply div_le_div_of_nonneg_right _ (sq_nonneg c) | |
| 109 | - have hh : 2*ν*(2*Kx^2/c^2) ≤ 4*Kx^2/c^2 := by | |
| 110 | - calc | |
| 111 | - _ = ν*(4*Kx^2/c^2) := by ring | |
| 112 | - _ ≤ 1*(4*Kx^2/c^2) := mul_le_mul_of_nonneg_right hν1 (by positivity) | |
| 113 | - _ = _ := one_mul _ | |
| 114 | - have hk : 2*‖K t‖*L ≤ 2*Kb*L := by | |
| 115 | - have h := mul_le_mul_of_nonneg_right hkn (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hL) | |
| 116 | - linarith only [h] | |
| 117 | - have hsum := add_le_add (add_le_add (add_le_add hKt (le_refl (2*(Kx*V)))) hh) hk | |
| 118 | - exact (add_le_add hsum (le_refl 1)).trans_eq (by ring) | |
| 119 | - have hd : (‖K t‖*(4*R))^2 ≤ defectConstant Kb R := by | |
| 120 | - have h := mul_le_mul_of_nonneg_right hkn (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hr0) | |
| 121 | - exact pow_le_pow_left₀ (mul_nonneg (norm_nonneg (K t)) | |
| 122 | - (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hr0)) h 2 | |
| 123 | - exact hgen.trans (add_le_add (mul_le_mul_of_nonneg_right hg he0) | |
| 124 | - (mul_le_mul_of_nonneg_right hd (sq_nonneg _))) | |
| 125 | - | |
| 126 | -end EulerCorrectionDifferenceMetric | |
+93 −1 Euler/CorrectionEnergyScalar.lean View file
| @@ -1,8 +1,100 @@ | ||
| 1 | -import Euler.CorrectionMildEnergy | |
| 1 | +import Euler.CorrectionEnergyMajorants | |
| 2 | +import Euler.CorrectionEnergyRestriction | |
| 3 | +import Euler.MildMajorantEnergy | |
| 2 | 4 | import Euler.IntegralEnergyBootstrap |
| 3 | 5 | |
| 4 | 6 | /-! The actual correction energy right-hand side has the scalar shrinking-radius form, including its exact zero initial trace. -/ |
| 5 | 7 | |
| 8 | +/-! ## From `Euler/CorrectionMildEnergy.lean` | |
| 9 | + | |
| 10 | +The text of `Euler/CorrectionMildEnergy.lean`, folded into this file, which was its only importer. -/ | |
| 11 | + | |
| 12 | +section | |
| 13 | + | |
| 14 | +/-! Actual nonlinear correction mild solutions obey the full-order continuous scalar integral energy estimate. -/ | |
| 15 | + | |
| 16 | +noncomputable section | |
| 17 | + | |
| 18 | +namespace EulerCorrectionMildEnergy | |
| 19 | + | |
| 20 | +open MeasureTheory Set InnerProductSpace EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 21 | + EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 22 | + EulerCorrectionEnergyRestriction EulerCorrectionEnergyTime EulerCorrectionEnergyData EulerCorrectionEnergyMajorants | |
| 23 | + EulerEnergyMetricPaths EulerGevreyMetricEstimate EulerMildMajorantEnergy EulerEnergyWordCoordinates | |
| 24 | + EulerTimeLpSubintervalBound EulerTimeLp EulerVolterraConvolution EulerSobolevHeat EulerSobolevMaximalRegularity | |
| 25 | +open scoped Topology | |
| 26 | + | |
| 27 | +variable (period : ℝ) [Fact (0 < period)] | |
| 28 | + | |
| 29 | +/-- The actual continuous scalar right-hand side of the nonlinear correction energy estimate. -/ | |
| 30 | +def correctionRhs {q : ℕ} {T : ℝ} {hq : 6 ≤ q+1} | |
| 31 | + {D : CorrectionData period (q+1) (Icc (0 : ℝ) T)} {N : ℕ} {R : C(Icc (0 : ℝ) T, ℝ)} | |
| 32 | + (S : SpatialBudget period hq D N R) (hN : N+6 ≤ q+1) {hT : 0 ≤ T} (K : MetricBudget period T hT D) | |
| 33 | + (Rdot : C(Icc (0 : ℝ) T, ℝ)) (e : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : C(Icc (0 : ℝ) T, ℝ) := | |
| 34 | + scalarEnergyRhs T (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) | |
| 35 | + (ContinuousMap.const _ (K.multiplier period)) | |
| 36 | + (energyPath period N hN T R (K.operatorPath period) e) | |
| 37 | + (lossPath period N hN T R (K.operatorPath period) e) (forcingMajorant period S hN K e) | |
| 38 | + | |
| 39 | +/-- The actual nonlinear lower mild equation yields the full energy-order scalar integral bound on every subinterval. | |
| 40 | +Maximal regularity, the higher nonlinear source, the pressure, and their constraints are all constructed or proved inside the argument. -/ | |
| 41 | +theorem correction_mild_integral {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 42 | + (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 43 | + (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 44 | + (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 45 | + (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 46 | + (hGq : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 47 | + (hLq : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 48 | + (hQq : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 49 | + (hG : Continuous (fun t => (D.metric.coefficient t).operator)) | |
| 50 | + (N : ℕ) (hN : N+6 ≤ q+1) (R Rdot : C(Icc (0 : ℝ) T, ℝ)) | |
| 51 | + (S : SpatialBudget period (by omega : 6 ≤ q+1) D N R) (K : MetricBudget period T hT D) | |
| 52 | + (hRd : ∀ t ∈ Ioo 0 T, HasDerivAt (extendPath T hT R) (extendPath T hT Rdot t) t) | |
| 53 | + (ν : ℝ) (hν : 0 < ν) (hν1 : ν ≤ 1) (e₀ : SobolevSpace period (q+1)) | |
| 54 | + (e : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 55 | + (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 56 | + e t = heatOperator period (q+1) (2*ν*t.val).toNNReal e₀ + | |
| 57 | + ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r | |
| 58 | + (extendPath T hT (forcingPath period hq (lowerData period D KG KL KQ hGq hLq hQq) e) (t.val-r))) | |
| 59 | + (hz : ∀ t, value period (D.approximation t) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 60 | + (he : ∀ t, value period (e t) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 61 | + (s t : ℝ) (h0s : 0 ≤ s) (hst : s ≤ t) (htT : t ≤ T) : | |
| 62 | + energyPath period N hN T R (K.operatorPath period) e ⟨t,h0s.trans hst,htT⟩ - | |
| 63 | + energyPath period N hN T R (K.operatorPath period) e ⟨s,h0s,hst.trans htT⟩ ≤ | |
| 64 | + ∫ r in s..t, extendPath T hT (correctionRhs period S hN K Rdot e) r := by | |
| 65 | + let Dlow := lowerData period D KG KL KQ hGq hLq hQq | |
| 66 | + let f := forcingPath period hq Dlow e | |
| 67 | + let p := pressurePath period hq Dlow e | |
| 68 | + obtain ⟨U,hU⟩ := exists_maximal_mild_limit period ν hν T hT e₀ f e hsol | |
| 69 | + let F := sourceTime period (by omega : 6 ≤ q+1) T hT D e U | |
| 70 | + let P := signedPressureTime period (by omega : 6 ≤ q+1) T hT D e U | |
| 71 | + let X := energyPath period N hN T R (K.operatorPath period) e | |
| 72 | + let Y := lossPath period N hN T R (K.operatorPath period) e | |
| 73 | + let k : C(Icc (0 : ℝ) T, ℝ) := ContinuousMap.const _ (K.multiplier period) | |
| 74 | + have hF := sourceTime_restriction period hq T hT D KG KL KQ hGq hLq hQq e U hU | |
| 75 | + have hP := signedPressureTime_restriction period hq T hT D KG KL KQ hGq hLq hQq e U hU | |
| 76 | + have henergy := mild_majorized_energy_subinterval period (by omega : 3 ≤ q+1) T hT s t h0s hst htT | |
| 77 | + energyLength energyWord (energyLength_le hN) (fun I : EulerGevreyMetricComparison.ExternalWord N => I.1.val) | |
| 78 | + ν hν D.κ D.direction K.c K.c_pos R Rdot S.radius_pos hRd K.metric D.metric.coefficient | |
| 79 | + K.continuous hG K.derivative K.hasDeriv K.symmetric K.coercive K.inverse | |
| 80 | + (fun τ => metricVelocityBound period K.c S.B0 (X τ)) (velocityPath period D e) e e₀ f p hsol he | |
| 81 | + (pressurePath_gradient period hq Dlow e) | |
| 82 | + (velocity_divergenceFree period D e hz he) (velocity_bound period S hN K e) | |
| 83 | + U F P hU hF hP (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) k | |
| 84 | + (growthPath_bound period S hN K e ν hν1) (fun _ => rfl) | |
| 85 | + (fun τ => div_le_div_of_nonneg_right (K.bound_le τ) K.c_pos.le) | |
| 86 | + have hforce := forcingMajorant_bound period S hN K hG e U hU | |
| 87 | + have hk : ∀ τ, 0 ≤ k τ := fun _ => (K.constants_nonneg period S.B0 S.B0_nonneg).2.2 | |
| 88 | + exact scalar_rhs_subinterval T hT s t h0s hst htT | |
| 89 | + (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) k X Y | |
| 90 | + (forcingMajorant period S hN K e) hk | |
| 91 | + (weightedCorrectionForcing period (by omega : 6 ≤ q+1) T hT D hG N hN R e U) hforce henergy | |
| 92 | + | |
| 93 | +end EulerCorrectionMildEnergy | |
| 94 | +end | |
| 95 | + | |
| 96 | +end | |
| 97 | + | |
| 6 | 98 | noncomputable section |
| 7 | 99 | |
| 8 | 100 | namespace EulerCorrectionEnergyScalar |
+0 −52 Euler/CorrectionLimitDerivative.lean deleted
| @@ -1,52 +0,0 @@ | ||
| 1 | -import Euler.CorrectionSourceRestriction | |
| 2 | -import Euler.QuadraticSourceLimit | |
| 3 | -import Euler.ViscosityDefect | |
| 4 | -import Euler.ViscosityCauchy | |
| 5 | - | |
| 6 | -/-! The actual viscous derivative expressed using the identical lower-order nonlinear source. -/ | |
| 7 | - | |
| 8 | -noncomputable section | |
| 9 | - | |
| 10 | -namespace EulerCorrectionLimitDerivative | |
| 11 | - | |
| 12 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 13 | - EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 14 | - EulerCorrectionSourceRestriction EulerQuadraticSource EulerQuadraticSourceLimit | |
| 15 | - EulerViscosityDefect EulerViscosityCauchy EulerVolterraConvolution EulerMildEquationBridge EulerSobolevHeatGenerator | |
| 16 | -open scoped Topology | |
| 17 | - | |
| 18 | -variable (period : ℝ) [Fact (0 < period)] | |
| 19 | - | |
| 20 | -/-- The inherited normed group on each actual Sobolev value space. -/ | |
| 21 | -local instance limitDerivativeGroup (s : ℕ) : NormedAddCommGroup (SobolevSpace period s) := inferInstance | |
| 22 | - | |
| 23 | -/-- The inherited real normed space on each actual Sobolev value space. -/ | |
| 24 | -local instance limitDerivativeSpace (s : ℕ) : NormedSpace ℝ (SobolevSpace period s) := inferInstance | |
| 25 | - | |
| 26 | -/-- The actual derivative of a high-order mild correction equals viscosity plus the literal lower-order nonlinear source. -/ | |
| 27 | -theorem lower_mild_value_derivative {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 28 | - (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 29 | - (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 30 | - (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 31 | - (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 32 | - (hG : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 33 | - (hL : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 34 | - (hQ : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 35 | - (ν : ℝ) (hν : 0 < ν) (u : C(Icc (0 : ℝ) T,SobolevSpace period ((q+1)+1))) | |
| 36 | - (hsol : ∀ t, u t = quadraticDuhamel period ν hν hT le_rfl | |
| 37 | - (D.coefficients period (by omega : 6 ≤ q+1)) 0 u t) | |
| 38 | - (r : ℝ) (hr : r ∈ Ioo 0 T) : | |
| 39 | - HasDerivAt (fun x => value period (extendPath T hT u x)) | |
| 40 | - (ν • laplacianEvaluation period ((q+1)+1) (by omega) (u ⟨r,hr.1.le,hr.2.le⟩) + | |
| 41 | - value period (((lowerData period D KG KL KQ hG hL hQ).coefficients period hq).apply | |
| 42 | - ⟨r,hr.1.le,hr.2.le⟩ (truncateOperator period (q+1) (u ⟨r,hr.1.le,hr.2.le⟩)))) r := by | |
| 43 | - let τ : Icc (0 : ℝ) T := ⟨r,hr.1.le,hr.2.le⟩ | |
| 44 | - have hx := viscous_mild_hasDerivAt period (by omega : 2 ≤ q+1) ν hν T hT 0 | |
| 45 | - (D.coefficients period (by omega : 6 ≤ q+1)).apply | |
| 46 | - (D.coefficients period (by omega : 6 ≤ q+1)).continuous u hsol r hr | |
| 47 | - have hs := congrArg (value period (q := q)) (truncate_source period hq D KG KL KQ hG hL hQ τ (u τ)) | |
| 48 | - rw [value_truncateOperator] at hs | |
| 49 | - apply hx.congr_deriv | |
| 50 | - exact congrArg (fun v => ν • laplacianEvaluation period ((q+1)+1) (by omega) (u τ)+v) hs | |
| 51 | - | |
| 52 | -end EulerCorrectionLimitDerivative | |
+111 −1 Euler/CorrectionLimitEquation.lean View file
| @@ -3,12 +3,122 @@ import Euler.QuadraticSourceLimit | ||
| 3 | 3 | import Euler.IntegralPathLimit |
| 4 | 4 | import Euler.SobolevPathLimits |
| 5 | 5 | import Euler.ViscosityDefect |
| 6 | -import Euler.CorrectionLimitPathDerivative | |
| 6 | +import Euler.ViscosityCauchy | |
| 7 | 7 | import Euler.ViscousPathDerivative |
| 8 | 8 | import Euler.ViscousSourcePathLimit |
| 9 | 9 | |
| 10 | 10 | /-! The literal inviscid correction equation follows from the actual strongly convergent viscous family. -/ |
| 11 | 11 | |
| 12 | +/-! ## From `Euler/CorrectionLimitDerivative.lean` | |
| 13 | + | |
| 14 | +The text of `Euler/CorrectionLimitDerivative.lean`, folded into this file, which was its only importer. -/ | |
| 15 | + | |
| 16 | +section | |
| 17 | + | |
| 18 | +/-! The actual viscous derivative expressed using the identical lower-order nonlinear source. -/ | |
| 19 | + | |
| 20 | +noncomputable section | |
| 21 | + | |
| 22 | +namespace EulerCorrectionLimitDerivative | |
| 23 | + | |
| 24 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 25 | + EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 26 | + EulerCorrectionSourceRestriction EulerQuadraticSource EulerQuadraticSourceLimit | |
| 27 | + EulerViscosityDefect EulerViscosityCauchy EulerVolterraConvolution EulerMildEquationBridge EulerSobolevHeatGenerator | |
| 28 | +open scoped Topology | |
| 29 | + | |
| 30 | +variable (period : ℝ) [Fact (0 < period)] | |
| 31 | + | |
| 32 | +/-- The inherited normed group on each actual Sobolev value space. -/ | |
| 33 | +local instance limitDerivativeGroup (s : ℕ) : NormedAddCommGroup (SobolevSpace period s) := inferInstance | |
| 34 | + | |
| 35 | +/-- The inherited real normed space on each actual Sobolev value space. -/ | |
| 36 | +local instance limitDerivativeSpace (s : ℕ) : NormedSpace ℝ (SobolevSpace period s) := inferInstance | |
| 37 | + | |
| 38 | +/-- The actual derivative of a high-order mild correction equals viscosity plus the literal lower-order nonlinear source. -/ | |
| 39 | +theorem lower_mild_value_derivative {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 40 | + (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 41 | + (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 42 | + (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 43 | + (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 44 | + (hG : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 45 | + (hL : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 46 | + (hQ : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 47 | + (ν : ℝ) (hν : 0 < ν) (u : C(Icc (0 : ℝ) T,SobolevSpace period ((q+1)+1))) | |
| 48 | + (hsol : ∀ t, u t = quadraticDuhamel period ν hν hT le_rfl | |
| 49 | + (D.coefficients period (by omega : 6 ≤ q+1)) 0 u t) | |
| 50 | + (r : ℝ) (hr : r ∈ Ioo 0 T) : | |
| 51 | + HasDerivAt (fun x => value period (extendPath T hT u x)) | |
| 52 | + (ν • laplacianEvaluation period ((q+1)+1) (by omega) (u ⟨r,hr.1.le,hr.2.le⟩) + | |
| 53 | + value period (((lowerData period D KG KL KQ hG hL hQ).coefficients period hq).apply | |
| 54 | + ⟨r,hr.1.le,hr.2.le⟩ (truncateOperator period (q+1) (u ⟨r,hr.1.le,hr.2.le⟩)))) r := by | |
| 55 | + let τ : Icc (0 : ℝ) T := ⟨r,hr.1.le,hr.2.le⟩ | |
| 56 | + have hx := viscous_mild_hasDerivAt period (by omega : 2 ≤ q+1) ν hν T hT 0 | |
| 57 | + (D.coefficients period (by omega : 6 ≤ q+1)).apply | |
| 58 | + (D.coefficients period (by omega : 6 ≤ q+1)).continuous u hsol r hr | |
| 59 | + have hs := congrArg (value period (q := q)) (truncate_source period hq D KG KL KQ hG hL hQ τ (u τ)) | |
| 60 | + rw [value_truncateOperator] at hs | |
| 61 | + apply hx.congr_deriv | |
| 62 | + exact congrArg (fun v => ν • laplacianEvaluation period ((q+1)+1) (by omega) (u τ)+v) hs | |
| 63 | + | |
| 64 | +end EulerCorrectionLimitDerivative | |
| 65 | +end | |
| 66 | + | |
| 67 | +end | |
| 68 | + | |
| 69 | +/-! ## From `Euler/CorrectionLimitPathDerivative.lean` | |
| 70 | + | |
| 71 | +The text of `Euler/CorrectionLimitPathDerivative.lean`, folded into this file, which was its only importer. -/ | |
| 72 | + | |
| 73 | +section | |
| 74 | + | |
| 75 | +/-! The actual viscous derivative expressed using the identical lower-order nonlinear source. -/ | |
| 76 | + | |
| 77 | +noncomputable section | |
| 78 | + | |
| 79 | +namespace EulerCorrectionLimitPathDerivative | |
| 80 | + | |
| 81 | +open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 82 | + EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 83 | + EulerCorrectionSourceRestriction EulerQuadraticSource EulerQuadraticSourceLimit | |
| 84 | + EulerViscosityDefect EulerViscosityCauchy EulerVolterraConvolution EulerMildEquationBridge EulerSobolevHeatGenerator | |
| 85 | +open scoped Topology | |
| 86 | + | |
| 87 | +variable (period : ℝ) [Fact (0 < period)] | |
| 88 | + | |
| 89 | +/-- The inherited normed group on each actual Sobolev value space. -/ | |
| 90 | +local instance limitDerivativeGroup (s : ℕ) : NormedAddCommGroup (SobolevSpace period s) := inferInstance | |
| 91 | + | |
| 92 | +/-- The inherited real normed space on each actual Sobolev value space. -/ | |
| 93 | +local instance limitDerivativeSpace (s : ℕ) : NormedSpace ℝ (SobolevSpace period s) := inferInstance | |
| 94 | + | |
| 95 | +/-- The actual derivative of a high-order mild correction equals viscosity plus the literal lower-order nonlinear source. -/ | |
| 96 | +theorem lower_mild_path_derivative {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 97 | + (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 98 | + (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 99 | + (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 100 | + (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 101 | + (hG : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 102 | + (hL : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 103 | + (hQ : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 104 | + (ν : ℝ) (hν : 0 < ν) (u : C(Icc (0 : ℝ) T,SobolevSpace period ((q+1)+1))) | |
| 105 | + (hsol : ∀ t, u t = quadraticDuhamel period ν hν hT le_rfl | |
| 106 | + (D.coefficients period (by omega : 6 ≤ q+1)) 0 u t) | |
| 107 | + (r : ℝ) (hr : r ∈ Ioo 0 T) : | |
| 108 | + HasDerivAt (extendPath T hT (valuePath period T u)) | |
| 109 | + (extendPath T hT (viscousDefect period (by omega : 2 ≤ (q+1)+1) ν T u + | |
| 110 | + valuePath period T (sourcePath ((lowerData period D KG KL KQ hG hL hQ).coefficients period hq) | |
| 111 | + ((truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) u))) r) r := by | |
| 112 | + exact EulerViscousPathDerivative.hasDerivAt_path period (by omega : 2 ≤ (q+1)+1) ν T hT u | |
| 113 | + (sourcePath ((lowerData period D KG KL KQ hG hL hQ).coefficients period hq) | |
| 114 | + ((truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) u)) r hr | |
| 115 | + (EulerCorrectionLimitDerivative.lower_mild_value_derivative period hq T hT D KG KL KQ hG hL hQ ν hν u hsol r hr) | |
| 116 | + | |
| 117 | +end EulerCorrectionLimitPathDerivative | |
| 118 | +end | |
| 119 | + | |
| 120 | +end | |
| 121 | + | |
| 12 | 122 | noncomputable section |
| 13 | 123 | |
| 14 | 124 | namespace EulerCorrectionLimitEquation |
+0 −49 Euler/CorrectionLimitPathDerivative.lean deleted
| @@ -1,49 +0,0 @@ | ||
| 1 | -import Euler.CorrectionLimitDerivative | |
| 2 | -import Euler.ViscousPathDerivative | |
| 3 | -import Euler.QuadraticSourceLimit | |
| 4 | -import Euler.ViscosityDefect | |
| 5 | -import Euler.ViscosityCauchy | |
| 6 | - | |
| 7 | -/-! The actual viscous derivative expressed using the identical lower-order nonlinear source. -/ | |
| 8 | - | |
| 9 | -noncomputable section | |
| 10 | - | |
| 11 | -namespace EulerCorrectionLimitPathDerivative | |
| 12 | - | |
| 13 | -open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 14 | - EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 15 | - EulerCorrectionSourceRestriction EulerQuadraticSource EulerQuadraticSourceLimit | |
| 16 | - EulerViscosityDefect EulerViscosityCauchy EulerVolterraConvolution EulerMildEquationBridge EulerSobolevHeatGenerator | |
| 17 | -open scoped Topology | |
| 18 | - | |
| 19 | -variable (period : ℝ) [Fact (0 < period)] | |
| 20 | - | |
| 21 | -/-- The inherited normed group on each actual Sobolev value space. -/ | |
| 22 | -local instance limitDerivativeGroup (s : ℕ) : NormedAddCommGroup (SobolevSpace period s) := inferInstance | |
| 23 | - | |
| 24 | -/-- The inherited real normed space on each actual Sobolev value space. -/ | |
| 25 | -local instance limitDerivativeSpace (s : ℕ) : NormedSpace ℝ (SobolevSpace period s) := inferInstance | |
| 26 | - | |
| 27 | -/-- The actual derivative of a high-order mild correction equals viscosity plus the literal lower-order nonlinear source. -/ | |
| 28 | -theorem lower_mild_path_derivative {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 29 | - (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 30 | - (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 31 | - (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 32 | - (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 33 | - (hG : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 34 | - (hL : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 35 | - (hQ : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 36 | - (ν : ℝ) (hν : 0 < ν) (u : C(Icc (0 : ℝ) T,SobolevSpace period ((q+1)+1))) | |
| 37 | - (hsol : ∀ t, u t = quadraticDuhamel period ν hν hT le_rfl | |
| 38 | - (D.coefficients period (by omega : 6 ≤ q+1)) 0 u t) | |
| 39 | - (r : ℝ) (hr : r ∈ Ioo 0 T) : | |
| 40 | - HasDerivAt (extendPath T hT (valuePath period T u)) | |
| 41 | - (extendPath T hT (viscousDefect period (by omega : 2 ≤ (q+1)+1) ν T u + | |
| 42 | - valuePath period T (sourcePath ((lowerData period D KG KL KQ hG hL hQ).coefficients period hq) | |
| 43 | - ((truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) u))) r) r := by | |
| 44 | - exact EulerViscousPathDerivative.hasDerivAt_path period (by omega : 2 ≤ (q+1)+1) ν T hT u | |
| 45 | - (sourcePath ((lowerData period D KG KL KQ hG hL hQ).coefficients period hq) | |
| 46 | - ((truncateOperator period (q+1)).compLeftContinuous ℝ (Icc (0 : ℝ) T) u)) r hr | |
| 47 | - (EulerCorrectionLimitDerivative.lower_mild_value_derivative period hq T hT D KG KL KQ hG hL hQ ν hν u hsol r hr) | |
| 48 | - | |
| 49 | -end EulerCorrectionLimitPathDerivative | |
+0 −84 Euler/CorrectionMildEnergy.lean deleted
| @@ -1,84 +0,0 @@ | ||
| 1 | -import Euler.CorrectionEnergyMajorants | |
| 2 | -import Euler.CorrectionEnergyRestriction | |
| 3 | -import Euler.MildMajorantEnergy | |
| 4 | - | |
| 5 | -/-! Actual nonlinear correction mild solutions obey the full-order continuous scalar integral energy estimate. -/ | |
| 6 | - | |
| 7 | -noncomputable section | |
| 8 | - | |
| 9 | -namespace EulerCorrectionMildEnergy | |
| 10 | - | |
| 11 | -open MeasureTheory Set InnerProductSpace EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev | |
| 12 | - EulerSpatialSobolevInverse EulerCorrectionOperators EulerSobolevCoefficientPressure EulerCorrectionLowerData | |
| 13 | - EulerCorrectionEnergyRestriction EulerCorrectionEnergyTime EulerCorrectionEnergyData EulerCorrectionEnergyMajorants | |
| 14 | - EulerEnergyMetricPaths EulerGevreyMetricEstimate EulerMildMajorantEnergy EulerEnergyWordCoordinates | |
| 15 | - EulerTimeLpSubintervalBound EulerTimeLp EulerVolterraConvolution EulerSobolevHeat EulerSobolevMaximalRegularity | |
| 16 | -open scoped Topology | |
| 17 | - | |
| 18 | -variable (period : ℝ) [Fact (0 < period)] | |
| 19 | - | |
| 20 | -/-- The actual continuous scalar right-hand side of the nonlinear correction energy estimate. -/ | |
| 21 | -def correctionRhs {q : ℕ} {T : ℝ} {hq : 6 ≤ q+1} | |
| 22 | - {D : CorrectionData period (q+1) (Icc (0 : ℝ) T)} {N : ℕ} {R : C(Icc (0 : ℝ) T, ℝ)} | |
| 23 | - (S : SpatialBudget period hq D N R) (hN : N+6 ≤ q+1) {hT : 0 ≤ T} (K : MetricBudget period T hT D) | |
| 24 | - (Rdot : C(Icc (0 : ℝ) T, ℝ)) (e : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) : C(Icc (0 : ℝ) T, ℝ) := | |
| 25 | - scalarEnergyRhs T (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) | |
| 26 | - (ContinuousMap.const _ (K.multiplier period)) | |
| 27 | - (energyPath period N hN T R (K.operatorPath period) e) | |
| 28 | - (lossPath period N hN T R (K.operatorPath period) e) (forcingMajorant period S hN K e) | |
| 29 | - | |
| 30 | -/-- The actual nonlinear lower mild equation yields the full energy-order scalar integral bound on every subinterval. | |
| 31 | -Maximal regularity, the higher nonlinear source, the pressure, and their constraints are all constructed or proved inside the argument. -/ | |
| 32 | -theorem correction_mild_integral {q : ℕ} (hq : 6 ≤ q) (T : ℝ) (hT : 0 ≤ T) | |
| 33 | - (D : CorrectionData period (q+1) (Icc (0 : ℝ) T)) | |
| 34 | - (KG : ∀ t, CoefficientJet period standardDirection q (D.metric.coefficient t)) | |
| 35 | - (KL : ∀ t, CoefficientJet period standardDirection q (D.linear.coefficient t)) | |
| 36 | - (KQ : ∀ i t, CoefficientJet period standardDirection q ((D.quadratic i).coefficient t)) | |
| 37 | - (hGq : Continuous (fun t => coefficientSobolevOperator period (KG t))) | |
| 38 | - (hLq : Continuous (fun t => coefficientSobolevOperator period (KL t))) | |
| 39 | - (hQq : ∀ i, Continuous (fun t => coefficientSobolevOperator period (KQ i t))) | |
| 40 | - (hG : Continuous (fun t => (D.metric.coefficient t).operator)) | |
| 41 | - (N : ℕ) (hN : N+6 ≤ q+1) (R Rdot : C(Icc (0 : ℝ) T, ℝ)) | |
| 42 | - (S : SpatialBudget period (by omega : 6 ≤ q+1) D N R) (K : MetricBudget period T hT D) | |
| 43 | - (hRd : ∀ t ∈ Ioo 0 T, HasDerivAt (extendPath T hT R) (extendPath T hT Rdot t) t) | |
| 44 | - (ν : ℝ) (hν : 0 < ν) (hν1 : ν ≤ 1) (e₀ : SobolevSpace period (q+1)) | |
| 45 | - (e : C(Icc (0 : ℝ) T, SobolevSpace period (q+1))) | |
| 46 | - (hsol : ∀ t : Icc (0 : ℝ) T, | |
| 47 | - e t = heatOperator period (q+1) (2*ν*t.val).toNNReal e₀ + | |
| 48 | - ∫ r in (0 : ℝ)..t.val, heatKernel period q ν hν r | |
| 49 | - (extendPath T hT (forcingPath period hq (lowerData period D KG KL KQ hGq hLq hQq) e) (t.val-r))) | |
| 50 | - (hz : ∀ t, value period (D.approximation t) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 51 | - (he : ∀ t, value period (e t) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 52 | - (s t : ℝ) (h0s : 0 ≤ s) (hst : s ≤ t) (htT : t ≤ T) : | |
| 53 | - energyPath period N hN T R (K.operatorPath period) e ⟨t,h0s.trans hst,htT⟩ - | |
| 54 | - energyPath period N hN T R (K.operatorPath period) e ⟨s,h0s,hst.trans htT⟩ ≤ | |
| 55 | - ∫ r in s..t, extendPath T hT (correctionRhs period S hN K Rdot e) r := by | |
| 56 | - let Dlow := lowerData period D KG KL KQ hGq hLq hQq | |
| 57 | - let f := forcingPath period hq Dlow e | |
| 58 | - let p := pressurePath period hq Dlow e | |
| 59 | - obtain ⟨U,hU⟩ := exists_maximal_mild_limit period ν hν T hT e₀ f e hsol | |
| 60 | - let F := sourceTime period (by omega : 6 ≤ q+1) T hT D e U | |
| 61 | - let P := signedPressureTime period (by omega : 6 ≤ q+1) T hT D e U | |
| 62 | - let X := energyPath period N hN T R (K.operatorPath period) e | |
| 63 | - let Y := lossPath period N hN T R (K.operatorPath period) e | |
| 64 | - let k : C(Icc (0 : ℝ) T, ℝ) := ContinuousMap.const _ (K.multiplier period) | |
| 65 | - have hF := sourceTime_restriction period hq T hT D KG KL KQ hGq hLq hQq e U hU | |
| 66 | - have hP := signedPressureTime_restriction period hq T hT D KG KL KQ hGq hLq hQq e U hU | |
| 67 | - have henergy := mild_majorized_energy_subinterval period (by omega : 3 ≤ q+1) T hT s t h0s hst htT | |
| 68 | - energyLength energyWord (energyLength_le hN) (fun I : EulerGevreyMetricComparison.ExternalWord N => I.1.val) | |
| 69 | - ν hν D.κ D.direction K.c K.c_pos R Rdot S.radius_pos hRd K.metric D.metric.coefficient | |
| 70 | - K.continuous hG K.derivative K.hasDeriv K.symmetric K.coercive K.inverse | |
| 71 | - (fun τ => metricVelocityBound period K.c S.B0 (X τ)) (velocityPath period D e) e e₀ f p hsol he | |
| 72 | - (pressurePath_gradient period hq Dlow e) | |
| 73 | - (velocity_divergenceFree period D e hz he) (velocity_bound period S hN K e) | |
| 74 | - U F P hU hF hP (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) k | |
| 75 | - (growthPath_bound period S hN K e ν hν1) (fun _ => rfl) | |
| 76 | - (fun τ => div_le_div_of_nonneg_right (K.bound_le τ) K.c_pos.le) | |
| 77 | - have hforce := forcingMajorant_bound period S hN K hG e U hU | |
| 78 | - have hk : ∀ τ, 0 ≤ k τ := fun _ => (K.constants_nonneg period S.B0 S.B0_nonneg).2.2 | |
| 79 | - exact scalar_rhs_subinterval T hT s t h0s hst htT | |
| 80 | - (growthPath period S hN K e) (radiusLossPath R Rdot S.radius_pos) k X Y | |
| 81 | - (forcingMajorant period S hN K e) hk | |
| 82 | - (weightedCorrectionForcing period (by omega : 6 ≤ q+1) T hT D hG N hN R e U) hforce henergy | |
| 83 | - | |
| 84 | -end EulerCorrectionMildEnergy | |
+135 −1 Euler/CorrectionStabilityBudget.lean View file
| @@ -1,7 +1,141 @@ | ||
| 1 | -import Euler.CorrectionDifferenceMetric | |
| 1 | +import Euler.CorrectionDifferencePDE | |
| 2 | +import Euler.SobolevDifferenceEnergy | |
| 2 | 3 | |
| 3 | 4 | /-! Concrete coefficient and inverse-metric data for actual vanishing-viscosity stability. -/ |
| 4 | 5 | |
| 6 | +/-! ## From `Euler/CorrectionDifferenceMetric.lean` | |
| 7 | + | |
| 8 | +The text of `Euler/CorrectionDifferenceMetric.lean`, folded into this file, which was its only importer. -/ | |
| 9 | + | |
| 10 | +section | |
| 11 | + | |
| 12 | +/-! The actual nonlinear viscosity-difference PDE implies a fixed squared metric energy inequality. -/ | |
| 13 | + | |
| 14 | +noncomputable section | |
| 15 | + | |
| 16 | +namespace EulerCorrectionDifferenceMetric | |
| 17 | + | |
| 18 | +open MeasureTheory Set InnerProductSpace EulerLiftedGradientSpace EulerLiftedPressure | |
| 19 | + EulerSpatialSobolevInverse EulerCylinderSobolevSpace EulerCorrectionOperators EulerCorrectionDifference | |
| 20 | + EulerCorrectionDifferencePDE EulerCorrectionStabilityConstants EulerSobolevTransport | |
| 21 | + EulerSobolevMetricTransport EulerSobolevHeatGenerator EulerMetricHeatEnergy EulerSobolevL2Product | |
| 22 | + EulerSquaredMetricStability EulerSobolevDifferenceEnergy | |
| 23 | +open scoped Topology | |
| 24 | + | |
| 25 | +variable (period : ℝ) [Fact (0 < period)] | |
| 26 | + | |
| 27 | +/-- The existing Sobolev normed-group instance for the literal metric difference equation. -/ | |
| 28 | +local instance metricSobolevGroup (q : ℕ) : NormedAddCommGroup (SobolevSpace period q) := inferInstance | |
| 29 | +/-- The existing real Sobolev module instance for the literal metric difference equation. -/ | |
| 30 | +local instance metricSobolevSpace (q : ℕ) : NormedSpace ℝ (SobolevSpace period q) := inferInstance | |
| 31 | + | |
| 32 | +/-- The actual correction-difference PDE gives the quantitative squared L² metric bound, with no assumed energy inequality. -/ | |
| 33 | +theorem difference_metric_deriv_bound {q : ℕ} {T : Type*} [TopologicalSpace T] | |
| 34 | + (D : CorrectionData period q T) (hq : 6 ≤ q) (τ : T) | |
| 35 | + (u v : SobolevSpace period (q+1)) (A : SmoothCoefficient period) | |
| 36 | + (K : ℝ → LiftL2 period →L[ℝ] LiftL2 period) (e : ℝ → LiftL2 period) | |
| 37 | + (t ν μ c Kb Kx Kt A0 A2 Z R : ℝ) (K' : LiftL2 period →L[ℝ] LiftL2 period) | |
| 38 | + (hc : 0 < c) (hν : 0 ≤ ν) (hν1 : ν ≤ 1) | |
| 39 | + (hKv : K t=A.operator) (hev : e t=value period (u-v)) | |
| 40 | + (hK : HasDerivAt K K' t) (he : HasDerivAt e (differenceRhs period D hq ν μ τ u v) t) | |
| 41 | + (hKb : ‖A.operator‖ ≤ Kb) (hKx : (A.firstBound : ℝ) ≤ Kx) (hKt : ‖K'‖ ≤ Kt) | |
| 42 | + (hA0 : ((D.linear.coefficient τ).bound : ℝ) ≤ A0) | |
| 43 | + (hA2 : (∑ i : Fin 3, (((D.quadratic i).coefficient τ).bound : ℝ)) ≤ A2) | |
| 44 | + (hZ : ‖D.approximation τ‖ ≤ Z) (hu : ‖u‖ ≤ R) (hv : ‖v‖ ≤ R) | |
| 45 | + (hsym : ∀ x a b, ⟪A.coefficient x a,b⟫_ℝ=⟪a,A.coefficient x b⟫_ℝ) | |
| 46 | + (hpos : ∀ x a, c^2*‖a‖^2 ≤ ⟪A.coefficient x a,a⟫_ℝ) | |
| 47 | + (hinv : ∀ x a, A.coefficient x ((D.metric.coefficient τ).coefficient x a)=a) | |
| 48 | + (hz : value period (D.approximation τ) ∈ divergenceFreeSpace period D.κ D.direction) | |
| 49 | + (hud : value period u ∈ divergenceFreeSpace period D.κ D.direction) | |
| 50 | + (hvd : value period v ∈ divergenceFreeSpace period D.κ D.direction) : | |
| 51 | + deriv (fun s => ⟪K s (e s),e s⟫_ℝ) t ≤ | |
| 52 | + growthConstant c Kb Kx Kt (velocityBound period q Z R) (lowerConstant period q A0 A2 Z R)* | |
| 53 | + ⟪K t (e t),e t⟫_ℝ+defectConstant Kb R*|ν-μ|^2 := by | |
| 54 | + let d := u-v | |
| 55 | + let top := value period (transportBilinear period hq (velocityComponents D.κ D.direction) | |
| 56 | + (velocityComponents_norm D.κ D.direction D.scale_bound D.direction_bound) (D.approximation τ+u) d) | |
| 57 | + let p := value period (D.pressure period hq τ u)-value period (D.pressure period hq τ v) | |
| 58 | + let F := -value period (differenceRemainder period D hq τ u v)+ | |
| 59 | + (ν-μ) • laplacianEvaluation period (q+1) (by omega) v | |
| 60 | + let L := lowerConstant period q A0 A2 Z R | |
| 61 | + let V := velocityBound period q Z R | |
| 62 | + have hr0 := (norm_nonneg u).trans hu | |
| 63 | + have hz0 := (norm_nonneg (D.approximation τ)).trans hZ | |
| 64 | + have ha00 := (D.linear.coefficient τ).bound.coe_nonneg.trans hA0 | |
| 65 | + have ha20 := (Finset.sum_nonneg (fun i _ => ((D.quadratic i).coefficient τ).bound.coe_nonneg)).trans hA2 | |
| 66 | + have hL : 0 ≤ L := lowerConstant_nonneg period q A0 A2 Z R ha00 ha20 hz0 hr0 | |
| 67 | + have hV : 0 ≤ V := velocityBound_nonneg period q Z R hz0 hr0 | |
| 68 | + have hkx0 := A.firstBound.coe_nonneg.trans hKx | |
| 69 | + have hkb0 := (norm_nonneg A.operator).trans hKb | |
| 70 | + have hkt0 := (norm_nonneg K').trans hKt | |
| 71 | + have heq : differenceRhs period D hq ν μ τ u v+top+(D.metric.coefficient τ).operator p = | |
| 72 | + F+ν • laplacianEvaluation period (q+1) (by omega) d := by | |
| 73 | + dsimp only [differenceRhs,p,F,d] | |
| 74 | + abel | |
| 75 | + have hdiv : value period d ∈ divergenceFreeSpace period D.κ D.direction := | |
| 76 | + (divergenceFreeSpace period D.κ D.direction).sub_mem hud hvd | |
| 77 | + have hpgrad : p ∈ gradientSpace period D.κ D.direction := | |
| 78 | + (gradientSpace period D.κ D.direction).sub_mem (D.pressure_mem_gradient period hq τ u) | |
| 79 | + (D.pressure_mem_gradient period hq τ v) | |
| 80 | + have hp : ⟪K t (e t),(D.metric.coefficient τ).operator p⟫_ℝ=0 := by | |
| 81 | + rw [hKv,hev] | |
| 82 | + exact metric_pressure_cancellation period D.κ D.direction A.coefficient (D.metric.coefficient τ).coefficient | |
| 83 | + A.measurable (D.metric.coefficient τ).measurable A.bound (D.metric.coefficient τ).bound | |
| 84 | + A.norm_bound (D.metric.coefficient τ).norm_bound hsym hinv hdiv hpgrad | |
| 85 | + have ht : |⟪K t (e t),top⟫_ℝ| ≤ (Kx*V)*‖e t‖^2 := by | |
| 86 | + rw [hKv,hev] | |
| 87 | + exact difference_transport_bound period D hq τ A u v Kx Z R hKx hZ hu hsym hz hud | |
| 88 | + have hheat : ⟪K t (e t),laplacianEvaluation period (q+1) (by omega) d⟫_ℝ ≤ | |
| 89 | + (2*Kx^2/c^2)*‖e t‖^2 := by | |
| 90 | + rw [hKv,hev] | |
| 91 | + exact difference_heat_bound period (by omega : 2 ≤ q+1) A d c Kx hc hKx hpos | |
| 92 | + have hforce : ‖F‖ ≤ L*‖e t‖+|ν-μ| *(4*R) := by | |
| 93 | + rw [hev] | |
| 94 | + have hrem := differenceRemainder_uniform period D hq τ u v A0 A2 Z R hA0 hA2 hZ hu hv | |
| 95 | + have hlap := (laplacianEvaluation_bound period (by omega : 2 ≤ q+1) v).trans | |
| 96 | + (mul_le_mul_of_nonneg_left hv (by norm_num : (0 : ℝ) ≤ 4)) | |
| 97 | + have hh := norm_add_le (-value period (differenceRemainder period D hq τ u v)) | |
| 98 | + ((ν-μ) • laplacianEvaluation period (q+1) (by omega) v) | |
| 99 | + rw [norm_neg,norm_smul,Real.norm_eq_abs] at hh | |
| 100 | + exact hh.trans (add_le_add hrem (mul_le_mul_of_nonneg_left hlap (abs_nonneg _))) | |
| 101 | + have hcoer : c^2*‖e t‖^2 ≤ ⟪K t (e t),e t⟫_ℝ := by | |
| 102 | + rw [hKv] | |
| 103 | + exact coefficientOperator_coercive A.coefficient A.measurable A.bound A.norm_bound (c^2) hpos (e t) | |
| 104 | + have hsymL : ∀ a b, ⟪K t a,b⟫_ℝ=⟪a,K t b⟫_ℝ := by | |
| 105 | + rw [hKv] | |
| 106 | + exact coefficientOperator_inner_swap A.coefficient A.measurable A.bound A.norm_bound hsym | |
| 107 | + have hgen := metric_derivative_bound K e t ν c (Kx*V) (2*Kx^2/c^2) L |ν-μ| (4*R) K' | |
| 108 | + (differenceRhs period D hq ν μ τ u v) top ((D.metric.coefficient τ).operator p) F | |
| 109 | + (laplacianEvaluation period (q+1) (by omega) d) hc hν (mul_nonneg hkx0 hV) (by positivity) hL | |
| 110 | + hK he hsymL hcoer heq hp ht hheat hforce | |
| 111 | + have he0 : 0 ≤ ⟪K t (e t),e t⟫_ℝ := (mul_nonneg (sq_nonneg c) (sq_nonneg ‖e t‖)).trans hcoer | |
| 112 | + have hkn : ‖K t‖ ≤ Kb := by rw [hKv]; exact hKb | |
| 113 | + have hg : (‖K'‖+2*(Kx*V)+2*ν*(2*Kx^2/c^2)+2*‖K t‖*L+1)/c^2 ≤ | |
| 114 | + growthConstant c Kb Kx Kt V L := by | |
| 115 | + unfold growthConstant | |
| 116 | + apply div_le_div_of_nonneg_right _ (sq_nonneg c) | |
| 117 | + have hh : 2*ν*(2*Kx^2/c^2) ≤ 4*Kx^2/c^2 := by | |
| 118 | + calc | |
| 119 | + _ = ν*(4*Kx^2/c^2) := by ring | |
| 120 | + _ ≤ 1*(4*Kx^2/c^2) := mul_le_mul_of_nonneg_right hν1 (by positivity) | |
| 121 | + _ = _ := one_mul _ | |
| 122 | + have hk : 2*‖K t‖*L ≤ 2*Kb*L := by | |
| 123 | + have h := mul_le_mul_of_nonneg_right hkn (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hL) | |
| 124 | + linarith only [h] | |
| 125 | + have hsum := add_le_add (add_le_add (add_le_add hKt (le_refl (2*(Kx*V)))) hh) hk | |
| 126 | + exact (add_le_add hsum (le_refl 1)).trans_eq (by ring) | |
| 127 | + have hd : (‖K t‖*(4*R))^2 ≤ defectConstant Kb R := by | |
| 128 | + have h := mul_le_mul_of_nonneg_right hkn (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hr0) | |
| 129 | + exact pow_le_pow_left₀ (mul_nonneg (norm_nonneg (K t)) | |
| 130 | + (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hr0)) h 2 | |
| 131 | + exact hgen.trans (add_le_add (mul_le_mul_of_nonneg_right hg he0) | |
| 132 | + (mul_le_mul_of_nonneg_right hd (sq_nonneg _))) | |
| 133 | + | |
| 134 | +end EulerCorrectionDifferenceMetric | |
| 135 | +end | |
| 136 | + | |
| 137 | +end | |
| 138 | + | |
| 5 | 139 | noncomputable section |
| 6 | 140 | |
| 7 | 141 | namespace EulerCorrectionStabilityBudget |
+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") | |
+17 −0 routes/s5-euler-correction-1/README.md added View file
| @@ -0,0 +1,17 @@ | ||
| 1 | +--- | |
| 2 | +issue: 14 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | +# s5-euler-correction-1 | |
| 6 | + | |
| 7 | +The wave-1 fold unit for the family `Euler/Correction*`: `Euler/CorrectionAssemblyCommon.lean`, | |
| 8 | +`CorrectionAssemblyCompatibility.lean`, `CorrectionMildEnergy.lean`, `CorrectionLimitDerivative.lean`, | |
| 9 | +`CorrectionLimitPathDerivative.lean` and `CorrectionDifferenceMetric.lean` each had exactly one importer in the family, | |
| 10 | +so their text moves into that importer unchanged, under a heading that names them and in a `section` of its own. The | |
| 11 | +plan is `routes/s5-euler-correction-1/plan.json`; `docs/s5-folding/fold.py check . routes/s5-euler-correction-1/plan.json` | |
| 12 | +reproduced every changed file from main's text byte for byte, and `grep` finds no import of a folded module left. | |
| 13 | + | |
| 14 | +## Next | |
| 15 | + | |
| 16 | +The pull request is open. The maintainer's verdict on whether this kind of change is wanted decides the rest of the | |
| 17 | +series; if it comes back with something to change, the folded files are made by the tool and edited by it. | |
+23 −0 routes/s5-euler-correction-1/plan.json added View file
| @@ -0,0 +1,23 @@ | ||
| 1 | +{ | |
| 2 | +"imports": "in place", | |
| 3 | +"folds": { | |
| 4 | +"Euler/CorrectionAssemblyPressure.lean": [ | |
| 5 | +"Euler/CorrectionAssemblyCompatibility.lean", | |
| 6 | +"Euler/CorrectionAssemblyCommon.lean", | |
| 7 | +"Euler/CorrectionAssemblyPressure.lean" | |
| 8 | +], | |
| 9 | +"Euler/CorrectionEnergyScalar.lean": [ | |
| 10 | +"Euler/CorrectionMildEnergy.lean", | |
| 11 | +"Euler/CorrectionEnergyScalar.lean" | |
| 12 | +], | |
| 13 | +"Euler/CorrectionLimitEquation.lean": [ | |
| 14 | +"Euler/CorrectionLimitDerivative.lean", | |
| 15 | +"Euler/CorrectionLimitPathDerivative.lean", | |
| 16 | +"Euler/CorrectionLimitEquation.lean" | |
| 17 | +], | |
| 18 | +"Euler/CorrectionStabilityBudget.lean": [ | |
| 19 | +"Euler/CorrectionDifferenceMetric.lean", | |
| 20 | +"Euler/CorrectionStabilityBudget.lean" | |
| 21 | +] | |
| 22 | +} | |
| 23 | +} | |