math / data /lean /OAI /Probability /FreeIsing /Posterior /LipschitzObservationDerivative.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
13.2 kB
import OAI.Probability.FreeIsing.Posterior.GaussianTimeDerivative
namespace OAI
noncomputable section
open MeasureTheory Filter Set
open scoped Topology BigOperators NNReal
namespace Problem367
theorem hasDerivAt_integral_sqrt_observation_of_integrable
{Ξ© : Type*} [MeasurableSpace Ξ©] {P : Measure Ξ©} [IsFiniteMeasure P]
{S G : Ξ© β†’ ℝ} (hS : Integrable S P) (hG : Integrable G P)
{f f' : ℝ β†’ ℝ} (hf : βˆ€ x, HasDerivAt f (f' x) x) (hf'm : Measurable f')
{M : ℝ} (hM : 0 ≀ M)
(hf'bound : βˆ€ x, |f' x| ≀ M) {t : ℝ} (ht : 0 < t)
(hFint : Integrable (fun Ο‰ => f (t * S Ο‰ + Real.sqrt t * G Ο‰)) P) :
Integrable (fun Ο‰ => f' (t * S Ο‰ + Real.sqrt t * G Ο‰) *
(S Ο‰ + G Ο‰ / (2 * Real.sqrt t))) P ∧
HasDerivAt (fun r : ℝ => ∫ Ο‰, f (r * S Ο‰ + Real.sqrt r * G Ο‰) βˆ‚P)
(∫ Ο‰, f' (t * S Ο‰ + Real.sqrt t * G Ο‰) *
(S Ο‰ + G Ο‰ / (2 * Real.sqrt t)) βˆ‚P) t := by
have hfcont : Continuous f := continuous_iff_continuousAt.mpr
(fun x => (hf x).continuousAt)
let F : ℝ β†’ Ξ© β†’ ℝ := fun r Ο‰ => f (r * S Ο‰ + Real.sqrt r * G Ο‰)
let F' : ℝ β†’ Ξ© β†’ ℝ := fun r Ο‰ => f' (r * S Ο‰ + Real.sqrt r * G Ο‰) *
(S Ο‰ + G Ο‰ / (2 * Real.sqrt r))
let a : ℝ := 1 / (2 * Real.sqrt (t / 2))
have ha : 0 ≀ a := by dsimp [a]; positivity
have hFm (r : ℝ) : AEStronglyMeasurable (F r) P :=
hfcont.comp_aestronglyMeasurable
((hS.aestronglyMeasurable.const_mul r).add
(hG.aestronglyMeasurable.const_mul (Real.sqrt r)))
have hF'm (r : ℝ) : AEStronglyMeasurable (F' r) P := by
apply AEStronglyMeasurable.mul
Β· exact (hf'm.comp_aemeasurable
((hS.aemeasurable.const_mul r).add
(hG.aemeasurable.const_mul (Real.sqrt r)))).aestronglyMeasurable
Β· simpa only [div_eq_mul_inv, Pi.add_def] using hS.aestronglyMeasurable.add
(hG.aestronglyMeasurable.mul_const (2 * Real.sqrt r)⁻¹)
have hdom : Integrable (fun Ο‰ => M * (|S Ο‰| + a * |G Ο‰|)) P :=
(hS.abs.add (hG.abs.const_mul a)).const_mul M
have hbound : βˆ€α΅ Ο‰ βˆ‚P, βˆ€ r ∈ Ioi (t / 2),
β€–F' r Ο‰β€– ≀ M * (|S Ο‰| + a * |G Ο‰|) := by
filter_upwards [] with Ο‰
intro r hr
have hrpos : 0 < r := lt_trans (by linarith) hr
have hden : 0 < 2 * Real.sqrt (t / 2) := by positivity
have hrecip : 1 / (2 * Real.sqrt r) ≀ a := by
apply one_div_le_one_div_of_le hden
exact mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt hr.le) (by norm_num)
have hinner : |S Ο‰ + G Ο‰ / (2 * Real.sqrt r)| ≀ |S Ο‰| + a * |G Ο‰| := by
calc
_ ≀ |S Ο‰| + |G Ο‰ / (2 * Real.sqrt r)| := abs_add_le _ _
_ = |S Ο‰| + (1 / (2 * Real.sqrt r)) * |G Ο‰| := by
rw [abs_div, abs_of_nonneg (by positivity : 0 ≀ 2 * Real.sqrt r)]
ring
_ ≀ |S Ο‰| + a * |G Ο‰| := by gcongr
dsimp [F']
rw [abs_mul]
exact mul_le_mul (hf'bound _) hinner (abs_nonneg _) hM
have hdiff : βˆ€α΅ Ο‰ βˆ‚P, βˆ€ r ∈ Ioi (t / 2), HasDerivAt (fun q => F q Ο‰) (F' r Ο‰) r := by
filter_upwards [] with Ο‰
intro r hr
have hrpos : 0 < r := lt_trans (by linarith) hr
have harg := ((hasDerivAt_id r).mul_const (S Ο‰)).add
((Real.hasDerivAt_sqrt hrpos.ne').mul_const (G Ο‰))
have harg' : HasDerivAt (fun q : ℝ => q * S Ο‰ + Real.sqrt q * G Ο‰)
(S Ο‰ + G Ο‰ / (2 * Real.sqrt r)) r := by
simpa only [Pi.add_def, id_eq, one_mul, mul_one, one_div, div_eq_mul_inv, mul_comm] using harg
exact (hf (r * S Ο‰ + Real.sqrt r * G Ο‰)).comp r harg'
exact hasDerivAt_integral_of_dominated_loc_of_deriv_le
(Ioi_mem_nhds (by linarith : t / 2 < t))
(Eventually.of_forall hFm) hFint (hF'm t) hbound hdom hdiff
theorem hasDerivAt_integral_sqrt_observation_vector_of_integrable
{Ξ© E : Type*} [MeasurableSpace Ξ©] [NormedAddCommGroup E] [NormedSpace ℝ E]
{P : Measure Ξ©} [IsFiniteMeasure P]
{S G : Ξ© β†’ E} (hS : Integrable S P) (hG : Integrable G P)
{f : E β†’ ℝ} {f' : E β†’ E β†’L[ℝ] ℝ}
(hf : βˆ€ x, HasFDerivAt f (f' x) x) (hf'cont : Continuous f')
{M : ℝ} (hM : 0 ≀ M)
(hf'bound : βˆ€ x, β€–f' xβ€– ≀ M) {t : ℝ} (ht : 0 < t)
(hFint : Integrable (fun Ο‰ => f (t β€’ S Ο‰ + Real.sqrt t β€’ G Ο‰)) P) :
Integrable (fun Ο‰ => f' (t β€’ S Ο‰ + Real.sqrt t β€’ G Ο‰)
(S Ο‰ + (1 / (2 * Real.sqrt t)) β€’ G Ο‰)) P ∧
HasDerivAt (fun r : ℝ => ∫ Ο‰, f (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰) βˆ‚P)
(∫ Ο‰, f' (t β€’ S Ο‰ + Real.sqrt t β€’ G Ο‰)
(S Ο‰ + (1 / (2 * Real.sqrt t)) β€’ G Ο‰) βˆ‚P) t := by
have hfcont : Continuous f := continuous_iff_continuousAt.mpr
(fun x => (hf x).continuousAt)
let F : ℝ β†’ Ξ© β†’ ℝ := fun r Ο‰ => f (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰)
let F' : ℝ β†’ Ξ© β†’ ℝ := fun r Ο‰ => f' (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰)
(S Ο‰ + (1 / (2 * Real.sqrt r)) β€’ G Ο‰)
let a : ℝ := 1 / (2 * Real.sqrt (t / 2))
have ha : 0 ≀ a := by dsimp [a]; positivity
have hargm (r : ℝ) : AEStronglyMeasurable
(fun Ο‰ => r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰) P :=
(hS.aestronglyMeasurable.const_smul r).add
(hG.aestronglyMeasurable.const_smul (Real.sqrt r))
have hFm (r : ℝ) : AEStronglyMeasurable (F r) P :=
hfcont.comp_aestronglyMeasurable (hargm r)
have hF'm (r : ℝ) : AEStronglyMeasurable (F' r) P :=
(isBoundedBilinearMap_apply (π•œ := ℝ) (E := E) (F := ℝ)).continuous
|>.comp_aestronglyMeasurable
((hf'cont.comp_aestronglyMeasurable (hargm r)).prodMk
(hS.aestronglyMeasurable.add
(hG.aestronglyMeasurable.const_smul (1 / (2 * Real.sqrt r)))))
have hdom : Integrable (fun Ο‰ => M * (β€–S Ο‰β€– + a * β€–G Ο‰β€–)) P :=
(hS.norm.add (hG.norm.const_mul a)).const_mul M
have hbound : βˆ€α΅ Ο‰ βˆ‚P, βˆ€ r ∈ Ioi (t / 2),
β€–F' r Ο‰β€– ≀ M * (β€–S Ο‰β€– + a * β€–G Ο‰β€–) := by
filter_upwards [] with Ο‰
intro r hr
have hrpos : 0 < r := lt_trans (by linarith) hr
have hden : 0 < 2 * Real.sqrt (t / 2) := by positivity
have hrecip : 1 / (2 * Real.sqrt r) ≀ a := by
apply one_div_le_one_div_of_le hden
exact mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt hr.le) (by norm_num)
have hinner : β€–S Ο‰ + (1 / (2 * Real.sqrt r)) β€’ G Ο‰β€– ≀
β€–S Ο‰β€– + a * β€–G Ο‰β€– := by
calc
_ ≀ β€–S Ο‰β€– + β€–(1 / (2 * Real.sqrt r)) β€’ G Ο‰β€– := norm_add_le _ _
_ = β€–S Ο‰β€– + (1 / (2 * Real.sqrt r)) * β€–G Ο‰β€– := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (by positivity)]
_ ≀ β€–S Ο‰β€– + a * β€–G Ο‰β€– := by gcongr
exact ((f' (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰)).le_opNorm _).trans
(mul_le_mul (hf'bound _) hinner (norm_nonneg _) hM)
have hdiff : βˆ€α΅ Ο‰ βˆ‚P, βˆ€ r ∈ Ioi (t / 2),
HasDerivAt (fun q => F q Ο‰) (F' r Ο‰) r := by
filter_upwards [] with Ο‰
intro r hr
have hrpos : 0 < r := lt_trans (by linarith) hr
have harg := ((hasDerivAt_id r).smul_const (S Ο‰)).add
((Real.hasDerivAt_sqrt hrpos.ne').smul_const (G Ο‰))
have harg' : HasDerivAt (fun q : ℝ => q β€’ S Ο‰ + Real.sqrt q β€’ G Ο‰)
(S Ο‰ + (1 / (2 * Real.sqrt r)) β€’ G Ο‰) r := by
simpa only [Pi.add_def, id_eq, one_smul, one_div] using harg
exact (hf (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰)).comp_hasDerivAt r harg'
exact hasDerivAt_integral_of_dominated_loc_of_deriv_le
(Ioi_mem_nhds (by linarith : t / 2 < t))
(Eventually.of_forall hFm) hFint (hF'm t) hbound hdom hdiff
theorem continuous_integral_sqrt_observation_lipschitz
{Ξ© E : Type*} [MeasurableSpace Ξ©] [NormedAddCommGroup E] [NormedSpace ℝ E]
{P : Measure Ξ©} [IsFiniteMeasure P] {S G : Ξ© β†’ E}
(hS : Integrable S P) (hG : Integrable G P)
{f : E β†’ ℝ} {K : ℝβ‰₯0} (hf : LipschitzWith K f) :
Continuous (fun t : ℝ => ∫ Ο‰, f (t β€’ S Ο‰ + Real.sqrt t β€’ G Ο‰) βˆ‚P) := by
apply continuous_iff_continuousAt.mpr
intro t
let a : ℝ := |t| + 1
have ha : 0 ≀ a := by dsimp [a]; positivity
have hloc : βˆ€αΆ  r in 𝓝 t, |r| < a :=
continuous_abs.continuousAt.eventually
(gt_mem_nhds (by dsimp [a]; linarith : |t| < a))
apply continuousAt_of_dominated
(bound := fun Ο‰ => β€–f 0β€– + (K : ℝ) *
(a * β€–S Ο‰β€– + Real.sqrt a * β€–G Ο‰β€–))
Β· exact Eventually.of_forall fun r => hf.continuous.comp_aestronglyMeasurable
((hS.aestronglyMeasurable.const_smul r).add
(hG.aestronglyMeasurable.const_smul (Real.sqrt r)))
Β· filter_upwards [hloc] with r hr
exact Eventually.of_forall fun Ο‰ => by
have harg : β€–r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰β€– ≀
a * β€–S Ο‰β€– + Real.sqrt a * β€–G Ο‰β€– := by
calc
_ ≀ β€–r β€’ S Ο‰β€– + β€–Real.sqrt r β€’ G Ο‰β€– := norm_add_le _ _
_ = |r| * β€–S Ο‰β€– + Real.sqrt r * β€–G Ο‰β€– := by
rw [norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs,
abs_of_nonneg (Real.sqrt_nonneg r)]
_ ≀ _ := add_le_add
(mul_le_mul_of_nonneg_right hr.le (norm_nonneg _))
(mul_le_mul_of_nonneg_right
(Real.sqrt_le_sqrt ((le_abs_self r).trans hr.le)) (norm_nonneg _))
calc
_ ≀ β€–f 0β€– + β€–f (r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰) - f 0β€– :=
norm_le_norm_add_norm_sub' _ _
_ ≀ β€–f 0β€– + (K : ℝ) * β€–r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰β€– := by
gcongr
simpa only [sub_zero] using hf.norm_sub_le
(r β€’ S Ο‰ + Real.sqrt r β€’ G Ο‰) 0
_ ≀ _ := add_le_add le_rfl (mul_le_mul_of_nonneg_left harg K.coe_nonneg)
Β· exact (integrable_const β€–f 0β€–).add
(((hS.norm.const_mul a).add (hG.norm.const_mul (Real.sqrt a))).const_mul (K : ℝ))
Β· exact Eventually.of_forall fun Ο‰ => (hf.continuous.comp
((continuous_id.smul continuous_const).add
(Real.continuous_sqrt.smul continuous_const))).continuousAt
theorem tendsto_integral_sqrt_observation_zero_lipschitz
{Ξ© E : Type*} [MeasurableSpace Ξ©] [NormedAddCommGroup E] [NormedSpace ℝ E]
{P : Measure Ξ©} [IsFiniteMeasure P] {S G : Ξ© β†’ E}
(hS : Integrable S P) (hG : Integrable G P)
{f : E β†’ ℝ} {K : ℝβ‰₯0} (hf : LipschitzWith K f) :
Tendsto (fun t : ℝ => ∫ Ο‰, f (t β€’ S Ο‰ + Real.sqrt t β€’ G Ο‰) βˆ‚P)
(𝓝 0) (𝓝 (P.real Set.univ * f 0)) := by
simpa only [zero_smul, Real.sqrt_zero, zero_add, integral_const, smul_eq_mul] using
(continuous_integral_sqrt_observation_lipschitz hS hG hf).tendsto 0
namespace FinitePosterior
variable {V Ξ© : Type*} [Fintype V] [MeasurableSpace Ξ©]
theorem hasDerivAt_integral_gaussianObservationCurve_of_integrable
(ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ]
(f : (V β†’ ℝ) β†’ ℝ) (g : (V β†’ ℝ) β†’ V β†’ ℝ)
(hdf : βˆ€ x, HasFDerivAt f (βˆ‘ v, g x v β€’
(ContinuousLinearMap.proj v : (V β†’ ℝ) β†’L[ℝ] ℝ)) x)
(hg : βˆ€ v, Continuous (fun x => g x v))
(C : ℝ) (hC : 0 ≀ C) (hgbound : βˆ€ x v, |g x v| ≀ C)
(signal noise : Ξ© β†’ V β†’ ℝ)
(hsignal : Measurable signal) (hnoise : Measurable noise)
(hspin : βˆ€ Ο‰ v, |signal Ο‰ v| ≀ 1)
(hnoiseInt : βˆ€ v, Integrable (fun Ο‰ => noise Ο‰ v) ΞΌ)
{t : ℝ} (ht : 0 < t)
(hFint : Integrable (fun Ο‰ =>
f (gaussianObservationCurve (signal Ο‰) (noise Ο‰) t)) ΞΌ) :
HasDerivAt (fun r => ∫ Ο‰, f (gaussianObservationCurve (signal Ο‰) (noise Ο‰) r) βˆ‚ΞΌ)
(∫ Ο‰, βˆ‘ v, g (gaussianObservationCurve (signal Ο‰) (noise Ο‰) t) v *
gaussianObservationVelocity (signal Ο‰) (noise Ο‰) t v βˆ‚ΞΌ) t := by
let D : (V β†’ ℝ) β†’ (V β†’ ℝ) β†’L[ℝ] ℝ := fun x => βˆ‘ v, g x v β€’
(ContinuousLinearMap.proj v : (V β†’ ℝ) β†’L[ℝ] ℝ)
have hDcont : Continuous D := by
apply continuous_finsetSum
intro v _
exact (hg v).smul continuous_const
have hDbound (x : V β†’ ℝ) : β€–D xβ€– ≀ (Fintype.card V : ℝ) * C := by
apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg (by positivity) hC)
intro y
simp only [D, sum_apply, smul_apply, ContinuousLinearMap.proj_apply, smul_eq_mul]
calc
β€–βˆ‘ v, g x v * y vβ€– ≀ βˆ‘ v, β€–g x v * y vβ€– := norm_sum_le _ _
_ ≀ βˆ‘ v : V, C * β€–yβ€– := by
apply Finset.sum_le_sum
intro v _
rw [norm_mul, Real.norm_eq_abs (g x v)]
exact mul_le_mul (hgbound x v) (norm_le_pi_norm y v) (norm_nonneg _) hC
_ = _ := by simp [Finset.sum_const, nsmul_eq_mul, mul_assoc]
have hsInt : Integrable signal ΞΌ := Integrable.of_eval fun v =>
Integrable.of_bound ((measurable_pi_apply v).comp hsignal).aestronglyMeasurable 1
(Filter.Eventually.of_forall fun Ο‰ => by simpa only [Real.norm_eq_abs] using hspin Ο‰ v)
have hnInt : Integrable noise ΞΌ :=
⟨hnoise.aestronglyMeasurable, (Integrable.of_eval hnoiseInt).hasFiniteIntegral⟩
have hd := (hasDerivAt_integral_sqrt_observation_vector_of_integrable hsInt hnInt hdf hDcont
(mul_nonneg (by positivity) hC) hDbound ht hFint).2
simpa only [gaussianObservationCurve, gaussianObservationVelocity, D, sum_apply,
smul_apply, ContinuousLinearMap.proj_apply, smul_eq_mul] using hd
end FinitePosterior
end Problem367
end
end OAI