import Euler.GraphVelocityTrace import Euler.SmoothTimeFieldPrecomp import Euler.SmoothTimeFieldLinear import Euler.SmoothFlowVolume import Euler.SmoothFlowJets import Euler.SmoothFlowTimeGevrey import Euler.SmoothFlowAcceleration /-! The true physical graph flow and its first two time derivatives. The change of labels is an actual ODE conjugacy, and the resulting three-dimensional flow preserves ordinary Lebesgue volume. -/ /-! ## From `Euler/SmoothScaledFlow.lean` The text of `Euler/SmoothScaledFlow.lean`, folded into this file, which was its only importer. -/ section /-! A physical label dilation of a smooth velocity has the conjugate actual flow. Displacement, material velocity and material acceleration are the literal dilations of the corresponding original fields. -/ noncomputable section namespace EulerSmoothBanachFlow open Set ContinuousLinearMap MeasureTheory EulerSmoothFlowGevrey open scoped ContDiff variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] (T : ℝ) (hT : 0 ≤ T) (A : SmoothTimeField (Icc (0 : ℝ) T) E E) (ell : ℝ) def scaledCoefficient : SmoothTimeField (Icc (0 : ℝ) T) E E := (A.precompLinear (ell⁻¹ • ContinuousLinearMap.id ℝ E)).map (ell • ContinuousLinearMap.id ℝ E) @[simp] theorem scaledCoefficient_apply (t : Icc (0 : ℝ) T) (x : E) : (scaledCoefficient T A ell).field t x = ell • A.field t (ell⁻¹ • x) := rfl theorem scaledCoefficient_timeDerivative (A₁ : SmoothTimeField (Icc (0 : ℝ) T) E E) (htime : SmoothTimeField.TimeDerivative T hT A A₁) : SmoothTimeField.TimeDerivative T hT (scaledCoefficient T A ell) (scaledCoefficient T A₁ ell) := (htime.precompLinear (ell⁻¹ • ContinuousLinearMap.id ℝ E)).map (ell • ContinuousLinearMap.id ℝ E) variable [FiniteDimensional ℝ E] theorem scaled_flow_eq (hell : ell ≠ 0) (s t : ℝ) (x : E) : (flowData T hT (scaledCoefficient T A ell)).flow s t x = ell • (flowData T hT A).flow s t (ell⁻¹ • x) := by let V := flowData T hT (scaledCoefficient T A ell) have hd (r : ℝ) : HasDerivAt (fun q => ell • (flowData T hT A).flow s q (ell⁻¹ • x)) (V.velocity r (ell • (flowData T hT A).flow s r (ell⁻¹ • x))) r := by have h := ((flowData T hT A).flow_hasDerivAt s r (ell⁻¹ • x)).const_smul ell convert h using 1 · rfl · change ell • A.field (projIcc 0 T hT r) (ell⁻¹ • (ell • (flowData T hT A).flow s r (ell⁻¹ • x))) = _ simp only [smul_smul,inv_mul_cancel₀ hell,one_smul] rfl have hi : ell • (flowData T hT A).flow s s (ell⁻¹ • x) = x := by simp only [EulerBoundedLipschitzFlow.Data.flow_initial,smul_smul,mul_inv_cancel₀ hell,one_smul] exact (congrFun (V.flow_unique s x _ hd hi) t).symm theorem scaled_displacement_eq (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : E) : displacement T hT (scaledCoefficient T A ell) t x = ell • displacement T hT A t (ell⁻¹ • x) := by rw [displacement_eq,displacement_eq] change (flowData T hT (scaledCoefficient T A ell)).flow 0 t x-x = _ rw [scaled_flow_eq T hT A ell hell,smul_sub,smul_smul,mul_inv_cancel₀ hell,one_smul] rfl theorem scaled_materialVelocity_eq (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : E) : materialVelocity T hT (scaledCoefficient T A ell) t x = ell • materialVelocity T hT A t (ell⁻¹ • x) := by unfold materialVelocity rw [scaledCoefficient_apply] change ell • A.field t (ell⁻¹ • (flowData T hT (scaledCoefficient T A ell)).flow 0 t x) = _ rw [scaled_flow_eq T hT A ell hell,smul_smul,inv_mul_cancel₀ hell,one_smul] rfl omit [FiniteDimensional ℝ E] in theorem scaledCoefficient_fderiv (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : E) : fderiv ℝ ((scaledCoefficient T A ell).field t : E → E) x = fderiv ℝ (A.field t : E → E) (ell⁻¹ • x) := by have h := ((((A.smooth t).differentiable (by simp) (ell⁻¹ • x)).hasFDerivAt).comp x ((ell⁻¹ • ContinuousLinearMap.id ℝ E).hasFDerivAt)).const_smul ell change HasFDerivAt (fun y => ell • A.field t (ell⁻¹ • y)) _ x at h change fderiv ℝ (fun y => ell • A.field t (ell⁻¹ • y)) x = _ rw [h.fderiv] ext v simp only [FunLike.coe_smul,Pi.smul_apply,comp_apply,id_apply,map_smul,smul_smul,mul_inv_cancel₀ hell,one_smul] omit [FiniteDimensional ℝ E] in theorem scaledCoefficient_trace_zero (hell : ell ≠ 0) (hdiv : ∀ t x, LinearMap.trace ℝ E (fderiv ℝ (A.field t : E → E) x).toLinearMap=0) (t : Icc (0 : ℝ) T) (x : E) : LinearMap.trace ℝ E (fderiv ℝ ((scaledCoefficient T A ell).field t : E → E) x).toLinearMap=0 := by rw [scaledCoefficient_fderiv T A ell hell] exact hdiv t _ end EulerSmoothBanachFlow end end /-! ## From `Euler/SmoothGraphFlow.lean` The text of `Euler/SmoothGraphFlow.lean`, folded into this file, which was its only importer. -/ section /-! The graph restriction of the actual lifted flow is the actual flow of a smooth three-dimensional velocity. It preserves ordinary spatial volume when the original lifted velocity has zero trace. -/ noncomputable section namespace EulerGraphInvariantFlow open Set MeasureTheory ContinuousLinearMap EulerLiftedGradientSpace EulerSmoothBanachFlow open scoped ContDiff variable (k : ℝ) (m : Vector3) (T : ℝ) (hT : 0 ≤ T) (A : SmoothTimeField (Icc (0 : ℝ) T) LiftTangent LiftTangent) def graphCoefficient : SmoothTimeField (Icc (0 : ℝ) T) Vector3 Vector3 := (A.precompLinear (graphLinear k m)).map (fst ℝ Vector3 ℝ) @[simp] theorem graphCoefficient_apply (t : Icc (0 : ℝ) T) (x : Vector3) : (graphCoefficient k m T A).field t x = (A.field t (graphLinear k m x)).1 := rfl theorem graphCoefficient_timeDerivative (A₁ : SmoothTimeField (Icc (0 : ℝ) T) LiftTangent LiftTangent) (htime : SmoothTimeField.TimeDerivative T hT A A₁) : SmoothTimeField.TimeDerivative T hT (graphCoefficient k m T A) (graphCoefficient k m T A₁) := (htime.precompLinear (graphLinear k m)).map (fst ℝ Vector3 ℝ) variable (hgraph : ∀ t z, graphConstraint k m (A.field t z)=0) include hgraph in theorem flowData_tangent (r : ℝ) (z : LiftTangent) : graphConstraint k m ((flowData T hT A).velocity r z)=0 := hgraph (projIcc 0 T hT r) z include hgraph in theorem graph_flow_eq (s t : ℝ) (x : Vector3) : graphFlow k m (flowData T hT A) s t x = (flowData T hT (graphCoefficient k m T A)).flow s t x := by let V := flowData T hT (graphCoefficient k m T A) have hd (r : ℝ) : HasDerivAt (fun q => graphFlow k m (flowData T hT A) s q x) (V.velocity r (graphFlow k m (flowData T hT A) s r x)) r := graphFlow_hasDerivAt k m (flowData T hT A) (flowData_tangent k m T hT A hgraph) s r x exact congrFun (V.flow_unique s x (fun q => graphFlow k m (flowData T hT A) s q x) hd (graphFlow_initial k m (flowData T hT A) s x)) t include hgraph in theorem graph_flow_cover (s t : ℝ) (x : Vector3) : (flowData T hT A).flow s t (graphLinear k m x) = graphLinear k m ((flowData T hT (graphCoefficient k m T A)).flow s t x) := by rw [graphFlow_invariant k m (flowData T hT A) (flowData_tangent k m T hT A hgraph), graph_flow_eq k m T hT A hgraph] include hgraph in theorem graph_displacement_eq (t : Icc (0 : ℝ) T) (x : Vector3) : (displacement T hT A t (graphLinear k m x)).1 = displacement T hT (graphCoefficient k m T A) t x := by rw [displacement_eq,displacement_eq] change ((flowData T hT A).flow 0 t (graphLinear k m x)-graphLinear k m x).1 = _ rw [graph_flow_cover k m T hT A hgraph] rfl variable (hdiv : ∀ t z, LinearMap.trace ℝ LiftTangent (fderiv ℝ (A.field t : LiftTangent → LiftTangent) z).toLinearMap=0) include hgraph hdiv in theorem graphCoefficient_trace_zero (t : Icc (0 : ℝ) T) (x : Vector3) : LinearMap.trace ℝ Vector3 (fderiv ℝ ((graphCoefficient k m T A).field t : Vector3 → Vector3) x).toLinearMap=0 := graphVelocity_trace_zero k m (A.field t) ((A.smooth t).differentiable (by simp)) (hgraph t) (hdiv t) x end EulerGraphInvariantFlow end end noncomputable section namespace EulerGraphInvariantFlow open Set MeasureTheory ContinuousLinearMap EulerLiftedGradientSpace EulerSmoothBanachFlow EulerSmoothFlowGevrey open scoped ContDiff variable (k : ℝ) (m : Vector3) (T : ℝ) (hT : 0 ≤ T) (A A₁ : SmoothTimeField (Icc (0 : ℝ) T) LiftTangent LiftTangent) (hgraph : ∀ t z, graphConstraint k m (A.field t z)=0) include hgraph in theorem graph_materialVelocity_eq (t : Icc (0 : ℝ) T) (x : Vector3) : materialVelocity T hT (graphCoefficient k m T A) t x = (materialVelocity T hT A t (graphLinear k m x)).1 := by change (A.field t (graphLinear k m ((flowData T hT (graphCoefficient k m T A)).flow 0 t x))).1 = _ rw [← graph_flow_cover k m T hT A hgraph] rfl def physicalCoefficient (ell : ℝ) : SmoothTimeField (Icc (0 : ℝ) T) Vector3 Vector3 := scaledCoefficient T (graphCoefficient k m T A) ell @[simp] theorem physicalCoefficient_apply (ell : ℝ) (t : Icc (0 : ℝ) T) (x : Vector3) : (physicalCoefficient k m T A ell).field t x = ell • (A.field t (graphLinear k m (ell⁻¹ • x))).1 := rfl theorem physicalCoefficient_timeDerivative (ell : ℝ) (htime : SmoothTimeField.TimeDerivative T hT A A₁) : SmoothTimeField.TimeDerivative T hT (physicalCoefficient k m T A ell) (physicalCoefficient k m T A₁ ell) := scaledCoefficient_timeDerivative T hT (graphCoefficient k m T A) ell (graphCoefficient k m T A₁) (graphCoefficient_timeDerivative k m T hT A A₁ htime) include hgraph in theorem physical_displacement_eq (ell : ℝ) (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : Vector3) : displacement T hT (physicalCoefficient k m T A ell) t x = ell • (displacement T hT A t (graphLinear k m (ell⁻¹ • x))).1 := by rw [physicalCoefficient,scaled_displacement_eq T hT (graphCoefficient k m T A) ell hell, ← graph_displacement_eq k m T hT A hgraph] include hgraph in theorem physical_materialVelocity_eq (ell : ℝ) (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : Vector3) : materialVelocity T hT (physicalCoefficient k m T A ell) t x = ell • (materialVelocity T hT A t (graphLinear k m (ell⁻¹ • x))).1 := by rw [physicalCoefficient,scaled_materialVelocity_eq T hT (graphCoefficient k m T A) ell hell, graph_materialVelocity_eq k m T hT A hgraph] variable (hdiv : ∀ t z, LinearMap.trace ℝ LiftTangent (fderiv ℝ (A.field t : LiftTangent → LiftTangent) z).toLinearMap=0) include hgraph hdiv in theorem physicalCoefficient_trace_zero (ell : ℝ) (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) (x : Vector3) : LinearMap.trace ℝ Vector3 (fderiv ℝ ((physicalCoefficient k m T A ell).field t : Vector3 → Vector3) x).toLinearMap=0 := scaledCoefficient_trace_zero T (graphCoefficient k m T A) ell hell (graphCoefficient_trace_zero k m T A hgraph hdiv) t x include hgraph hdiv in theorem physical_forward_measurePreserving (ell : ℝ) (hell : ell ≠ 0) (t : Icc (0 : ℝ) T) : MeasurePreserving ((flowData T hT (physicalCoefficient k m T A ell)).forward t) volume volume := by exact forward_measurePreserving T hT (physicalCoefficient k m T A ell) (physicalCoefficient_trace_zero k m T A hgraph hdiv ell hell) volume t end EulerGraphInvariantFlow