Download data/lean/OAI/Analysis/Conductivity/Variational/AdaptedSpatialBasis.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Variational/AdaptedSpatialBasis.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/Conductivity/Variational/AdaptedSpatialBasis.lean
-
curl -L -o AdaptedSpatialBasis.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Conductivity/Variational/AdaptedSpatialBasis.lean
10.4 kB
| import Mathlib | |
| import OAI.Analysis.Conductivity.Flux.TwoFluxColumns | |
| 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 | |
| section | |
| theorem exists_adapted_spatial_basis | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [FiniteDimensional β E] (hdim : Module.finrank β E = 3) | |
| (D : E βL[β] (Fin 2 β β)) (hD : Function.Surjective D) : | |
| β v : Module.Basis (Fin 3) β E, | |
| D (v 0) = Pi.single 0 1 β§ D (v 1) = Pi.single 1 1 β§ D (v 2) = 0 := by | |
| classical | |
| obtain β¨Q, hQβ© := ContinuousLinearMap.HasRightInverse.of_surjective_of_finiteDimensional hD | |
| have hk := D.toLinearMap.finrank_range_add_finrank_ker | |
| rw [LinearMap.range_eq_top.mpr hD, finrank_top, | |
| Module.finrank_pi, Fintype.card_fin, hdim] at hk | |
| have hkp : 0 < Module.finrank β D.ker := by omega | |
| obtain β¨w, hwβ© := Module.finrank_pos_iff_exists_ne_zero.mp hkp | |
| have hw0 : (w : E) β 0 := fun h => hw (Subtype.ext h) | |
| have hDw : D (w : E) = 0 := w.property | |
| let v : Fin 3 β E := ![Q (Pi.single 0 1), Q (Pi.single 1 1), w] | |
| have hv : LinearIndependent β v := by | |
| rw [Fintype.linearIndependent_iff] | |
| intro c hc | |
| have hs : c 0 β’ Q (Pi.single 0 1) + c 1 β’ Q (Pi.single 1 1) + c 2 β’ (w : E) = 0 := by | |
| simpa [v, Fin.sum_univ_succ, add_assoc] using hc | |
| have hh := congrArg D hs | |
| simp only [map_add, map_smul, hQ (Pi.single 0 1), hQ (Pi.single 1 1), hDw, | |
| smul_zero, add_zero, map_zero] at hh | |
| have h0 : c 0 = 0 := by simpa using congr_fun hh 0 | |
| have h1 : c 1 = 0 := by simpa using congr_fun hh 1 | |
| have h2 : c 2 = 0 := by | |
| simp only [h0, h1, zero_smul, zero_add] at hs | |
| exact (smul_eq_zero.mp hs).resolve_right hw0 | |
| intro i | |
| fin_cases i <;> assumption | |
| let b := basisOfLinearIndependentOfCardEqFinrank hv (by simpa using hdim.symm) | |
| have hb : (b : Fin 3 β E) = v := coe_basisOfLinearIndependentOfCardEqFinrank hv _ | |
| refine β¨b, ?_, ?_, ?_β© | |
| Β· rw [hb] | |
| exact hQ _ | |
| Β· rw [hb] | |
| exact hQ _ | |
| Β· rw [hb] | |
| exact hDw | |
| open Filter Topology | |
| def rawTwoSpatial {E : Type*} [AddCommGroup E] [Module β E] | |
| (v : Fin 3 β E) (r : Fin 5 β β) : Fin 2 β E := | |
| ![r 0 β’ v 0 + r 1 β’ v 1 + r 3 β’ v 2, | |
| r 1 β’ v 0 + r 2 β’ v 1 + r 4 β’ v 2] | |
| lemma rawTwoSpatial_symmetry | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (D : E βL[β] (Fin 2 β β)) | |
| (h0 : D (v 0) = Pi.single 0 1) (h1 : D (v 1) = Pi.single 1 1) | |
| (h2 : D (v 2) = 0) (r : Fin 5 β β) : | |
| D (rawTwoSpatial v r 0) 1 = D (rawTwoSpatial v r 1) 0 := by | |
| simp [rawTwoSpatial, map_add, map_smul, h0, h1, h2] | |
| lemma adapted_basis_coordinate | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Module.Basis (Fin 3) β E) (D : E βL[β] (Fin 2 β β)) | |
| (h0 : D (v 0) = Pi.single 0 1) (h1 : D (v 1) = Pi.single 1 1) | |
| (h2 : D (v 2) = 0) (x : E) (i : Fin 2) : | |
| D x i = v.repr x i.castSucc := by | |
| have hx := congrArg D (v.sum_repr x) | |
| rw [Fin.sum_univ_three] at hx | |
| simp only [map_add, map_smul, h0, h1, h2, smul_zero, add_zero] at hx | |
| fin_cases i | |
| Β· simpa using (congr_fun hx 0).symm | |
| Β· simpa using (congr_fun hx 1).symm | |
| lemma exists_rawTwoSpatial | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Module.Basis (Fin 3) β E) (D : E βL[β] (Fin 2 β β)) | |
| (h0 : D (v 0) = Pi.single 0 1) (h1 : D (v 1) = Pi.single 1 1) | |
| (h2 : D (v 2) = 0) (R : Fin 2 β E) | |
| (hR : D (R 0) 1 = D (R 1) 0) : | |
| β r : Fin 5 β β, rawTwoSpatial v r = R := by | |
| have hs : v.repr (R 0) 1 = v.repr (R 1) 0 := by | |
| simpa [adapted_basis_coordinate v D h0 h1 h2] using hR | |
| refine β¨![v.repr (R 0) 0, v.repr (R 0) 1, v.repr (R 1) 1, | |
| v.repr (R 0) 2, v.repr (R 1) 2], ?_β© | |
| funext i | |
| fin_cases i | |
| Β· change v.repr (R 0) 0 β’ v 0 + v.repr (R 0) 1 β’ v 1 + v.repr (R 0) 2 β’ v 2 = R 0 | |
| simpa only [Fin.sum_univ_three] using v.sum_repr (R 0) | |
| Β· change v.repr (R 0) 1 β’ v 0 + v.repr (R 1) 1 β’ v 1 + v.repr (R 1) 2 β’ v 2 = R 1 | |
| rw [hs] | |
| simpa only [Fin.sum_univ_three] using v.sum_repr (R 1) | |
| lemma rawTwoSpatial_symbol | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (L : E βL[β] β) (r : Fin 5 β β) : | |
| divSymbolTwo (fun i => L (v i)) *α΅₯ r = fun j => L (rawTwoSpatial v r j) := by | |
| ext j | |
| fin_cases j <;> simp [rawTwoSpatial, divSymbolTwo, Matrix.mulVec, | |
| dotProduct, Fin.sum_univ_succ, map_add, map_smul] <;> ring | |
| lemma smooth_rawTwoSpatial | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (G : Fin 5 β SmoothScalar E) (j : Fin 2) : | |
| ContDiff β (β(β€ : ββ)) (fun x => rawTwoSpatial v (fun i => (G i).val x) j) := by | |
| fin_cases j <;> | |
| exact (((smoothScalar_contDiff (G _)).smul contDiff_const).add | |
| ((smoothScalar_contDiff (G _)).smul contDiff_const)).add | |
| ((smoothScalar_contDiff (G _)).smul contDiff_const) | |
| lemma support_rawTwoSpatial | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (G : Fin 5 β SmoothScalar E) {K : Set E} | |
| (hK : IsClosed K) (hG : β i, tsupport (G i).val β K) (j : Fin 2) : | |
| tsupport (fun x => rawTwoSpatial v (fun i => (G i).val x) j) β K := by | |
| apply closure_minimal _ hK | |
| intro x hx | |
| by_contra hn | |
| have hz (i : Fin 5) : (G i).val x = 0 := | |
| image_eq_zero_of_notMem_tsupport (fun ht => hn (hG i ht)) | |
| apply hx | |
| fin_cases j <;> simp [rawTwoSpatial, hz] | |
| lemma rawTwoSpatial_pairing | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (G : Fin 5 β SmoothScalar E) (Ο : SmoothScalar E) | |
| (j : Fin 2) (x : E) : | |
| fderiv β Ο.val x (rawTwoSpatial v (fun i => (G i).val x) j) = | |
| β i, (twoFluxColumns G j i).val x * (smoothDirection (v i) Ο).val x := by | |
| fin_cases j <;> simp [rawTwoSpatial, twoFluxColumns, smoothDirection, | |
| Fin.sum_univ_succ, map_add, map_smul, add_assoc] | |
| end | |
| open MeasureTheory Filter Topology | |
| lemma uniform_zero_smul_vector {X I E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| {l : Filter I} {f : I β X β β} (v : E) | |
| (hf : TendstoUniformly f (fun _ => 0) l) : | |
| TendstoUniformly (fun i x => f i x β’ v) (fun _ => 0) l := by | |
| simpa [Function.comp_def] using | |
| ((ContinuousLinearMap.id β β).smulRight v).uniformContinuous.comp_tendstoUniformly hf | |
| lemma rawTwoSpatial_error | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (v : Fin 3 β E) (g r : Fin 5 β β) (z : β) (j : Fin 2) : | |
| rawTwoSpatial v g j - z β’ rawTwoSpatial v r j = | |
| rawTwoSpatial v (fun i => g i - r i * z) j := by | |
| fin_cases j <;> simp [rawTwoSpatial, sub_smul, mul_smul, smul_add] <;> module | |
| lemma rawTwoSpatial_error_tendsto | |
| {X I E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| {l : Filter I} (v : Fin 3 β E) (G : I β X β Fin 5 β β) | |
| (r : Fin 5 β β) (z : I β X β β) | |
| (hG : β i, TendstoUniformly (fun k x => G k x i - r i * z k x) | |
| (fun _ => 0) l) (j : Fin 2) : | |
| TendstoUniformly (fun k x => rawTwoSpatial v (G k x) j - z k x β’ rawTwoSpatial v r j) | |
| (fun _ => 0) l := by | |
| simp_rw [rawTwoSpatial_error] | |
| have hc (i : Fin 5) (a : Fin 3) := uniform_zero_smul_vector (v a) (hG i) | |
| fin_cases j | |
| Β· convert ((hc 0 0).add (hc 1 1)).add (hc 3 2) using 1 <;> ext <;> simp [rawTwoSpatial] | |
| Β· convert ((hc 1 0).add (hc 2 1)).add (hc 4 2) using 1 <;> ext <;> simp [rawTwoSpatial] | |
| theorem exists_physical_two_flux | |
| {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| (hdim : Module.finrank β E = 3) (ΞΌ : Measure E) [ΞΌ.IsAddHaarMeasure] | |
| (D : E βL[β] (Fin 2 β β)) (hD : Function.Surjective D) | |
| (Ο : SmoothScalar E) (hΟ : HasCompactSupport Ο.val) | |
| (L : E βL[β] β) (hL : L β 0) | |
| (h : SmoothScalar β) (hp : Function.Periodic h.val 1) | |
| (hm : β« t in (0 : β)..1, h.val t = 0) | |
| (R : Fin 2 β E) (hRs : D (R 0) 1 = D (R 1) 0) | |
| (hRn : β j, L (R j) = 0) : | |
| β F : β β Fin 2 β E β E, | |
| (β k j, ContDiff β (β(β€ : ββ)) (F k j)) β§ | |
| (β k j, tsupport (F k j) β tsupport Ο.val) β§ | |
| (β k x, D (F k 0 x) 1 = D (F k 1 x) 0) β§ | |
| (β k j (Ο : E β β), ContDiff β (β(β€ : ββ)) Ο β | |
| (β« x, fderiv β Ο x (F k j x) βΞΌ) = 0) β§ | |
| β j, TendstoUniformly | |
| (fun k x => F k j x - (Ο.val x * h.val (k * L x)) β’ R j) | |
| (fun _ => 0) atTop := by | |
| obtain β¨v, h0, h1, h2β© := exists_adapted_spatial_basis hdim D hD | |
| obtain β¨r, hrβ© := exists_rawTwoSpatial v D h0 h1 h2 R hRs | |
| have hΞΎ : (fun i => L (v i)) β 0 := by | |
| intro hz | |
| apply hL | |
| ext x | |
| have hx := congrArg L (v.sum_repr x) | |
| simp only [map_sum, map_smul] at hx | |
| have hv (i : Fin 3) : L (v i) = 0 := congr_fun hz i | |
| simpa only [hv, smul_zero, Finset.sum_const_zero, _root_.zero_apply] | |
| using hx.symm | |
| have hsymbol : divSymbolTwo (fun i => L (v i)) *α΅₯ r = 0 := by | |
| rw [rawTwoSpatial_symbol, hr] | |
| exact funext hRn | |
| obtain β¨G, hdiv, hs, heβ© := exists_localized_two_flux v Ο L h r hΟ hΞΎ hsymbol hp hm | |
| let F : β β Fin 2 β E β E := fun k j x => rawTwoSpatial v (fun i => (G k i).val x) j | |
| refine β¨F, (fun k j => smooth_rawTwoSpatial v (G k) j), | |
| (fun k j => support_rawTwoSpatial v (G k) (isClosed_tsupport _) (hs k) j), | |
| (fun k x => rawTwoSpatial_symmetry v D h0 h1 h2 _), ?_, ?_β© | |
| Β· intro k j Ο hΟ | |
| let Ξ¨ : SmoothScalar E := β¨Ο, hΟβ© | |
| change (β« x, fderiv β Ξ¨.val x (rawTwoSpatial v (fun i => (G k i).val x) j) βΞΌ) = 0 | |
| simp_rw [rawTwoSpatial_pairing] | |
| apply smooth_divergence_zero_pairing ΞΌ v _ _ _ Ξ¨ | |
| Β· have hc (i : Fin 5) : HasCompactSupport (G k i).val := | |
| hΟ.of_isClosed_subset (isClosed_tsupport _) (hs k i) | |
| intro i | |
| fin_cases j <;> fin_cases i <;> exact hc _ | |
| Β· rw [twoFluxColumns_divergence, hdiv] | |
| rfl | |
| Β· intro j | |
| have ht := rawTwoSpatial_error_tendsto v (fun k x i => (G k i).val x) r | |
| (fun k x => Ο.val x * h.val (k * L x)) he j | |
| simpa only [hr] using ht | |
| end ScalarConductivity | |
| end | |
| end OAI | |