math / data /lean /OAI /Probability /LogConcave /Numerics /ParametricFDeriv.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.07 kB
import Mathlib
namespace OAI
section
section
noncomputable section
namespace LogConcaveSampling.CompactIntegral
open Set Function Filter MeasureTheory Metric
open scoped Topology
variable {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E]
[FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F]
omit [CompleteSpace F] in
lemma parametric_hasFDerivAt {f : E Γ— ℝ β†’ F} (hf : ContDiff ℝ 1 f)
{s : Set ℝ} (hs : IsCompact s) (x : E) :
HasFDerivAt (fun x => ∫t in s,f (x,t))
(∫t in s,(fderiv ℝ f (x,t)).comp (ContinuousLinearMap.inl ℝ E ℝ)) x := by
let D := fun p : E Γ— ℝ => (fderiv ℝ f p).comp (ContinuousLinearMap.inl ℝ E ℝ)
have hD : Continuous D := (hf.continuous_fderiv (by norm_num)).clm_comp continuous_const
obtain ⟨C,hC⟩ := ((isCompact_closedBall x 1).prod hs).exists_bound_of_continuousOn hD.continuousOn
apply hasFDerivAt_integral_of_dominated_of_fderiv_le
(F':=fun y t => D (y,t)) (bound:=fun _ => C) (ball_mem_nhds x zero_lt_one)
Β· exact Eventually.of_forall fun y => (hf.continuous.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable
Β· exact (hf.continuous.comp (continuous_const.prodMk continuous_id)).continuousOn.integrableOn_compact hs
Β· exact (hD.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable
Β· filter_upwards [ae_restrict_mem hs.measurableSet] with t ht y hy
exact hC (y,t) ⟨ball_subset_closedBall hy,ht⟩
Β· exact integrableOn_const hs.measure_ne_top
Β· filter_upwards [] with t y _hy
exact ((hf.differentiable (by norm_num) (y,t)).hasFDerivAt).comp y
((hasFDerivAt_id (π•œ:=ℝ) y).prodMk (hasFDerivAt_const (π•œ:=ℝ) t y))
theorem contDiff_parametric {f : E Γ— ℝ β†’ F} (n : β„•)
(hf : ContDiff ℝ (n:WithTop β„•βˆž) f) {s : Set ℝ} (hs : IsCompact s) :
ContDiff ℝ (n:WithTop β„•βˆž) (fun x => ∫t in s,f (x,t)) := by
induction n generalizing F with
| zero => exact contDiff_zero.mpr (continuous_parametric_integral_of_continuous (f:=fun x t => f (x,t)) hf.continuous hs)
| succ n ih =>
let D := fun p : E Γ— ℝ => (fderiv ℝ f p).comp (ContinuousLinearMap.inl ℝ E ℝ)
have hD : ContDiff ℝ (n:WithTop β„•βˆž) D := (hf.fderiv_right (by simp)).clm_comp contDiff_const
have hd (x : E) := parametric_hasFDerivAt (hf.of_le (by exact_mod_cast Nat.succ_pos n)) hs x
rw [show ((n+1:β„•):WithTop β„•βˆž)=(n:WithTop β„•βˆž)+1 by simp,contDiff_succ_iff_fderiv]
refine ⟨fun x => (hd x).differentiableAt,?_⟩
refine ⟨by simp,?_⟩
have he : fderiv ℝ (fun x => ∫t in s,f (x,t))=fun x => ∫t in s,D (x,t) := funext fun x => (hd x).fderiv
rw [he]
exact ih hD
theorem smooth_parametric {f : E Γ— ℝ β†’ F} (hf : ContDiff ℝ (⊀:β„•βˆž) f)
{s : Set ℝ} (hs : IsCompact s) :
ContDiff ℝ (⊀:β„•βˆž) (fun x => ∫t in s,f (x,t)) := by
apply contDiff_infty.mpr
intro n
exact contDiff_parametric n (hf.of_le (WithTop.coe_le_coe.mpr le_top)) hs
end LogConcaveSampling.CompactIntegral
end
end
end
end OAI