Download data/lean/OAI/MathematicalPhysics/RapidForcing/JointSmoothness.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.36 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/JointSmoothness.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/RapidForcing/JointSmoothness.lean
-
curl -L -o JointSmoothness.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/JointSmoothness.lean
9.36 kB
| import OAI.MathematicalPhysics.RapidForcing.Collars | |
| namespace OAI | |
| open scoped BigOperators ENNReal Topology | |
| open Set MeasureTheory | |
| namespace RapidForcing | |
| lemma curl_joint_smooth {v : Field Space} | |
| (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) : | |
| ContDiff β (β€ : ββ) (fun p : β Γ Space => curl (v p.1) p.2) := by | |
| have h : ContDiff β (β€ : ββ) | |
| (fun p : (β Γ Space) Γ Space => v p.1.1 p.2) := | |
| hv.comp (contDiff_fst.fst.prodMk contDiff_snd) | |
| have hD : ContDiff β (β€ : ββ) | |
| (fun p : β Γ Space => fderiv β (v p.1) p.2) := | |
| h.fderiv contDiff_snd (by simp) | |
| apply (contDiff_piLp 2).mpr | |
| intro i | |
| fin_cases i <;> dsimp [curl, vec] <;> fun_prop | |
| lemma movingCurl_joint_smooth {c : β β Space} | |
| (hc : ContDiff β (β€ : ββ) c) (Ξ΄ : β) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (movingCurl c Ξ΄)) := by | |
| change ContDiff β (β€ : ββ) (fun p : β Γ Space => curl (fun y => | |
| ΞΆ (Ξ΄β»ΒΉ β’ (y - c p.1)) β’ ((1 / 2 : β) β’ cross (deriv c p.1) (y - c p.1))) p.2) | |
| apply curl_joint_smooth (v := fun Ο y => | |
| ΞΆ (Ξ΄β»ΒΉ β’ (y - c Ο)) β’ ((1 / 2 : β) β’ cross (deriv c Ο) (y - c Ο))) | |
| have hdc : ContDiff β (β€ : ββ) (deriv c) := | |
| (contDiff_infty_iff_deriv.mp hc).2 | |
| apply (contDiff_piLp 2).mpr | |
| intro i | |
| fin_cases i <;> dsimp [cross, vec, Function.uncurry] <;> unfold ΞΆ <;> fun_prop | |
| noncomputable def stepVelocity (M : Machine) (w : M.Input) (n : β) : Field Space := | |
| fun t x => β m β Finset.range ((M.scaleData w).D n + 1), | |
| movingCurl (addressPath M (M.scaleData w) n m) ((M.scaleData w).Ξ΄ n) | |
| (t - 1 - (n : β)) x | |
| noncomputable def loadingVelocity (M : Machine) (w : M.Input) : Field Space := | |
| movingCurl (fun s => ΞΈ s β’ vec (-1) ((M.scaleData w).Ξ΄ 0 * (M.initialDigit w : β)) 0) 1 | |
| lemma stepVelocity_smooth (M : Machine) (w : M.Input) (n : β) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (stepVelocity M w n)) := by | |
| unfold stepVelocity Function.uncurry | |
| apply ContDiff.sum | |
| intro m _ | |
| have hc : ContDiff β (β€ : ββ) (addressPath M (M.scaleData w) n m) := by | |
| unfold addressPath | |
| exact contDiff_const.add (theta_smooth.smul contDiff_const) | |
| have hsh : ContDiff β (β€ : ββ) (fun p : β Γ Space => (p.1 - 1 - (n : β), p.2)) := by | |
| fun_prop | |
| simpa only [Function.comp_def, Function.uncurry] using | |
| (movingCurl_joint_smooth hc ((M.scaleData w).Ξ΄ n)).comp hsh | |
| lemma loadingVelocity_smooth (M : Machine) (w : M.Input) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (loadingVelocity M w)) := | |
| movingCurl_joint_smooth (theta_smooth.smul contDiff_const) 1 | |
| lemma stepVelocity_left_collar (M : Machine) (w : M.Input) (n : β) {t : β} | |
| (ht : t < 1 + (n : β) + 1 / 4) : stepVelocity M w n t = 0 := by | |
| funext x | |
| apply Finset.sum_eq_zero | |
| intro m _ | |
| exact congrFun (movingCurl_left_collar (addressCenter (M.scaleData w) n m) | |
| (addressDisplacement M (M.scaleData w) n m) _ (by linarith)) x | |
| lemma stepVelocity_right_collar (M : Machine) (w : M.Input) (n : β) {t : β} | |
| (ht : 1 + (n : β) + 3 / 4 < t) : stepVelocity M w n t = 0 := by | |
| funext x | |
| apply Finset.sum_eq_zero | |
| intro m _ | |
| exact congrFun (movingCurl_right_collar (addressCenter (M.scaleData w) n m) | |
| (addressDisplacement M (M.scaleData w) n m) _ (by linarith)) x | |
| lemma loadingVelocity_right_collar (M : Machine) (w : M.Input) {t : β} | |
| (ht : 3 / 4 < t) : loadingVelocity M w t = 0 := by | |
| have h := movingCurl_right_collar 0 | |
| (vec (-1) ((M.scaleData w).Ξ΄ 0 * (M.initialDigit w : β)) 0) 1 ht | |
| funext x | |
| change movingCurl (fun s => ΞΈ s β’ vec (-1) ((M.scaleData w).Ξ΄ 0 * (M.initialDigit w : β)) 0) | |
| 1 t x = 0 | |
| simpa only [zero_add] using congrFun h x | |
| lemma addressedVelocity_eq_finite (M : Machine) (w : M.Input) (N : β) | |
| {t : β} (ht : t < (N : β) + 1) : | |
| addressedVelocity M w t = loadingVelocity M w t + β n β Finset.range N, | |
| stepVelocity M w n t := by | |
| by_cases h : t β€ 1 | |
| Β· have hz : β n β Finset.range N, stepVelocity M w n t = 0 := by | |
| apply Finset.sum_eq_zero | |
| intro n _ | |
| apply stepVelocity_left_collar | |
| have : 0 β€ (n : β) := Nat.cast_nonneg n | |
| linarith | |
| rw [hz, add_zero] | |
| exact funext fun x => by simp [addressedVelocity, loadingVelocity, h] | |
| Β· have ht1 : 1 < t := lt_of_not_ge h | |
| let n := Nat.floor (t - 1) | |
| have hn : (n : β) β€ t - 1 := Nat.floor_le (by linarith) | |
| have hn' : t - 1 < (n : β) + 1 := Nat.lt_floor_add_one _ | |
| have hnN : n < N := by | |
| exact_mod_cast (by linarith : (n : β) < (N : β)) | |
| have hs : (β j β Finset.range N, stepVelocity M w j t) = stepVelocity M w n t := by | |
| apply Finset.sum_eq_single n | |
| Β· intro j _ hj | |
| rcases lt_or_gt_of_ne hj with hj | hj | |
| Β· apply stepVelocity_right_collar | |
| have : (j : β) + 1 β€ (n : β) := by exact_mod_cast hj | |
| linarith | |
| Β· apply stepVelocity_left_collar | |
| have : (n : β) + 1 β€ (j : β) := by exact_mod_cast hj | |
| linarith | |
| Β· intro hnnot | |
| exact (hnnot (Finset.mem_range.mpr hnN)).elim | |
| rw [hs, loadingVelocity_right_collar M w (by linarith), zero_add] | |
| exact funext fun x => by simp [addressedVelocity, stepVelocity, h, n] | |
| theorem addressedVelocity_joint_smooth (M : Machine) (w : M.Input) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (addressedVelocity M w)) := by | |
| rw [contDiff_iff_contDiffAt] | |
| intro p | |
| obtain β¨N, hNβ© := exists_nat_gt p.1 | |
| have hs : ContDiff β (β€ : ββ) (fun q : β Γ Space => | |
| loadingVelocity M w q.1 q.2 + β n β Finset.range N, stepVelocity M w n q.1 q.2) := | |
| (loadingVelocity_smooth M w).add <| ContDiff.sum fun n _ => stepVelocity_smooth M w n | |
| apply hs.contDiffAt.congr_of_eventuallyEq | |
| have ho : IsOpen {q : β Γ Space | q.1 < (N : β) + 1} := | |
| isOpen_lt continuous_fst continuous_const | |
| have he : βαΆ q : β Γ Space in π p, q.1 < (N : β) + 1 := | |
| ho.mem_nhds (by change p.1 < (N : β) + 1; linarith) | |
| filter_upwards [he] with q hq | |
| simpa only [Function.uncurry, Pi.add_apply, Finset.sum_apply] using | |
| congrFun (addressedVelocity_eq_finite M w N hq) q.2 | |
| section JointDerivatives | |
| variable {E : Type} [NormedAddCommGroup E] [NormedSpace β E] | |
| {v : Field E} | |
| lemma spatialD_joint_smooth (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) | |
| (i : Fin 3) : ContDiff β (β€ : ββ) (Function.uncurry (spatialD i v)) := by | |
| have h : ContDiff β (β€ : ββ) | |
| (fun p : (β Γ Space) Γ Space => v p.1.1 p.2) := | |
| hv.comp (contDiff_fst.fst.prodMk contDiff_snd) | |
| have hD : ContDiff β (β€ : ββ) | |
| (fun p : β Γ Space => fderiv β (v p.1) p.2) := | |
| h.fderiv contDiff_snd (by simp) | |
| exact hD.clm_apply contDiff_const | |
| lemma ordinaryTimeD_joint_smooth (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) : | |
| ContDiff β (β€ : ββ) (fun p : β Γ Space => deriv (fun s => v s p.2) p.1) := by | |
| have h : ContDiff β (β€ : ββ) | |
| (fun p : (β Γ Space) Γ β => v p.2 p.1.2) := | |
| hv.comp (contDiff_snd.prodMk contDiff_fst.snd) | |
| have hD : ContDiff β (β€ : ββ) | |
| (fun p : β Γ Space => fderiv β (fun s => v s p.2) p.1) := | |
| h.fderiv contDiff_fst (by simp) | |
| exact hD.clm_apply contDiff_const | |
| lemma timeD_eq_ordinary (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) | |
| {t : β} (ht : 0 β€ t) (x : Space) : timeD v t x = deriv (fun s => v s x) t := by | |
| have h : ContDiff β (β€ : ββ) (fun s => v s x) := | |
| hv.comp (contDiff_id.prodMk contDiff_const) | |
| exact (h.differentiable (by simp) t).derivWithin (uniqueDiffOn_Ici 0 t ht) | |
| end JointDerivatives | |
| lemma advection_joint_smooth {v : Field Space} | |
| (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (advection v)) := by | |
| change ContDiff β (β€ : ββ) (fun p : β Γ Space => β i, (v p.1 p.2 i) β’ spatialD i v p.1 p.2) | |
| apply ContDiff.sum | |
| intro i _ | |
| exact ((EuclideanSpace.proj i).contDiff.comp hv).smul (spatialD_joint_smooth hv i) | |
| lemma laplace_joint_smooth {v : Field Space} | |
| (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) : | |
| ContDiff β (β€ : ββ) (Function.uncurry (laplace v)) := by | |
| change ContDiff β (β€ : ββ) (fun p : β Γ Space => β i, spatialD i (spatialD i v) p.1 p.2) | |
| apply ContDiff.sum | |
| intro i _ | |
| exact spatialD_joint_smooth (spatialD_joint_smooth hv i) i | |
| lemma residual_smooth_of_joint_smooth {v : Field Space} | |
| (hv : ContDiff β (β€ : ββ) (Function.uncurry v)) (Ξ½ : β) : Smooth (residual Ξ½ v) := by | |
| have hr : ContDiff β (β€ : ββ) (fun p : β Γ Space => | |
| deriv (fun s => v s p.2) p.1 + advection v p.1 p.2 - Ξ½ β’ laplace v p.1 p.2) := | |
| ((ordinaryTimeD_joint_smooth hv).add (advection_joint_smooth hv)).sub | |
| ((laplace_joint_smooth hv).const_smul Ξ½) | |
| apply hr.contDiffOn.congr | |
| intro p hp | |
| change timeD v p.1 p.2 + advection v p.1 p.2 - Ξ½ β’ laplace v p.1 p.2 = _ | |
| rw [timeD_eq_ordinary hv hp.1] | |
| theorem addressed_fields_smooth (Ξ½ : β) (M : Machine) (w : M.Input) : | |
| Smooth (addressedVelocity M w) β§ Smooth (addressedForce Ξ½ M w) := | |
| β¨(addressedVelocity_joint_smooth M w).contDiffOn, | |
| residual_smooth_of_joint_smooth (addressedVelocity_joint_smooth M w) Ξ½β© | |
| end RapidForcing | |
| end OAI | |