math / data /lean /OAI /Analysis /Conductivity /Variational /CompactSelectedReplacement.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
11.8 kB
import Mathlib
import OAI.Analysis.Conductivity.Variational.ChangeOld
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 Filter Topology
open scoped Matrix.Norms.Elementwise
structure CompactSelectedReplacement (J : Set (Fin 2)) (ΞΌ : 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 ∈ J, βˆ€ (ψ : Coord3 β†’ ℝ), ContDiff ℝ (↑(⊀ : β„•βˆž)) ψ β†’
(∫ x, fderiv ℝ ψ x ((dF x).col j) βˆ‚ΞΌ) = 0
smooth_tensor : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) (fun x => (tensor x).val) O
rank : βˆ€ x ∈ O, LinearIndependent ℝ
(gradientColumns (fderiv ℝ (fun y => u y+du y) x)).col
constitutive : βˆ€ x ∈ O, (tensor x).val *
gradientColumns (fderiv ℝ (fun y => u y+du y) x) = conductivityFlux u A x + dF x
theorem synchronized_selected_replacement
(J : Set (Fin 2))
(ΞΌ : Measure Coord3) [ΞΌ.IsAddHaarMeasure]
(u : Coord3 β†’ Fin 2 β†’ ℝ) (hu : ContDiff ℝ (↑(⊀ : β„•βˆž)) u)
(A : Coord3 β†’ Symmetric3) {U O K : Set Coord3}
(hU : IsOpen U) (hUb : Bornology.IsBounded U) (hOU : O βŠ† U)
(hK : IsCompact K) (hKO : K βŠ† O)
(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)
(Y : Coord3 ≃ Coord3) (hY : ContDiff ℝ (↑(⊀ : β„•βˆž)) Y)
(hYi : ContDiff ℝ (↑(⊀ : β„•βˆž)) Y.symm) (hoff : βˆ€ x βˆ‰ K, Y x = x)
(z : Coord3 β†’ ℝ) (hz : ContDiff ℝ (↑(⊀ : β„•βˆž)) z)
(C : ℝ β†’ Symmetric3)
(hC : βˆ€ x ∈ O, ContDiffAt ℝ (↑(⊀ : β„•βˆž)) (fun t => (C t).val) (z x))
(Ξ΄ : Fin 2 β†’ Coord3 β†’ Coord3)
(hΞ΄ : βˆ€ j, ContDiff ℝ (↑(⊀ : β„•βˆž)) (Ξ΄ j))
(hsΞ΄ : βˆ€ j, tsupport (Ξ΄ j) βŠ† K)
(hΞ΄div : βˆ€ j (ψ : Coord3 β†’ ℝ), ContDiff ℝ (↑(⊀ : β„•βˆž)) ψ β†’
(∫ x, fderiv ℝ ψ x (Ξ΄ j x) βˆ‚ΞΌ) = 0)
(hstate : βˆ€ x ∈ O,
let E := gradientColumns (fderiv ℝ u x)
let Ft := conductivityFlux u A x + Matrix.of (fun i j => Ξ΄ j x i)
let J := operatorMatrix (fderiv ℝ Y x)
let At := repairPushed (C (z x)) J E Ft
0 < J.det ∧ LinearIndependent ℝ E.col ∧
At.val * gradientColumns (fderiv ℝ (u ∘ Y.symm) (Y x)) = pushFlux J Ft) :
βˆƒ R : CompactSelectedReplacement J ΞΌ O u A, βˆ€ x ∈ O,
R.tensor (Y x) = repairPushed (C (z x)) (operatorMatrix (fderiv ℝ Y x))
(gradientColumns (fderiv ℝ u x))
(conductivityFlux u A x + Matrix.of (fun i j => Ξ΄ j x i)) := by
classical
let Ft : Coord3 β†’ Matrix (Fin 3) (Fin 2) ℝ :=
fun x => conductivityFlux u A x + Matrix.of (fun i j => Ξ΄ j x i)
let G : Coord3 β†’ Matrix (Fin 3) (Fin 2) ℝ :=
fun x => Matrix.of (fun i j => piolaFlux Y (fun t => (Ft t).col j) x i)
let dF : Coord3 β†’ Matrix (Fin 3) (Fin 2) ℝ := fun x => G x - conductivityFlux u A x
let B : Coord3 β†’ Symmetric3 := fun x => repairPushed (C (z x))
(operatorMatrix (fderiv ℝ Y x)) (gradientColumns (fderiv ℝ u x)) (Ft x)
let du : Coord3 β†’ Fin 2 β†’ ℝ := fun x => u (Y.symm x)-u x
have heq : (fun x => u x+du x) = u ∘ Y.symm := by
funext x; simp only [du, Function.comp_apply]; abel
have him : MapsTo Y.symm O O := (equiv_mapsTo_of_fixed_compl Y O
(fun x hx => hoff x (fun hk => hx (hKO hk)))).2
have hF := conductivityFlux_contDiffOn u hu A hU hA
have hcol (j : Fin 2) : ContDiffOn ℝ (↑(⊀ : β„•βˆž))
(fun x => (conductivityFlux u A x).col j) U := by
apply contDiffOn_pi.mpr; intro i
exact contDiffOn_pi.mp (contDiffOn_pi.mp hF i) j
have hdcol (j : Fin 2) := local_compact_updated_flux_regular Y hY hYi hU hUb hK
(hKO.trans hOU) hoff (fun x => (conductivityFlux u A x).col j) (Ξ΄ j)
(hcol j) (hΞ΄ j) (hsΞ΄ j)
have hdFe (j : Fin 2) : (fun x => (dF x).col j) =
fun x => piolaFlux Y (fun t => (conductivityFlux u A t).col j + Ξ΄ j t) x -
(conductivityFlux u A x).col j := by rfl
have hdFs : ContDiff ℝ (↑(⊀ : β„•βˆž)) dF := by
apply contDiff_pi.mpr; intro i
apply contDiff_pi.mpr; intro j
exact contDiff_pi.mp (hdFe j β–Έ (hdcol j).1) i
have hdsupp : tsupport dF βŠ† K := tsupport_matrix_subset dF hK.isClosed
(fun j => hdFe j β–Έ (hdcol j).2.2)
have hdu := local_compact_recomposition_difference Y hYi hU hUb hK
(hKO.trans hOU) hoff u hu.contDiffOn
have hBs : ContDiffOn ℝ (↑(⊀ : β„•βˆž)) (fun x => (B x).val) O := by
intro x hx
have hd := (hstate x hx).1.ne'
have hi := (hstate x hx).2.1
have hFt : ContDiffAt ℝ (↑(⊀ : β„•βˆž)) Ft x := by
apply ((hF x (hOU hx)).contDiffAt (hU.mem_nhds (hOU hx))).add
apply contDiffAt_pi.mpr; intro i
apply contDiffAt_pi.mpr; intro j
exact contDiffAt_pi.mp (hΞ΄ j).contDiffAt i
exact (contDiffAt_repairPushed (fun x => C (z x)) _ _ _
((hC x hx).comp x hz.contDiffAt)
((operatorMatrix_contDiff (m := Fin 3) (n := Fin 3)).contDiffAt.comp x (hY.contDiffAt.fderiv_right (by simp)))
(contDiff_gradientColumns u hu).contDiffAt hFt hd hi).contDiffWithinAt
refine ⟨{
du := du, dF := dF, tensor := B ∘ Y.symm
smooth_du := hdu.1, compact_du := hdu.2.1, support_du := hdu.2.2.trans hKO
smooth_dF := hdFs, compact_dF := hK.of_isClosed_subset isClosed_closure hdsupp
support_dF := hdsupp.trans hKO
cauchy_dF := ?_
smooth_tensor := hBs.comp hYi.contDiffOn him
rank := ?_
constitutive := ?_ }, ?_⟩
· intro j hj ψ hψ
have hh := local_compact_updated_flux ΞΌ Y hY hYi hU hUb hK (hKO.trans hOU) hoff
(fun x => (conductivityFlux u A x).col j) (Ξ΄ j) (hcol j) (hdiv j hj)
(hΞ΄ j) (hsΞ΄ j) (hΞ΄div j)
simpa only [congrFun (hdFe j)] using hh.2.2.2 ψ hψ
Β· intro x hx
rw [heq, ← Y.apply_symm_apply x, gradientColumns_recomposition Y
(hY.differentiable (by simp)) (hYi.differentiable (by simp)) u (hu.differentiable (by simp))]
exact pushGradient_rank _ (hstate (Y.symm x) (him hx)).1.ne' _
(hstate (Y.symm x) (him hx)).2.1
Β· intro x hx
rw [heq]
have hh := (hstate (Y.symm x) (him hx)).2.2
rw [Y.apply_symm_apply] at hh
change (B (Y.symm x)).val * gradientColumns (fderiv ℝ (u ∘ Y.symm) x) =
conductivityFlux u A x + dF x
rw [hh]
have he : conductivityFlux u A x+dF x=G x := by simp only [dF]; abel
rw [he]
ext i j
have hd : 0 < (fderiv ℝ Y (Y.symm x)).det := by
rw [← operatorMatrix_det]; exact (hstate (Y.symm x) (him hx)).1
have hp := piolaFlux_columns Y Ft hd j
rw [Y.apply_symm_apply] at hp
exact congrFun hp.symm i
Β· intro x _
simp only [Function.comp_apply, Y.symm_apply_apply, B, Ft]
theorem exists_selected_split_on_subpatch
(J : Set (Fin 2))
(ΞΌ : Measure Coord3) [ΞΌ.IsAddHaarMeasure]
(u : Coord3 β†’ Fin 2 β†’ ℝ) (hu : ContDiff ℝ (↑(⊀ : β„•βˆž)) u)
(A : Coord3 β†’ Symmetric3) {p : Coord3} (hAp : ContinuousAt A p)
{U : Set Coord3} (hU : IsOpen U) (hUb : Bornology.IsBounded U) (hpU : p ∈ 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 ⟨X, W, hW, hpW, hWU, hWc, hWX, hX, hXi, hop⟩ :=
exists_local_split_on_subpatch_retained ΞΌ u hu A hAp hD d L hLd B hB hBn
hΞΈ hΞΈ1 hm hpath C hC hdet hconstit hG hCG hU hpU
refine ⟨W, hW, hpW, hWU, hWc, ?_⟩
intro O hO hOW Ξ΅ hΞ΅
have hOU : O βŠ† U := hOW.trans (subset_closure.trans hWU)
have hOX : O βŠ† X.source := hOW.trans hWX
obtain βŸ¨Ο‡, H, F, hΟ‡c, hΟ‡O, hΟ‡b, hHr, hF, hFs, hFdiv, hn⟩ := hop O hO hOW Ξ΅ hΞ΅
obtain ⟨n, hn⟩ := hn.exists
obtain ⟨Y, hY, hYi, hoffO, _, hform, hpure, hstate⟩ := hn
have hΟ‡t : tsupport Ο‡.val βŠ† X.target := hΟ‡O.trans (by
rintro y ⟨x, hx, rfl⟩; exact X.map_source (hOX hx))
let K := X.symm '' tsupport Ο‡.val
have hK : IsCompact K := hχc.image_of_continuousOn (X.symm.continuousOn.mono hχt)
have hKO : K βŠ† O := by
rintro x ⟨y, hy, rfl⟩
obtain ⟨t, ht, rfl⟩ := hΟ‡O hy
simpa only [X.left_inv (hOX ht)] using ht
have hχp := localPullback_tsupport X χ.val hχc hχt
have hoff : βˆ€ x βˆ‰ K, Y x = x := by
intro x hx
have hz := image_eq_zero_of_notMem_tsupport (fun h => hx (hχp.2.1 h))
rw [hform x, hz, mul_zero, zero_mul, zero_smul, add_zero]
let z : Coord3 β†’ ℝ := fun x => localPullback X Ο‡.val x *
(smoothDirection 1 H).val ((n+1 : ℝ) * L (X x))
have hz : ContDiff ℝ (↑(⊀ : β„•βˆž)) z :=
(localPullback_contDiff X hX.contDiffOn χ.val (smoothScalar_contDiff χ) hχc hχt).mul
((smoothScalar_contDiff (smoothDirection 1 H)).comp
(contDiff_const.mul (L.contDiff.comp hX)))
have hzr : βˆ€ x, z x ∈ Icc (-ΞΈ) (1-ΞΈ) := fun x =>
scalar_cutoff_segment hθ.le (by linarith) (localPullback_bounds X χ.val hχb x) (hHr _)
obtain ⟨R, hRt⟩ := synchronized_selected_replacement J μ u hu A hU hUb hOU hK hKO hA hdiv
Y hY hYi hoff z hz C (fun x _ => hCs _ (hzr x)) (F (n+1 : ℝ))
(hF _) (fun j => (hFs _ j).2.2) (hFdiv _) (fun x hx =>
⟨(hstate x hx).1, (hstate x hx).2.1, (hstate x hx).2.2.2⟩)
let q : Coord3 β†’ ℝ := z ∘ Y.symm
have him : MapsTo Y.symm O O := (equiv_mapsTo_of_fixed_compl Y O hoffO).2
refine ⟨R, q, hz.comp hYi, fun x => hzr _, ?_, hpure⟩
intro x hx
have ht := hRt (Y.symm x) (him hx)
rw [Y.apply_symm_apply] at ht
rw [ht]
exact (hstate (Y.symm x) (him hx)).2.2.1
end ScalarConductivity
end
end OAI