File size: 4,320 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | import Mathlib
import OAI.Probability.SKGap.Localization.ConditionalModelAlgebra
namespace OAI
section
noncomputable section
namespace SKGap
open Matrix Real Set MeasureTheory ProbabilityTheory
open scoped BigOperators Matrix.Norms.Frobenius
def conditionalMiddleSize (j V W : β) (p : ScalarPoint) : β :=
(1+2*|conditionalKappa j p-1|+|conditionalEll j p-2*conditionalKappa j p+1|)*W+
2*(|j*sqrt (scalarQMoment p.1/scalarS j p)| * (sqrt (scalarS j p)*V)+
|j*scalarA j p/scalarS j p|)+
|2*j*(scalarA j p+j*scalarBMoment p.1*scalarQMoment p.1)/(scalarS j p+j*scalarQMoment p.1)|+
|j| * V^2+|2*j*scalarQMoment p.1|+|j*scalarBMoment p.1|
lemma continuousAt_conditionalMiddleSize {X : Type*} [TopologicalSpace X]
{R : β} (hR : 0 β€ R) (j V W : β) (f : X β ScalarPoint) (hf : Continuous f)
(hdom : β x,f x β scalarMomentDomain R) {x : X}
(hs : scalarS j (f x) β 0) (hS : scalarS j (f x)+j*scalarQMoment (f x).1 β 0) :
ContinuousAt (fun x=>conditionalMiddleSize j V W (f x)) x := by
have hq := (continuous_scalarQMoment.comp (continuous_fst.comp hf)).continuousAt (x := x)
have hb := (continuous_scalarBMoment.comp (continuous_fst.comp hf)).continuousAt (x := x)
have hss := ((continuous_scalarS j).comp hf).continuousAt (x := x)
have hSS : ContinuousAt (fun x=>scalarS j (f x)+j*scalarQMoment (f x).1) x := hss.add (continuousAt_const.mul hq)
have ha := ((continuousOn_scalarA hR j).comp_continuous hf hdom).continuousAt (x := x)
have hn : ContinuousAt (fun x=>(f x).2.1+(f x).2.2^2) x := by fun_prop
have hk : ContinuousAt (fun x=>conditionalKappa j (f x)) x := (hn.div hss hs).sqrt
have hl : ContinuousAt (fun x=>conditionalEll j (f x)) x := (hn.div hSS hS).sqrt
unfold conditionalMiddleSize
fun_prop (disch := assumption)
theorem conditionalMiddleSize_uniform {j R t0 T : β} (hj : 0 β€ j) (hR : 0 β€ R)
(ht0 : 0 < t0) (V W : β) :
β L : β, 1 β€ L β§ β (P : ProbabilityMeasure β), P β momentBall R β
β t β Icc t0 T,β Ο : β, |Ο| β€ 1 β conditionalMiddleSize j V W (P,t,Ο) β€ L := by
let X : Type := β₯(momentBall R) Γ β₯(Icc t0 T) Γ β₯(Icc (-1:β) 1)
let : CompactSpace (momentBall R) := isCompact_iff_compactSpace.mp (isCompact_momentBall R)
let f : X β ScalarPoint := fun x=>((x.1:ProbabilityMeasure β),(x.2.1:β),(x.2.2:β))
have hf : Continuous f := by dsimp [f,X]; fun_prop
have hdom : β x,f x β scalarMomentDomain R := fun (x : X)=>β¨x.1.2,mem_univ _β©
have hc : Continuous (fun x : X=>conditionalMiddleSize j V W (f x)) := by
apply continuous_iff_continuousAt.mpr
intro x
have ht : 0 < (x.2.1:β) := ht0.trans_le x.2.1.2.1
have hs : 0 < scalarS j (f x) := by
dsimp [scalarS,f]
exact add_pos_of_pos_of_nonneg (add_pos_of_pos_of_nonneg ht (sq_nonneg _))
(mul_nonneg hj (scalarQMoment_bounds _).1)
have hS : 0 < scalarS j (f x)+j*scalarQMoment (f x).1 :=
add_pos_of_pos_of_nonneg hs (mul_nonneg hj (scalarQMoment_bounds _).1)
exact continuousAt_conditionalMiddleSize hR j V W f hf hdom hs.ne' hS.ne'
obtain β¨M,hMβ© := isCompact_univ.bddAbove_image hc.continuousOn
refine β¨max 1 M,le_max_left _ _,?_β©
intro P hP t ht Ο hΟ
let x : X := (β¨P,hPβ©,β¨t,htβ©,β¨Ο,abs_le.mp hΟβ©)
exact (hM (mem_image_of_mem _ (mem_univ x))).trans (le_max_right _ _)
lemma empirical_column_coefficient {n : β} [NeZero n] {j t0 t T Ο : β}
(hj : 0 β€ j) (ht0 : 0 < t0) (ht : t β Icc t0 T) (y : Fin n β β) :
(1+|scalarD j (empiricalLaw y,t,Ο)|)/scalarS j (empiricalLaw y,t,Ο) β€
max 1 ((1+|T|+j)/t0) := by
have ht' : 0 < t := ht0.trans_le ht.1
have hd : |scalarD j (empiricalLaw y,t,Ο)| β€ |T|+j := by
apply (abs_add_le _ _).trans
rw [abs_of_pos ht',abs_mul,abs_of_nonneg hj]
have hh := mul_le_mul_of_nonneg_left (scalarM_bounds (empiricalLaw y)) hj
have hT := ht.2.trans (le_abs_self T)
nlinarith only [hh,hT]
have hs : t0 β€ scalarS j (empiricalLaw y,t,Ο) := by
dsimp [scalarS]
exact ht.1.trans (le_add_of_nonneg_right (sq_nonneg Ο) |>.trans
(le_add_of_nonneg_right (mul_nonneg hj (scalarQMoment_bounds _).1)))
apply le_trans _ (le_max_right _ _)
exact div_le_divβ (by positivity) (by linarith) ht0 hs
end SKGap
end
end
end OAI
|