math / data /lean /OAI /Analysis /Conductivity /Variational /CompactCompatibleReplacement.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
11.1 kB
import Mathlib
import OAI.Analysis.Conductivity.Variational.CompactSelectedReplacement
namespace OAI
noncomputable section
open MeasureTheory
open scoped ENNReal
open Matrix Filter Topology
open Set MeasureTheory Filter Topology
open scoped BigOperators
open Set MeasureTheory Filter Topology
open scoped Manifold
open Set Filter
open scoped Topology
open Set Filter MeasureTheory
open scoped Topology Manifold ENNReal
open Set
namespace ScalarConductivity
open Matrix Set MeasureTheory
open scoped Matrix.Norms.Elementwise
structure CompactCompatibleReplacement (ΞΌ : Measure Coord3) (O : Set Coord3)
(u : Coord3 β†’ Fin 2 β†’ ℝ) (A : Coord3 β†’ Symmetric3) where
du : Coord3 β†’ Fin 2 β†’ ℝ
dF : Coord3 β†’ Matrix (Fin 3) (Fin 2) ℝ
tensor : Coord3 β†’ Symmetric3
smooth_du : ContDiff ℝ (↑(⊀ : β„•βˆž)) du
compact_du : HasCompactSupport du
support_du : tsupport du βŠ† O
smooth_dF : ContDiff ℝ (↑(⊀ : β„•βˆž)) dF
compact_dF : HasCompactSupport dF
support_dF : tsupport dF βŠ† O
cauchy_dF : βˆ€ j (ψ : Coord3 β†’ ℝ), ContDiff ℝ (↑(⊀ : β„•βˆž)) ψ β†’
(∫ x, fderiv ℝ ψ x ((dF x).col j) βˆ‚ΞΌ) = 0
smooth_tensor : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) (fun x => (tensor x).val) O
constitutive : βˆ€ x ∈ O, (tensor x).val *
gradientColumns (fderiv ℝ (fun y => u y+du y) x) = conductivityFlux u A x + dF x
def CompactTwoFieldReplacement.forgetRank {ΞΌ : Measure Coord3} {O : Set Coord3}
{u : Coord3 β†’ Fin 2 β†’ ℝ} {A : Coord3 β†’ Symmetric3}
(R : CompactTwoFieldReplacement ΞΌ O u A) : CompactCompatibleReplacement ΞΌ O u A where
du := R.du
dF := R.dF
tensor := R.tensor
smooth_du := R.smooth_du
compact_du := R.compact_du
support_du := R.support_du
smooth_dF := R.smooth_dF
compact_dF := R.compact_dF
support_dF := R.support_dF
cauchy_dF := R.cauchy_dF
smooth_tensor := R.smooth_tensor
constitutive := R.constitutive
lemma gradientColumns_affine_column {O : Set Coord3} (hO : IsOpen O)
{u v : Coord3 β†’ Fin 2 β†’ ℝ} {l ΞΊ : Fin 2 β†’ ℝ}
(he : βˆ€ x ∈ O, βˆ€ j, u x j = l j * v x 0 + ΞΊ j)
(hv : DifferentiableOn ℝ v O) {x : Coord3} (hx : x ∈ O) (i : Fin 3) (j : Fin 2) :
gradientColumns (fderiv ℝ u x) i j = l j * gradientColumns (fderiv ℝ v x) i 0 := by
let w : Coord3 β†’ Fin 2 β†’ ℝ := fun x j => l j * v x 0 + ΞΊ j
have hw : HasFDerivAt w
(ContinuousLinearMap.pi (fun j => l j β€’
((ContinuousLinearMap.proj 0).comp (fderiv ℝ v x)))) x := by
apply hasFDerivAt_pi.mpr
intro j
exact (((ContinuousLinearMap.proj 0).hasFDerivAt.comp x
(hv x hx |>.differentiableAt (hO.mem_nhds hx)).hasFDerivAt).const_mul (l j)).add_const (ΞΊ j)
have heq : EqOn u w O := fun y hy => funext (he y hy)
rw [fderiv_eq_of_eqOn_open hO heq hx, hw.fderiv]
rfl
def CompactSelectedReplacement.affineTransfer
{ΞΌ : Measure Coord3} {O : Set Coord3} (hO : IsOpen O)
{u v : Coord3 β†’ Fin 2 β†’ ℝ} {A : Coord3 β†’ Symmetric3}
{l ΞΊ : Fin 2 β†’ ℝ}
(he : βˆ€ x ∈ O, βˆ€ j, u x j = l j * v x 0 + ΞΊ j)
(hv : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) v O)
(R : CompactSelectedReplacement {0} ΞΌ O v A) :
CompactCompatibleReplacement ΞΌ O u A := by
classical
let du : Coord3 β†’ Fin 2 β†’ ℝ := fun x j => l j * R.du x 0
let dF : Coord3 β†’ Matrix (Fin 3) (Fin 2) ℝ := fun x i j => l j * R.dF x i 0
have hdu : ContDiff ℝ (↑(⊀ : β„•βˆž)) du :=
contDiff_pi.mpr (fun j => contDiff_const.mul (contDiff_pi.mp R.smooth_du 0))
have hdF : ContDiff ℝ (↑(⊀ : β„•βˆž)) dF :=
contDiff_pi.mpr (fun i => contDiff_pi.mpr (fun j => contDiff_const.mul
(contDiff_pi.mp (contDiff_pi.mp R.smooth_dF i) 0)))
have hsu : Function.support du βŠ† Function.support R.du := by
intro x hx hz
apply hx
ext j
simp [du, hz]
have hsF : Function.support dF βŠ† Function.support R.dF := by
intro x hx hz
apply hx
ext i j
simp [dF, hz]
have hsdu : tsupport du βŠ† tsupport R.du := closure_mono hsu
have hsdF : tsupport dF βŠ† tsupport R.dF := closure_mono hsF
refine ⟨du, dF, R.tensor, hdu, R.compact_du.mono hsu, hsdu.trans R.support_du,
hdF, R.compact_dF.mono hsF, hsdF.trans R.support_dF, ?_, R.smooth_tensor, ?_⟩
· intro j ψ hψ
have hecol : (fun x => (dF x).col j) = fun x => l j β€’ (R.dF x).col 0 := rfl
simp_rw [show βˆ€ x, (dF x).col j = l j β€’ (R.dF x).col 0 from fun x => congrFun hecol x,
map_smul, smul_eq_mul]
rw [integral_const_mul, R.cauchy_dF 0 (by simp) ψ hψ, mul_zero]
Β· intro x hx
have hnew (y : Coord3) (hy : y ∈ O) (j : Fin 2) :
(u y + du y) j = l j * (v y + R.du y) 0 + ΞΊ j := by
simp only [Pi.add_apply, du, he y hy j]
ring
have hvd := hv.differentiableOn (by simp)
have hvo := (hv.add R.smooth_du.contDiffOn).differentiableOn (by simp)
ext i j
change (βˆ‘ k, (R.tensor x).val i k * gradientColumns (fderiv ℝ (fun y => u y+du y) x) k j) =
(βˆ‘ k, (A x).val i k * gradientColumns (fderiv ℝ u x) k j) + l j * R.dF x i 0
simp_rw [gradientColumns_affine_column hO hnew hvo hx,
gradientColumns_affine_column hO he hvd hx]
have hr := congrFun (congrFun (R.constitutive x hx) i) 0
change (βˆ‘ k, (R.tensor x).val i k * gradientColumns (fderiv ℝ (fun y => v y+R.du y) x) k 0) =
(βˆ‘ k, (A x).val i k * gradientColumns (fderiv ℝ v x) k 0) + R.dF x i 0 at hr
calc
βˆ‘ k, (R.tensor x).val i k * (l j * gradientColumns (fderiv ℝ (fun y => v y+R.du y) x) k 0) =
l j * βˆ‘ k, (R.tensor x).val i k * gradientColumns (fderiv ℝ (fun y => v y+R.du y) x) k 0 := by
rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring
_ = l j * ((βˆ‘ k, (A x).val i k * gradientColumns (fderiv ℝ v x) k 0) + R.dF x i 0) := by rw [hr]
_ = (βˆ‘ k, (A x).val i k * (l j * gradientColumns (fderiv ℝ v x) k 0)) + l j * R.dF x i 0 := by
rw [mul_add, Finset.mul_sum]; congr 1; apply Finset.sum_congr rfl; intro k _; ring
lemma CompactSelectedReplacement.affineTransfer_relation
{ΞΌ : Measure Coord3} {O : Set Coord3} (hO : IsOpen O)
{u v : Coord3 β†’ Fin 2 β†’ ℝ} {A : Coord3 β†’ Symmetric3}
{l ΞΊ : Fin 2 β†’ ℝ}
(he : βˆ€ x ∈ O, βˆ€ j, u x j = l j * v x 0 + ΞΊ j)
(hv : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) v O)
(R : CompactSelectedReplacement {0} ΞΌ O v A) :
βˆ€ x ∈ O, βˆ€ j, (u x + (R.affineTransfer hO he hv).du x) j =
l j * (v x + R.du x) 0 + ΞΊ j := by
intro x hx j
change u x j + l j * R.du x 0 = _
rw [he x hx j]
simp only [Pi.add_apply]
ring
end ScalarConductivity
namespace ScalarConductivity
open Matrix Set MeasureTheory Filter Topology
open scoped Matrix.Norms.Elementwise
def CompactSelectedReplacement.changeOld
{J : Set (Fin 2)}
{ΞΌ : Measure Coord3} {O : Set Coord3} (hO : IsOpen O)
{u v : Coord3 β†’ Fin 2 β†’ ℝ} {A B : Coord3 β†’ Symmetric3}
(R : CompactSelectedReplacement J ΞΌ O u A) (he : EqOn u v O) (hAB : EqOn A B O) :
CompactSelectedReplacement J ΞΌ O v B where
du := R.du
dF := R.dF
tensor := R.tensor
smooth_du := R.smooth_du
compact_du := R.compact_du
support_du := R.support_du
smooth_dF := R.smooth_dF
compact_dF := R.compact_dF
support_dF := R.support_dF
cauchy_dF := R.cauchy_dF
smooth_tensor := R.smooth_tensor
rank := by
intro x hx
rw [← fderiv_eq_of_eqOn_open hO (show EqOn (fun y => u y+R.du y)
(fun y => v y+R.du y) O from fun y hy => by dsimp only; rw [he hy]) hx]
exact R.rank x hx
constitutive := by
intro x hx
rw [← fderiv_eq_of_eqOn_open hO (show EqOn (fun y => u y+R.du y)
(fun y => v y+R.du y) O from fun y hy => by dsimp only; rw [he hy]) hx]
rw [R.constitutive x hx]
simp only [conductivityFlux, hAB hx, fderiv_eq_of_eqOn_open hO he hx]
theorem exists_locally_smooth_selected_split
(J : Set (Fin 2))
(ΞΌ : Measure Coord3) [ΞΌ.IsAddHaarMeasure]
(u : Coord3 β†’ Fin 2 β†’ ℝ) (A : Coord3 β†’ Symmetric3) {p : Coord3}
{U : Set Coord3} (hU : IsOpen U) (hUb : Bornology.IsBounded U) (hpU : p ∈ U)
(hu : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) u U)
(hA : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) (fun x => (A x).val) U)
(hdiv : βˆ€ j ∈ J, βˆ€ (ψ : Coord3 β†’ ℝ), ContDiff ℝ (↑(⊀ : β„•βˆž)) ψ β†’ HasCompactSupport ψ β†’
tsupport ψ βŠ† U β†’ (∫ x, fderiv ℝ ψ x ((conductivityFlux u A x).col j) βˆ‚ΞΌ) = 0)
(hD : Function.Surjective (fderiv ℝ u p))
(d : Coord3) (L : Coord3 β†’L[ℝ] ℝ) (hLd : L d = 1)
(B : Mat3) (hB : B.IsSymm) (hBn : βˆ€ v, L (B *α΅₯ v) = 0)
{ΞΈ c m : ℝ} (hΞΈ : 0 < ΞΈ) (hΞΈ1 : ΞΈ < 1)
(hm : 0 < m) (hpath : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ), m ≀ 1+c*z)
(C : ℝ β†’ Symmetric3) (hC : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ), ContinuousAt C z)
(hCs : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ), ContDiffAt ℝ (↑(⊀ : β„•βˆž)) (fun t => (C t).val) z)
(hdet : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ), 0 < (splitJacobian d L c z).det)
(hconstit : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ),
(C z).val = (splitJacobian d L c z).det⁻¹ β€’
(splitJacobian d L c z * ((A p).val + z β€’ B) * (splitJacobian d L c z)α΅€))
{G : Set (ℝ Γ— Symmetric3)} (hG : IsOpen G)
(hCG : βˆ€ z ∈ Icc (-ΞΈ) (1-ΞΈ), (z, C z) ∈ G) :
βˆƒ W : Set Coord3, IsOpen W ∧ p ∈ W ∧ closure W βŠ† U ∧ IsCompact (closure W) ∧
βˆ€ O : Set Coord3, IsOpen O β†’ O βŠ† W β†’ βˆ€ Ξ΅ : ℝ, 0 < Ξ΅ β†’
βˆƒ (R : CompactSelectedReplacement J ΞΌ O u A) (q : Coord3 β†’ ℝ),
ContDiff ℝ (↑(⊀ : β„•βˆž)) q ∧ (βˆ€ x, q x ∈ Icc (-ΞΈ) (1-ΞΈ)) ∧
(βˆ€ x ∈ O, (q x, R.tensor x) ∈ G) ∧
ΞΌ {x | x ∈ O ∧ q x β‰  -ΞΈ ∧ q x β‰  1-ΞΈ} ≀ ENNReal.ofReal Ξ΅ := by
obtain ⟨v, V, hv, _, hV, hpV, hVU, he⟩ := exists_smooth_compact_extension
hU hUb isCompact_singleton (singleton_subset_iff.mpr hpU) u hu
have hep : fderiv ℝ v p = fderiv ℝ u p := fderiv_eq_of_eqOn_open hV he (hpV (mem_singleton p))
have hAp : ContinuousAt A p :=
Topology.IsInducing.subtypeVal.continuousAt_iff.mpr
(hA.continuousOn.continuousAt (hU.mem_nhds hpU))
have hdivv : βˆ€ j ∈ J, βˆ€ (ψ : Coord3 β†’ ℝ), ContDiff ℝ (↑(⊀ : β„•βˆž)) ψ β†’ HasCompactSupport ψ β†’
tsupport ψ βŠ† V β†’ (∫ x, fderiv ℝ ψ x ((conductivityFlux v A x).col j) βˆ‚ΞΌ) = 0 := by
intro j hj ψ hψ hc hs
rw [derivative_test_integral_congr μ ψ _ (fun x => (conductivityFlux u A x).col j) (by
intro x hx
simp only [conductivityFlux, fderiv_eq_of_eqOn_open hV he (hs hx)])]
exact hdiv j hj ψ hψ hc (hs.trans hVU)
obtain ⟨W, hW, hpW, hWV, hWc, hw⟩ := exists_selected_split_on_subpatch J μ v hv A hAp
hV (hUb.subset hVU) (hpV (mem_singleton p)) (hA.mono hVU) hdivv (hep β–Έ hD)
d L hLd B hB hBn hΞΈ hΞΈ1 hm hpath C hC hCs hdet hconstit hG hCG
refine ⟨W, hW, hpW, hWV.trans hVU, hWc, ?_⟩
intro O hO hOW Ξ΅ hΞ΅
obtain ⟨R, q, hq, hqr, hqG, hqm⟩ := hw O hO hOW Ρ hΡ
exact ⟨R.changeOld hO (he.mono (hOW.trans (subset_closure.trans hWV))) (fun _ _ => rfl),
q, hq, hqr, hqG, hqm⟩
end ScalarConductivity
end
end OAI