cfahlgren1's picture
download
raw
4.57 kB
import Mathlib
import OAI.Computability.VertexCover.Information.Finite
namespace OAI
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace UniqueGames.Foundations.Information
open scoped BigOperators
variable {α : Type*} [Fintype α]
noncomputable def hellingerSquared (p q : α → ℝ) : ℝ :=
∑ a, (Real.sqrt (p a) - Real.sqrt (q a)) ^ 2
theorem sqrt_distance_le_relativeEntropy_term {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y)
(hs : x ≠ 0 → y ≠ 0) :
(Real.sqrt x - Real.sqrt y)^2 ≤ x * Real.log (x / y) - x + y := by
by_cases hxzero : x = 0
· subst x
simp [Real.sq_sqrt hy]
have hxpos : 0 < x := lt_of_le_of_ne hx (Ne.symm hxzero)
have hypos : 0 < y := lt_of_le_of_ne hy (Ne.symm (hs hxzero))
have hsx : 0 < Real.sqrt x := Real.sqrt_pos.2 hxpos
have hsy : 0 < Real.sqrt y := Real.sqrt_pos.2 hypos
have hlog := Real.log_le_sub_one_of_pos (div_pos hsy hsx)
have hlogid : Real.log (Real.sqrt y / Real.sqrt x) =
-(Real.log (x / y)) / 2 := by
rw [Real.log_div hsy.ne' hsx.ne', Real.log_sqrt hy, Real.log_sqrt hx,
Real.log_div hxzero (hs hxzero)]
ring
have hprod : x * (Real.sqrt y / Real.sqrt x) = Real.sqrt x * Real.sqrt y := by
calc
x * (Real.sqrt y / Real.sqrt x) = (Real.sqrt x)^2 * (Real.sqrt y / Real.sqrt x) := by
rw [Real.sq_sqrt hx]
_ = Real.sqrt x * Real.sqrt y := by field_simp [hsx.ne']
have hm := mul_le_mul_of_nonneg_left hlog hx
rw [hlogid, mul_sub, mul_one, hprod] at hm
nlinarith [Real.sq_sqrt hx, Real.sq_sqrt hy]
theorem hellingerSquared_le_relativeEntropy (p q : α → ℝ) (hp : IsProbability p)
(hq : IsProbability q) (hs : SupportedBy p q) :
hellingerSquared p q ≤ relativeEntropy p q := by
have hsum := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset α)) =>
sqrt_distance_le_relativeEntropy_term (hp.1 a) (hq.1 a) (hs a))
simpa only [hellingerSquared, relativeEntropy, Finset.sum_add_distrib,
Finset.sum_sub_distrib, hp.2, hq.2, sub_add_cancel] using hsum
theorem totalVariation_sq_le_hellingerSquared (p q : α → ℝ) (hp : IsProbability p)
(hq : IsProbability q) : totalVariation p q ^ 2 ≤ hellingerSquared p q := by
have hfactor : ∀ a, |Real.sqrt (p a) - Real.sqrt (q a)| *
(Real.sqrt (p a) + Real.sqrt (q a)) = |p a - q a| := by
intro a
rw [← abs_of_nonneg (add_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _)),
← abs_mul]
congr 1
nlinarith [Real.sq_sqrt (hp.1 a), Real.sq_sqrt (hq.1 a)]
have hcs := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset α)
(fun a => |Real.sqrt (p a) - Real.sqrt (q a)|)
(fun a => Real.sqrt (p a) + Real.sqrt (q a))
simp only [hfactor, sq_abs] at hcs
have hpoint : ∀ a, (Real.sqrt (p a) + Real.sqrt (q a)) ^ 2 ≤ 2 * (p a + q a) := by
intro a
nlinarith [sq_nonneg (Real.sqrt (p a) - Real.sqrt (q a)),
Real.sq_sqrt (hp.1 a), Real.sq_sqrt (hq.1 a)]
have hsum := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset α)) => hpoint a)
simp only [← Finset.mul_sum, Finset.sum_add_distrib, hp.2, hq.2] at hsum
have hnonneg : 0 ≤ ∑ a, (Real.sqrt (p a) - Real.sqrt (q a)) ^ 2 :=
Finset.sum_nonneg (fun a _ => sq_nonneg _)
have hmul := mul_le_mul_of_nonneg_left hsum hnonneg
dsimp [totalVariation, hellingerSquared]
nlinarith
theorem totalVariation_sq_le_relativeEntropy (p q : α → ℝ) (hp : IsProbability p)
(hq : IsProbability q) (hs : SupportedBy p q) :
totalVariation p q ^ 2 ≤ relativeEntropy p q :=
(totalVariation_sq_le_hellingerSquared p q hp hq).trans
(hellingerSquared_le_relativeEntropy p q hp hq hs)
theorem posterior_totalVariation_sq_le_log (p w : α → ℝ) (hp : IsProbability p)
(hw : ∀ a, 0 ≤ w a) (hw_one : ∀ a, w a ≤ 1) {z : ℝ} (hz : 0 < z)
(hmass : ∑ a, p a * w a = z) :
totalVariation (posterior p w z) p ^ 2 ≤ Real.log (1 / z) := by
exact (totalVariation_sq_le_relativeEntropy _ _ (posterior_isProbability p w hp hw hz hmass)
hp (posterior_supportedBy p w z)).trans
(posterior_relativeEntropy_le p w hp hw hw_one hz hmass)
end UniqueGames.Foundations.Information
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end OAI

Xet Storage Details

Size:
4.57 kB
·
Xet hash:
b1a2723243b048c93998703949c1a93c4533c9811189f0fb56a52bb1fe772242

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