Download data/lean/OAI/MathematicalPhysics/RapidForcing/NSUniqueness.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 14.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/NSUniqueness.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/RapidForcing/NSUniqueness.lean
-
curl -L -o NSUniqueness.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/NSUniqueness.lean
14.6 kB
| import OAI.MathematicalPhysics.RapidForcing.ClassicalSolution | |
| import OAI.MathematicalPhysics.RapidForcing.Energy | |
| import OAI.MathematicalPhysics.RapidForcing.Uniqueness | |
| namespace OAI | |
| section | |
| open scoped BigOperators ENNReal Topology NNReal InnerProductSpace | |
| open Set MeasureTheory | |
| namespace RapidForcing | |
| lemma L2ContinuousOn.memLp {E : Type} [NormedAddCommGroup E] | |
| {f : Field E} {T t : β} (hf : L2ContinuousOn f T) (ht : t β Icc 0 T) : | |
| MemLp (f t) 2 volume := by | |
| obtain β¨v, _, hvβ© := hf | |
| exact (Lp.memLp (v t)).ae_eq (hv t ht) | |
| @[simp] lemma spatialMulti_zero {E : Type} [NormedAddCommGroup E] [NormedSpace β E] | |
| (f : Field E) : spatialMulti 0 f = f := by simp [spatialMulti] | |
| lemma spatialMulti_single {E : Type} [NormedAddCommGroup E] [NormedSpace β E] | |
| (f : Field E) (i : Fin 3) (n : β) : | |
| spatialMulti (Pi.single i n) f = (spatialD i)^[n] f := by | |
| fin_cases i <;> simp [spatialMulti] | |
| lemma order_single (i : Fin 3) (n : β) : order (Pi.single i n) = n := by | |
| simp [order] | |
| lemma EnergyRegularity.memLp_velocity {u : Field Space} {p : Field β} | |
| (h : EnergyRegularity u p) {t : β} (ht : 0 β€ t) : MemLp (u t) 2 volume := by | |
| have he := (h t ht).1 0 (by simp [order]) | |
| simpa using he.memLp (right_mem_Icc.mpr ht) | |
| lemma EnergyRegularity.memLp_pressure {u : Field Space} {p : Field β} | |
| (h : EnergyRegularity u p) {t : β} (ht : 0 β€ t) : MemLp (p t) 2 volume := by | |
| have he := (h t ht).2.2 0 (by simp [order]) | |
| simpa using he.memLp (right_mem_Icc.mpr ht) | |
| lemma EnergyRegularity.memLp_velocityD {u : Field Space} {p : Field β} | |
| (h : EnergyRegularity u p) {t : β} (ht : 0 β€ t) (i : Fin 3) : | |
| MemLp (spaceD i (u t)) 2 volume := by | |
| have he := (h t ht).1 (Pi.single i 1) (by rw [order_single]; norm_num) | |
| have this := he.memLp (right_mem_Icc.mpr ht) | |
| rw [spatialMulti_single] at this | |
| exact this | |
| lemma EnergyRegularity.memLp_velocityDD {u : Field Space} {p : Field β} | |
| (h : EnergyRegularity u p) {t : β} (ht : 0 β€ t) (i : Fin 3) : | |
| MemLp (spaceD i (spaceD i (u t))) 2 volume := by | |
| have he := (h t ht).1 (Pi.single i 2) (by rw [order_single]) | |
| have this := he.memLp (right_mem_Icc.mpr ht) | |
| rw [spatialMulti_single] at this | |
| exact this | |
| lemma EnergyRegularity.memLp_pressureD {u : Field Space} {p : Field β} | |
| (h : EnergyRegularity u p) {t : β} (ht : 0 β€ t) (i : Fin 3) : | |
| MemLp (spaceD i (p t)) 2 volume := by | |
| have he := (h t ht).2.2 (Pi.single i 1) (by rw [order_single]) | |
| have this := he.memLp (right_mem_Icc.mpr ht) | |
| rw [spatialMulti_single] at this | |
| exact this | |
| lemma timeD_sub {u v : Field Space} (hu : β x, DifferentiableOn β (fun t => u t x) (Ici 0)) | |
| (hv : β x, DifferentiableOn β (fun t => v t x) (Ici 0)) {t : β} (ht : 0 β€ t) (x : Space) : | |
| timeD (fun t x => u t x - v t x) t x = timeD u t x - timeD v t x := | |
| derivWithin_sub (hu x t ht) (hv x t ht) | |
| lemma spaceD_sub_twice {u v : Space β Space} | |
| (hu : ContDiff β 2 u) (hv : ContDiff β 2 v) (i : Fin 3) : | |
| spaceD i (spaceD i (fun x => u x - v x)) = | |
| fun x => spaceD i (spaceD i u) x - spaceD i (spaceD i v) x := by | |
| rw [spaceD_sub (hu.differentiable (by norm_num)) (hv.differentiable (by norm_num))] | |
| exact spaceD_sub ((spaceD_contDiff hu i).differentiable (by norm_num)) | |
| ((spaceD_contDiff hv i).differentiable (by norm_num)) i | |
| lemma advection_difference {u v : Space β Space} | |
| (hu : Differentiable β u) (hv : Differentiable β v) (x : Space) : | |
| (β i, v x i β’ spaceD i v x) - (β i, u x i β’ spaceD i u x) = | |
| (β i, v x i β’ spaceD i (fun z => v z - u z) x) + | |
| fderiv β u x (v x - u x) := by | |
| simp only [spaceD_sub hv hu, smul_sub, Finset.sum_sub_distrib, | |
| spaceD_sum, map_sub] | |
| abel | |
| lemma navierStokes_difference_energy {Ξ½ : β} (hΞ½ : 0 β€ Ξ½) | |
| {f u v : Field Space} {p q : Field β} | |
| (hu : Classical u p) (hv : Classical v q) | |
| (heu : EnergyRegularity u p) (hev : EnergyRegularity v q) | |
| (hnsu : NavierStokes Ξ½ f u p) (hnsv : NavierStokes Ξ½ f v q) | |
| {t C B A : β} (ht : 0 β€ t) | |
| (huC : β x, βfderiv β (u t) xβ β€ C) | |
| (hvB : β x, βv t xβ β€ B) (huA : β x, βu t xβ β€ A) : | |
| (β« x, βͺv t x - u t x, timeD v t x - timeD u t xβ«_β) β€ | |
| C * β« x, βv t x - u t xβ ^ 2 := by | |
| let w : Space β Space := fun x => v t x - u t x | |
| let r : Space β β := fun x => q t x - p t x | |
| have huβ := (hu.1 t ht).1 | |
| have hvβ := (hv.1 t ht).1 | |
| have hpβ := (hu.1 t ht).2 | |
| have hqβ := (hv.1 t ht).2 | |
| have hu' := huβ.differentiable (by norm_num) | |
| have hv' := hvβ.differentiable (by norm_num) | |
| have hp' := hpβ.differentiable (by norm_num) | |
| have hq' := hqβ.differentiable (by norm_num) | |
| have hw1 (i : Fin 3) : MemLp (spaceD i w) 2 volume := by | |
| dsimp [w]; rw [spaceD_sub hv' hu'] | |
| exact (hev.memLp_velocityD ht i).sub (heu.memLp_velocityD ht i) | |
| have hw2 (i : Fin 3) : MemLp (spaceD i (spaceD i w)) 2 volume := by | |
| dsimp [w]; rw [spaceD_sub_twice hvβ huβ] | |
| exact (hev.memLp_velocityDD ht i).sub (heu.memLp_velocityDD ht i) | |
| have hr1 (i : Fin 3) : MemLp (spaceD i r) 2 volume := by | |
| dsimp [r]; rw [spaceD_sub hq' hp'] | |
| exact (hev.memLp_pressureD ht i).sub (heu.memLp_pressureD ht i) | |
| have hdv (x : Space) : β i, spaceD i (v t) x i = 0 := hnsv.2.1 t ht x | |
| have hdw (x : Space) : β i, spaceD i w x i = 0 := by | |
| dsimp [w] | |
| simp_rw [spaceD_sub hv' hu', PiLp.sub_apply, Finset.sum_sub_distrib] | |
| change divergence v t x - divergence u t x = 0 | |
| rw [hnsv.2.1 t ht x, hnsu.2.1 t ht x, sub_self] | |
| have hbound := spatial_energy_bound huβ hv' (hvβ.sub huβ) (hq'.sub hp') | |
| ((hev.memLp_velocity ht).sub (heu.memLp_velocity ht)) | |
| ((hev.memLp_pressure ht).sub (heu.memLp_pressure ht)) | |
| (hev.memLp_velocityD ht) hw1 hw2 hr1 hΞ½ huC hvB | |
| (fun x => (norm_sub_le (v t x) (u t x)).trans (add_le_add (hvB x) (huA x))) hdv hdw | |
| have heq (x : Space) : timeD v t x - timeD u t x = | |
| -(β i, spaceD i r x β’ basis i) + Ξ½ β’ (β i, spaceD i (spaceD i w) x) - | |
| (β i, v t x i β’ spaceD i w x) - fderiv β (u t) x (w x) := by | |
| have ha := advection_difference hu' hv' x | |
| change advection v t x - advection u t x = | |
| (β i, v t x i β’ spaceD i w x) + fderiv β (u t) x (w x) at ha | |
| have hl : (β i, spaceD i (spaceD i w) x) = laplace v t x - laplace u t x := by | |
| simp only [w, spaceD_sub_twice hvβ huβ, Finset.sum_sub_distrib] | |
| rfl | |
| have hg : (β i, spaceD i r x β’ basis i) = gradient q t x - gradient p t x := by | |
| simp only [r, spaceD_sub hq' hp', sub_smul, Finset.sum_sub_distrib] | |
| rfl | |
| rw [hl, hg, smul_sub] | |
| have hvns := hnsv.1 t ht x | |
| have huns := hnsu.1 t ht x | |
| linear_combination (norm := module) hvns - huns - ha | |
| change (β« x, βͺw x, -(β i, spaceD i r x β’ basis i) + | |
| Ξ½ β’ (β i, spaceD i (spaceD i w) x) - (β i, v t x i β’ spaceD i w x) - | |
| fderiv β (u t) x (w x)β«_β) β€ C * β« x, βw xβ ^ 2 at hbound | |
| simpa only [β heq] using hbound | |
| lemma energy_zero {E : Type} [NormedAddCommGroup E] [InnerProductSpace β E] | |
| {v v' : β β E} {T C : β} (hT : 0 β€ T) | |
| (hv : ContinuousOn v (Icc 0 T)) | |
| (hd : β t β Icc 0 T, HasDerivWithinAt v (v' t) (Icc 0 T) t) | |
| (h0 : v 0 = 0) | |
| (hb : β t β Icc 0 T, βͺv t, v' tβ«_β β€ C * βv tβ ^ 2) : | |
| β t β Icc 0 T, v t = 0 := by | |
| let e : β β β := fun s => Real.exp (-2 * C * s) * βv sβ ^ 2 | |
| let e' : β β β := fun s => Real.exp (-2 * C * s) * | |
| (2 * βͺv s, v' sβ«_β - 2 * C * βv sβ ^ 2) | |
| have he : ContinuousOn e (Icc 0 T) := | |
| ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn).mul (hv.norm.pow 2) | |
| have he' (s : β) (hs : s β Icc 0 T) : HasDerivWithinAt e (e' s) (Icc 0 T) s := by | |
| have h := (((hasDerivAt_id s).const_mul (-2 * C)).exp.hasDerivWithinAt).mul (hd s hs).norm_sq | |
| convert h using 1 <;> first | rfl | (dsimp only [e, e', id_eq]; ring) | |
| have hn (s : β) (hs : s β Icc 0 T) : e' s β€ 0 := by | |
| apply mul_nonpos_of_nonneg_of_nonpos (Real.exp_nonneg _) | |
| have := hb s hs | |
| linarith | |
| have hanti : AntitoneOn e (Icc 0 T) := | |
| antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc 0 T) he | |
| (fun s hs => (he' s (interior_subset hs)).mono interior_subset) | |
| (fun s hs => hn s (interior_subset hs)) | |
| intro t ht | |
| have h := hanti (left_mem_Icc.mpr hT) ht ht.1 | |
| have hle : Real.exp (-2 * C * t) * βv tβ ^ 2 β€ 0 := by simpa [e, h0] using h | |
| have hz : βv tβ ^ 2 = 0 := le_antisymm (nonpos_of_mul_nonpos_right hle (Real.exp_pos _)) | |
| (sq_nonneg _) | |
| exact norm_eq_zero.mp (eq_zero_of_pow_eq_zero hz) | |
| theorem energy_velocity_unique {Ξ½ : β} (hΞ½ : 0 β€ Ξ½) | |
| {f u v : Field Space} {p q : Field β} | |
| (hu : Classical u p) (hv : Classical v q) | |
| (heu : EnergyClass u p) (hev : EnergyCompetitor v q) | |
| (hnsu : NavierStokes Ξ½ f u p) (hnsv : NavierStokes Ξ½ f v q) : | |
| β t : β, 0 β€ t β v t = u t := by | |
| intro t ht | |
| obtain β¨U, U', hU, hU', huCoe, hu'Coe, hdUβ© := (heu.1 t ht).2.1 | |
| obtain β¨V, V', hV, hV', hvCoe, hv'Coe, hdVβ© := (hev.1 t ht).2.1 | |
| obtain β¨C, hCβ© := heu.2 t ht | |
| obtain β¨B, hBβ© := hev.2 t ht | |
| let W := fun s => V s - U s | |
| let W' := fun s => V' s - U' s | |
| have hCoe (s : β) (hs : s β Icc 0 t) : | |
| ((W s) : Space β Space) =α΅[volume] (fun x => v s x - u s x) := by | |
| filter_upwards [Lp.coeFn_sub (V s) (U s), hvCoe s hs, huCoe s hs] with x hw hv hu | |
| change (V s - U s) x = _ | |
| rw [hw, Pi.sub_apply, hv, hu] | |
| have h'Coe (s : β) (hs : s β Icc 0 t) : | |
| ((W' s) : Space β Space) =α΅[volume] (fun x => timeD v s x - timeD u s x) := by | |
| filter_upwards [Lp.coeFn_sub (V' s) (U' s), hv'Coe s hs, hu'Coe s hs] with x hw hv hu | |
| change (V' s - U' s) x = _ | |
| rw [hw, Pi.sub_apply, hv, hu] | |
| have h0 : W 0 = 0 := by | |
| apply Lp.ext | |
| filter_upwards [hCoe 0 (left_mem_Icc.mpr ht), Lp.coeFn_zero (E := Space) (p := 2) | |
| (ΞΌ := (volume : Measure Space))] with x hw hz | |
| rw [hw, hnsv.2.2 x, hnsu.2.2 x, sub_self, hz] | |
| rfl | |
| have henergy (s : β) (hs : s β Icc 0 t) : βͺW s, W' sβ«_β β€ C * βW sβ ^ 2 := by | |
| have hi : βͺW s, W' sβ«_β = β« x, βͺv s x - u s x, timeD v s x - timeD u s xβ«_β := by | |
| rw [L2.inner_def] | |
| apply integral_congr_ae | |
| filter_upwards [hCoe s hs, h'Coe s hs] with x hw hw' | |
| rw [hw, hw'] | |
| have hn : βW sβ ^ 2 = β« x, βv s x - u s xβ ^ 2 := by | |
| rw [β real_inner_self_eq_norm_sq, L2.inner_def] | |
| apply integral_congr_ae | |
| filter_upwards [hCoe s hs] with x hx | |
| rw [hx, real_inner_self_eq_norm_sq] | |
| rw [hi, hn] | |
| apply navierStokes_difference_energy hΞ½ hu hv heu.1 hev.1 hnsu hnsv hs.1 | |
| Β· intro x | |
| exact (le_add_of_nonneg_left (norm_nonneg (u s x))).trans (hC s hs x) | |
| Β· exact hB s hs | |
| Β· intro x | |
| exact (le_add_of_nonneg_right (norm_nonneg (fderiv β (u s) x))).trans (hC s hs x) | |
| have heq : W t = 0 := energy_zero ht (hV.sub hU) | |
| (fun s hs => (hdV s hs).sub (hdU s hs)) h0 henergy t (right_mem_Icc.mpr ht) | |
| apply ((hv.1 t ht).1.continuous.ae_eq_iff_eq volume (hu.1 t ht).1.continuous).mp | |
| have h := hCoe t (right_mem_Icc.mpr ht) | |
| rw [heq] at h | |
| filter_upwards [h, Lp.coeFn_zero (E := Space) (p := 2) (ΞΌ := (volume : Measure Space))] | |
| with x hx hz | |
| rw [hz] at hx | |
| exact sub_eq_zero.mp hx.symm | |
| lemma volume_space_univ : volume (univ : Set Space) = β := by | |
| have h := (PiLp.volume_preserving_ofLp (Fin 3)).measure_preimage MeasurableSet.univ | |
| change volume (univ : Set Space) = volume (univ : Set (Fin 3 β β)) at h | |
| rw [h, β pi_univ (univ : Set (Fin 3)), volume_pi_pi] | |
| simp | |
| lemma gradient_apply (p : Field β) (t : β) (x : Space) (i : Fin 3) : | |
| gradient p t x i = spatialD i p t x := by | |
| simp [gradient, basis, Pi.single_apply, apply_ite] | |
| theorem energy_pressure_unique {Ξ½ : β} {f u v : Field Space} {p q : Field β} | |
| (hu : Classical u p) (hv : Classical v q) | |
| (heu : EnergyRegularity u p) (hev : EnergyRegularity v q) | |
| (hnsu : NavierStokes Ξ½ f u p) (hnsv : NavierStokes Ξ½ f v q) | |
| (heq : β t : β, 0 β€ t β v t = u t) : | |
| β t : β, 0 β€ t β β x : Space, q t x = p t x := by | |
| intro t ht | |
| have htime (x : Space) : timeD v t x = timeD u t x := by | |
| apply derivWithin_congr (fun s hs => congrFun (heq s hs) x) (congrFun (heq t ht) x) | |
| have hgrad (x : Space) : gradient q t x = gradient p t x := by | |
| have h := hnsv.1 t ht x | |
| have h' := hnsu.1 t ht x | |
| have ha : advection v t x = advection u t x := by | |
| simp only [advection, spatialD, heq t ht] | |
| have hl : laplace v t x = laplace u t x := by | |
| unfold laplace spatialD | |
| rw [heq t ht] | |
| rw [htime, ha, hl] at h | |
| linear_combination (norm := module) h - h' | |
| let r : Space β β := fun x => q t x - p t x | |
| have hp := (hu.1 t ht).2.differentiable (by norm_num) | |
| have hq := (hv.1 t ht).2.differentiable (by norm_num) | |
| have hdr (x : Space) : fderiv β r x = 0 := by | |
| ext z | |
| have hd (i : Fin 3) : fderiv β r x (basis i) = 0 := by | |
| have h := congrArg (fun z : Space => z i) (hgrad x) | |
| rw [gradient_apply, gradient_apply] at h | |
| simpa [r, fderiv_fun_sub (hq x) (hp x), spatialD] using sub_eq_zero.mpr h | |
| calc | |
| (fderiv β r x) z = (fderiv β r x) (β i, z i β’ basis i) := by rw [sum_basis] | |
| _ = 0 := by simp [map_sum, hd] | |
| have hconst : r = fun _ => r 0 := funext fun x => | |
| is_const_of_fderiv_eq_zero (hq.sub hp) hdr x 0 | |
| have hr : MemLp r 2 volume := (hev.memLp_pressure ht).sub (heu.memLp_pressure ht) | |
| rw [hconst] at hr | |
| have hz := (memLp_const_iff (by norm_num : (2 : ββ₯0β) β 0) (by simp)).mp hr | |
| have hz : r 0 = 0 := hz.resolve_right (by simp) | |
| intro x | |
| exact sub_eq_zero.mp ((congrFun hconst x).trans hz) | |
| theorem energy_solution_unique {Ξ½ : β} (hΞ½ : 0 β€ Ξ½) | |
| {f u : Field Space} {p : Field β} (hu : Classical u p) | |
| (heu : EnergyClass u p) (hnsu : NavierStokes Ξ½ f u p) : | |
| UniqueEnergySolution Ξ½ f u p := by | |
| refine β¨hu, heu, hnsu, ?_β© | |
| intro v q hv hev hnsv | |
| have heq := energy_velocity_unique hΞ½ hu hv heu hev hnsu hnsv | |
| have hp := energy_pressure_unique hu hv heu.1 hev.1 hnsu hnsv heq | |
| exact fun t ht x => β¨congrFun (heq t ht) x, hp t ht xβ© | |
| theorem addressed_uniqueEnergySolution {Ξ½ : β} (hΞ½ : 0 β€ Ξ½) (M : Machine) (w : M.Input) : | |
| UniqueEnergySolution Ξ½ (addressedForce Ξ½ M w) (addressedVelocity M w) (fun _ _ => 0) := by | |
| exact energy_solution_unique hΞ½ (addressed_classical_solution Ξ½ M w).2.2.2.2.1 | |
| (addressed_energyClass M w) (addressed_pointwise_equations Ξ½ M w) | |
| end RapidForcing | |
| end | |
| end OAI | |