Download data/lean/OAI/MathematicalPhysics/AlternatingFlow/SpatialCurls.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.85 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/SpatialCurls.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/AlternatingFlow/SpatialCurls.lean
-
curl -L -o SpatialCurls.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/SpatialCurls.lean
7.85 kB
| import OAI.MathematicalPhysics.AlternatingFlow.Model | |
| namespace OAI | |
| open scoped BigOperators ENNReal NNReal Topology ContDiff | |
| open MeasureTheory | |
| namespace AlternatingNS | |
| namespace Spatial | |
| noncomputable def d {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (i : Fin 3) (F : Space β E) (x : Space) : E := fderiv β F x (e i) | |
| lemma coord_smooth (i : Fin 3) : ContDiff β β (fun x : Space => x i) := | |
| (PiLp.proj 2 (π := β) (fun _ : Fin 3 => β) i).contDiff | |
| lemma coord_hasFDeriv (i : Fin 3) (x : Space) : | |
| HasFDerivAt (fun x : Space => x i) (PiLp.proj 2 (π := β) (fun _ : Fin 3 => β) i) x := | |
| (PiLp.proj 2 (π := β) (fun _ : Fin 3 => β) i).hasFDerivAt | |
| lemma e_apply (i j : Fin 3) : e i j = if j = i then 1 else 0 := by | |
| simp [e, EuclideanSpace.single, PiLp.single_apply] | |
| lemma d_smooth {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (i : Fin 3) (F : Space β E) (hF : ContDiff β β F) : ContDiff β β (d i F) := by | |
| exact (hF.fderiv_right (by simp : (β : ββΟ) + 1 β€ (β : ββΟ))).clm_apply contDiff_const | |
| lemma d_tsupport {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (i : Fin 3) (F : Space β E) : tsupport (d i F) β tsupport F := | |
| tsupport_fderiv_apply_subset β (e i) | |
| lemma d_comm (i j : Fin 3) (F : Space β β) (hF : ContDiff β β F) : | |
| d i (d j F) = d j (d i F) := by | |
| ext x | |
| have hd := (hF.fderiv_right (by simp : (β : ββΟ) + 1 β€ (β : ββΟ))).differentiable (by simp) | |
| have heq (a b : Fin 3) : d a (d b F) x = fderiv β (fderiv β F) x (e a) (e b) := by | |
| unfold d | |
| rw [fderiv_clm_apply (hd x) (differentiableAt_const _)] | |
| simp | |
| rw [heq, heq] | |
| exact hF.contDiffAt.isSymmSndFDerivAt (by norm_num) _ _ | |
| noncomputable def curl (i j : Fin 3) (Ο : Space β β) (x : Space) : Space := | |
| d j Ο x β’ e i - d i Ο x β’ e j | |
| lemma curl_smooth (i j : Fin 3) (Ο : Space β β) (hΟ : ContDiff β β Ο) : | |
| ContDiff β β (curl i j Ο) := | |
| ((d_smooth j Ο hΟ).smul contDiff_const).sub ((d_smooth i Ο hΟ).smul contDiff_const) | |
| lemma curl_tsupport (i j : Fin 3) (Ο : Space β β) : tsupport (curl i j Ο) β tsupport Ο := by | |
| apply (tsupport_sub _ _).trans | |
| apply Set.union_subset | |
| Β· exact (tsupport_smul_subset_left _ _).trans (d_tsupport j Ο) | |
| Β· exact (tsupport_smul_subset_left _ _).trans (d_tsupport i Ο) | |
| lemma curl_div (i j : Fin 3) (Ο : Space β β) (hΟ : ContDiff β β Ο) (x : Space) : | |
| (β k : Fin 3, d k (curl i j Ο) x k) = 0 := by | |
| have hd (k : Fin 3) := (d_smooth k Ο hΟ).differentiable (by simp) | |
| have hc (k : Fin 3) : d k (curl i j Ο) x k = | |
| d k (d j Ο) x * (if k = i then 1 else 0) - | |
| d k (d i Ο) x * (if k = j then 1 else 0) := by | |
| change (fderiv β ((fun y => d j Ο y β’ e i) - (fun y => d i Ο y β’ e j)) x (e k)) k = _ | |
| rw [fderiv_sub ((hd j x).smul_const _) ((hd i x).smul_const _), | |
| fderiv_smul_const (hd j x), fderiv_smul_const (hd i x)] | |
| simp [e_apply, d] | |
| simp_rw [hc] | |
| rw [Finset.sum_sub_distrib] | |
| simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] | |
| rw [d_comm i j Ο hΟ, sub_self] | |
| def box : Set Space := {x | β i : Fin 3, |x i| β€ 3} | |
| def plateau : Set Space := {x | β i : Fin 3, |x i| < 2} | |
| noncomputable def cutoff (x : Space) : β := | |
| letI := threeAtLeastTwo | |
| β i : Fin 3, Real.smoothTransition (3 - x i) * Real.smoothTransition (3 + x i) | |
| lemma cutoff_smooth : ContDiff β β cutoff := by | |
| unfold cutoff | |
| apply contDiff_prod | |
| intro i _ | |
| have hi := coord_smooth i | |
| fun_prop | |
| lemma isClosed_box : IsClosed box := by | |
| have heq : box = β i : Fin 3, {x : Space | |x i| β€ 3} := by ext; simp [box] | |
| rw [heq] | |
| exact isClosed_iInter (fun i => isClosed_le (coord_smooth i).continuous.abs continuous_const) | |
| lemma box_compact : IsCompact box := by | |
| apply (isCompact_closedBall (0 : Space) 9).of_isClosed_subset isClosed_box | |
| intro x hx | |
| rw [Metric.mem_closedBall, dist_zero_right] | |
| rw [EuclideanSpace.norm_eq, Real.sqrt_le_iff] | |
| refine β¨by norm_num, ?_β© | |
| calc | |
| β i : Fin 3, βx iβ ^ 2 β€ β _i : Fin 3, (3 : β) ^ 2 := by | |
| apply Finset.sum_le_sum | |
| intro i _ | |
| exact pow_le_pow_leftβ (norm_nonneg _) (hx i) 2 | |
| _ β€ 9 ^ 2 := by norm_num | |
| lemma plateau_open : IsOpen plateau := by | |
| have heq : plateau = β i : Fin 3, {x : Space | |x i| < 2} := by ext; simp [plateau] | |
| rw [heq] | |
| exact isOpen_iInter_of_finite (fun i => isOpen_lt (coord_smooth i).continuous.abs continuous_const) | |
| lemma cutoff_one (x : Space) (hx : x β plateau) : cutoff x = 1 := by | |
| apply Finset.prod_eq_one | |
| intro i _ | |
| have hi := abs_lt.1 (hx i) | |
| rw [Real.smoothTransition.one_of_one_le (by linarith : 1 β€ 3 - x i), | |
| Real.smoothTransition.one_of_one_le (by linarith : 1 β€ 3 + x i), one_mul] | |
| lemma cutoff_one_near (x : Space) (hx : x β plateau) : | |
| cutoff =αΆ [π x] (fun _ => 1) := | |
| Filter.eventually_of_mem (plateau_open.mem_nhds hx) (fun y hy => cutoff_one y hy) | |
| lemma cutoff_support : tsupport cutoff β box := by | |
| apply closure_minimal _ isClosed_box | |
| intro x hx i | |
| by_contra hi | |
| have hn : 3 < |x i| := lt_of_not_ge hi | |
| have hz : Real.smoothTransition (3 - x i) * Real.smoothTransition (3 + x i) = 0 := by | |
| rcases (lt_abs.1 hn) with hn | hn | |
| Β· rw [Real.smoothTransition.zero_of_nonpos (by linarith : 3 - x i β€ 0), zero_mul] | |
| Β· rw [Real.smoothTransition.zero_of_nonpos (by linarith : 3 + x i β€ 0), mul_zero] | |
| exact hx (Finset.prod_eq_zero (Finset.mem_univ i) hz) | |
| noncomputable def shearPotential (d i j : Fin 3) (L E : β β β) (x : Space) : β := | |
| x j * L (x d) - x i * E (x d) | |
| noncomputable def localizedShear (d i j : Fin 3) (L E : β β β) : Space β Space := | |
| curl i j (fun x => cutoff x * shearPotential d i j L E x) | |
| lemma shearPotential_smooth (d i j : Fin 3) (L E : β β β) | |
| (hL : ContDiff β β L) (hE : ContDiff β β E) : | |
| ContDiff β β (shearPotential d i j L E) := | |
| ((coord_smooth j).mul (hL.comp (coord_smooth d))).sub | |
| ((coord_smooth i).mul (hE.comp (coord_smooth d))) | |
| lemma localizedShear_smooth (d i j : Fin 3) (L E : β β β) | |
| (hL : ContDiff β β L) (hE : ContDiff β β E) : | |
| ContDiff β β (localizedShear d i j L E) := | |
| curl_smooth i j _ (cutoff_smooth.mul (shearPotential_smooth d i j L E hL hE)) | |
| lemma localizedShear_support (d i j : Fin 3) (L E : β β β) : | |
| tsupport (localizedShear d i j L E) β box := | |
| (curl_tsupport _ _ _).trans (tsupport_mul_subset_left.trans cutoff_support) | |
| lemma localizedShear_div (d i j : Fin 3) (L E : β β β) | |
| (hL : ContDiff β β L) (hE : ContDiff β β E) (x : Space) : | |
| (β k : Fin 3, Spatial.d k (localizedShear d i j L E) x k) = 0 := | |
| curl_div i j _ (cutoff_smooth.mul (shearPotential_smooth d i j L E hL hE)) x | |
| lemma localizedShear_plateau (d i j : Fin 3) (hij : i β j) (hdi : d β i) (hdj : d β j) | |
| (L E : β β β) (hL : ContDiff β β L) (hE : ContDiff β β E) | |
| (x : Space) (hx : x β plateau) : | |
| localizedShear d i j L E x = L (x d) β’ e i + E (x d) β’ e j := by | |
| have heq : (fun y => cutoff y * shearPotential d i j L E y) =αΆ [π x] | |
| shearPotential d i j L E := by | |
| filter_upwards [cutoff_one_near x hx] with y hy | |
| rw [hy, one_mul] | |
| have hL' := ((hL.differentiable (by simp)) (x d)).hasFDerivAt.comp x (coord_hasFDeriv d x) | |
| have hE' := ((hE.differentiable (by simp)) (x d)).hasFDerivAt.comp x (coord_hasFDeriv d x) | |
| have hΟ := ((coord_hasFDeriv j x).mul hL').sub ((coord_hasFDeriv i x).mul hE') | |
| have hΟeq := hΟ.fderiv | |
| change fderiv β (shearPotential d i j L E) x = _ at hΟeq | |
| simp only [localizedShear, curl, Spatial.d, heq.fderiv_eq, hΟeq] | |
| simp [ContinuousLinearMap.comp_apply, PiLp.proj_apply, e_apply, hij, hij.symm, hdi, | |
| hdj, sub_eq_add_neg] | |
| end Spatial | |
| end AlternatingNS | |
| end OAI | |