Download data/lean/OAI/Probability/Perceptron/Control/ControlledPrefix.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 24.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/Perceptron/Control/ControlledPrefix.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/Perceptron/Control/ControlledPrefix.lean
-
curl -L -o ControlledPrefix.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/Perceptron/Control/ControlledPrefix.lean
24.5 kB
| import Mathlib | |
| import OAI.Probability.Perceptron.Variational.HeatLogBCF | |
| namespace OAI | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped ENNReal NNReal Topology BigOperators BoundedContinuousFunction | |
| namespace SphericalPerceptronFreeEnergy | |
| open Matrix | |
| open scoped InnerProductSpace | |
| variable {H : Type*} [SeminormedAddCommGroup H] [InnerProductSpace β H] | |
| lemma heatLog_control_step_error (d L Cβ Cβ Cβ Cβ : ββ₯0) : | |
| β C : ββ₯0, β {Ξ© : Type*} [MeasurableSpace Ξ©] (P : Measure Ξ©) [IsProbabilityMeasure P] | |
| (g : Jet3), βg.fβ β€ Cβ β βg.d1β β€ Cβ β βg.d2β β€ Cβ β βg.d3β β€ Cβ β | |
| β (s : ββ₯0), s β€ 1 β β (X Z A : Ξ© β β), AEMeasurable X P β | |
| HasLaw Z (gaussianReal 0 s) P β IndepFun X Z P β AEMeasurable A P β | |
| (β Ο, |A Ο| β€ (L : β)*s) β | |
| |(β« Ο, g.f (X Ο+Z Ο+A Ο) βP) - (β« Ο, heatLog s d g.f (X Ο) βP) - | |
| (β« Ο, g.d1 (X Ο)*A Ο βP) + (d : β)*(s : β)/2 * (β« Ο, (g.d1 (X Ο))^2 βP)| β€ | |
| (C : β)*(s : β)*Real.sqrt s := by | |
| obtain β¨C,hCβ© := heatLog_generator_uniform d Cβ Cβ Cβ Cβ | |
| let Mβ := β« z : β, |z| βgaussianReal 0 1 | |
| let Mβ := β« z : β, |z|^3 βgaussianReal 0 1 | |
| have hMβ : 0 β€ Mβ := integral_nonneg (fun z => abs_nonneg z) | |
| have hMβ : 0 β€ Mβ := integral_nonneg (fun z => by positivity) | |
| let K := (Cβ : β)*((L : β)*Mβ+(L : β)^2/2) + (Cβ : β)/6*Mβ | |
| have hK : 0 β€ K := by positivity | |
| refine β¨β¨K+C, by positivityβ©, ?_β© | |
| intro Ξ© _ P _ g hβ hβ hβ hβ s hs X Z A hX hZ hI hA hAK | |
| have hG := gaussian_drift_taylor_mean_bound g.f g.contDiff Cβ Cβ Cβ (L*s) | |
| (fun y => by rw [g.deriv_eq]; exact (g.d1.norm_coe_le_norm y).trans hβ) | |
| (fun y => by rw [g.deriv2_eq]; exact (g.d2.norm_coe_le_norm y).trans hβ) | |
| (fun y => by rw [g.deriv3_eq]; exact (g.d3.norm_coe_le_norm y).trans hβ) | |
| hX hZ hI hA (by simpa only [NNReal.coe_mul] using hAK) | |
| rw [g.deriv_eq, g.deriv2_eq] at hG | |
| have hs0 := s.coe_nonneg | |
| have hr0 := Real.sqrt_nonneg (s : β) | |
| have hr1 : Real.sqrt (s : β) β€ 1 := Real.sqrt_le_one.mpr hs | |
| have hsr : (s : β) β€ Real.sqrt (s : β) := by nlinarith [Real.sq_sqrt hs0] | |
| have hrcube : (Real.sqrt (s : β))^3 = (s : β)*Real.sqrt s := by nlinarith [Real.sq_sqrt hs0] | |
| have hG' : |(β« Ο, g.f (X Ο+Z Ο+A Ο) βP) - (β« Ο, g.f (X Ο) βP) - | |
| (β« Ο, g.d1 (X Ο)*A Ο βP) - (s : β)/2*(β« Ο, g.d2 (X Ο) βP)| β€ | |
| K*(s : β)*Real.sqrt s := by | |
| refine hG.trans ?_ | |
| simp only [NNReal.coe_mul, hrcube] | |
| have ht := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hsr hs0) | |
| (show 0 β€ (Cβ : β)*(L : β)^2/2 by positivity) | |
| dsimp [K,Mβ,Mβ] at * | |
| nlinarith only [ht] | |
| have hiF := boundedContinuousFunction_integrable_comp g.f hX | |
| have hiH := boundedContinuousFunction_integrable_comp (heatLogBCF s d g.f) hX | |
| change Integrable (fun Ο => heatLog s d g.f (X Ο)) P at hiH | |
| have hiβ := boundedContinuousFunction_integrable_comp g.d2 hX | |
| have hiββ := boundedContinuousFunction_integrable_comp (g.d1^2) hX | |
| change Integrable (fun Ο => (g.d1 (X Ο))^2) P at hiββ | |
| let R := fun Ο => heatLog s d g.f (X Ο) - g.f (X Ο) - | |
| (s : β)/2*(g.d2 (X Ο)+(d : β)*(g.d1 (X Ο))^2) | |
| have hiR : Integrable R P := (hiH.sub hiF).sub ((hiβ.add (hiββ.const_mul d)).const_mul ((s : β)/2)) | |
| have hR : |β« Ο, R Ο βP| β€ (C : β)*(s : β)*Real.sqrt s := by | |
| simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using | |
| norm_integral_le_of_norm_le_const (f := R) (ΞΌ := P) (Filter.Eventually.of_forall fun Ο => | |
| show βR Οβ β€ (C : β)*(s : β)*Real.sqrt s by | |
| simpa only [Real.norm_eq_abs, R] using hC g hβ hβ hβ hβ s hs (X Ο)) | |
| have hRe : (β« Ο, R Ο βP) = (β« Ο, heatLog s d g.f (X Ο) βP) - (β« Ο, g.f (X Ο) βP) - | |
| (s : β)/2*((β« Ο, g.d2 (X Ο) βP)+(d : β)*(β« Ο, (g.d1 (X Ο))^2 βP)) := by | |
| have he := integral_sub (hiH.sub hiF) ((hiβ.add (hiββ.const_mul d)).const_mul ((s : β)/2)) | |
| simp only [Pi.sub_apply, Pi.add_apply] at he | |
| dsimp only [R] | |
| rw [he, integral_sub hiH hiF, integral_const_mul, integral_add hiβ (hiββ.const_mul d), integral_const_mul] | |
| rw [hRe] at hR | |
| have hh := abs_sub | |
| ((β« Ο, g.f (X Ο+Z Ο+A Ο) βP) - (β« Ο, g.f (X Ο) βP) - | |
| (β« Ο, g.d1 (X Ο)*A Ο βP) - (s : β)/2*(β« Ο, g.d2 (X Ο) βP)) | |
| ((β« Ο, heatLog s d g.f (X Ο) βP) - (β« Ο, g.f (X Ο) βP) - | |
| (s : β)/2*((β« Ο, g.d2 (X Ο) βP)+(d : β)*(β« Ο, (g.d1 (X Ο))^2 βP))) | |
| have hh' := hh.trans (add_le_add hG' hR) | |
| convert! hh' using 1 | |
| Β· congr 1; ring | |
| Β· change (K+(C : β))*(s : β)*Real.sqrt s = K*(s : β)*Real.sqrt s + (C : β)*(s : β)*Real.sqrt s | |
| ring | |
| lemma usualBrownianSigma_mono (P : Measure BrownianPath) {s t : Time} (hst : s β€ t) : | |
| usualBrownianSigma P s β€ usualBrownianSigma P t := by | |
| apply le_iInf | |
| intro r | |
| exact iInf_le_of_le (β¨r.val, lt_of_le_of_lt hst r.propertyβ© : {r : ββ₯0 // (s : β) < r}) le_rfl | |
| lemma brownianEval_usual_measurable (P : Measure BrownianPath) (t : Time) : | |
| _ _ (usualBrownianSigma P t) (borel β) | |
| (brownianEval β¨t.val,t.property.1β©) := by | |
| rw [measurable_iff_comap_le] | |
| apply le_iInf | |
| intro r | |
| apply le_sup_of_le_left | |
| exact le_iSup_of_le (β¨β¨t.val,t.property.1β©, r.property.leβ© : {s : ββ₯0 // s β€ r.val}) le_rfl | |
| lemma progressive_prefix_integral_measurable (P : Measure BrownianPath) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) | |
| (a : Time β β) (ha : Measurable a) (t : Time) : | |
| _ _ (usualBrownianSigma P t) (borel β) | |
| (fun Ο => β« r in Set.Iic t, a r * v r Ο βtimeLaw) := by | |
| let : MeasurableSpace BrownianPath := usualBrownianSigma P t | |
| have hm : Measurable (fun p : Set.Iic t Γ BrownianPath => a p.1.val * v p.1.val p.2) := | |
| (ha.comp (measurable_subtype_coe.comp measurable_fst)).mul (hv t) | |
| have hi := hm.stronglyMeasurable.integral_prod_left (f := fun r Ο => a r.val * v r.val Ο) (ΞΌ := Measure.comap Subtype.val timeLaw) | |
| have he : (fun Ο => β« r : Set.Iic t, a r.val * v r.val Ο βMeasure.comap Subtype.val timeLaw) = | |
| (fun Ο => β« r in Set.Iic t, a r * v r Ο βtimeLaw) := by | |
| funext Ο | |
| exact integral_subtype_comap (ΞΌ := timeLaw) (s := Set.Iic t) measurableSet_Iic (fun r => a r * v r Ο) | |
| rw [he] at hi | |
| exact hi.measurable | |
| lemma progressive_interval_integral_aemeasurable (P : Measure BrownianPath) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) | |
| (a : Time β β) (ha : Measurable a) (s t : Time) : | |
| AEMeasurable (fun Ο => β« r in Set.Ioc s t, a r * v r Ο βtimeLaw) P := by | |
| have hm := (ha.comp measurable_fst).mul (progressive_joint_complete P hv) | |
| have hi := hm.stronglyMeasurable.integral_prod_left (Ξ² := NullMeasurableSpace BrownianPath P) | |
| (f := fun r Ο => a r * v r Ο) (ΞΌ := timeLaw.restrict (Set.Ioc s t)) | |
| exact (show NullMeasurable (fun Ο => β« r in Set.Ioc s t, a r * v r Ο βtimeLaw) P from hi.measurable).aemeasurable | |
| def controlledPrefix (m : Trial) (v : Time β BrownianPath β β) (t : Time) (Ο : BrownianPath) : β := | |
| brownianEval β¨t.val,t.property.1β© Ο + β« r in Set.Iic t, m r * v r Ο βtimeLaw | |
| lemma controlledPrefix_usual_measurable (P : Measure BrownianPath) (m : Trial) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (t : Time) : | |
| _ _ (usualBrownianSigma P t) (borel β) (controlledPrefix m v t) := | |
| (brownianEval_usual_measurable P t).add (progressive_prefix_integral_measurable P hv m m.measurable t) | |
| def timeSpan (s t : Time) : ββ₯0 := Real.toNNReal ((t : β)-(s : β)) | |
| lemma timeSpan_coe {s t : Time} (hst : s β€ t) : | |
| (timeSpan s t : β) = (t : β)-(s : β) := Real.coe_toNNReal _ (sub_nonneg.mpr hst) | |
| lemma timeSpan_le_one (s t : Time) : timeSpan s t β€ 1 := by | |
| apply Real.toNNReal_le_one.mpr | |
| linarith [t.property.2,s.property.1] | |
| lemma timeLaw_real_Ioc {s t : Time} (hst : s β€ t) : | |
| timeLaw.real (Set.Ioc s t) = (t : β)-(s : β) := by | |
| simp only [timeLaw_eq_volume, Measure.real, unitInterval.volume_Ioc, | |
| ENNReal.toReal_ofReal (sub_nonneg.mpr hst)] | |
| lemma timeLaw_integral_const_Ioc {s t : Time} (hst : s β€ t) (a : β) : | |
| (β« _r in Set.Ioc s t, a βtimeLaw) = ((t : β)-(s : β))*a := by | |
| rw [integral_const, Measure.real, Measure.restrict_apply_univ, β Measure.real, | |
| timeLaw_real_Ioc hst, smul_eq_mul] | |
| lemma bounded_control_integrable (P : Measure BrownianPath) (m : Trial) (L : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β t Ο, |v t Ο| β€ L) (Ο : BrownianPath) : | |
| Integrable (fun r => m r * v r Ο^2) timeLaw β§ Integrable (fun r => m r * v r Ο) timeLaw := | |
| weightedTime_integrable m (progressive_time_measurable P hv Ο) | |
| ((pathControlCost_le_bound m L hL Ο).trans_lt (by finiteness)) | |
| lemma controlledPrefix_increment (P : Measure BrownianPath) (m : Trial) (L : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β t Ο, |v t Ο| β€ L) | |
| {s t : Time} (hst : s β€ t) (Ο : BrownianPath) : | |
| controlledPrefix m v t Ο = controlledPrefix m v s Ο + | |
| (brownianEval β¨t.val,t.property.1β© Ο - brownianEval β¨s.val,s.property.1β© Ο) + | |
| β« r in Set.Ioc s t, m r * v r Ο βtimeLaw := by | |
| have hi := (bounded_control_integrable P m L hv hL Ο).2 | |
| have he := setIntegral_union (s := Set.Iic s) (t := Set.Ioc s t) | |
| (Set.Iic_disjoint_Ioc (a := s) (c := t) le_rfl) measurableSet_Ioc | |
| hi.integrableOn hi.integrableOn | |
| rw [Set.Iic_union_Ioc_eq_Iic hst] at he | |
| unfold controlledPrefix | |
| rw [he] | |
| ring | |
| lemma bounded_interval_drift (P : Measure BrownianPath) (m : Trial) (L : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β t Ο, |v t Ο| β€ L) | |
| {s t : Time} (hst : s β€ t) (Ο : BrownianPath) : | |
| |β« r in Set.Ioc s t, m r * v r Ο βtimeLaw| β€ (L : β) * timeSpan s t := by | |
| rw [timeSpan_coe hst, mul_comm (L : β)] | |
| calc | |
| _ β€ β« r in Set.Ioc s t, |m r*v r Ο| βtimeLaw := abs_integral_le_integral_abs | |
| _ β€ β« _r in Set.Ioc s t, (L : β) βtimeLaw := by | |
| apply integral_mono (bounded_control_integrable P m L hv hL Ο).2.integrableOn.abs (integrable_const _) | |
| intro r | |
| change |m r * v r Ο| β€ (L : β) | |
| rw [abs_mul, abs_of_nonneg (m.nonneg r)] | |
| exact (mul_le_mul_of_nonneg_left (hL r Ο) (m.nonneg r)).trans | |
| (by nlinarith [m.le_one r]) | |
| _ = _ := timeLaw_integral_const_Ioc hst L | |
| def intervalControlCost (m : Trial) (v : Time β BrownianPath β β) (s t : Time) (Ο : BrownianPath) : β := | |
| β« r in Set.Ioc s t, m r * (v r Ο)^2 βtimeLaw | |
| lemma intervalControlCost_nonneg (m : Trial) (v : Time β BrownianPath β β) (s t : Time) (Ο : BrownianPath) : | |
| 0 β€ intervalControlCost m v s t Ο := integral_nonneg (fun r => mul_nonneg (m.nonneg r) (sq_nonneg _)) | |
| lemma intervalControlCost_aemeasurable (P : Measure BrownianPath) (m : Trial) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (s t : Time) : | |
| AEMeasurable (intervalControlCost m v s t) P := | |
| progressive_interval_integral_aemeasurable P (fun r => (hv r).pow_const 2) m m.measurable s t | |
| lemma intervalControlCost_le_bound (P : Measure BrownianPath) (m : Trial) (L : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β t Ο, |v t Ο| β€ L) | |
| {s t : Time} (hst : s β€ t) (Ο : BrownianPath) : | |
| intervalControlCost m v s t Ο β€ (L : β)^2 * timeSpan s t := by | |
| rw [timeSpan_coe hst, mul_comm ((L : β)^2)] | |
| calc | |
| _ β€ β« _r in Set.Ioc s t, (L : β)^2 βtimeLaw := by | |
| apply integral_mono (bounded_control_integrable P m L hv hL Ο).1.integrableOn (integrable_const _) | |
| intro r | |
| have hh : (v r Ο)^2 β€ (L : β)^2 := by | |
| simpa only [sq_abs] using (sq_le_sqβ (abs_nonneg _) L.coe_nonneg).mpr (hL r Ο) | |
| exact (mul_le_mul_of_nonneg_left hh (m.nonneg r)).trans (by nlinarith [m.le_one r]) | |
| _ = _ := timeLaw_integral_const_Ioc hst _ | |
| lemma intervalControlCost_integrable (P : Measure BrownianPath) [IsProbabilityMeasure P] | |
| (m : Trial) (L : ββ₯0) {v : Time β BrownianPath β β} (hv : Progressive P v) | |
| (hL : β t Ο, |v t Ο| β€ L) {s t : Time} (hst : s β€ t) : | |
| Integrable (intervalControlCost m v s t) P := | |
| bounded_real_integrable (intervalControlCost_aemeasurable P m hv s t) ((L : β)^2*timeSpan s t) | |
| (Filter.Eventually.of_forall fun Ο => by | |
| rw [abs_of_nonneg (intervalControlCost_nonneg m v s t Ο)] | |
| exact intervalControlCost_le_bound P m L hv hL hst Ο) | |
| lemma interval_square_completion (P : Measure BrownianPath) (m : Trial) (L d : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β t Ο, |v t Ο| β€ L) | |
| {s t : Time} (hst : s β€ t) (hm : β r β Set.Ioc s t, m r = (d : β)) | |
| (a : β) (Ο : BrownianPath) : | |
| 2*a*(β« r in Set.Ioc s t, m r * v r Ο βtimeLaw) - | |
| (d : β)*(timeSpan s t : β)*a^2 β€ intervalControlCost m v s t Ο := by | |
| have hi := bounded_control_integrable P m L hv hL Ο | |
| have him : Integrable (fun r => m r) timeLaw := by | |
| apply (integrable_const (1 : β)).mono' m.measurable.aestronglyMeasurable | |
| exact Filter.Eventually.of_forall fun r => by | |
| rw [Real.norm_eq_abs, abs_of_nonneg (m.nonneg r)]; exact m.le_one r | |
| have hmono := setIntegral_mono_on (s := Set.Ioc s t) ((hi.2.const_mul (2*a)).sub (him.const_mul (a^2))).integrableOn | |
| hi.1.integrableOn measurableSet_Ioc (fun r _ => by | |
| change 2*a*(m r*v r Ο) - a^2*m r β€ m r*(v r Ο)^2 | |
| nlinarith [mul_nonneg (m.nonneg r) (sq_nonneg (v r Ο-a))]) | |
| have he : (β« r in Set.Ioc s t, m r βtimeLaw) = (d : β)*timeSpan s t := by | |
| rw [setIntegral_congr_fun measurableSet_Ioc hm, timeLaw_integral_const_Ioc hst, timeSpan_coe hst, mul_comm] | |
| simp only [Pi.sub_apply] at hmono | |
| rw [integral_sub (hi.2.const_mul (2*a)).integrableOn (him.const_mul (a^2)).integrableOn, | |
| integral_const_mul, integral_const_mul, he] at hmono | |
| convert! hmono using 1 | |
| ring | |
| lemma brownian_increment_timeSpan (P : Measure BrownianPath) [IsProbabilityMeasure P] | |
| (hB : IsBrownianReal brownianEval P) {s t : Time} (hst : s β€ t) : | |
| HasLaw (fun Ο => brownianEval β¨t.val,t.property.1β© Ο - brownianEval β¨s.val,s.property.1β© Ο) | |
| (gaussianReal 0 (timeSpan s t)) P := by | |
| have he : timeSpan s t = nndist (t : β) (s : β) := by | |
| apply NNReal.coe_injective | |
| rw [timeSpan_coe hst, coe_nndist, Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr (show (s : β) β€ (t : β) from hst))] | |
| rw [he] | |
| exact (hB.toIsPreBrownianReal.hasLaw_sub β¨t.val,t.property.1β© β¨s.val,s.property.1β©).congr | |
| (Filter.Eventually.of_forall fun Ο => rfl) | |
| lemma brownian_control_cell_upper (d L Cβ Cβ Cβ Cβ : ββ₯0) : | |
| β C : ββ₯0, β (P : Measure BrownianPath) [IsProbabilityMeasure P], | |
| IsBrownianReal brownianEval P β β (m : Trial) (v : Time β BrownianPath β β), | |
| Progressive P v β (β r Ο, |v r Ο| β€ L) β β (s t : Time), s < t β | |
| (β r β Set.Ioc s t, m r = (d : β)) β β (g : Jet3), | |
| βg.fβ β€ Cβ β βg.d1β β€ Cβ β βg.d2β β€ Cβ β βg.d3β β€ Cβ β | |
| (β« Ο, g.f (controlledPrefix m v t Ο) βP) - | |
| (β« Ο, heatLog (timeSpan s t) d g.f (controlledPrefix m v s Ο) βP) β€ | |
| (β« Ο, intervalControlCost m v s t Ο βP)/2 + | |
| (C : β)*(timeSpan s t : β)*Real.sqrt (timeSpan s t) := by | |
| obtain β¨C,hCβ© := heatLog_control_step_error d L Cβ Cβ Cβ Cβ | |
| refine β¨C, ?_β© | |
| intro P _ hB m v hv hL s t hst hm g hβ hβ hβ hβ | |
| let X := controlledPrefix m v s | |
| let Z := fun Ο => brownianEval β¨t.val,t.property.1β© Ο - brownianEval β¨s.val,s.property.1β© Ο | |
| let A := fun Ο => β« r in Set.Ioc s t, m r*v r Ο βtimeLaw | |
| have hX := controlledPrefix_usual_measurable P m hv s | |
| have hXm : AEMeasurable X P := usual_measurable_aemeasurable P s hX | |
| have hAm : AEMeasurable A P := progressive_interval_integral_aemeasurable P hv m m.measurable s t | |
| have hAb : β Ο, |A Ο| β€ (L : β)*timeSpan s t := bounded_interval_drift P m L hv hL hst.le | |
| have he := hC P g hβ hβ hβ hβ (timeSpan s t) (timeSpan_le_one s t) X Z A hXm | |
| (brownian_increment_timeSpan P hB hst.le) | |
| (brownian_increment_indep_adapted P hB s β¨t.val,t.property.1β© hst hX) hAm hAb | |
| have hXT : β Ο, X Ο+Z Ο+A Ο = controlledPrefix m v t Ο := by | |
| intro Ο | |
| exact (controlledPrefix_increment P m L hv hL hst.le Ο).symm | |
| simp only [hXT] at he | |
| have hiβ := boundedContinuousFunction_integrable_comp g.d1 hXm | |
| have hiβ := boundedContinuousFunction_integrable_comp (g.d1^2) hXm | |
| change Integrable (fun Ο => (g.d1 (X Ο))^2) P at hiβ | |
| have hiA := bounded_real_integrable hAm ((L : β)*timeSpan s t) (Filter.Eventually.of_forall hAb) | |
| have hiJ : Integrable (fun Ο => g.d1 (X Ο)*A Ο) P := | |
| hiA.bdd_mul ((g.d1.continuous.measurable.comp_aemeasurable hXm).aestronglyMeasurable) | |
| (Filter.Eventually.of_forall fun Ο => g.d1.norm_coe_le_norm (X Ο)) | |
| have hq := integral_mono ((hiJ.const_mul 2).sub (hiβ.const_mul ((d : β)*(timeSpan s t : β)))) | |
| (intervalControlCost_integrable P m L hv hL hst.le) | |
| (fun Ο => by | |
| change 2*(g.d1 (X Ο)*A Ο) - (d : β)*(timeSpan s t : β)*(g.d1 (X Ο))^2 β€ _ | |
| nlinarith only [interval_square_completion P m L d hv hL hst.le hm (g.d1 (X Ο)) Ο]) | |
| simp only [Pi.sub_apply] at hq | |
| rw [integral_sub (hiJ.const_mul 2) (hiβ.const_mul ((d : β)*(timeSpan s t : β))), | |
| integral_const_mul, integral_const_mul] at hq | |
| exact le_trans (by linarith only [(abs_le.mp he).2,hq]) le_rfl | |
| lemma antitoneOn_of_superlinear_increment (F : Time β β) (C : β) | |
| {a b : Time} (hab : a β€ b) | |
| (h : β s β Set.Icc a b, β t β Set.Icc a b, s < t β | |
| F t - F s β€ C*((t : β)-(s : β))*Real.sqrt ((t : β)-(s : β))) : F b β€ F a := by | |
| have hbnd : β n : β, β s β Set.Icc a b, β t β Set.Icc a b, s < t β | |
| F t - F s β€ C*((t : β)-(s : β))*Real.sqrt (((t : β)-(s : β))*(1/2 : β)^n) := by | |
| intro n | |
| induction n with | |
| | zero => simpa using h | |
| | succ n ih => | |
| intro s hs t ht hst | |
| have hstreal : (s : β) < (t : β) := hst | |
| let u : Time := β¨((s : β)+(t : β))/2, by | |
| constructor <;> linarith [s.property.1,s.property.2,t.property.1,t.property.2]β© | |
| have hsu : s < u := by change (s : β) < ((s : β)+(t : β))/2; linarith only [hstreal] | |
| have hut : u < t := by change ((s : β)+(t : β))/2 < (t : β); linarith only [hstreal] | |
| have hu : u β Set.Icc a b := β¨hs.1.trans hsu.le,hut.le.trans ht.2β© | |
| have hβ := ih s hs u hu hsu | |
| have hβ := ih u hu t ht hut | |
| have eβ : (u : β)-(s : β) = ((t : β)-(s : β))/2 := by dsimp [u]; ring | |
| have eβ : (t : β)-(u : β) = ((t : β)-(s : β))/2 := by dsimp [u]; ring | |
| rw [eβ] at hβ | |
| rw [eβ] at hβ | |
| have eβ : ((t : β)-(s : β))*(1/2 : β)^(n+1) = (((t : β)-(s : β))/2)*(1/2 : β)^n := by rw [pow_succ]; ring | |
| rw [eβ] | |
| linarith only [hβ,hβ] | |
| rcases hab.eq_or_lt with heq | hlt | |
| Β· simp [heq] | |
| have hlim : Tendsto (fun n : β => C*((b : β)-(a : β))*Real.sqrt (((b : β)-(a : β))*(1/2 : β)^n)) atTop (π 0) := by | |
| have hp := tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num : (0 : β) β€ 1/2) (by norm_num : (1/2 : β) < 1) | |
| simpa using (hp.const_mul ((b : β)-(a : β))).sqrt.const_mul (C*((b : β)-(a : β))) | |
| have he := ge_of_tendsto hlim (Filter.Eventually.of_forall fun n => hbnd n a β¨le_rfl,habβ© b β¨hab,le_rflβ© hlt) | |
| linarith only [he] | |
| lemma timeSpan_add {a b c : Time} (hab : a β€ b) (hbc : b β€ c) : | |
| timeSpan a b + timeSpan b c = timeSpan a c := by | |
| apply NNReal.coe_injective | |
| simp only [NNReal.coe_add,timeSpan_coe hab,timeSpan_coe hbc,timeSpan_coe (hab.trans hbc)] | |
| ring | |
| lemma intervalControlCost_add (P : Measure BrownianPath) (m : Trial) (L : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β r Ο, |v r Ο| β€ L) | |
| {a b c : Time} (hab : a β€ b) (hbc : b β€ c) (Ο : BrownianPath) : | |
| intervalControlCost m v a c Ο = intervalControlCost m v a b Ο + intervalControlCost m v b c Ο := by | |
| have hi := (bounded_control_integrable P m L hv hL Ο).1 | |
| have he := setIntegral_union (s := Set.Ioc a b) (t := Set.Ioc b c) | |
| (Set.Ioc_disjoint_Ioc_of_le le_rfl) measurableSet_Ioc hi.integrableOn hi.integrableOn | |
| rwa [Set.Ioc_union_Ioc_eq_Ioc hab hbc] at he | |
| lemma expected_intervalControlCost_add (P : Measure BrownianPath) [IsProbabilityMeasure P] | |
| (m : Trial) (L : ββ₯0) {v : Time β BrownianPath β β} (hv : Progressive P v) | |
| (hL : β r Ο, |v r Ο| β€ L) {a b c : Time} (hab : a β€ b) (hbc : b β€ c) : | |
| (β« Ο, intervalControlCost m v a c Ο βP) = | |
| (β« Ο, intervalControlCost m v a b Ο βP) + (β« Ο, intervalControlCost m v b c Ο βP) := by | |
| simp only [intervalControlCost_add P m L hv hL hab hbc] | |
| exact integral_add (intervalControlCost_integrable P m L hv hL hab) | |
| (intervalControlCost_integrable P m L hv hL hbc) | |
| lemma brownian_control_interval_upper (P : Measure BrownianPath) [IsProbabilityMeasure P] | |
| (hB : IsBrownianReal brownianEval P) (m : Trial) (L d : ββ₯0) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (hL : β r Ο, |v r Ο| β€ L) | |
| {a b : Time} (hab : a β€ b) (hm : β r β Set.Ioc a b, m r = (d : β)) (g : Jet3) : | |
| (β« Ο, g.f (controlledPrefix m v b Ο) βP) - | |
| (β« Ο, heatLog (timeSpan a b) d g.f (controlledPrefix m v a Ο) βP) β€ | |
| (β« Ο, intervalControlCost m v a b Ο βP)/2 := by | |
| obtain β¨Cβ,Cβ,Cβ,Cβ,hGβ© := g.heatLog_uniform_bounds d | |
| obtain β¨C,hCβ© := brownian_control_cell_upper d L Cβ Cβ Cβ Cβ | |
| let F : Time β β := fun t => | |
| (β« Ο, heatLog (timeSpan t b) d g.f (controlledPrefix m v t Ο) βP) - | |
| (β« Ο, intervalControlCost m v a t Ο βP)/2 | |
| have hF := antitoneOn_of_superlinear_increment F (C : β) hab (by | |
| intro s hs t ht hst | |
| have hmst : β r β Set.Ioc s t, m r = (d : β) := fun r hr => hm r β¨hs.1.trans_lt hr.1,hr.2.trans ht.2β© | |
| obtain β¨hβ,hβ,hβ,hββ© := hG (timeSpan t b) | |
| have hh := hC P hB m v hv hL s t hst hmst (g.heatLog (timeSpan t b) d) hβ hβ hβ hβ | |
| rw [g.heatLog_f] at hh | |
| simp only [heatLogBCF_coe, heatLog_semigroup, timeSpan_add hst.le ht.2] at hh | |
| have hcost := expected_intervalControlCost_add P m L hv hL hs.1 hst.le | |
| rw [timeSpan_coe hst.le] at hh | |
| dsimp [F] | |
| linarith only [hh,hcost]) | |
| have heβ : timeSpan b b = 0 := by simp [timeSpan] | |
| have heβ : β Ο, intervalControlCost m v a a Ο = 0 := by intro Ο; simp [intervalControlCost] | |
| dsimp [F] at hF | |
| simp only [heβ,heatLog_zero,heβ,integral_zero,zero_div,sub_zero] at hF | |
| linarith only [hF] | |
| def patchControl (v : Time β BrownianPath β β) (s t : Time) (a : BrownianPath β β) : | |
| Time β BrownianPath β β := fun r Ο => if r β Set.Ioc s t then a Ο else v r Ο | |
| lemma progressive_patchControl (P : Measure BrownianPath) | |
| {v : Time β BrownianPath β β} (hv : Progressive P v) (s t : Time) | |
| {a : BrownianPath β β} (ha : @Measurable _ _ (usualBrownianSigma P s) (borel β) a) : | |
| Progressive P (patchControl v s t a) := by | |
| intro T | |
| by_cases hs : s β€ T | |
| Β· have haT := ha.mono (usualBrownianSigma_mono P hs) le_rfl | |
| apply Measurable.ite _ (haT.comp measurable_snd) (hv T) | |
| exact (measurableSet_Ioc : MeasurableSet (Set.Ioc s t)).preimage | |
| (measurable_subtype_coe.comp measurable_fst) | |
| Β· have he : (fun p : Set.Iic T Γ BrownianPath => patchControl v s t a p.1.val p.2) = | |
| (fun p : Set.Iic T Γ BrownianPath => v p.1.val p.2) := by | |
| funext p | |
| apply ite_eq_right | |
| intro h | |
| exact hs (h.1.le.trans p.1.property) | |
| rw [he] | |
| exact hv T | |
| lemma patchControl_bound {v : Time β BrownianPath β β} {L : ββ₯0} | |
| (hv : β r Ο, |v r Ο| β€ L) (s t : Time) {a : BrownianPath β β} | |
| (ha : β Ο, |a Ο| β€ L) : β r Ο, |patchControl v s t a r Ο| β€ L := by | |
| intro r Ο | |
| simp only [patchControl] | |
| split <;> first | exact ha Ο | exact hv r Ο | |
| end SphericalPerceptronFreeEnergy | |
| end | |
| end OAI | |