openAI-math-dataset / lean /OAI /Probability /SKBarriers /Gaussian /LipschitzChainRepresentation.lean
roseking's picture
Add lean source and binary files (part 127)
135052a verified
Raw History Blame Contribute Delete
4.65 kB
import Mathlib
import OAI.Probability.SKBarriers.Parisi.CDFPartitionRepresentation
import OAI.Probability.SKBarriers.Gaussian.LipschitzObservable
namespace OAI
section
noncomputable section
open scoped NNReal Topology
open MeasureTheory ProbabilityTheory Filter Set
namespace SK.Analytic
theorem scalarWindowDerivative_lipschitz_bound {g : ℝ → ℝ} {L : ℝ≥0}
(hg : LipschitzWith L g) {h : ℝ} (hh : 0<h) (x : ℝ) :
|scalarWindowDerivative g h x| ≤ L := by
have H := hg.dist_le_mul (x+h) x
simp only [Real.dist_eq,add_sub_cancel_left,abs_of_pos hh] at H
rw [scalarWindowDerivative,abs_div,abs_of_pos hh,div_le_iff₀ hh]
exact H
theorem scalarWindow_lipschitz {g : ℝ → ℝ} {L : ℝ≥0}
(hg : LipschitzWith L g) {h : ℝ} (hh : 0<h) : LipschitzWith L (scalarWindow g h) := by
apply lipschitzWith_of_nnnorm_deriv_le
(fun x => (scalarWindow_hasDerivAt hg.continuous h x).differentiableAt)
intro x
rw [(scalarWindow_hasDerivAt hg.continuous h x).deriv]
exact_mod_cast scalarWindowDerivative_lipschitz_bound hg hh x
theorem scalarCDFAverage_eq_chainAverage_lipschitz {f g : ℝ → ℝ}
(hf : BoundedDerivs f) {K B L : ℝ≥0} (hfK : LipschitzWith K f)
(hgL : LipschitzWith L g) (hB : ∀ z, |g z| ≤ B)
(β : ℝ) {α : ℝ → ℝ} (hα : ∀ z, α z∈Icc (0:ℝ) 1) (hmono : Monotone α)
(l : List (ℝ × ℝ≥0)) (hm : ∀ p∈l, p.1∈Icc (0:ℝ) 1)
(s : ℝ) (t : ℝ≥0) (ht : t≤1) (hdur : chainDuration l=t)
(hmodel : TimeChainModels α s l) (x : ℝ) :
scalarCDFAverage β α s t f g x=scalarTimeChainAverage β l f g x := by
apply sub_eq_zero.mp
apply abs_eq_zero.mp
apply le_antisymm ?_ (abs_nonneg _)
apply le_of_forall_pos_le_add
intro ε hε
simp only [zero_add]
let h := ε/(2*((L:ℝ)+1))
have hL : 0<(L:ℝ)+1 := by positivity
have hh : 0<h := div_pos hε (mul_pos (by norm_num) hL)
have hsmall : (L:ℝ)*h ≤ ε/2 := by
calc
_ ≤ ((L:ℝ)+1)*h := mul_le_mul_of_nonneg_right (by linarith) hh.le
_ = ε/2 := by dsimp [h]; field_simp
have hd (z) : |g z-scalarWindow g h z| ≤ (L:ℝ)*h := by
rw [abs_sub_comm]
exact scalarWindow_approx hgL hh z
have H₁ := scalarCDFAverage_observable_distance β hα hmono hf hfK hgL
(scalarWindow_lipschitz hgL hh) hB (scalarWindow_bound hgL.continuous hB hh)
(mul_nonneg L.coe_nonneg hh.le) hd s t ht x
have H₂ := scalarHierarchyAverage_observable_distance hf
⟨hgL.continuous,B,B.coe_nonneg,hB⟩
⟨(scalarWindow_lipschitz hgL hh).continuous,B,B.coe_nonneg,scalarWindow_bound hgL.continuous hB hh⟩
(mul_nonneg L.coe_nonneg hh.le) hd l.length (fun i => (l.get i).1)
(fun i => β*Real.sqrt ((l.get i).2:ℝ)) x
change |scalarTimeChainAverage β l f g x-scalarTimeChainAverage β l f (scalarWindow g h) x|≤_ at H₂
have HE := scalarCDFAverage_eq_chainAverage hf
(scalarWindow_hasDerivAt hgL.continuous h) (scalarWindowDerivative_continuous hgL.continuous h)
hfK (scalarWindow_bound hgL.continuous hB hh) (scalarWindowDerivative_lipschitz_bound hgL hh)
β hα hmono l hm s t ht hdur hmodel x
rw [HE] at H₁
have H := abs_sub_le (scalarCDFAverage β α s t f g x)
(scalarTimeChainAverage β l f (scalarWindow g h) x) (scalarTimeChainAverage β l f g x)
rw [abs_sub_comm (scalarTimeChainAverage β l f (scalarWindow g h) x)] at H
linarith
theorem scalarCDFAverage_eq_partition_lipschitz {f g : ℝ → ℝ} (hf : BoundedDerivs f)
{K B L : ℝ≥0} (hK : LipschitzWith K f) (hgL : LipschitzWith L g) (hB : ∀ y, |g y|≤B)
(β : ℝ) {α : ℝ → ℝ} (hα : ∀ z, α z∈Icc (0:ℝ) 1) (hαm : Monotone α)
(n : ℕ) (q : Fin (n+1) → ℝ) (hq : Monotone q) (m : Fin n → ℝ)
(hm : ∀ i, m i∈Icc (0:ℝ) 1)
(hmodel : ∀ i : Fin n, ∀ z∈Ico (q i.castSucc) (q i.succ), α z=m i)
(t : ℝ≥0) (ht : t≤1) (hd : (t:ℝ)=q (Fin.last n)-q 0) (x : ℝ) :
scalarCDFAverage β α (q 0) t f g x=scalarHierarchyAverage n m (timeGridCoefficients n β q) f g x := by
have hdur : chainDuration (partitionTimeChain n q hq m)=t := by
apply NNReal.coe_injective
exact (partitionTimeChain_duration n q hq m).trans hd.symm
have hml (p) (hp : p∈partitionTimeChain n q hq m) : p.1∈Icc (0:ℝ) 1 := by
obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hp
exact hm i
have H := scalarCDFAverage_eq_chainAverage_lipschitz hf hK hgL hB β hα hαm
(partitionTimeChain n q hq m) hml (q 0) t ht hdur (partitionTimeChain_models n q hq m hmodel) x
simp only [partitionTimeChain,scalarTimeChainAverage_ofFn,NNReal.coe_mk] at H
exact H
end SK.Analytic
end
end
end OAI