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(NavierStokes/Local): 4 small modules folded into the file that imports them (−36.6%, measured)
Browse filesPart of #14. 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
+0 −108 NavierStokes/LocalAngularScalar.lean deleted
| @@ -1,108 +0,0 @@ | ||
| 1 | -import NavierStokes.LocalAngularGrowth | |
| 2 | - | |
| 3 | -/-! | |
| 4 | -# A scalar representation of the selected direct angular field | |
| 5 | - | |
| 6 | -The same locally finite cutoffs can be summed as scalar cylindrical | |
| 7 | -coefficients. The resulting scalar is independent of the polar angle, and | |
| 8 | -its angular vector field is the actual selected direct sum. | |
| 9 | --/ | |
| 10 | - | |
| 11 | -noncomputable section | |
| 12 | - | |
| 13 | -open Set Filter | |
| 14 | -open scoped Topology | |
| 15 | - | |
| 16 | -namespace NavierStokes.LocalAngularScalar | |
| 17 | - | |
| 18 | -open ProblemStatement DirectAngularDiagonal CorrectionInitialization | |
| 19 | - | |
| 20 | -def angularDirection (w : SpaceTime) : Space := | |
| 21 | - (-w.2 1 / radius w) • coordinateVector 0 + | |
| 22 | - (w.2 0 / radius w) • coordinateVector 1 | |
| 23 | - | |
| 24 | -theorem angularField_eq_smul (b : Coefficient) (w : SpaceTime) : | |
| 25 | - angularField b w = b (cylPoint w) • angularDirection w := by | |
| 26 | - simp only [angularField, angularDirection, smul_add, smul_smul] | |
| 27 | - rw [mul_comm (b (cylPoint w)) (-w.2 1 / radius w), | |
| 28 | - mul_comm (b (cylPoint w)) (w.2 0 / radius w)] | |
| 29 | - | |
| 30 | -theorem angularField_add (b c : Coefficient) : | |
| 31 | - angularField (fun p => b p + c p) = fun w => angularField b w + angularField c w := by | |
| 32 | - funext w | |
| 33 | - simp only [angularField_eq_smul, add_smul] | |
| 34 | - | |
| 35 | -/-- Convert a smooth coefficient of the Cartesian rotation vector into its | |
| 36 | -physical angular magnitude in cylindrical coordinates. -/ | |
| 37 | -def magnitudeOfProfile (F : AxisymmetricFields.Profile) : Coefficient := | |
| 38 | - fun p => p.2.1 * F (p.1, (p.2.1 ^ 2 / 2, p.2.2)) | |
| 39 | - | |
| 40 | -theorem angularField_magnitudeOfProfile (F : AxisymmetricFields.Profile) (w : SpaceTime) : | |
| 41 | - angularField (magnitudeOfProfile F) w = | |
| 42 | - F (AxisymmetricFields.profilePoint w.1 w.2) • BaseResidual.angularVector w := by | |
| 43 | - have hrsq : radius w ^ 2 = w.2 0 ^ 2 + w.2 1 ^ 2 := | |
| 44 | - PolarCharts.radius_sq (PhysicalGraphBounds.radialProjection w) | |
| 45 | - have hval : magnitudeOfProfile F (cylPoint w) = | |
| 46 | - radius w * F (AxisymmetricFields.profilePoint w.1 w.2) := by | |
| 47 | - simp only [magnitudeOfProfile, cylPoint, hrsq, AxisymmetricFields.profilePoint, | |
| 48 | - AxisymmetricFields.radialEnergy] | |
| 49 | - simp only [angularField, hval, BaseResidual.angularVector, smul_add, smul_smul] | |
| 50 | - by_cases hr : radius w = 0 | |
| 51 | - · have hx0 : w.2 0 = 0 := by rw [hr] at hrsq; nlinarith [sq_nonneg (w.2 1)] | |
| 52 | - have hx1 : w.2 1 = 0 := by rw [hr] at hrsq; nlinarith [sq_nonneg (w.2 0)] | |
| 53 | - simp only [hx0, hx1, neg_zero, zero_div, zero_mul, mul_zero, zero_smul, add_zero] | |
| 54 | - · have h0 : (-w.2 1 / radius w) * | |
| 55 | - (radius w * F (AxisymmetricFields.profilePoint w.1 w.2)) = | |
| 56 | - F (AxisymmetricFields.profilePoint w.1 w.2) * -w.2 1 := by | |
| 57 | - field_simp [hr] | |
| 58 | - have h1 : (w.2 0 / radius w) * | |
| 59 | - (radius w * F (AxisymmetricFields.profilePoint w.1 w.2)) = | |
| 60 | - F (AxisymmetricFields.profilePoint w.1 w.2) * w.2 0 := by | |
| 61 | - field_simp [hr] | |
| 62 | - rw [h0, h1] | |
| 63 | - | |
| 64 | -def scalarSum (a : ℕ → ℝ) (q : Coefficient) (b : ℕ → Coefficient) : Coefficient := | |
| 65 | - fun p => ∑' j : ℕ, SmoothCutoffs.scaledCutoff (a j) (q p) * b j p | |
| 66 | - | |
| 67 | -/-- Local finiteness of the cutoff series justifies pulling the angular | |
| 68 | -direction through the scalar sum, including at the axis. -/ | |
| 69 | -theorem angularSum_eq_scalarSum {a : ℕ → ℝ} (ha : Tendsto a atTop atTop) | |
| 70 | - (q : Coefficient) (b : ℕ → Coefficient) {w : SpaceTime} | |
| 71 | - (hq : ContinuousAt (fun y : SpaceTime => q (cylPoint y)) w) | |
| 72 | - (hpos : 0 < q (cylPoint w)) : | |
| 73 | - angularSum a (fun y => q (cylPoint y)) b w = angularField (scalarSum a q b) w := by | |
| 74 | - have hs : Summable (fun j : ℕ => | |
| 75 | - SmoothCutoffs.scaledCutoff (a j) (q (cylPoint w)) * b j (cylPoint w)) := by | |
| 76 | - simpa only [SolenoidalDiagonal.cutStage, smul_eq_mul] using | |
| 77 | - SolenoidalDiagonal.summable_cutStage ha hq hpos | |
| 78 | - (fun j (y : SpaceTime) => b j (cylPoint y)) | |
| 79 | - simp only [angularSum, SolenoidalDiagonal.potentialSum, SolenoidalDiagonal.cutStage, | |
| 80 | - angularField_eq_smul, smul_smul] | |
| 81 | - rw [hs.tsum_smul_const] | |
| 82 | - rfl | |
| 83 | - | |
| 84 | -def selectedScalar (a : ℕ → ℕ) : Coefficient := | |
| 85 | - scalarSum (fun j => (a j : ℝ)) (qCoefficient ActualPrimary.h) | |
| 86 | - (fun j => (ActualCandidateAssembly.directData ActualCandidateConstruction.selectedBudget | |
| 87 | - ActualCandidateConstruction.selectedThreshold | |
| 88 | - ActualCandidateConstruction.selectedThreshold_geometry j).scalar) | |
| 89 | - | |
| 90 | -/-- The actual selected direct sum is one axisymmetric scalar times the | |
| 91 | -angular unit vector on the entire preterminal domain. -/ | |
| 92 | -theorem selectedDirect_eq_angularField {a : ℕ → ℕ} | |
| 93 | - (ha : Tendsto (fun j => (a j : ℝ)) atTop atTop) : | |
| 94 | - EqOn (LocalAngularGrowth.selectedDirect a) (angularField (selectedScalar a)) | |
| 95 | - PhysicalWaveSum.preterminal := by | |
| 96 | - intro w hw | |
| 97 | - have hq : ContinuousAt (fun y : SpaceTime => qCoefficient ActualPrimary.h (cylPoint y)) w := | |
| 98 | - (PhysicalWaveSum.physicalQ_smoothAt ActualPrimary.outgoing.data.h_pos | |
| 99 | - ActualPrimary.outgoing.data.h_lt_half hw).continuousAt | |
| 100 | - have hpos : 0 < qCoefficient ActualPrimary.h (cylPoint w) := | |
| 101 | - PhysicalWaveSum.physicalQ_pos ActualPrimary.outgoing.data.h_pos | |
| 102 | - ActualPrimary.outgoing.data.h_lt_half hw | |
| 103 | - exact angularSum_eq_scalarSum ha (qCoefficient ActualPrimary.h) | |
| 104 | - (fun j => (ActualCandidateAssembly.directData ActualCandidateConstruction.selectedBudget | |
| 105 | - ActualCandidateConstruction.selectedThreshold | |
| 106 | - ActualCandidateConstruction.selectedThreshold_geometry j).scalar) hq hpos | |
| 107 | - | |
| 108 | -end NavierStokes.LocalAngularScalar | |
+0 −130 NavierStokes/LocalHeatExterior.lean deleted
| @@ -1,130 +0,0 @@ | ||
| 1 | -import NavierStokes.TailGaugePotential | |
| 2 | - | |
| 3 | -/-! | |
| 4 | -# The axial part of the actual slow-base potential | |
| 5 | - | |
| 6 | -The stream coefficients vanish in the proved heat exterior. Consequently the | |
| 7 | -anchored potential is purely axial there, and its axial projection has the | |
| 8 | -same spatial curl as the constructed slow base. | |
| 9 | --/ | |
| 10 | - | |
| 11 | -noncomputable section | |
| 12 | - | |
| 13 | -namespace NavierStokes.LocalHeatExterior | |
| 14 | - | |
| 15 | -open Set Filter ProblemStatement | |
| 16 | -open scoped Topology ContDiff | |
| 17 | - | |
| 18 | -/-- Projection of a potential onto its axial component. -/ | |
| 19 | -noncomputable def axialPart (A : VelocityField) : VelocityField := | |
| 20 | - fun w => A w 2 • coordinateVector 2 | |
| 21 | - | |
| 22 | -theorem axialPart_smooth {A : VelocityField} {S : Set SpaceTime} | |
| 23 | - (hA : ContDiffOn ℝ ∞ A S) : ContDiffOn ℝ ∞ (axialPart A) S := by | |
| 24 | - exact ((AxisymmetricFields.projection 2).contDiff.comp_contDiffOn hA).smul_const | |
| 25 | - (coordinateVector 2) | |
| 26 | - | |
| 27 | -theorem axialPart_awayExtensions {A : VelocityField} | |
| 28 | - (hA : JointResidualLimits.AwayExtensions A) : | |
| 29 | - JointResidualLimits.AwayExtensions (axialPart A) := by | |
| 30 | - intro x hx | |
| 31 | - obtain ⟨e⟩ := hA x hx | |
| 32 | - refine ⟨{ | |
| 33 | - value := axialPart e.value | |
| 34 | - domain := e.domain | |
| 35 | - isOpen := e.isOpen | |
| 36 | - mem := e.mem | |
| 37 | - smooth := axialPart_smooth e.smooth | |
| 38 | - agrees := ?_ }⟩ | |
| 39 | - intro w hw | |
| 40 | - exact congrArg (fun u : Space => u 2 • coordinateVector 2) (e.agrees hw) | |
| 41 | - | |
| 42 | -theorem axialPart_potential (H K : AxisymmetricFields.Profile) : | |
| 43 | - axialPart (AxisymmetricFields.potential H K) = AxisymmetricFields.potential (fun _ => 0) K := by | |
| 44 | - ext w i | |
| 45 | - fin_cases i <;> simp [axialPart, AxisymmetricFields.potential, coordinateVector] | |
| 46 | - | |
| 47 | -theorem axialPotential_curl (K : AxisymmetricFields.Profile) {w : SpaceTime} | |
| 48 | - (hK : DifferentiableAt ℝ K (AxisymmetricFields.profilePoint w.1 w.2)) : | |
| 49 | - SpatialCurl.spatialCurl (AxisymmetricFields.potential (fun _ => 0) K) w = | |
| 50 | - (-AxisymmetricFields.partialS K (AxisymmetricFields.profilePoint w.1 w.2)) • | |
| 51 | - BaseResidual.angularVector w := by | |
| 52 | - change AxisymmetricFields.velocity (fun _ => 0) K w = _ | |
| 53 | - ext i | |
| 54 | - fin_cases i | |
| 55 | - · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 0 = _ | |
| 56 | - rw [AxisymmetricFields.velocity_zero (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 57 | - simp [AxisymmetricFields.partialZ, BaseResidual.angularVector, coordinateVector] | |
| 58 | - ring | |
| 59 | - · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 1 = _ | |
| 60 | - rw [AxisymmetricFields.velocity_one (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 61 | - simp [AxisymmetricFields.partialZ, BaseResidual.angularVector, coordinateVector] | |
| 62 | - ring | |
| 63 | - · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 2 = _ | |
| 64 | - rw [AxisymmetricFields.velocity_two (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 65 | - simp [AxisymmetricFields.partialS, BaseResidual.angularVector, coordinateVector] | |
| 66 | - | |
| 67 | -section ActualBase | |
| 68 | - | |
| 69 | -variable {F : OutgoingProfile.Profile} {W : NominalProfile.Witness F} | |
| 70 | - (H : NominalConeAssembly.Certificate W) {ld : ModulatedProfileAssembly.LoopData W} | |
| 71 | - (v : ModulatedProfileAssembly.Witness ld) | |
| 72 | - | |
| 73 | -/-- The angular coefficient of the curl of the axial projection. -/ | |
| 74 | -noncomputable def axialCurlCoefficient (upper : ℝ) (B : ℕ) : AxisymmetricFields.Profile := | |
| 75 | - fun p => -AxisymmetricFields.partialS | |
| 76 | - (TailGaugePotential.gaugedSwirl (FinalSlowBase.scales H v upper B) F.data.h | |
| 77 | - W.axis.normalization (FinalSlowBase.coefficients H v)) p | |
| 78 | - | |
| 79 | -theorem axialPart_finalPotential_curl_angular (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 80 | - (ht : w.1 < 1) : | |
| 81 | - SpatialCurl.spatialCurl (axialPart (TailGaugePotential.finalPotential H v upper B)) w = | |
| 82 | - axialCurlCoefficient H v upper B (AxisymmetricFields.profilePoint w.1 w.2) • | |
| 83 | - BaseResidual.angularVector w := by | |
| 84 | - unfold TailGaugePotential.finalPotential TailGaugePotential.potential | |
| 85 | - rw [axialPart_potential] | |
| 86 | - exact axialPotential_curl _ | |
| 87 | - ((TailGaugePotential.gaugedSwirl_smoothAt (FinalSlowBase.scales_strictMono H v upper B) | |
| 88 | - F.data.h_pos F.data.h_lt_half (FinalSlowBase.coefficients_smooth H v) ht).differentiableAt | |
| 89 | - (by simp)) | |
| 90 | - | |
| 91 | -theorem finalPotential_eq_axialPart (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 92 | - (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 93 | - TailGaugePotential.finalPotential H v upper B w = | |
| 94 | - axialPart (TailGaugePotential.finalPotential H v upper B) w := by | |
| 95 | - have hext := ModulatedExterior.realized_exterior_coefficients W v.profiles v.finiteModification | |
| 96 | - (FinalSlowBase.realizesScheme H v) (EntranceAlignedBase.modulated_base_eq H v) | |
| 97 | - (EntranceAlignedBase.modulated_outer H v) | |
| 98 | - have hzero := BaseExterior.exterior_stream_zero | |
| 99 | - (a := FinalSlowBase.scales H v upper B) (C := W.axis.normalization) | |
| 100 | - (p := AxisymmetricFields.profilePoint w.1 w.2) | |
| 101 | - F.data.h_pos F.data.h_lt_half (BaseExterior.nominalExteriorRadius_pos W).le hext hw | |
| 102 | - have he : TailGaugePotential.finalPotential H v upper B w = | |
| 103 | - TailGaugePotential.gaugedSwirl (FinalSlowBase.scales H v upper B) F.data.h | |
| 104 | - W.axis.normalization (FinalSlowBase.coefficients H v) | |
| 105 | - (AxisymmetricFields.profilePoint w.1 w.2) • coordinateVector 2 := by | |
| 106 | - simp only [TailGaugePotential.finalPotential, TailGaugePotential.potential, | |
| 107 | - AxisymmetricFields.potential, hzero, mul_zero, zero_smul, zero_add] | |
| 108 | - unfold axialPart | |
| 109 | - rw [he] | |
| 110 | - simp [coordinateVector] | |
| 111 | - | |
| 112 | -theorem axialPart_finalPotential_germ (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 113 | - (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 114 | - axialPart (TailGaugePotential.finalPotential H v upper B) =ᶠ[𝓝 w] | |
| 115 | - TailGaugePotential.finalPotential H v upper B := by | |
| 116 | - filter_upwards [(BaseExterior.cartesianExterior_isOpen F.data.h_pos F.data.h_lt_half | |
| 117 | - (BaseExterior.nominalExteriorRadius W)).mem_nhds hw] with y hy | |
| 118 | - exact (finalPotential_eq_axialPart H v upper B hy).symm | |
| 119 | - | |
| 120 | -theorem axialPart_finalPotential_curl (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 121 | - (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 122 | - SpatialCurl.spatialCurl (axialPart (TailGaugePotential.finalPotential H v upper B)) w = | |
| 123 | - FinalSlowBase.velocity H v upper B w := by | |
| 124 | - rw [(SolenoidalDiagonal.spatialCurl_eventuallyEq | |
| 125 | - (axialPart_finalPotential_germ H v upper B hw)).self_of_nhds] | |
| 126 | - exact TailGaugePotential.finalPotential_sameCurl H v upper B hw.1 | |
| 127 | - | |
| 128 | -end ActualBase | |
| 129 | - | |
| 130 | -end NavierStokes.LocalHeatExterior | |
+0 −117 NavierStokes/LocalHeatFormula.lean deleted
| @@ -1,117 +0,0 @@ | ||
| 1 | -import NavierStokes.LocalHeatPressure | |
| 2 | -import NavierStokes.DirectAngularDiagonal | |
| 3 | - | |
| 4 | -/-! | |
| 5 | -# The literal exterior heat profile in radial coordinates | |
| 6 | - | |
| 7 | -This packages the existing heat solution using the manuscript's argument | |
| 8 | -`τ / r²`, with its fixed normalization absorbed into the exterior profile. | |
| 9 | --/ | |
| 10 | - | |
| 11 | -noncomputable section | |
| 12 | - | |
| 13 | -namespace NavierStokes.LocalHeatFormula | |
| 14 | - | |
| 15 | -open Set | |
| 16 | -open scoped ContDiff | |
| 17 | - | |
| 18 | -/-- The exterior profile with the fixed physical normalization absorbed. -/ | |
| 19 | -noncomputable def exteriorProfile (C h y : ℝ) : ℝ := | |
| 20 | - C * (2 : ℝ) ^ (1 / 2 + h) * RadialHeatProfile.profile (1 + h) (4 * y) | |
| 21 | - | |
| 22 | -theorem exteriorProfile_smooth (C : ℝ) {h : ℝ} (hh : 0 < h) : | |
| 23 | - ContDiffOn ℝ ∞ (exteriorProfile C h) (Ici 0) := by | |
| 24 | - have hm : MapsTo (fun y : ℝ => 4 * y) (Ici 0) (Ici 0) := by | |
| 25 | - intro y hy | |
| 26 | - exact mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hy | |
| 27 | - exact contDiffOn_const.mul | |
| 28 | - ((RadialHeatProfile.profile_contDiffOn (show 1 < 1 + h by linarith)).comp | |
| 29 | - (contDiffOn_const.mul contDiffOn_id) hm) | |
| 30 | - | |
| 31 | -theorem exteriorProfile_iteratedDerivWithin (C : ℝ) {h : ℝ} (hh : 0 < h) | |
| 32 | - (n : ℕ) {y : ℝ} (hy : 0 ≤ y) : | |
| 33 | - iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y = | |
| 34 | - (C * (2 : ℝ) ^ (1 / 2 + h)) * (4 : ℝ) ^ n * | |
| 35 | - iteratedDerivWithin n (RadialHeatProfile.profile (1 + h)) (Ici 0) (4 * y) := by | |
| 36 | - unfold exteriorProfile | |
| 37 | - rw [iteratedDerivWithin_const_mul_field] | |
| 38 | - rw [iteratedDerivWithin_comp_const_smul (s := Ici (0 : ℝ)) hy (uniqueDiffOn_Ici 0) | |
| 39 | - ((RadialHeatProfile.profile_contDiffOn (show 1 < 1 + h by linarith)).of_le | |
| 40 | - (ENat.natCast_le_of_coe_top_le_withTop le_rfl n)) 4 | |
| 41 | - (fun z hz => mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hz)] | |
| 42 | - simp only [smul_eq_mul, mul_assoc] | |
| 43 | - | |
| 44 | -/-- A finite bound independent of the nonnegative profile argument. -/ | |
| 45 | -noncomputable def exteriorDerivativeBound (C h : ℝ) (n : ℕ) : ℝ := | |
| 46 | - |C * (2 : ℝ) ^ (1 / 2 + h)| * (4 : ℝ) ^ n * | |
| 47 | - (|(Real.Gamma (1 + h))⁻¹ * RadialHeatProfile.derivativeCoeff (1 + h) n| * | |
| 48 | - Real.Gamma (1 + h + (n : ℝ))) | |
| 49 | - | |
| 50 | -theorem exteriorProfile_derivative_bound (C : ℝ) {h : ℝ} (hh : 0 < h) | |
| 51 | - (n : ℕ) {y : ℝ} (hy : 0 ≤ y) : | |
| 52 | - |iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y| ≤ exteriorDerivativeBound C h n := by | |
| 53 | - rw [exteriorProfile_iteratedDerivWithin C hh n hy, abs_mul, abs_mul, | |
| 54 | - abs_of_nonneg (show 0 ≤ (4 : ℝ) ^ n by positivity)] | |
| 55 | - exact mul_le_mul_of_nonneg_left | |
| 56 | - (RadialHeatProfile.profile_derivative_bound (show 1 < 1 + h by linarith) n | |
| 57 | - (mul_nonneg (by norm_num) hy)) (by positivity) | |
| 58 | - | |
| 59 | -theorem exteriorProfile_all_derivatives_bounded (C : ℝ) {h : ℝ} (hh : 0 < h) (n : ℕ) : | |
| 60 | - ∃ M : ℝ, 0 ≤ M ∧ ∀ y ∈ Ici (0 : ℝ), | |
| 61 | - |iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y| ≤ M := by | |
| 62 | - refine ⟨exteriorDerivativeBound C h n, ?_, fun y hy => exteriorProfile_derivative_bound C hh n hy⟩ | |
| 63 | - exact (abs_nonneg _).trans (exteriorProfile_derivative_bound C hh n (y := 0) le_rfl) | |
| 64 | - | |
| 65 | -/-- The angular speed expressed using backward time. -/ | |
| 66 | -noncomputable def amplitude (C h τ r : ℝ) : ℝ := | |
| 67 | - C * RadialHeatProfile.radialProfile (1 + h) τ r | |
| 68 | - | |
| 69 | -theorem amplitude_formula (C h τ : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 70 | - amplitude C h τ r = r ^ (-1 - 2 * h) * exteriorProfile C h (τ / r ^ 2) := by | |
| 71 | - have hpow : (r ^ 2 / 2) ^ (-(1 / 2 + h)) = | |
| 72 | - r ^ (-1 - 2 * h) * (2 : ℝ) ^ (1 / 2 + h) := by | |
| 73 | - rw [Real.div_rpow (sq_nonneg r) (by norm_num), ← Real.rpow_natCast r 2, | |
| 74 | - ← Real.rpow_mul hr.le] | |
| 75 | - norm_num only [Nat.cast_ofNat] | |
| 76 | - rw [show (2 : ℝ) * -(1 / 2 + h) = -1 - 2 * h by ring, | |
| 77 | - Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 2), div_inv_eq_mul] | |
| 78 | - have harg : 2 * τ / (r ^ 2 / 2) = 4 * (τ / r ^ 2) := by ring | |
| 79 | - rw [amplitude, RadialHeatProfile.radialProfile_source_formula, hpow, harg, exteriorProfile] | |
| 80 | - ring | |
| 81 | - | |
| 82 | -theorem amplitude_heat_equation (C : ℝ) {h τ r : ℝ} | |
| 83 | - (hh : 0 < h) (hτ : 0 < τ) (hr : 0 < r) : | |
| 84 | - -deriv (fun τ => amplitude C h τ r) τ = | |
| 85 | - iteratedDeriv 2 (amplitude C h τ) r + deriv (amplitude C h τ) r / r - | |
| 86 | - amplitude C h τ r / r ^ 2 := by | |
| 87 | - have he := RadialHeatProfile.radial_heat_equation (show 1 < 1 + h by linarith) hτ hr | |
| 88 | - change -deriv (fun τ => C * RadialHeatProfile.radialProfile (1 + h) τ r) τ = | |
| 89 | - iteratedDeriv 2 (fun r => C * RadialHeatProfile.radialProfile (1 + h) τ r) r + | |
| 90 | - deriv (fun r => C * RadialHeatProfile.radialProfile (1 + h) τ r) r / r - | |
| 91 | - C * RadialHeatProfile.radialProfile (1 + h) τ r / r ^ 2 | |
| 92 | - rw [iteratedDeriv_const_mul_field, deriv_const_mul_field, deriv_const_mul_field] | |
| 93 | - linear_combination C * he | |
| 94 | - | |
| 95 | -theorem amplitude_eq_heatAmplitude (C h t r : ℝ) : | |
| 96 | - amplitude C h (1 - t) r = TerminalStress.heatAmplitude C (1 + h) t r := rfl | |
| 97 | - | |
| 98 | -theorem heatCoefficient_radius (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 99 | - BaseExterior.heatCoefficient C h (TerminalStress.radiusPoint t r z) = | |
| 100 | - amplitude C h (1 - t) r / r := by | |
| 101 | - have he := TerminalStress.swirlCoefficient_amplitude C h (fun _ => 1) t z hr | |
| 102 | - simp only [TerminalStress.radialSlice, TerminalStress.flattening, mul_one] at he | |
| 103 | - apply (eq_div_iff hr.ne').mpr | |
| 104 | - simpa only [BaseExterior.heatCoefficient, amplitude_eq_heatAmplitude, mul_comm] using he | |
| 105 | - | |
| 106 | -theorem heatVelocity_formula (C h : ℝ) {w : ProblemStatement.SpaceTime} | |
| 107 | - (hs : 0 < AxisymmetricFields.radialEnergy w.2) : | |
| 108 | - BaseExterior.heatVelocity C h w = | |
| 109 | - (amplitude C h (1 - w.1) (Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2)) / | |
| 110 | - Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2)) • BaseResidual.angularVector w := by | |
| 111 | - rw [BaseExterior.heatVelocity_eq_angularVector] | |
| 112 | - have he := heatCoefficient_radius C h w.1 (w.2 2) | |
| 113 | - (show 0 < Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2) by positivity) | |
| 114 | - rw [TerminalStress.radiusPoint_profilePoint hs.le] at he | |
| 115 | - rw [he] | |
| 116 | - | |
| 117 | -end NavierStokes.LocalHeatFormula | |
+0 −107 NavierStokes/LocalHeatPressure.lean deleted
| @@ -1,107 +0,0 @@ | ||
| 1 | -import NavierStokes.BaseExterior | |
| 2 | -import Mathlib.MeasureTheory.Function.JacobianOneDim | |
| 3 | - | |
| 4 | -/-! | |
| 5 | -# Canonical heat pressure in the radius coordinate | |
| 6 | - | |
| 7 | -The canonical pressure in the regular coordinate `s = r ^ 2 / 2` is exactly | |
| 8 | -the radius tail integral of the squared heat amplitude divided by the radius. | |
| 9 | --/ | |
| 10 | - | |
| 11 | -noncomputable section | |
| 12 | - | |
| 13 | -open Set MeasureTheory | |
| 14 | - | |
| 15 | -namespace NavierStokes.LocalHeatPressure | |
| 16 | - | |
| 17 | -private theorem radiusChange_image {r : ℝ} (hr : 0 < r) : | |
| 18 | - (fun ρ : ℝ => ρ ^ 2 / 2) '' Ioi r = Ioi (r ^ 2 / 2) := by | |
| 19 | - ext s | |
| 20 | - constructor | |
| 21 | - · rintro ⟨ρ, hρ, rfl⟩ | |
| 22 | - change r < ρ at hρ | |
| 23 | - change r ^ 2 / 2 < ρ ^ 2 / 2 | |
| 24 | - nlinarith | |
| 25 | - · intro hs | |
| 26 | - change r ^ 2 / 2 < s at hs | |
| 27 | - have hs0 : 0 < s := by | |
| 28 | - have hr2 := sq_nonneg r | |
| 29 | - linarith | |
| 30 | - refine ⟨Real.sqrt (2 * s), ?_, ?_⟩ | |
| 31 | - · have hsq := Real.sq_sqrt (show 0 ≤ 2 * s by positivity) | |
| 32 | - have hnonneg := Real.sqrt_nonneg (2 * s) | |
| 33 | - change r < Real.sqrt (2 * s) | |
| 34 | - nlinarith | |
| 35 | - · dsimp only | |
| 36 | - rw [Real.sq_sqrt (by positivity)] | |
| 37 | - ring | |
| 38 | - | |
| 39 | -private theorem radiusChange_deriv (r ρ : ℝ) : | |
| 40 | - HasDerivWithinAt (fun x : ℝ => x ^ 2 / 2) ρ (Ioi r) ρ := by | |
| 41 | - simpa using (((hasDerivAt_id ρ).pow 2).div_const 2).hasDerivWithinAt (s := Ioi r) | |
| 42 | - | |
| 43 | -private theorem radiusChange_injOn {r : ℝ} (hr : 0 < r) : | |
| 44 | - InjOn (fun ρ : ℝ => ρ ^ 2 / 2) (Ioi r) := by | |
| 45 | - intro x hx y hy hxy | |
| 46 | - change r < x at hx | |
| 47 | - change r < y at hy | |
| 48 | - change x ^ 2 / 2 = y ^ 2 / 2 at hxy | |
| 49 | - nlinarith | |
| 50 | - | |
| 51 | -/-- Change the canonical pressure integral from `s` to the physical radius. -/ | |
| 52 | -theorem canonicalPressure_radius_integral (F : SimilarityProfile.PhysicalProfile) | |
| 53 | - (t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 54 | - TerminalStress.canonicalPressure F (TerminalStress.radiusPoint t r z) = | |
| 55 | - -(∫ ρ in Ioi r, ρ * F (TerminalStress.radiusPoint t ρ z) ^ 2) := by | |
| 56 | - unfold TerminalStress.canonicalPressure TerminalStress.radiusPoint | |
| 57 | - dsimp only | |
| 58 | - congr 1 | |
| 59 | - rw [← radiusChange_image hr] | |
| 60 | - rw [integral_image_eq_integral_abs_deriv_smul measurableSet_Ioi | |
| 61 | - (fun ρ _ => radiusChange_deriv r ρ) (radiusChange_injOn hr)] | |
| 62 | - apply setIntegral_congr_fun measurableSet_Ioi | |
| 63 | - intro ρ hρ | |
| 64 | - dsimp only | |
| 65 | - rw [abs_of_pos (hr.trans hρ), smul_eq_mul] | |
| 66 | - | |
| 67 | -/-- The regular swirl coefficient is the heat amplitude divided by the radius. -/ | |
| 68 | -theorem heatCoefficient_radius (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 69 | - BaseExterior.heatCoefficient C h (TerminalStress.radiusPoint t r z) = | |
| 70 | - TerminalStress.heatAmplitude C (1 + h) t r / r := by | |
| 71 | - have he := TerminalStress.swirlCoefficient_amplitude C h (fun _ => 1) t z hr | |
| 72 | - simp only [TerminalStress.radialSlice, TerminalStress.flattening, mul_one] at he | |
| 73 | - apply (eq_div_iff hr.ne').2 | |
| 74 | - exact (mul_comm _ _).trans he | |
| 75 | - | |
| 76 | -/-- The canonical pure heat pressure is the literal radial improper integral. -/ | |
| 77 | -theorem heatPressure_radius_integral (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 78 | - BaseExterior.heatPressure C h (TerminalStress.radiusPoint t r z) = | |
| 79 | - -(∫ ρ in Ioi r, TerminalStress.heatAmplitude C (1 + h) t ρ ^ 2 / ρ) := by | |
| 80 | - rw [BaseExterior.heatPressure, canonicalPressure_radius_integral _ t z hr] | |
| 81 | - congr 1 | |
| 82 | - apply setIntegral_congr_fun measurableSet_Ioi | |
| 83 | - intro ρ hρ | |
| 84 | - dsimp only | |
| 85 | - rw [heatCoefficient_radius C h t z (hr.trans hρ)] | |
| 86 | - field_simp | |
| 87 | - | |
| 88 | -/-- The radius pressure integrand is integrable on every positive exterior tail. -/ | |
| 89 | -theorem heatAmplitude_sq_div_integrable (C : ℝ) {h t r : ℝ} | |
| 90 | - (hh : 0 < h) (hh1 : h < 1 / 2) (ht : t < 1) (hr : 0 < r) : | |
| 91 | - IntegrableOn (fun ρ => TerminalStress.heatAmplitude C (1 + h) t ρ ^ 2 / ρ) | |
| 92 | - (Ioi r) := by | |
| 93 | - have hi := BaseExterior.heatCoefficient_sq_integrable C hh hh1 | |
| 94 | - (z := 0) ht (show 0 < r ^ 2 / 2 by positivity) | |
| 95 | - rw [← radiusChange_image hr] at hi | |
| 96 | - have hi' := (integrableOn_image_iff_integrableOn_abs_deriv_smul measurableSet_Ioi | |
| 97 | - (fun ρ _ => radiusChange_deriv r ρ) (radiusChange_injOn hr) | |
| 98 | - (fun s => BaseExterior.heatCoefficient C h (t, (s, 0)) ^ 2)).mp hi | |
| 99 | - apply hi'.congr_fun _ measurableSet_Ioi | |
| 100 | - intro ρ hρ | |
| 101 | - change |ρ| • BaseExterior.heatCoefficient C h | |
| 102 | - (TerminalStress.radiusPoint t ρ 0) ^ 2 = _ | |
| 103 | - rw [abs_of_pos (hr.trans hρ), smul_eq_mul, | |
| 104 | - heatCoefficient_radius C h t 0 (hr.trans hρ)] | |
| 105 | - field_simp | |
| 106 | - | |
| 107 | -end NavierStokes.LocalHeatPressure | |
+241 −2 NavierStokes/LocalPaperHeat.lean View file
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import NavierStokes.LocalPaperTheorem |
| 2 | -import NavierStokes.LocalHeatFormula | |
| 3 | -import NavierStokes.LocalHeatPressure | |
| 2 | +import NavierStokes.BaseExterior | |
| 3 | +import Mathlib.MeasureTheory.Function.JacobianOneDim | |
| 4 | +import NavierStokes.DirectAngularDiagonal | |
| 4 | 5 | |
| 5 | 6 | /-! |
| 6 | 7 | # The local theorem's literal radial heat formulas |
| @@ -10,6 +11,244 @@ They express the heat exterior in the manuscript's radius coordinate, including | ||
| 10 | 11 | the genuinely integrable pressure tail. |
| 11 | 12 | -/ |
| 12 | 13 | |
| 14 | +/-! ## From `NavierStokes/LocalHeatPressure.lean` | |
| 15 | + | |
| 16 | +The text of `NavierStokes/LocalHeatPressure.lean`, folded into this file, which was its only importer. -/ | |
| 17 | + | |
| 18 | +section | |
| 19 | + | |
| 20 | +/-! | |
| 21 | +# Canonical heat pressure in the radius coordinate | |
| 22 | + | |
| 23 | +The canonical pressure in the regular coordinate `s = r ^ 2 / 2` is exactly | |
| 24 | +the radius tail integral of the squared heat amplitude divided by the radius. | |
| 25 | +-/ | |
| 26 | + | |
| 27 | +noncomputable section | |
| 28 | + | |
| 29 | +open Set MeasureTheory | |
| 30 | + | |
| 31 | +namespace NavierStokes.LocalHeatPressure | |
| 32 | + | |
| 33 | +private theorem radiusChange_image {r : ℝ} (hr : 0 < r) : | |
| 34 | + (fun ρ : ℝ => ρ ^ 2 / 2) '' Ioi r = Ioi (r ^ 2 / 2) := by | |
| 35 | + ext s | |
| 36 | + constructor | |
| 37 | + · rintro ⟨ρ, hρ, rfl⟩ | |
| 38 | + change r < ρ at hρ | |
| 39 | + change r ^ 2 / 2 < ρ ^ 2 / 2 | |
| 40 | + nlinarith | |
| 41 | + · intro hs | |
| 42 | + change r ^ 2 / 2 < s at hs | |
| 43 | + have hs0 : 0 < s := by | |
| 44 | + have hr2 := sq_nonneg r | |
| 45 | + linarith | |
| 46 | + refine ⟨Real.sqrt (2 * s), ?_, ?_⟩ | |
| 47 | + · have hsq := Real.sq_sqrt (show 0 ≤ 2 * s by positivity) | |
| 48 | + have hnonneg := Real.sqrt_nonneg (2 * s) | |
| 49 | + change r < Real.sqrt (2 * s) | |
| 50 | + nlinarith | |
| 51 | + · dsimp only | |
| 52 | + rw [Real.sq_sqrt (by positivity)] | |
| 53 | + ring | |
| 54 | + | |
| 55 | +private theorem radiusChange_deriv (r ρ : ℝ) : | |
| 56 | + HasDerivWithinAt (fun x : ℝ => x ^ 2 / 2) ρ (Ioi r) ρ := by | |
| 57 | + simpa using (((hasDerivAt_id ρ).pow 2).div_const 2).hasDerivWithinAt (s := Ioi r) | |
| 58 | + | |
| 59 | +private theorem radiusChange_injOn {r : ℝ} (hr : 0 < r) : | |
| 60 | + InjOn (fun ρ : ℝ => ρ ^ 2 / 2) (Ioi r) := by | |
| 61 | + intro x hx y hy hxy | |
| 62 | + change r < x at hx | |
| 63 | + change r < y at hy | |
| 64 | + change x ^ 2 / 2 = y ^ 2 / 2 at hxy | |
| 65 | + nlinarith | |
| 66 | + | |
| 67 | +/-- Change the canonical pressure integral from `s` to the physical radius. -/ | |
| 68 | +theorem canonicalPressure_radius_integral (F : SimilarityProfile.PhysicalProfile) | |
| 69 | + (t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 70 | + TerminalStress.canonicalPressure F (TerminalStress.radiusPoint t r z) = | |
| 71 | + -(∫ ρ in Ioi r, ρ * F (TerminalStress.radiusPoint t ρ z) ^ 2) := by | |
| 72 | + unfold TerminalStress.canonicalPressure TerminalStress.radiusPoint | |
| 73 | + dsimp only | |
| 74 | + congr 1 | |
| 75 | + rw [← radiusChange_image hr] | |
| 76 | + rw [integral_image_eq_integral_abs_deriv_smul measurableSet_Ioi | |
| 77 | + (fun ρ _ => radiusChange_deriv r ρ) (radiusChange_injOn hr)] | |
| 78 | + apply setIntegral_congr_fun measurableSet_Ioi | |
| 79 | + intro ρ hρ | |
| 80 | + dsimp only | |
| 81 | + rw [abs_of_pos (hr.trans hρ), smul_eq_mul] | |
| 82 | + | |
| 83 | +/-- The regular swirl coefficient is the heat amplitude divided by the radius. -/ | |
| 84 | +theorem heatCoefficient_radius (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 85 | + BaseExterior.heatCoefficient C h (TerminalStress.radiusPoint t r z) = | |
| 86 | + TerminalStress.heatAmplitude C (1 + h) t r / r := by | |
| 87 | + have he := TerminalStress.swirlCoefficient_amplitude C h (fun _ => 1) t z hr | |
| 88 | + simp only [TerminalStress.radialSlice, TerminalStress.flattening, mul_one] at he | |
| 89 | + apply (eq_div_iff hr.ne').2 | |
| 90 | + exact (mul_comm _ _).trans he | |
| 91 | + | |
| 92 | +/-- The canonical pure heat pressure is the literal radial improper integral. -/ | |
| 93 | +theorem heatPressure_radius_integral (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 94 | + BaseExterior.heatPressure C h (TerminalStress.radiusPoint t r z) = | |
| 95 | + -(∫ ρ in Ioi r, TerminalStress.heatAmplitude C (1 + h) t ρ ^ 2 / ρ) := by | |
| 96 | + rw [BaseExterior.heatPressure, canonicalPressure_radius_integral _ t z hr] | |
| 97 | + congr 1 | |
| 98 | + apply setIntegral_congr_fun measurableSet_Ioi | |
| 99 | + intro ρ hρ | |
| 100 | + dsimp only | |
| 101 | + rw [heatCoefficient_radius C h t z (hr.trans hρ)] | |
| 102 | + field_simp | |
| 103 | + | |
| 104 | +/-- The radius pressure integrand is integrable on every positive exterior tail. -/ | |
| 105 | +theorem heatAmplitude_sq_div_integrable (C : ℝ) {h t r : ℝ} | |
| 106 | + (hh : 0 < h) (hh1 : h < 1 / 2) (ht : t < 1) (hr : 0 < r) : | |
| 107 | + IntegrableOn (fun ρ => TerminalStress.heatAmplitude C (1 + h) t ρ ^ 2 / ρ) | |
| 108 | + (Ioi r) := by | |
| 109 | + have hi := BaseExterior.heatCoefficient_sq_integrable C hh hh1 | |
| 110 | + (z := 0) ht (show 0 < r ^ 2 / 2 by positivity) | |
| 111 | + rw [← radiusChange_image hr] at hi | |
| 112 | + have hi' := (integrableOn_image_iff_integrableOn_abs_deriv_smul measurableSet_Ioi | |
| 113 | + (fun ρ _ => radiusChange_deriv r ρ) (radiusChange_injOn hr) | |
| 114 | + (fun s => BaseExterior.heatCoefficient C h (t, (s, 0)) ^ 2)).mp hi | |
| 115 | + apply hi'.congr_fun _ measurableSet_Ioi | |
| 116 | + intro ρ hρ | |
| 117 | + change |ρ| • BaseExterior.heatCoefficient C h | |
| 118 | + (TerminalStress.radiusPoint t ρ 0) ^ 2 = _ | |
| 119 | + rw [abs_of_pos (hr.trans hρ), smul_eq_mul, | |
| 120 | + heatCoefficient_radius C h t 0 (hr.trans hρ)] | |
| 121 | + field_simp | |
| 122 | + | |
| 123 | +end NavierStokes.LocalHeatPressure | |
| 124 | +end | |
| 125 | + | |
| 126 | +end | |
| 127 | + | |
| 128 | +/-! ## From `NavierStokes/LocalHeatFormula.lean` | |
| 129 | + | |
| 130 | +The text of `NavierStokes/LocalHeatFormula.lean`, folded into this file, which was its only importer. -/ | |
| 131 | + | |
| 132 | +section | |
| 133 | + | |
| 134 | +/-! | |
| 135 | +# The literal exterior heat profile in radial coordinates | |
| 136 | + | |
| 137 | +This packages the existing heat solution using the manuscript's argument | |
| 138 | +`τ / r²`, with its fixed normalization absorbed into the exterior profile. | |
| 139 | +-/ | |
| 140 | + | |
| 141 | +noncomputable section | |
| 142 | + | |
| 143 | +namespace NavierStokes.LocalHeatFormula | |
| 144 | + | |
| 145 | +open Set | |
| 146 | +open scoped ContDiff | |
| 147 | + | |
| 148 | +/-- The exterior profile with the fixed physical normalization absorbed. -/ | |
| 149 | +noncomputable def exteriorProfile (C h y : ℝ) : ℝ := | |
| 150 | + C * (2 : ℝ) ^ (1 / 2 + h) * RadialHeatProfile.profile (1 + h) (4 * y) | |
| 151 | + | |
| 152 | +theorem exteriorProfile_smooth (C : ℝ) {h : ℝ} (hh : 0 < h) : | |
| 153 | + ContDiffOn ℝ ∞ (exteriorProfile C h) (Ici 0) := by | |
| 154 | + have hm : MapsTo (fun y : ℝ => 4 * y) (Ici 0) (Ici 0) := by | |
| 155 | + intro y hy | |
| 156 | + exact mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hy | |
| 157 | + exact contDiffOn_const.mul | |
| 158 | + ((RadialHeatProfile.profile_contDiffOn (show 1 < 1 + h by linarith)).comp | |
| 159 | + (contDiffOn_const.mul contDiffOn_id) hm) | |
| 160 | + | |
| 161 | +theorem exteriorProfile_iteratedDerivWithin (C : ℝ) {h : ℝ} (hh : 0 < h) | |
| 162 | + (n : ℕ) {y : ℝ} (hy : 0 ≤ y) : | |
| 163 | + iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y = | |
| 164 | + (C * (2 : ℝ) ^ (1 / 2 + h)) * (4 : ℝ) ^ n * | |
| 165 | + iteratedDerivWithin n (RadialHeatProfile.profile (1 + h)) (Ici 0) (4 * y) := by | |
| 166 | + unfold exteriorProfile | |
| 167 | + rw [iteratedDerivWithin_const_mul_field] | |
| 168 | + rw [iteratedDerivWithin_comp_const_smul (s := Ici (0 : ℝ)) hy (uniqueDiffOn_Ici 0) | |
| 169 | + ((RadialHeatProfile.profile_contDiffOn (show 1 < 1 + h by linarith)).of_le | |
| 170 | + (ENat.natCast_le_of_coe_top_le_withTop le_rfl n)) 4 | |
| 171 | + (fun z hz => mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hz)] | |
| 172 | + simp only [smul_eq_mul, mul_assoc] | |
| 173 | + | |
| 174 | +/-- A finite bound independent of the nonnegative profile argument. -/ | |
| 175 | +noncomputable def exteriorDerivativeBound (C h : ℝ) (n : ℕ) : ℝ := | |
| 176 | + |C * (2 : ℝ) ^ (1 / 2 + h)| * (4 : ℝ) ^ n * | |
| 177 | + (|(Real.Gamma (1 + h))⁻¹ * RadialHeatProfile.derivativeCoeff (1 + h) n| * | |
| 178 | + Real.Gamma (1 + h + (n : ℝ))) | |
| 179 | + | |
| 180 | +theorem exteriorProfile_derivative_bound (C : ℝ) {h : ℝ} (hh : 0 < h) | |
| 181 | + (n : ℕ) {y : ℝ} (hy : 0 ≤ y) : | |
| 182 | + |iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y| ≤ exteriorDerivativeBound C h n := by | |
| 183 | + rw [exteriorProfile_iteratedDerivWithin C hh n hy, abs_mul, abs_mul, | |
| 184 | + abs_of_nonneg (show 0 ≤ (4 : ℝ) ^ n by positivity)] | |
| 185 | + exact mul_le_mul_of_nonneg_left | |
| 186 | + (RadialHeatProfile.profile_derivative_bound (show 1 < 1 + h by linarith) n | |
| 187 | + (mul_nonneg (by norm_num) hy)) (by positivity) | |
| 188 | + | |
| 189 | +theorem exteriorProfile_all_derivatives_bounded (C : ℝ) {h : ℝ} (hh : 0 < h) (n : ℕ) : | |
| 190 | + ∃ M : ℝ, 0 ≤ M ∧ ∀ y ∈ Ici (0 : ℝ), | |
| 191 | + |iteratedDerivWithin n (exteriorProfile C h) (Ici 0) y| ≤ M := by | |
| 192 | + refine ⟨exteriorDerivativeBound C h n, ?_, fun y hy => exteriorProfile_derivative_bound C hh n hy⟩ | |
| 193 | + exact (abs_nonneg _).trans (exteriorProfile_derivative_bound C hh n (y := 0) le_rfl) | |
| 194 | + | |
| 195 | +/-- The angular speed expressed using backward time. -/ | |
| 196 | +noncomputable def amplitude (C h τ r : ℝ) : ℝ := | |
| 197 | + C * RadialHeatProfile.radialProfile (1 + h) τ r | |
| 198 | + | |
| 199 | +theorem amplitude_formula (C h τ : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 200 | + amplitude C h τ r = r ^ (-1 - 2 * h) * exteriorProfile C h (τ / r ^ 2) := by | |
| 201 | + have hpow : (r ^ 2 / 2) ^ (-(1 / 2 + h)) = | |
| 202 | + r ^ (-1 - 2 * h) * (2 : ℝ) ^ (1 / 2 + h) := by | |
| 203 | + rw [Real.div_rpow (sq_nonneg r) (by norm_num), ← Real.rpow_natCast r 2, | |
| 204 | + ← Real.rpow_mul hr.le] | |
| 205 | + norm_num only [Nat.cast_ofNat] | |
| 206 | + rw [show (2 : ℝ) * -(1 / 2 + h) = -1 - 2 * h by ring, | |
| 207 | + Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 2), div_inv_eq_mul] | |
| 208 | + have harg : 2 * τ / (r ^ 2 / 2) = 4 * (τ / r ^ 2) := by ring | |
| 209 | + rw [amplitude, RadialHeatProfile.radialProfile_source_formula, hpow, harg, exteriorProfile] | |
| 210 | + ring | |
| 211 | + | |
| 212 | +theorem amplitude_heat_equation (C : ℝ) {h τ r : ℝ} | |
| 213 | + (hh : 0 < h) (hτ : 0 < τ) (hr : 0 < r) : | |
| 214 | + -deriv (fun τ => amplitude C h τ r) τ = | |
| 215 | + iteratedDeriv 2 (amplitude C h τ) r + deriv (amplitude C h τ) r / r - | |
| 216 | + amplitude C h τ r / r ^ 2 := by | |
| 217 | + have he := RadialHeatProfile.radial_heat_equation (show 1 < 1 + h by linarith) hτ hr | |
| 218 | + change -deriv (fun τ => C * RadialHeatProfile.radialProfile (1 + h) τ r) τ = | |
| 219 | + iteratedDeriv 2 (fun r => C * RadialHeatProfile.radialProfile (1 + h) τ r) r + | |
| 220 | + deriv (fun r => C * RadialHeatProfile.radialProfile (1 + h) τ r) r / r - | |
| 221 | + C * RadialHeatProfile.radialProfile (1 + h) τ r / r ^ 2 | |
| 222 | + rw [iteratedDeriv_const_mul_field, deriv_const_mul_field, deriv_const_mul_field] | |
| 223 | + linear_combination C * he | |
| 224 | + | |
| 225 | +theorem amplitude_eq_heatAmplitude (C h t r : ℝ) : | |
| 226 | + amplitude C h (1 - t) r = TerminalStress.heatAmplitude C (1 + h) t r := rfl | |
| 227 | + | |
| 228 | +theorem heatCoefficient_radius (C h t z : ℝ) {r : ℝ} (hr : 0 < r) : | |
| 229 | + BaseExterior.heatCoefficient C h (TerminalStress.radiusPoint t r z) = | |
| 230 | + amplitude C h (1 - t) r / r := by | |
| 231 | + have he := TerminalStress.swirlCoefficient_amplitude C h (fun _ => 1) t z hr | |
| 232 | + simp only [TerminalStress.radialSlice, TerminalStress.flattening, mul_one] at he | |
| 233 | + apply (eq_div_iff hr.ne').mpr | |
| 234 | + simpa only [BaseExterior.heatCoefficient, amplitude_eq_heatAmplitude, mul_comm] using he | |
| 235 | + | |
| 236 | +theorem heatVelocity_formula (C h : ℝ) {w : ProblemStatement.SpaceTime} | |
| 237 | + (hs : 0 < AxisymmetricFields.radialEnergy w.2) : | |
| 238 | + BaseExterior.heatVelocity C h w = | |
| 239 | + (amplitude C h (1 - w.1) (Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2)) / | |
| 240 | + Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2)) • BaseResidual.angularVector w := by | |
| 241 | + rw [BaseExterior.heatVelocity_eq_angularVector] | |
| 242 | + have he := heatCoefficient_radius C h w.1 (w.2 2) | |
| 243 | + (show 0 < Real.sqrt (2 * AxisymmetricFields.radialEnergy w.2) by positivity) | |
| 244 | + rw [TerminalStress.radiusPoint_profilePoint hs.le] at he | |
| 245 | + rw [he] | |
| 246 | + | |
| 247 | +end NavierStokes.LocalHeatFormula | |
| 248 | +end | |
| 249 | + | |
| 250 | +end | |
| 251 | + | |
| 13 | 252 | noncomputable section |
| 14 | 253 | |
| 15 | 254 | namespace NavierStokes.LocalPaper |
+255 −2 NavierStokes/LocalPotentialRebundle.lean View file
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | import NavierStokes.LocalAngularGrowth |
| 2 | -import NavierStokes.LocalHeatExterior | |
| 3 | -import NavierStokes.LocalAngularScalar | |
| 2 | +import NavierStokes.TailGaugePotential | |
| 4 | 3 | |
| 5 | 4 | /-! |
| 6 | 5 | # The local paper's potential representation |
| @@ -10,6 +9,260 @@ Moving that axial component into the direct angular field preserves the | ||
| 10 | 9 | velocity and gives the paper's vanishing vector potential in the heat exterior. |
| 11 | 10 | -/ |
| 12 | 11 | |
| 12 | +/-! ## From `NavierStokes/LocalHeatExterior.lean` | |
| 13 | + | |
| 14 | +The text of `NavierStokes/LocalHeatExterior.lean`, folded into this file, which was its only importer. -/ | |
| 15 | + | |
| 16 | +section | |
| 17 | + | |
| 18 | +/-! | |
| 19 | +# The axial part of the actual slow-base potential | |
| 20 | + | |
| 21 | +The stream coefficients vanish in the proved heat exterior. Consequently the | |
| 22 | +anchored potential is purely axial there, and its axial projection has the | |
| 23 | +same spatial curl as the constructed slow base. | |
| 24 | +-/ | |
| 25 | + | |
| 26 | +noncomputable section | |
| 27 | + | |
| 28 | +namespace NavierStokes.LocalHeatExterior | |
| 29 | + | |
| 30 | +open Set Filter ProblemStatement | |
| 31 | +open scoped Topology ContDiff | |
| 32 | + | |
| 33 | +/-- Projection of a potential onto its axial component. -/ | |
| 34 | +noncomputable def axialPart (A : VelocityField) : VelocityField := | |
| 35 | + fun w => A w 2 • coordinateVector 2 | |
| 36 | + | |
| 37 | +theorem axialPart_smooth {A : VelocityField} {S : Set SpaceTime} | |
| 38 | + (hA : ContDiffOn ℝ ∞ A S) : ContDiffOn ℝ ∞ (axialPart A) S := by | |
| 39 | + exact ((AxisymmetricFields.projection 2).contDiff.comp_contDiffOn hA).smul_const | |
| 40 | + (coordinateVector 2) | |
| 41 | + | |
| 42 | +theorem axialPart_awayExtensions {A : VelocityField} | |
| 43 | + (hA : JointResidualLimits.AwayExtensions A) : | |
| 44 | + JointResidualLimits.AwayExtensions (axialPart A) := by | |
| 45 | + intro x hx | |
| 46 | + obtain ⟨e⟩ := hA x hx | |
| 47 | + refine ⟨{ | |
| 48 | + value := axialPart e.value | |
| 49 | + domain := e.domain | |
| 50 | + isOpen := e.isOpen | |
| 51 | + mem := e.mem | |
| 52 | + smooth := axialPart_smooth e.smooth | |
| 53 | + agrees := ?_ }⟩ | |
| 54 | + intro w hw | |
| 55 | + exact congrArg (fun u : Space => u 2 • coordinateVector 2) (e.agrees hw) | |
| 56 | + | |
| 57 | +theorem axialPart_potential (H K : AxisymmetricFields.Profile) : | |
| 58 | + axialPart (AxisymmetricFields.potential H K) = AxisymmetricFields.potential (fun _ => 0) K := by | |
| 59 | + ext w i | |
| 60 | + fin_cases i <;> simp [axialPart, AxisymmetricFields.potential, coordinateVector] | |
| 61 | + | |
| 62 | +theorem axialPotential_curl (K : AxisymmetricFields.Profile) {w : SpaceTime} | |
| 63 | + (hK : DifferentiableAt ℝ K (AxisymmetricFields.profilePoint w.1 w.2)) : | |
| 64 | + SpatialCurl.spatialCurl (AxisymmetricFields.potential (fun _ => 0) K) w = | |
| 65 | + (-AxisymmetricFields.partialS K (AxisymmetricFields.profilePoint w.1 w.2)) • | |
| 66 | + BaseResidual.angularVector w := by | |
| 67 | + change AxisymmetricFields.velocity (fun _ => 0) K w = _ | |
| 68 | + ext i | |
| 69 | + fin_cases i | |
| 70 | + · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 0 = _ | |
| 71 | + rw [AxisymmetricFields.velocity_zero (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 72 | + simp [AxisymmetricFields.partialZ, BaseResidual.angularVector, coordinateVector] | |
| 73 | + ring | |
| 74 | + · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 1 = _ | |
| 75 | + rw [AxisymmetricFields.velocity_one (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 76 | + simp [AxisymmetricFields.partialZ, BaseResidual.angularVector, coordinateVector] | |
| 77 | + ring | |
| 78 | + · change AxisymmetricFields.velocity (fun _ => 0) K (w.1, w.2) 2 = _ | |
| 79 | + rw [AxisymmetricFields.velocity_two (fun _ => 0) K w.1 w.2 (differentiableAt_const 0) hK] | |
| 80 | + simp [AxisymmetricFields.partialS, BaseResidual.angularVector, coordinateVector] | |
| 81 | + | |
| 82 | +section ActualBase | |
| 83 | + | |
| 84 | +variable {F : OutgoingProfile.Profile} {W : NominalProfile.Witness F} | |
| 85 | + (H : NominalConeAssembly.Certificate W) {ld : ModulatedProfileAssembly.LoopData W} | |
| 86 | + (v : ModulatedProfileAssembly.Witness ld) | |
| 87 | + | |
| 88 | +/-- The angular coefficient of the curl of the axial projection. -/ | |
| 89 | +noncomputable def axialCurlCoefficient (upper : ℝ) (B : ℕ) : AxisymmetricFields.Profile := | |
| 90 | + fun p => -AxisymmetricFields.partialS | |
| 91 | + (TailGaugePotential.gaugedSwirl (FinalSlowBase.scales H v upper B) F.data.h | |
| 92 | + W.axis.normalization (FinalSlowBase.coefficients H v)) p | |
| 93 | + | |
| 94 | +theorem axialPart_finalPotential_curl_angular (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 95 | + (ht : w.1 < 1) : | |
| 96 | + SpatialCurl.spatialCurl (axialPart (TailGaugePotential.finalPotential H v upper B)) w = | |
| 97 | + axialCurlCoefficient H v upper B (AxisymmetricFields.profilePoint w.1 w.2) • | |
| 98 | + BaseResidual.angularVector w := by | |
| 99 | + unfold TailGaugePotential.finalPotential TailGaugePotential.potential | |
| 100 | + rw [axialPart_potential] | |
| 101 | + exact axialPotential_curl _ | |
| 102 | + ((TailGaugePotential.gaugedSwirl_smoothAt (FinalSlowBase.scales_strictMono H v upper B) | |
| 103 | + F.data.h_pos F.data.h_lt_half (FinalSlowBase.coefficients_smooth H v) ht).differentiableAt | |
| 104 | + (by simp)) | |
| 105 | + | |
| 106 | +theorem finalPotential_eq_axialPart (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 107 | + (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 108 | + TailGaugePotential.finalPotential H v upper B w = | |
| 109 | + axialPart (TailGaugePotential.finalPotential H v upper B) w := by | |
| 110 | + have hext := ModulatedExterior.realized_exterior_coefficients W v.profiles v.finiteModification | |
| 111 | + (FinalSlowBase.realizesScheme H v) (EntranceAlignedBase.modulated_base_eq H v) | |
| 112 | + (EntranceAlignedBase.modulated_outer H v) | |
| 113 | + have hzero := BaseExterior.exterior_stream_zero | |
| 114 | + (a := FinalSlowBase.scales H v upper B) (C := W.axis.normalization) | |
| 115 | + (p := AxisymmetricFields.profilePoint w.1 w.2) | |
| 116 | + F.data.h_pos F.data.h_lt_half (BaseExterior.nominalExteriorRadius_pos W).le hext hw | |
| 117 | + have he : TailGaugePotential.finalPotential H v upper B w = | |
| 118 | + TailGaugePotential.gaugedSwirl (FinalSlowBase.scales H v upper B) F.data.h | |
| 119 | + W.axis.normalization (FinalSlowBase.coefficients H v) | |
| 120 | + (AxisymmetricFields.profilePoint w.1 w.2) • coordinateVector 2 := by | |
| 121 | + simp only [TailGaugePotential.finalPotential, TailGaugePotential.potential, | |
| 122 | + AxisymmetricFields.potential, hzero, mul_zero, zero_smul, zero_add] | |
| 123 | + unfold axialPart | |
| 124 | + rw [he] | |
| 125 | + simp [coordinateVector] | |
| 126 | + | |
| 127 | +theorem axialPart_finalPotential_germ (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 128 | + (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 129 | + axialPart (TailGaugePotential.finalPotential H v upper B) =ᶠ[𝓝 w] | |
| 130 | + TailGaugePotential.finalPotential H v upper B := by | |
| 131 | + filter_upwards [(BaseExterior.cartesianExterior_isOpen F.data.h_pos F.data.h_lt_half | |
| 132 | + (BaseExterior.nominalExteriorRadius W)).mem_nhds hw] with y hy | |
| 133 | + exact (finalPotential_eq_axialPart H v upper B hy).symm | |
| 134 | + | |
| 135 | +theorem axialPart_finalPotential_curl (upper : ℝ) (B : ℕ) {w : SpaceTime} | |
| 136 | + (hw : w ∈ BaseExterior.cartesianExterior F.data.h (BaseExterior.nominalExteriorRadius W)) : | |
| 137 | + SpatialCurl.spatialCurl (axialPart (TailGaugePotential.finalPotential H v upper B)) w = | |
| 138 | + FinalSlowBase.velocity H v upper B w := by | |
| 139 | + rw [(SolenoidalDiagonal.spatialCurl_eventuallyEq | |
| 140 | + (axialPart_finalPotential_germ H v upper B hw)).self_of_nhds] | |
| 141 | + exact TailGaugePotential.finalPotential_sameCurl H v upper B hw.1 | |
| 142 | + | |
| 143 | +end ActualBase | |
| 144 | + | |
| 145 | +end NavierStokes.LocalHeatExterior | |
| 146 | +end | |
| 147 | + | |
| 148 | +end | |
| 149 | + | |
| 150 | +/-! ## From `NavierStokes/LocalAngularScalar.lean` | |
| 151 | + | |
| 152 | +The text of `NavierStokes/LocalAngularScalar.lean`, folded into this file, which was its only importer. -/ | |
| 153 | + | |
| 154 | +section | |
| 155 | + | |
| 156 | +/-! | |
| 157 | +# A scalar representation of the selected direct angular field | |
| 158 | + | |
| 159 | +The same locally finite cutoffs can be summed as scalar cylindrical | |
| 160 | +coefficients. The resulting scalar is independent of the polar angle, and | |
| 161 | +its angular vector field is the actual selected direct sum. | |
| 162 | +-/ | |
| 163 | + | |
| 164 | +noncomputable section | |
| 165 | + | |
| 166 | +open Set Filter | |
| 167 | +open scoped Topology | |
| 168 | + | |
| 169 | +namespace NavierStokes.LocalAngularScalar | |
| 170 | + | |
| 171 | +open ProblemStatement DirectAngularDiagonal CorrectionInitialization | |
| 172 | + | |
| 173 | +def angularDirection (w : SpaceTime) : Space := | |
| 174 | + (-w.2 1 / radius w) • coordinateVector 0 + | |
| 175 | + (w.2 0 / radius w) • coordinateVector 1 | |
| 176 | + | |
| 177 | +theorem angularField_eq_smul (b : Coefficient) (w : SpaceTime) : | |
| 178 | + angularField b w = b (cylPoint w) • angularDirection w := by | |
| 179 | + simp only [angularField, angularDirection, smul_add, smul_smul] | |
| 180 | + rw [mul_comm (b (cylPoint w)) (-w.2 1 / radius w), | |
| 181 | + mul_comm (b (cylPoint w)) (w.2 0 / radius w)] | |
| 182 | + | |
| 183 | +theorem angularField_add (b c : Coefficient) : | |
| 184 | + angularField (fun p => b p + c p) = fun w => angularField b w + angularField c w := by | |
| 185 | + funext w | |
| 186 | + simp only [angularField_eq_smul, add_smul] | |
| 187 | + | |
| 188 | +/-- Convert a smooth coefficient of the Cartesian rotation vector into its | |
| 189 | +physical angular magnitude in cylindrical coordinates. -/ | |
| 190 | +def magnitudeOfProfile (F : AxisymmetricFields.Profile) : Coefficient := | |
| 191 | + fun p => p.2.1 * F (p.1, (p.2.1 ^ 2 / 2, p.2.2)) | |
| 192 | + | |
| 193 | +theorem angularField_magnitudeOfProfile (F : AxisymmetricFields.Profile) (w : SpaceTime) : | |
| 194 | + angularField (magnitudeOfProfile F) w = | |
| 195 | + F (AxisymmetricFields.profilePoint w.1 w.2) • BaseResidual.angularVector w := by | |
| 196 | + have hrsq : radius w ^ 2 = w.2 0 ^ 2 + w.2 1 ^ 2 := | |
| 197 | + PolarCharts.radius_sq (PhysicalGraphBounds.radialProjection w) | |
| 198 | + have hval : magnitudeOfProfile F (cylPoint w) = | |
| 199 | + radius w * F (AxisymmetricFields.profilePoint w.1 w.2) := by | |
| 200 | + simp only [magnitudeOfProfile, cylPoint, hrsq, AxisymmetricFields.profilePoint, | |
| 201 | + AxisymmetricFields.radialEnergy] | |
| 202 | + simp only [angularField, hval, BaseResidual.angularVector, smul_add, smul_smul] | |
| 203 | + by_cases hr : radius w = 0 | |
| 204 | + · have hx0 : w.2 0 = 0 := by rw [hr] at hrsq; nlinarith [sq_nonneg (w.2 1)] | |
| 205 | + have hx1 : w.2 1 = 0 := by rw [hr] at hrsq; nlinarith [sq_nonneg (w.2 0)] | |
| 206 | + simp only [hx0, hx1, neg_zero, zero_div, zero_mul, mul_zero, zero_smul, add_zero] | |
| 207 | + · have h0 : (-w.2 1 / radius w) * | |
| 208 | + (radius w * F (AxisymmetricFields.profilePoint w.1 w.2)) = | |
| 209 | + F (AxisymmetricFields.profilePoint w.1 w.2) * -w.2 1 := by | |
| 210 | + field_simp [hr] | |
| 211 | + have h1 : (w.2 0 / radius w) * | |
| 212 | + (radius w * F (AxisymmetricFields.profilePoint w.1 w.2)) = | |
| 213 | + F (AxisymmetricFields.profilePoint w.1 w.2) * w.2 0 := by | |
| 214 | + field_simp [hr] | |
| 215 | + rw [h0, h1] | |
| 216 | + | |
| 217 | +def scalarSum (a : ℕ → ℝ) (q : Coefficient) (b : ℕ → Coefficient) : Coefficient := | |
| 218 | + fun p => ∑' j : ℕ, SmoothCutoffs.scaledCutoff (a j) (q p) * b j p | |
| 219 | + | |
| 220 | +/-- Local finiteness of the cutoff series justifies pulling the angular | |
| 221 | +direction through the scalar sum, including at the axis. -/ | |
| 222 | +theorem angularSum_eq_scalarSum {a : ℕ → ℝ} (ha : Tendsto a atTop atTop) | |
| 223 | + (q : Coefficient) (b : ℕ → Coefficient) {w : SpaceTime} | |
| 224 | + (hq : ContinuousAt (fun y : SpaceTime => q (cylPoint y)) w) | |
| 225 | + (hpos : 0 < q (cylPoint w)) : | |
| 226 | + angularSum a (fun y => q (cylPoint y)) b w = angularField (scalarSum a q b) w := by | |
| 227 | + have hs : Summable (fun j : ℕ => | |
| 228 | + SmoothCutoffs.scaledCutoff (a j) (q (cylPoint w)) * b j (cylPoint w)) := by | |
| 229 | + simpa only [SolenoidalDiagonal.cutStage, smul_eq_mul] using | |
| 230 | + SolenoidalDiagonal.summable_cutStage ha hq hpos | |
| 231 | + (fun j (y : SpaceTime) => b j (cylPoint y)) | |
| 232 | + simp only [angularSum, SolenoidalDiagonal.potentialSum, SolenoidalDiagonal.cutStage, | |
| 233 | + angularField_eq_smul, smul_smul] | |
| 234 | + rw [hs.tsum_smul_const] | |
| 235 | + rfl | |
| 236 | + | |
| 237 | +def selectedScalar (a : ℕ → ℕ) : Coefficient := | |
| 238 | + scalarSum (fun j => (a j : ℝ)) (qCoefficient ActualPrimary.h) | |
| 239 | + (fun j => (ActualCandidateAssembly.directData ActualCandidateConstruction.selectedBudget | |
| 240 | + ActualCandidateConstruction.selectedThreshold | |
| 241 | + ActualCandidateConstruction.selectedThreshold_geometry j).scalar) | |
| 242 | + | |
| 243 | +/-- The actual selected direct sum is one axisymmetric scalar times the | |
| 244 | +angular unit vector on the entire preterminal domain. -/ | |
| 245 | +theorem selectedDirect_eq_angularField {a : ℕ → ℕ} | |
| 246 | + (ha : Tendsto (fun j => (a j : ℝ)) atTop atTop) : | |
| 247 | + EqOn (LocalAngularGrowth.selectedDirect a) (angularField (selectedScalar a)) | |
| 248 | + PhysicalWaveSum.preterminal := by | |
| 249 | + intro w hw | |
| 250 | + have hq : ContinuousAt (fun y : SpaceTime => qCoefficient ActualPrimary.h (cylPoint y)) w := | |
| 251 | + (PhysicalWaveSum.physicalQ_smoothAt ActualPrimary.outgoing.data.h_pos | |
| 252 | + ActualPrimary.outgoing.data.h_lt_half hw).continuousAt | |
| 253 | + have hpos : 0 < qCoefficient ActualPrimary.h (cylPoint w) := | |
| 254 | + PhysicalWaveSum.physicalQ_pos ActualPrimary.outgoing.data.h_pos | |
| 255 | + ActualPrimary.outgoing.data.h_lt_half hw | |
| 256 | + exact angularSum_eq_scalarSum ha (qCoefficient ActualPrimary.h) | |
| 257 | + (fun j => (ActualCandidateAssembly.directData ActualCandidateConstruction.selectedBudget | |
| 258 | + ActualCandidateConstruction.selectedThreshold | |
| 259 | + ActualCandidateConstruction.selectedThreshold_geometry j).scalar) hq hpos | |
| 260 | + | |
| 261 | +end NavierStokes.LocalAngularScalar | |
| 262 | +end | |
| 263 | + | |
| 264 | +end | |
| 265 | + | |
| 13 | 266 | noncomputable section |
| 14 | 267 | |
| 15 | 268 | namespace NavierStokes.LocalPotentialRebundle |
+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") | |
+11 −0 routes/s5-ns-local-1/README.md added View file
| @@ -0,0 +1,11 @@ | ||
| 1 | +--- | |
| 2 | +issue: 14 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | +# s5-ns-local-1 | |
| 6 | + | |
| 7 | +Family `NavierStokes/Local*`. Four small modules, each imported by exactly one file of the same family and folder, are folded into that file with their text unchanged: `LocalHeatPressure.lean` and `LocalHeatFormula.lean` into `LocalPaperHeat.lean`; `LocalHeatExterior.lean` and `LocalAngularScalar.lean` into `LocalPotentialRebundle.lean`. The plan is `plan.json` here; `docs/s5-folding/fold.py` is brought as it now is, with the series' statement listing `ContentTail.lean` and the page's section on how it was taken. | |
| 8 | + | |
| 9 | +## Next | |
| 10 | + | |
| 11 | +Nothing further for this unit: the pull request is open and `build` will report on it. | |
+15 −0 routes/s5-ns-local-1/plan.json added View file
| @@ -0,0 +1,15 @@ | ||
| 1 | +{ | |
| 2 | +"imports": "in place", | |
| 3 | +"folds": { | |
| 4 | +"NavierStokes/LocalPaperHeat.lean": [ | |
| 5 | +"NavierStokes/LocalHeatPressure.lean", | |
| 6 | +"NavierStokes/LocalHeatFormula.lean", | |
| 7 | +"NavierStokes/LocalPaperHeat.lean" | |
| 8 | +], | |
| 9 | +"NavierStokes/LocalPotentialRebundle.lean": [ | |
| 10 | +"NavierStokes/LocalHeatExterior.lean", | |
| 11 | +"NavierStokes/LocalAngularScalar.lean", | |
| 12 | +"NavierStokes/LocalPotentialRebundle.lean" | |
| 13 | +] | |
| 14 | +} | |
| 15 | +} | |