Download data/lean/OAI/Probability/FreeIsing/Posterior/LipschitzObservationDerivative.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 13.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Posterior/LipschitzObservationDerivative.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Posterior/LipschitzObservationDerivative.lean
-
curl -L -o LipschitzObservationDerivative.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Posterior/LipschitzObservationDerivative.lean
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 | |