Download data/lean/OAI/Analysis/Conductivity/Variational/CrossingProfiles.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.01 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Variational/CrossingProfiles.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/Conductivity/Variational/CrossingProfiles.lean
-
curl -L -o CrossingProfiles.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Variational/CrossingProfiles.lean
7.01 kB
| import Mathlib | |
| import OAI.Analysis.Conductivity.Model | |
| namespace OAI | |
| noncomputable section | |
| namespace ScalarConductivity | |
| open Real Set Filter Topology MeasureTheory | |
| lemma smooth_deriv_infty {f : β β β} | |
| (hf : ContDiff β (β(β€ : ββ)) f) : | |
| ContDiff β (β(β€ : ββ)) (deriv f) := | |
| (contDiff_infty_iff_deriv.mp hf).2 | |
| lemma smoothTransition_flat_left {x : β} (hx : x < 0) : | |
| deriv smoothTransition x = 0 β§ deriv (deriv smoothTransition) x = 0 := by | |
| have he : smoothTransition =αΆ [π x] fun _ => (0 : β) := by | |
| filter_upwards [isOpen_Iio.mem_nhds hx] with y hy | |
| exact smoothTransition.zero_of_nonpos hy.le | |
| exact β¨by simpa using he.deriv_eq, by simpa using he.deriv.deriv_eqβ© | |
| lemma smoothTransition_flat_right {x : β} (hx : 1 < x) : | |
| deriv smoothTransition x = 0 β§ deriv (deriv smoothTransition) x = 0 := by | |
| have he : smoothTransition =αΆ [π x] fun _ => (1 : β) := by | |
| filter_upwards [isOpen_Ioi.mem_nhds hx] with y hy | |
| exact smoothTransition.one_of_one_le hy.le | |
| exact β¨by simpa using he.deriv_eq, by simpa using he.deriv.deriv_eqβ© | |
| lemma exists_transition_derivative_bound : β M : β, 1 β€ M β§ β x : β, | |
| |deriv smoothTransition x| β€ M β§ |deriv (deriv smoothTransition) x| β€ M := by | |
| have hc : HasCompactSupport (deriv smoothTransition) := by | |
| apply HasCompactSupport.intro (K := Icc (0 : β) 1) isCompact_Icc | |
| intro x hx | |
| by_cases h : x < 0 | |
| Β· exact (smoothTransition_flat_left h).1 | |
| Β· exact (smoothTransition_flat_right (by simp only [mem_Icc, not_and_or, not_le] at hx | |
| rcases hx with hx | hx | |
| Β· exact False.elim (h hx) | |
| Β· exact hx)).1 | |
| obtain β¨M,hMβ© := hc.exists_bound_of_continuous | |
| (smooth_deriv_infty smoothTransition.contDiff).continuous | |
| obtain β¨N,hNβ© := hc.deriv.exists_bound_of_continuous | |
| (smooth_deriv_infty (smooth_deriv_infty smoothTransition.contDiff)).continuous | |
| refine β¨max 1 (max M N), le_max_left _ _, fun x => β¨?_,?_β©β© | |
| Β· exact (show |deriv smoothTransition x| β€ M by simpa only [Real.norm_eq_abs] using hM x).trans | |
| ((le_max_left M N).trans (le_max_right _ _)) | |
| Β· exact (show |deriv (deriv smoothTransition) x| β€ N by simpa only [Real.norm_eq_abs] using hN x).trans | |
| ((le_max_right M N).trans (le_max_right _ _)) | |
| def crossingOn (L z : β) : β := smoothTransition (4*z/L+3) | |
| def crossingOff (L z : β) : β := 1 - smoothTransition (4*z/L-2) | |
| def crossingFirst (L z : β) : β := crossingOff L z * exp (-3*z) | |
| def crossingSecond (L z : β) : β := crossingOn L z * exp (-z) | |
| lemma crossingOn_smooth (L : β) : ContDiff β (β(β€ : ββ)) (crossingOn L) := by | |
| exact smoothTransition.contDiff.comp ((contDiff_const.mul contDiff_id).div_const L |>.add contDiff_const) | |
| lemma crossingOff_smooth (L : β) : ContDiff β (β(β€ : ββ)) (crossingOff L) := by | |
| exact contDiff_const.sub (smoothTransition.contDiff.comp | |
| (((contDiff_const.mul contDiff_id).div_const L).sub contDiff_const)) | |
| lemma crossingFirst_smooth (L : β) : ContDiff β (β(β€ : ββ)) (crossingFirst L) := by | |
| exact (crossingOff_smooth L).mul ((contDiff_const.mul contDiff_id).exp) | |
| lemma crossingSecond_smooth (L : β) : ContDiff β (β(β€ : ββ)) (crossingSecond L) := by | |
| exact (crossingOn_smooth L).mul (contDiff_id.neg.exp) | |
| lemma crossingOn_bounds (L z : β) : 0 β€ crossingOn L z β§ crossingOn L z β€ 1 := | |
| β¨smoothTransition.nonneg _,smoothTransition.le_one _β© | |
| lemma crossingOff_bounds (L z : β) : 0 β€ crossingOff L z β§ crossingOff L z β€ 1 := by | |
| constructor <;> dsimp [crossingOff] | |
| Β· linarith [smoothTransition.le_one (4*z/L-2)] | |
| Β· linarith [smoothTransition.nonneg (4*z/L-2)] | |
| lemma crossingOn_eq_zero {L z : β} (hL : 0 < L) (hz : z β€ -3*L/4) : | |
| crossingOn L z = 0 := by | |
| apply smoothTransition.zero_of_nonpos | |
| have : 4*z/L β€ -3 := (div_le_iffβ hL).mpr (by linarith) | |
| linarith | |
| lemma crossingOn_eq_one {L z : β} (hL : 0 < L) (hz : -L/2 β€ z) : | |
| crossingOn L z = 1 := by | |
| apply smoothTransition.one_of_one_le | |
| have : -2 β€ 4*z/L := (le_div_iffβ hL).mpr (by linarith) | |
| linarith | |
| lemma crossingOff_eq_one {L z : β} (hL : 0 < L) (hz : z β€ L/2) : | |
| crossingOff L z = 1 := by | |
| have : 4*z/L β€ 2 := (div_le_iffβ hL).mpr (by linarith) | |
| rw [crossingOff,smoothTransition.zero_of_nonpos (by linarith),sub_zero] | |
| lemma crossingOff_eq_zero {L z : β} (hL : 0 < L) (hz : 3*L/4 β€ z) : | |
| crossingOff L z = 0 := by | |
| have : 3 β€ 4*z/L := (le_div_iffβ hL).mpr (by linarith) | |
| rw [crossingOff,smoothTransition.one_of_one_le (by linarith),sub_self] | |
| lemma crossingOn_hasDerivAt (L z : β) : HasDerivAt (crossingOn L) | |
| ((4/L)*deriv smoothTransition (4*z/L+3)) z := by | |
| have h := ((smoothTransition.contDiff (n := β€)).differentiable (by simp) (4*z/L+3)).hasDerivAt | |
| change HasDerivAt (fun w => smoothTransition (4*w/L+3)) ((4/L)*deriv smoothTransition (4*z/L+3)) z | |
| exact (h.comp z (((hasDerivAt_id z).const_mul 4).div_const L |>.add_const 3)).congr_deriv | |
| (g' := (4/L)*deriv smoothTransition (4*z/L+3)) | |
| (by simp only [mul_one]; ring) | |
| lemma crossingOff_hasDerivAt (L z : β) : HasDerivAt (crossingOff L) | |
| (-(4/L)*deriv smoothTransition (4*z/L-2)) z := by | |
| have h := ((smoothTransition.contDiff (n := β€)).differentiable (by simp) (4*z/L-2)).hasDerivAt | |
| change HasDerivAt (fun w => 1-smoothTransition (4*w/L-2)) (-(4/L)*deriv smoothTransition (4*z/L-2)) z | |
| exact ((h.comp z ((((hasDerivAt_id z).const_mul 4).div_const L).sub_const 2)).const_sub 1).congr_deriv | |
| (g' := -(4/L)*deriv smoothTransition (4*z/L-2)) | |
| (by simp only [mul_one]; ring) | |
| lemma deriv_crossingOn (L : β) : deriv (crossingOn L) = | |
| fun z => (4/L)*deriv smoothTransition (4*z/L+3) := | |
| funext fun z => (crossingOn_hasDerivAt L z).deriv | |
| lemma deriv_crossingOff (L : β) : deriv (crossingOff L) = | |
| fun z => -(4/L)*deriv smoothTransition (4*z/L-2) := | |
| funext fun z => (crossingOff_hasDerivAt L z).deriv | |
| lemma crossingOn_second (L z : β) : deriv (deriv (crossingOn L)) z = | |
| (4/L)^2*deriv (deriv smoothTransition) (4*z/L+3) := by | |
| rw [deriv_crossingOn] | |
| have h := ((smooth_deriv_infty smoothTransition.contDiff).differentiable (by simp) (4*z/L+3)).hasDerivAt | |
| have hh := (h.comp z ((((hasDerivAt_id z).const_mul 4).div_const L).add_const 3)).const_mul (4/L) | |
| convert hh.deriv using 1 <;> simp only [Function.comp_def, id_eq, mul_one] | |
| ring | |
| lemma crossingOff_second (L z : β) : deriv (deriv (crossingOff L)) z = | |
| -(4/L)^2*deriv (deriv smoothTransition) (4*z/L-2) := by | |
| rw [deriv_crossingOff] | |
| have h := ((smooth_deriv_infty smoothTransition.contDiff).differentiable (by simp) (4*z/L-2)).hasDerivAt | |
| have hh := (h.comp z ((((hasDerivAt_id z).const_mul 4).div_const L).sub_const 2)).const_mul (-(4/L)) | |
| convert hh.deriv using 1 <;> simp only [Function.comp_def, id_eq, mul_one] | |
| ring | |
| end ScalarConductivity | |
| end | |
| end OAI | |