cfahlgren1/math / lean /OAI /Probability /DilutedSpin /ExternalCovariance.lean
cfahlgren1's picture
download
raw
5.21 kB
23
noncomputable def externalCovariance (t u : ℝ) : ℝ :=
body · 3 lines
  externalAverage ξ μ ν η r s S a T Q m base old D E f t u -
    oldTreeAverage ξ μ ν r s S T Q (fun j => m j.succ) base old f *
      externalAverage ξ μ ν η r s S a T Q m base old D E (fun _ => 1) t u
28
noncomputable def covarianceCoefficient (k : ℕ) : ℝ :=
body · 3 lines
  externalCoefficientAverage ξ μ ν η r s S a T Q m base old D E f k -
    oldTreeAverage ξ μ ν r s S T Q (fun j => m j.succ) base old f *
      externalCoefficientAverage ξ μ ν η r s S a T Q m base old D E (fun _ => 1) k
40
lemma externalCovariance_taylor_bound {t : ℝ} (ht : t ∈ Set.Icc (0:ℝ) (1/2)) (k : ℕ) :
    |externalCovariance ξ μ ν η r s S a T Q m base old D E f t 0 -
      ∑ j ∈ Finset.range (k+1), covarianceCoefficient ξ μ ν η r s S a T Q m base old D E f j*t^j| ≤
        (2*B*PrescribedTree.derivativeBound (S.leaves+(Finset.univ.erase a).card) (k+1)/(k.factorial:ℝ))*t^(k+1) := by
proof · 22 lines
  have h1 := externalAverage_taylor_bound ξ μ ν η r s S a T Q m base old D E f hb hm hmono hpos hroot hend hB hf hD hE ht k
  have h2 := externalAverage_taylor_bound ξ μ ν η r s S a T Q m base old D E (fun _ => 1) hb hm hmono hpos hroot hend
    (by norm_num : (0:ℝ) ≤ 1) (by intro _; norm_num) hD hE ht k
  have hmean := oldTreeAverage_bound ξ μ ν r s S T Q (fun j => m j.succ) base old f hf
  let c := oldTreeAverage ξ μ ν r s S T Q (fun j => m j.succ) base old f
  let F := externalAverage ξ μ ν η r s S a T Q m base old D E f t 0
  let G := externalAverage ξ μ ν η r s S a T Q m base old D E (fun _ => 1) t 0
  let P := ∑ j ∈ Finset.range (k+1), externalCoefficientAverage ξ μ ν η r s S a T Q m base old D E f j*t^j
  let R := ∑ j ∈ Finset.range (k+1), externalCoefficientAverage ξ μ ν η r s S a T Q m base old D E (fun _ => 1) j*t^j
  have he : externalCovariance ξ μ ν η r s S a T Q m base old D E f t 0 -
      ∑ j ∈ Finset.range (k+1), covarianceCoefficient ξ μ ν η r s S a T Q m base old D E f j*t^j = (F-P)-c*(G-R) := by
    simp only [externalCovariance,covarianceCoefficient,sub_mul,Finset.sum_sub_distrib,mul_assoc,← Finset.mul_sum]
    dsimp only [F,P,c,G,R]
    ring
  rw [he]
  have hh := (abs_sub (F-P) (c*(G-R))).trans (add_le_add h1 (show |c*(G-R)| ≤ B*((1*PrescribedTree.derivativeBound (S.leaves+(Finset.univ.erase a).card) (k+1)/(k.factorial:ℝ))*t^(k+1)) from by
    rw [abs_mul]
    exact mul_le_mul hmean h2 (abs_nonneg _) hB))
  calc
    _ ≤ (B*PrescribedTree.derivativeBound (S.leaves+(Finset.univ.erase a).card) (k+1)/(k.factorial:ℝ))*t^(k+1) +
        B*((1*PrescribedTree.derivativeBound (S.leaves+(Finset.univ.erase a).card) (k+1)/(k.factorial:ℝ))*t^(k+1)) := hh
    _ = _ := by ring
68
lemma externalCovariance_sub_le {t u : ℝ} (ht : |t| ≤ 1/4) (huz : 0 ≤ u) (hu : u ≤ 1/4) :
    |externalCovariance ξ μ ν η r s S a T Q m base old D E f t u -
      externalCovariance ξ μ ν η r s S a T Q m base old D E f t 0| ≤ 2*(4+8*(S.leaves:ℝ))*B*u := by
proof · 10 lines
  have h1 := externalAverage_sub_le ξ μ ν η r s S a T Q m base old D E f hb hm hmono hpos hroot hend hB hf hD hE ht huz hu
  have h2 := externalAverage_sub_le ξ μ ν η r s S a T Q m base old D E (fun _ => 1) hb hm hmono hpos hroot hend
    (by norm_num : (0:ℝ) ≤ 1) (by intro _; norm_num) hD hE ht huz hu
  have hmean := oldTreeAverage_bound ξ μ ν r s S T Q (fun j => m j.succ) base old f hf
  unfold externalCovariance
  rw [show ∀ F G F' G' c : ℝ, (F-c*G)-(F'-c*G')=(F-F')-c*(G-G') by intros; ring]
  refine (abs_sub _ _).trans ?_
  rw [abs_mul]
  have hh := mul_le_mul hmean h2 (abs_nonneg _) hB
  linarith

Xet Storage Details

Size:
5.21 kB
·
Xet hash:
58fc7727c272cddefe414ace618cb7aba4ceee23c05089ac97c8be044ab7a0bb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.