Download data/lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/CompactTails.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 11 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/CompactTails.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/CompactTails.lean
-
curl -L -o CompactTails.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/CompactTails.lean
11 kB
| import OAI.MathematicalPhysics.NavierStokes.VelocityDetection.TailDifferentiability | |
| import OAI.MathematicalPhysics.NavierStokes.VelocityDetection.TailCompleteness | |
| namespace OAI | |
| noncomputable section | |
| namespace VelocityDetection.TailSpace | |
| open scoped BigOperators Topology ContDiff | |
| open Set Function Filter | |
| open Set Function Filter MeasureTheory | |
| open scoped Topology BigOperators ContDiff | |
| open scoped Topology ContDiff BigOperators | |
| open scoped Topology ContDiff ZeroAtInfty | |
| def ofCompact {n : β} (f : Coord n β β) | |
| (hf : Continuous f) (hc : HasCompactSupport f) : compatible n := | |
| β¨(β¨β¨f, hfβ©, hc.is_zero_at_inftyβ©, | |
| (memLp_one_iff_integrable.mpr (hf.integrable_of_hasCompactSupport hc)).toLp f), | |
| (memLp_one_iff_integrable.mpr (hf.integrable_of_hasCompactSupport hc)).coeFn_toLpβ© | |
| @[simp] theorem ofCompact_apply {n : β} (f : Coord n β β) | |
| (hf : Continuous f) (hc : HasCompactSupport f) (X : Coord n) : | |
| (ofCompact f hf hc).val.1 X = f X := rfl | |
| theorem ext_fun {n : β} {v w : compatible n} | |
| (h : β X, v.val.1 X = w.val.1 X) : v = w := by | |
| apply Subtype.ext | |
| apply Prod.ext | |
| Β· exact ZeroAtInftyContinuousMap.ext h | |
| Β· apply Lp.ext | |
| filter_upwards [v.property, w.property] with X hv hw | |
| exact hv.trans ((h X).trans hw.symm) | |
| theorem norm_le_of_support {n : β} (v : compatible n) {K : Set (Coord n)} | |
| (hK : IsCompact K) {B : β} (hB : 0 β€ B) | |
| (hs : β X β K, v.val.1 X = 0) | |
| (hb : β X, βv.val.1 Xβ β€ B) : | |
| βvβ β€ (1 + volume.real K) * B := by | |
| have hβ : βv.val.1β β€ B := by | |
| rw [β ZeroAtInftyContinuousMap.norm_toBCF_eq_norm] | |
| exact (BoundedContinuousFunction.norm_le hB).mpr hb | |
| have hi : Integrable (K.indicator (fun _ : Coord n => B)) volume := by | |
| exact (integrableOn_const (C := B) hK.measure_lt_top.ne).integrable_indicator hK.measurableSet | |
| have hβ : βv.val.2β β€ volume.real K * B := by | |
| rw [L1.norm_eq_integral_norm] | |
| have hv : (fun X => v.val.2 X) =α΅[volume] (fun X => v.val.1 X) := v.property | |
| calc | |
| (β« X, βv.val.2 Xβ) = β« X, βv.val.1 Xβ := integral_congr_ae (hv.fun_comp norm) | |
| _ β€ β« X, K.indicator (fun _ : Coord n => B) X := by | |
| apply integral_mono_of_nonneg (Filter.Eventually.of_forall (fun _ => norm_nonneg _)) hi | |
| filter_upwards [] with X | |
| by_cases hX : X β K | |
| Β· simpa only [Set.indicator_of_mem hX] using hb X | |
| Β· simp [hX, hs X hX] | |
| _ = volume.real K * B := by | |
| rw [integral_indicator hK.measurableSet, setIntegral_const] | |
| rfl | |
| change max βv.val.1β βv.val.2β β€ _ | |
| refine max_le ?_ ?_ | |
| Β· nlinarith [measureReal_nonneg (ΞΌ := (volume : Measure (Coord n))) (s := K)] | |
| Β· nlinarith [measureReal_nonneg (ΞΌ := (volume : Measure (Coord n))) (s := K)] | |
| def LocalHorizontalSupport (f : ScalarField 2) : Prop := | |
| β T : β, 0 β€ T β β K : Set (Coord 2), IsCompact K β§ | |
| β t, |t| β€ T β β X β K, f t X = 0 | |
| theorem LocalHorizontalSupport.slice {f : ScalarField 2} | |
| (hf : LocalHorizontalSupport f) (t : β) : HasCompactSupport (f t) := by | |
| obtain β¨K, hK, hzeroβ© := hf |t| (abs_nonneg _) | |
| apply HasCompactSupport.of_support_subset_isCompact hK | |
| intro X hX | |
| by_contra hnot | |
| exact hX (hzero t le_rfl X hnot) | |
| theorem continuous_intersection_of_support (F : β β compatible 2) | |
| (hf : Continuous (fun q : β Γ Coord 2 => (F q.1).val.1 q.2)) | |
| (hs : LocalHorizontalSupport (fun t X => (F t).val.1 X)) : Continuous F := by | |
| rw [continuous_iff_continuousAt] | |
| intro t | |
| obtain β¨K, hK, hzeroβ© := hs (|t| + 1) (by positivity) | |
| change β r, |r| β€ |t| + 1 β β X β K, (F r).val.1 X = 0 at hzero | |
| let : CompactSpace K := isCompact_iff_compactSpace.mp hK | |
| let G : C(β, C(K, β)) := ContinuousMap.curry β¨fun q : β Γ K => (F q.1).val.1 q.2.val, | |
| hf.comp (continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd))β© | |
| have hG : Continuous G := G.continuous | |
| have hT : βαΆ s in π t, |s| β€ |t| + 1 := by | |
| filter_upwards [(continuous_abs.tendsto t).eventually (gt_mem_nhds (by linarith : |t| < |t| + 1))] with s hs | |
| exact hs.le | |
| change Tendsto F (π t) (π (F t)) | |
| rw [Metric.tendsto_nhds] | |
| intro Ξ΅ hΞ΅ | |
| have hV : 0 β€ volume.real K := measureReal_nonneg | |
| have hC : 0 < 1 + volume.real K := by linarith | |
| have hΞ΅' : 0 < Ξ΅ / (2 * (1 + volume.real K)) := div_pos hΞ΅ (by positivity) | |
| have H := (Metric.tendsto_nhds.mp (hG.tendsto t)) _ hΞ΅' | |
| filter_upwards [H, hT] with s hdist hst | |
| rw [dist_eq_norm] at hdist | |
| change dist (F s).val (F t).val < Ξ΅ | |
| rw [dist_eq_norm] | |
| change βF s - F tβ < Ξ΅ | |
| have hbound (X : Coord 2) : β(F s - F t).val.1 Xβ β€ Ξ΅ / (2 * (1 + volume.real K)) := by | |
| by_cases hX : X β K | |
| Β· calc | |
| β(F s - F t).val.1 Xβ = β(G s - G t) β¨X, hXβ©β := rfl | |
| _ β€ βG s - G tβ := ContinuousMap.norm_coe_le_norm _ _ | |
| _ β€ _ := hdist.le | |
| Β· change β(F s).val.1 X - (F t).val.1 Xβ β€ _ | |
| rw [hzero s hst X hX, hzero t (by linarith [le_abs_self t] : |t| β€ |t| + 1) X hX] | |
| simpa using hΞ΅'.le | |
| have hz (X : Coord 2) (hX : X β K) : (F s - F t).val.1 X = 0 := by | |
| change (F s).val.1 X - (F t).val.1 X = 0 | |
| rw [hzero s hst X hX, hzero t (by linarith : |t| β€ |t| + 1) X hX, sub_self] | |
| have hh := norm_le_of_support (F s - F t) hK hΞ΅'.le hz hbound | |
| have heq : (1 + volume.real K) * (Ξ΅ / (2 * (1 + volume.real K))) = Ξ΅ / 2 := by | |
| field_simp [hC.ne'] | |
| exact hh.trans_lt (by rw [heq]; linarith) | |
| theorem continuous_ofCompact_curve {f : ScalarField 2} | |
| (hf : Continuous (uncurry f)) (hs : LocalHorizontalSupport f) : | |
| Continuous (fun t => ofCompact (f t) | |
| (hf.comp (continuous_const.prodMk continuous_id)) (hs.slice t)) := by | |
| apply continuous_intersection_of_support | |
| Β· exact hf | |
| Β· exact hs | |
| theorem LocalHorizontalSupport.dAlong {f : ScalarField 2} | |
| (hf : LocalHorizontalSupport f) (v : β Γ Coord 2) : | |
| LocalHorizontalSupport (fun t X => JointCalculus.dAlong v (uncurry f) (t, X)) := by | |
| intro T hT | |
| obtain β¨K, hK, hzeroβ© := hf (T + 1) (by linarith) | |
| refine β¨K, hK, ?_β© | |
| intro t ht X hX | |
| have ht' : βαΆ q : β Γ Coord 2 in π (t, X), |q.1| < T + 1 := | |
| (isOpen_lt (continuous_abs.comp continuous_fst) continuous_const).mem_nhds (by | |
| change |t| < T + 1 | |
| linarith) | |
| have hX' : βαΆ q : β Γ Coord 2 in π (t, X), q.2 β K := | |
| (hK.isClosed.isOpen_compl.preimage continuous_snd).mem_nhds hX | |
| have heq : uncurry f =αΆ [π (t, X)] (fun _ => (0 : β)) := by | |
| filter_upwards [ht', hX'] with q hq hqK | |
| exact hzero q.1 hq.le q.2 hqK | |
| have hd := (JointCalculus.eventuallyEq_dAlong v heq).eq_of_nhds | |
| simpa only [JointCalculus.dAlong, fderiv_const_apply, zero_apply] using hd | |
| theorem LocalHorizontalSupport.spatialD {f : ScalarField 2} | |
| (hs : LocalHorizontalSupport f) (hf : ContDiff β β (uncurry f)) (i : Fin 2) : | |
| LocalHorizontalSupport (spatialD i f) := by | |
| have heq : VelocityDetection.spatialD i f = fun t X => JointCalculus.dAlong (0, Pi.single i 1) (uncurry f) (t, X) := | |
| funext fun t => funext fun X => JointCalculus.spatialD_eq hf i t X | |
| rw [heq] | |
| exact hs.dAlong _ | |
| theorem hasDerivAt_intersection {F dF : β β compatible 2} | |
| (hdF : Continuous dF) | |
| (hder : β t X, HasDerivAt (fun s => (F s).val.1 X) ((dF t).val.1 X) t) (t : β) : | |
| HasDerivAt F (dF t) t := by | |
| have heq (s : β) : F s = F 0 + β« r in (0 : β)..s, dF r := by | |
| apply ext_fun | |
| intro X | |
| change (F s).val.1 X = eval X (F 0 + β« r in (0 : β)..s, dF r) | |
| rw [map_add] | |
| have hint : (β« r in (0 : β)..s, eval X (dF r)) = eval X (β« r in (0 : β)..s, dF r) := | |
| ContinuousLinearMap.intervalIntegral_comp_comm (π := β) (ΞΌ := volume) (E := compatible 2) (F := β) | |
| (eval X) (Continuous.intervalIntegrable (E := compatible 2) hdF 0 s) | |
| rw [β hint] | |
| have hc : Continuous (fun r => (dF r).val.1 X) := (eval X).continuous.comp hdF | |
| have hh := intervalIntegral.integral_eq_sub_of_hasDerivAt | |
| (fun r (_ : r β uIcc (0 : β) s) => hder r X) (hc.intervalIntegrable 0 s) | |
| simp only [eval_apply] | |
| rw [hh] | |
| ring | |
| have hm : StronglyMeasurable dF := Continuous.stronglyMeasurable hdF | |
| have H := HasDerivAt.const_add (F := compatible 2) (F 0) | |
| (intervalIntegral.integral_hasDerivAt_right (E := compatible 2) | |
| (Continuous.intervalIntegrable (E := compatible 2) hdF 0 t) | |
| hm.stronglyMeasurableAtFilter hdF.continuousAt) | |
| exact HasDerivAt.congr_of_eventuallyEq (F := compatible 2) H (Filter.Eventually.of_forall heq) | |
| theorem c1Tails_of_smooth_support {f : ScalarField 2} | |
| (hf : ContDiff β β (uncurry f)) (hs : LocalHorizontalSupport f) : C1Tails f := by | |
| let g : ScalarField 2 := fun t X => JointCalculus.dAlong (1, 0) (uncurry f) (t, X) | |
| have hg : ContDiff β β (uncurry g) := JointCalculus.contDiff_dAlong _ hf | |
| have hgs : LocalHorizontalSupport g := hs.dAlong _ | |
| let F : β β compatible 2 := fun t => ofCompact (f t) | |
| (hf.continuous.comp (continuous_const.prodMk continuous_id)) (hs.slice t) | |
| let dF : β β compatible 2 := fun t => ofCompact (g t) | |
| (hg.continuous.comp (continuous_const.prodMk continuous_id)) (hgs.slice t) | |
| have hdF : Continuous dF := continuous_ofCompact_curve hg.continuous hgs | |
| refine β¨F, dF, (continuous_ofCompact_curve hf.continuous hs).continuousOn, | |
| hdF.continuousOn, fun _ _ => rfl, ?_β© | |
| intro t ht | |
| apply HasDerivAt.hasDerivWithinAt (π := β) (F := compatible 2) (hasDerivAt_intersection hdF ?_ t) | |
| intro s X | |
| change HasDerivAt (fun r => f r X) (JointCalculus.dAlong (1, 0) (uncurry f) (s, X)) s | |
| simpa only [comp_def, JointCalculus.dAlong, uncurry_apply_pair, id_eq] using | |
| ((hf.differentiable (by simp) (s, X)).hasFDerivAt.comp_hasDerivAt s | |
| ((hasDerivAt_id s).prodMk (hasDerivAt_const s X))) | |
| theorem spatial_c1Tails_of_smooth_support {f : ScalarField 2} | |
| (hf : ContDiff β β (uncurry f)) (hs : LocalHorizontalSupport f) (i : Fin 2) : | |
| C1Tails (spatialD i f) := by | |
| have hdiff : ContDiff β β (uncurry (spatialD i f)) := by | |
| have heq : uncurry (spatialD i f) = JointCalculus.dAlong (0, Pi.single i 1) (uncurry f) := | |
| funext fun q => JointCalculus.spatialD_eq hf i q.1 q.2 | |
| rw [heq] | |
| exact JointCalculus.contDiff_dAlong _ hf | |
| exact c1Tails_of_smooth_support hdiff (hs.spatialD hf i) | |
| theorem second_continuousTails_of_smooth_support {f : ScalarField 2} | |
| (hf : ContDiff β β (uncurry f)) (hs : LocalHorizontalSupport f) (i k : Fin 2) : | |
| ContinuousTails (spatialD k (spatialD i f)) := by | |
| have hdiff : ContDiff β β (uncurry (spatialD i f)) := by | |
| have heq : uncurry (spatialD i f) = JointCalculus.dAlong (0, Pi.single i 1) (uncurry f) := | |
| funext fun q => JointCalculus.spatialD_eq hf i q.1 q.2 | |
| rw [heq] | |
| exact JointCalculus.contDiff_dAlong _ hf | |
| exact (spatial_c1Tails_of_smooth_support hdiff (hs.spatialD hf i) k).continuous | |
| end VelocityDetection.TailSpace | |
| end | |
| end OAI | |