import NavierStokes.MeanIncrementBounds /-! # Changes in the angularly averaged residual Section 8.1, equation (8.3), of *Finite time blowup for Navier–Stokes* (166-page version) gives the azimuthal and axial residuals and the radial pressure source. This module subtracts those expressions before and after a covariance increment, first with the mean fixed and then with a simultaneous mean update. It also bounds the covariance contributions from a bound on each tensor entry. -/ noncomputable section namespace NavierStokes.CorrectionStep open Set WeightedClasses MeanIncrementBounds open scoped ContDiff BigOperators variable {D : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] abbrev ScalarField (D : Type) := MeanIncrementBounds.Field D abbrev Tensor (D : Type) := Fin 3 → Fin 3 → ScalarField D /-- These are changes of the literal covariance terms in (8.3). -/ noncomputable def thetaCovarianceChange (o : Operators D) (X : Tensor D) : ScalarField D := o.radialDiv 2 (X 0 1) + o.dz (X 2 1) noncomputable def axialCovarianceChange (o : Operators D) (X : Tensor D) : ScalarField D := o.radialDiv 1 (X 0 2) + o.dz (X 2 2) noncomputable def radialCovarianceChange (o : Operators D) (X : Tensor D) : ScalarField D := -o.radialDiv 1 (X 0 0) - o.dz (X 2 0) + o.invRadius * X 1 1 theorem smooth_updated {U : Set D} {m h : Triple D} (hm : SmoothTriple U m) (hh : SmoothTriple U h) : SmoothTriple U (updated m h) := ⟨hm.radial.add hh.radial, hm.angular.add hh.angular, hm.axial.add hh.axial⟩ section CovarianceChanges variable {U : Set D} (hU : IsOpen U) (o : Operators D) {b m : Triple D} (hb : SmoothTriple U b) (hm : SmoothTriple U m) (W X : Tensor D) (hW : ∀ i j, SmoothOn U (W i j)) (hX : ∀ i j, SmoothOn U (X i j)) include hU hb hm hW hX in theorem thetaResidual_covariance_change (T : ScalarField D) : Agree U (thetaResidual o b m (W + X) T - thetaResidual o b m W T) (thetaCovarianceChange o X) := by have hr : thetaRadial b m + (W + X) 0 1 = (thetaRadial b m + W 0 1) + X 0 1 := by funext n x simp only [Pi.add_apply] ring have hz : thetaAxial b m + (W + X) 2 1 = (thetaAxial b m + W 2 1) + X 2 1 := by funext n x simp only [Pi.add_apply] ring simp only [Pi.add_apply] at hr hz intro n x hx simp only [thetaResidual, Pi.sub_apply, Pi.add_apply] rw [hr, hz, o.radialDiv_add hU 2 ((hb.thetaRadial hm).add (hW 0 1)) (hX 0 1) n hx, o.dz_add hU ((hb.thetaAxial hm).add (hW 2 1)) (hX 2 1) n hx] simp only [thetaCovarianceChange, Pi.add_apply] ring include hU hb hm hW hX in theorem axialResidual_covariance_change (p T : ScalarField D) (hp : SmoothOn U p) : Agree U (axialResidual o b m (W + X) p T - axialResidual o b m W p T) (axialCovarianceChange o X) := by have hr : axialRadial b m + (W + X) 0 2 = (axialRadial b m + W 0 2) + X 0 2 := by funext n x simp only [Pi.add_apply] ring have hz : axialAxial b m + (W + X) 2 2 + p = (axialAxial b m + W 2 2 + p) + X 2 2 := by funext n x simp only [Pi.add_apply] ring simp only [Pi.add_apply] at hr hz intro n x hx simp only [axialResidual, Pi.sub_apply, Pi.add_apply] rw [hr, hz, o.radialDiv_add hU 1 ((hb.axialRadial hm).add (hW 0 2)) (hX 0 2) n hx, o.dz_add hU (((hb.axialAxial hm).add (hW 2 2)).add hp) (hX 2 2) n hx] simp only [axialCovarianceChange, Pi.add_apply] ring include hU hb hm hW hX in theorem gr_covariance_change : Agree U (gr o b m (W + X) - gr o b m W) (radialCovarianceChange o X) := by have hr : radialRadial b m + (W + X) 0 0 = (radialRadial b m + W 0 0) + X 0 0 := by funext n x simp only [Pi.add_apply] ring have hz : axialRadial b m + (W + X) 2 0 = (axialRadial b m + W 2 0) + X 2 0 := by funext n x simp only [Pi.add_apply] ring simp only [Pi.add_apply] at hr hz intro n x hx simp only [gr, Pi.sub_apply, Pi.add_apply, Pi.neg_apply, Pi.mul_apply] rw [hr, hz, o.radialDiv_add hU 1 ((hb.radialRadial hm).add (hW 0 0)) (hX 0 0) n hx, o.dz_add hU ((hb.axialRadial hm).add (hW 2 0)) (hX 2 0) n hx] simp only [radialCovarianceChange, Pi.add_apply, Pi.sub_apply, Pi.neg_apply, Pi.mul_apply] ring end CovarianceChanges section JointChanges variable {U : Set D} (hU : IsOpen U) (o : Operators D) (ha : ContDiffOn ℝ ∞ o.radialProfile U) {b m h : Triple D} (hb : SmoothTriple U b) (hm : SmoothTriple U m) (hh : SmoothTriple U h) (W X : Tensor D) (hW : ∀ i j, SmoothOn U (W i j)) (hX : ∀ i j, SmoothOn U (X i j)) include hU ha hb hm hh hW hX in theorem thetaResidual_joint_change (T : ScalarField D) : Agree U (thetaResidual o b (updated m h) (W + X) T - thetaResidual o b m W T) (o.fastTime h.angular + thetaRemainder o b m h + thetaCovarianceChange o X) := by intro n x hx have hmean := thetaResidual_change hU o ha hb hm hh W hW T n hx have hwave := thetaResidual_covariance_change hU o hb (smooth_updated hm hh) W X hW hX T n hx simp only [Pi.add_apply, Pi.sub_apply] at * linarith include hU ha hb hm hh hW hX in theorem axialResidual_joint_change (p δp T : ScalarField D) (hp : SmoothOn U p) (hδp : SmoothOn U δp) : Agree U (axialResidual o b (updated m h) (W + X) (p + δp) T - axialResidual o b m W p T) (o.fastTime h.axial + axialRemainder o b m h δp + axialCovarianceChange o X) := by intro n x hx have hmean := axialResidual_change hU o ha hb hm hh W hW p δp T hp hδp n hx have hwave := axialResidual_covariance_change hU o hb (smooth_updated hm hh) W X hW hX (p + δp) T (hp.add hδp) n hx simp only [Pi.add_apply, Pi.sub_apply] at * linarith include hU ha hb hm hh hW hX in theorem gr_joint_change : Agree U (gr o b (updated m h) (W + X) - gr o b m W) (leadingRadial o b h + radialRemainder o b m h + radialCovarianceChange o X) := by intro n x hx have hmean := gr_change hU o ha hb hm hh W hW n hx have hwave := gr_covariance_change hU o hb (smooth_updated hm hh) W X hW hX n hx simp only [Pi.add_apply, Pi.sub_apply] at * linarith end JointChanges /-- A bound on each actual tensor entry. It is not a bound on the resulting residual and contains no update-preservation assertion. -/ def TensorClass (s : StripData D) (α : ℝ) (X : Tensor D) : Prop := ∀ i j, MeanClass s α (X i j) section CovarianceBounds variable {s : StripData D} {o : Operators D} {κ α : ℝ} (ho : OperatorBounds s o κ) {X : Tensor D} (hX : TensorClass s α X) include ho hX in theorem thetaCovarianceChange_mem : MeanClass s (α - κ) (thetaCovarianceChange o X) := by exact (ho.radialDiv (hX 0 1) 2).add ((ho.dz (hX 2 1)).mono_exponent (by linarith [ho.kappa_nonneg])) include ho hX in theorem axialCovarianceChange_mem : MeanClass s (α - κ) (axialCovarianceChange o X) := by exact (ho.radialDiv (hX 0 2) 1).add ((ho.dz (hX 2 2)).mono_exponent (by linarith [ho.kappa_nonneg])) include ho hX in theorem radialCovarianceChange_mem : MeanClass s (α - κ) (radialCovarianceChange o X) := by exact (Class.sub (Class.neg (ho.radialDiv (hX 0 0) 1)) ((ho.dz (hX 2 0)).mono_exponent (by linarith [ho.kappa_nonneg]))).add ((ho.inv_mul (hX 1 1)).mono_exponent (by linarith [ho.kappa_nonneg])) end CovarianceBounds end NavierStokes.CorrectionStep