Download data/lean/OAI/Analysis/Conductivity/Fourier/FourierMatchingLocalData.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Fourier/FourierMatchingLocalData.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/Conductivity/Fourier/FourierMatchingLocalData.lean
-
curl -L -o FourierMatchingLocalData.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Fourier/FourierMatchingLocalData.lean
12.9 kB
| import Mathlib | |
| import OAI.Analysis.Conductivity.Geometry.TorusLocalizedMoments | |
| import OAI.Analysis.Conductivity.Fourier.FourierMatchingInterpolation | |
| namespace OAI | |
| noncomputable section | |
| namespace ScalarConductivity | |
| open Set Filter Topology Real MeasureTheory Matrix | |
| lemma flatTensorLaplacian_congr_nhds (s : Fin 3 β β) {f g : Coord3 β β} {x : Coord3} | |
| (h : f=αΆ [π x] g) : flatTensorLaplacian s f x=flatTensorLaplacian s g x := | |
| congrArg (flatTensorLaplacianCLM s) ((h.iteratedFDeriv β 2).self_of_nhds) | |
| lemma fourier_left_coeff_bound {k : β€} {b : (Fin 2 β β€) β β} {B : β} | |
| (hb : β h,|b h|β€B) (h : Fin 2 β β€) : | |
| |(Pi.single ![0,k] (1:β) : (Fin 2 β β€) β β) h+b h|β€1+B := | |
| (abs_add_le _ _).trans (add_le_add (single_fourier_coeff_bound _ _) (hb h)) | |
| lemma fourierMatchingPair_left_fourier {s : Fin 3 β β} | |
| (hs : β x y : β,(1/2)*(x^2+y^2) β€ s 0*x^2+2*s 1*x*y+s 2*y^2) | |
| (k : β€) {f g : βΓCoord3 β β} {a b pa pb : (Fin 2 β β€) β β} {B p : β} | |
| (hb : β h,|b h|β€B) (hp : pb ![0,k]=0) | |
| (hf : β y : Coord3,y 0βIcc 0 6 β f (p,y)=flatFourier s a pa y) | |
| (hg : β y : Coord3,y 0βIcc 0 6 β g (p,y)=flatFourier s b pb y) | |
| {x : Coord3} (hx : x 0βIoo 0 2) : | |
| (fun y => fourierMatchingPair s k f g (p,y) 0)=αΆ [π x] affineFourierField s a pa 1 0 β§ | |
| (fun y => fourierMatchingPair s k f g (p,y) 1)=αΆ [π x] | |
| flatFourier s (fun h => (Pi.single ![0,k] (1:β) : (Fin 2 β β€) β β) h+b h) pb := by | |
| have hn : βαΆ y in π x,y 0βIoo 0 2 := | |
| (isOpen_Ioo.preimage (continuous_apply 0)).mem_nhds hx | |
| constructor | |
| Β· filter_upwards [hn] with y hy | |
| change y 0+fourierMatchingCutoff (y 0)*f (p,y)=_ | |
| rw [fourierMatchingCutoff_left hy.2.le,one_mul,hf y β¨hy.1.le,by linarith [hy.2]β©] | |
| simp only [affineFourierField,one_mul,add_zero] | |
| Β· filter_upwards [hn] with y hy | |
| change flatPhaseMode s ![0,k] 0 y+fourierMatchingCutoff (y 0)*g (p,y)=_ | |
| rw [fourierMatchingCutoff_left hy.2.le,one_mul,hg y β¨hy.1.le,by linarith [hy.2]β©, | |
| flatFourier_add hs (single_fourier_coeff_bound ![0,k]) hb hy.1, | |
| flatFourier_single,hp,one_mul] | |
| lemma fourierMatchingPair_right_fourier (s : Fin 3 β β) (k : β€) (f g : βΓCoord3 β β) | |
| (pa pb : (Fin 2 β β€) β β) (hp : pb ![0,k]=0) (p : β) {x : Coord3} (hx : 4<x 0) : | |
| (fun y => fourierMatchingPair s k f g (p,y) 0)=αΆ [π x] affineFourierField s (fun _ => 0) pa 1 0 β§ | |
| (fun y => fourierMatchingPair s k f g (p,y) 1)=αΆ [π x] flatFourier s (Pi.single ![0,k] 1) pb := by | |
| have hn : βαΆ y in π x,4<y 0 := (isOpen_lt continuous_const (continuous_apply 0)).mem_nhds hx | |
| constructor | |
| Β· filter_upwards [hn] with y hy | |
| change y 0+fourierMatchingCutoff (y 0)*f (p,y)=_ | |
| simp only [fourierMatchingCutoff_right hy.le,zero_mul,add_zero,affineFourierField, | |
| flatFourier_zero,one_mul] | |
| Β· filter_upwards [hn] with y hy | |
| change flatPhaseMode s ![0,k] 0 y+fourierMatchingCutoff (y 0)*g (p,y)=_ | |
| rw [fourierMatchingCutoff_right hy.le,zero_mul,add_zero,flatFourier_single,hp,one_mul] | |
| end ScalarConductivity | |
| namespace ScalarConductivity | |
| open Set Filter Topology Real MeasureTheory Matrix | |
| open scoped Matrix.Norms.Elementwise | |
| lemma periodicSourceMoment_neg (T : β) (u : Coord3 β Fin 2 β β) (r : Fin 2 β Coord3 β β) : | |
| periodicSourceMoment T u (fun j x => -r j x)=-periodicSourceMoment T u r := by | |
| have hpoint (x : Coord3) : u x 1*(-r 0 x)-u x 0*(-r 1 x)= | |
| -(u x 1*r 0 x-u x 0*r 1 x) := by ring | |
| ext i | |
| fin_cases i | |
| Β· change (β« t,β« y in 0..T,β« z in 0..T,-r 0 ![t,y,z])=-(β« t,β« y in 0..T,β« z in 0..T,r 0 ![t,y,z]) | |
| simp only [intervalIntegral.integral_neg,integral_neg] | |
| Β· change (β« t,β« y in 0..T,β« z in 0..T,-r 1 ![t,y,z])=-(β« t,β« y in 0..T,β« z in 0..T,r 1 ![t,y,z]) | |
| simp only [intervalIntegral.integral_neg,integral_neg] | |
| Β· change (β« t,β« y in 0..T,β« z in 0..T,u ![t,y,z] 1*(-r 0 ![t,y,z])-u ![t,y,z] 0*(-r 1 ![t,y,z]))= | |
| -(β« t,β« y in 0..T,β« z in 0..T,u ![t,y,z] 1*r 0 ![t,y,z]-u ![t,y,z] 0*r 1 ![t,y,z]) | |
| simp only [hpoint,intervalIntegral.integral_neg,integral_neg] | |
| theorem fourier_matching_three_moments {s : Fin 3 β β} | |
| (hs : β x y : β,(1/2)*(x^2+y^2) β€ s 0*x^2+2*s 1*x*y+s 2*y^2) | |
| {a b : Fin 2 β (Fin 2 β β€) β β} {pa pb : Fin 2 β (Fin 2 β β€) β β} | |
| {Ba Bb ga gb : Fin 2 β β} {l d Ξ± : β} {Ξ² : Fin 2 β β} | |
| (ha : β e h,|a e h|β€Ba e) (hb : β e h,|b e h|β€Bb e) | |
| (hga : β e,0<ga e) (hgb : β e,0<gb e) | |
| (hra : β e h,a e hβ 0 β ga eβ€torusRate s h) | |
| (hrb : β e h,b e hβ 0 β gb eβ€torusRate s h) | |
| (hl : 0<l) (hld : lβ€d) {u : Coord3 β Fin 2 β β} {r : Fin 2 β Coord3 β β} | |
| (hu : ContDiff β (β(β€:ββ)) u) (hup : AngularPeriodic (2*Real.pi) u) | |
| (he0 : β e x,x 0=![l,d] e β (fun y => u y 0)=αΆ [π x] affineFourierField s (a e) (pa e) Ξ± (Ξ² e)) | |
| (he1 : β e x,x 0=![l,d] e β (fun y => u y 1)=αΆ [π x] flatFourier s (b e) (pb e)) | |
| (hrs : β j,tsupport (r j)β{x | x 0βIcc l d}) | |
| (hre : β j x,x 0βIcc l d β r j x=symmetricSource (fun _ => flatBackgroundTensor s) u j x) : | |
| periodicSourceMoment (2*Real.pi) u r=0 β§ | |
| periodicSourceMoment (2*Real.pi) u (fun j x => -r j x)=0 := by | |
| have ht (e : Fin 2) : 0<![l,d] e := by fin_cases e; exact hl; exact hl.trans_le hld | |
| have he (e : Fin 2) := fourier_pair_boundary_flux hs (ha e) (hb e) (hga e) (hgb e) | |
| (hra e) (hrb e) Ξ± (Ξ² e) (ht e) (hu.differentiable (by simp)) (he0 e) (he1 e) | |
| have heL := he 0 | |
| have heR := he 1 | |
| simp only [Matrix.cons_val_zero,Matrix.cons_val_one] at heL heR | |
| have hm := periodic_localized_source_moment_formula (by positivity : 0β€2*Real.pi) hld | |
| (H:=fun _ => flatBackgroundTensor s) contDiff_const hu (fun _ _ => rfl) hup | |
| (fun _ => flatBackgroundTensor_symm s) hrs hre | |
| have hz : periodicSourceMoment (2*Real.pi) u r=0 := by | |
| rw [hm] | |
| ext i | |
| fin_cases i | |
| Β· change _-_=0 | |
| rw [heR.1,heL.1,sub_self] | |
| Β· change _-_=0 | |
| rw [heR.2.1,heL.2.1,sub_self] | |
| Β· change _-_=0 | |
| rw [heR.2.2,heL.2.2,sub_self] | |
| exact β¨hz,by rw [periodicSourceMoment_neg,hz,neg_zero]β© | |
| end ScalarConductivity | |
| end | |
| noncomputable section | |
| namespace ScalarConductivity | |
| open Set Filter Topology Real MeasureTheory Matrix | |
| lemma fourierMatchingResidual_exact {s : Fin 3 β β} | |
| (hs : β x y : β,(1/2)*(x^2+y^2) β€ s 0*x^2+2*s 1*x*y+s 2*y^2) | |
| (k : β€) {f g : βΓCoord3 β β} {a b pa pb : (Fin 2 β β€) β β} {A B p : β} | |
| (hfs : ContDiff β (β(β€:ββ)) f) (hgs : ContDiff β (β(β€:ββ)) g) | |
| (ha : β h,|a h|β€A) (hb : β h,|b h|β€B) (hp : pb ![0,k]=0) | |
| (hf : β y : Coord3,y 0βIcc 0 6 β f (p,y)=flatFourier s a pa y) | |
| (hg : β y : Coord3,y 0βIcc 0 6 β g (p,y)=flatFourier s b pb y) | |
| (j : Fin 2) (x : Coord3) (hx : 0<x 0) : | |
| fourierMatchingResidual s k f g j (p,x)= | |
| -symmetricSource (fun _ => flatBackgroundTensor s) (fun y => fourierMatchingPair s k f g (p,y)) j x := by | |
| have hu : ContDiff β (β(β€:ββ)) (fun y : Coord3 => fourierMatchingPair s k f g (p,y)) := | |
| (fourierMatchingPair_smooth s k hfs hgs).comp ((contDiff_const (c:=p)).prodMk contDiff_id) | |
| by_cases hmid : x 0βIcc 2 4 | |
| Β· simp only [fourierMatchingResidual,fourierResidualCutoff_one hmid,neg_mul,one_mul] | |
| have hz : symmetricSource (fun _ => flatBackgroundTensor s) (fun y => fourierMatchingPair s k f g (p,y)) j x=0 := by | |
| rw [flatBackgroundTensor_source hu] | |
| by_cases hleft : x 0<2 | |
| Β· have he := fourierMatchingPair_left_fourier hs k hb hp hf hg (x:=x) β¨hx,hleftβ© | |
| fin_cases j | |
| Β· change flatTensorLaplacian s (fun y => fourierMatchingPair s k f g (p,y) 0) x=0 | |
| rw [flatTensorLaplacian_congr_nhds s he.1] | |
| exact affineFourierField_harmonic hs ha 1 0 hx | |
| Β· change flatTensorLaplacian s (fun y => fourierMatchingPair s k f g (p,y) 1) x=0 | |
| rw [flatTensorLaplacian_congr_nhds s he.2] | |
| exact flatFourier_harmonic hs (fourier_left_coeff_bound hb) hx | |
| Β· have hright : 4<x 0 := by | |
| by_contra hh | |
| exact hmid β¨le_of_not_gt hleft,le_of_not_gt hhβ© | |
| have he := fourierMatchingPair_right_fourier s k f g pa pb hp p hright | |
| fin_cases j | |
| Β· change flatTensorLaplacian s (fun y => fourierMatchingPair s k f g (p,y) 0) x=0 | |
| rw [flatTensorLaplacian_congr_nhds s he.1] | |
| exact affineFourierField_harmonic hs (B:=0) (by intro h; simp) 1 0 (by linarith) | |
| Β· change flatTensorLaplacian s (fun y => fourierMatchingPair s k f g (p,y) 1) x=0 | |
| rw [flatTensorLaplacian_congr_nhds s he.2] | |
| exact flatFourier_harmonic hs (single_fourier_coeff_bound ![0,k]) (by linarith) | |
| simp only [fourierMatchingResidual,hz,mul_zero,neg_zero] | |
| lemma fourier_single_plus_rate {s : Fin 3 β β} {k : β€} {b : (Fin 2 β β€) β β} | |
| (hb : β h,b hβ 0 β torusRate s ![0,k]β€torusRate s h) : | |
| β h,(Pi.single ![0,k] (1:β) : (Fin 2 β β€) β β) h+b hβ 0 β torusRate s ![0,k]β€torusRate s h := by | |
| classical | |
| intro h hh | |
| by_cases he : h=![0,k] | |
| Β· subst h; exact le_rfl | |
| Β· apply hb h | |
| simpa only [Pi.single_eq_of_ne he,zero_add] using hh | |
| lemma fourierMatchingResidual_moments {s : Fin 3 β β} | |
| (hs : β x y : β,(1/2)*(x^2+y^2) β€ s 0*x^2+2*s 1*x*y+s 2*y^2) | |
| (k : β€) {f g : βΓCoord3 β β} {a b pa pb : (Fin 2 β β€) β β} {A B p ga : β} | |
| (hfs : ContDiff β (β(β€:ββ)) f) (hgs : ContDiff β (β(β€:ββ)) g) | |
| (hfp : β p,AngularPeriodic (2*Real.pi) (fun x => f (p,x))) | |
| (hgp : β p,AngularPeriodic (2*Real.pi) (fun x => g (p,x))) | |
| (ha : β h,|a h|β€A) (hb : β h,|b h|β€B) (hp : pb ![0,k]=0) | |
| (hga : 0<ga) (hgb : 0<torusRate s ![0,k]) | |
| (hra : β h,a hβ 0 β gaβ€torusRate s h) | |
| (hrb : β h,b hβ 0 β torusRate s ![0,k]β€torusRate s h) | |
| (hf : β y : Coord3,y 0βIcc 0 6 β f (p,y)=flatFourier s a pa y) | |
| (hg : β y : Coord3,y 0βIcc 0 6 β g (p,y)=flatFourier s b pb y) : | |
| periodicSourceMoment (2*Real.pi) (fun y => fourierMatchingPair s k f g (p,y)) | |
| (fun j y => fourierMatchingResidual s k f g j (p,y))=0 := by | |
| classical | |
| let aa : Fin 2 β (Fin 2 β β€) β β := ![a,fun _ => 0] | |
| let bb : Fin 2 β (Fin 2 β β€) β β := ![fun h => (Pi.single ![0,k] (1:β) : (Fin 2 β β€) β β) h+b h,Pi.single ![0,k] 1] | |
| have haa : β e h,|aa e h|β€![A,0] e := by intro e h; fin_cases e; exact ha h; simp [aa] | |
| have hbb : β e h,|bb e h|β€![1+B,1] e := by | |
| intro e h | |
| fin_cases e | |
| Β· exact fourier_left_coeff_bound hb h | |
| Β· exact single_fourier_coeff_bound _ _ | |
| have hraa : β e h,aa e hβ 0 β gaβ€torusRate s h := by | |
| intro e h hh | |
| fin_cases e | |
| Β· exact hra h hh | |
| Β· exact False.elim (hh rfl) | |
| have hrbb : β e h,bb e hβ 0 β torusRate s ![0,k]β€torusRate s h := by | |
| intro e h hh | |
| fin_cases e | |
| Β· exact fourier_single_plus_rate hrb h hh | |
| Β· by_cases he : h=![0,k] | |
| Β· subst h; exact le_rfl | |
| Β· exact False.elim (hh (Pi.single_eq_of_ne he 1)) | |
| have he (e : Fin 2) (x : Coord3) (hx : x 0=![1,5] e) : | |
| (fun y => fourierMatchingPair s k f g (p,y) 0)=αΆ [π x] affineFourierField s (aa e) pa 1 0 β§ | |
| (fun y => fourierMatchingPair s k f g (p,y) 1)=αΆ [π x] flatFourier s (bb e) pb := by | |
| fin_cases e | |
| Β· exact fourierMatchingPair_left_fourier hs k hb hp hf hg β¨by simpa using hx βΈ (show (0:β)<1 by norm_num),by simpa using hx βΈ (show (1:β)<2 by norm_num)β© | |
| Β· exact fourierMatchingPair_right_fourier s k f g pa pb hp p (by simpa using hx βΈ (show (4:β)<5 by norm_num)) | |
| have hrs (j : Fin 2) : tsupport (fun y => -fourierMatchingResidual s k f g j (p,y))β{x | x 0βIcc 1 5} := by | |
| rw [show (fun y => -fourierMatchingResidual s k f g j (p,y))= -(fun y => fourierMatchingResidual s k f g j (p,y)) from rfl,tsupport_neg] | |
| exact fourierMatchingResidual_support s k f g p j | |
| have hre (j : Fin 2) (x : Coord3) (hx : x 0βIcc 1 5) : | |
| -fourierMatchingResidual s k f g j (p,x)= symmetricSource (fun _ => flatBackgroundTensor s) | |
| (fun y => fourierMatchingPair s k f g (p,y)) j x := by | |
| rw [fourierMatchingResidual_exact hs k hfs hgs ha hb hp hf hg j x (by linarith [hx.1]),neg_neg] | |
| have hu : ContDiff β (β(β€:ββ)) (fun y : Coord3 => fourierMatchingPair s k f g (p,y)) := | |
| (fourierMatchingPair_smooth s k hfs hgs).comp ((contDiff_const (c:=p)).prodMk contDiff_id) | |
| have hm := fourier_matching_three_moments hs haa hbb (fun _ => hga) (fun _ => hgb) | |
| hraa hrbb (by norm_num : (0:β)<1) (by norm_num : (1:β)β€5) | |
| hu | |
| (fourierMatchingPair_periodic s k hfp hgp p) (fun e x hx => (he e x hx).1) (fun e x hx => (he e x hx).2) hrs hre | |
| simpa only [neg_neg,Function.comp_apply] using hm.2 | |
| end ScalarConductivity | |
| end | |
| end OAI | |