Buckets:
| import Mathlib | |
| import OAI.Computability.MaxCut.Games.Kernels | |
| namespace OAI | |
| /-! | |
| A finite Pinsker inequality with a nonoptimal constant, sufficient for the | |
| information bound used by Holenstein: TV(p,q)^2 ≤ D_nat(p || q). | |
| The proof factors the L1 distance through square roots and uses log t ≤ t-1. | |
| -/ | |
| namespace MaxCutGames.Foundations.Information | |
| section | |
| 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 | |
| /-! Tensorization and conditioning for finite independent coordinates. -/ | |
| section | |
| open scoped BigOperators | |
| variable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq ι] | |
| noncomputable def coordinateMarginal (p : (ι → α) → ℝ) (i : ι) (a : α) : ℝ := by | |
| classical | |
| exact ∑ x, if x i = a then p x else 0 | |
| noncomputable def independentProduct (q : ι → α → ℝ) (x : ι → α) : ℝ := ∏ i, q i (x i) | |
| theorem coordinateMarginal_isProbability (p : (ι → α) → ℝ) (hp : IsProbability p) (i : ι) : | |
| IsProbability (coordinateMarginal p i) := by | |
| classical | |
| constructor | |
| · intro a | |
| apply Finset.sum_nonneg | |
| intro x _ | |
| split_ifs | |
| · exact hp.1 x | |
| · exact le_rfl | |
| · simp only [coordinateMarginal] | |
| rw [Finset.sum_comm] | |
| simpa using hp.2 | |
| theorem point_le_coordinateMarginal (p : (ι → α) → ℝ) (hp : IsProbability p) | |
| (i : ι) (x : ι → α) : p x ≤ coordinateMarginal p i (x i) := by | |
| classical | |
| have h := Finset.single_le_sum | |
| (f := fun y : ι → α => if y i = x i then p y else 0) | |
| (fun y _ => by split_ifs; exact hp.1 y; exact le_rfl) (Finset.mem_univ x) | |
| simpa [coordinateMarginal] using h | |
| theorem marginal_expectation (p : (ι → α) → ℝ) (i : ι) (f : α → ℝ) : | |
| (∑ x, p x * f (x i)) = ∑ a, coordinateMarginal p i a * f a := by | |
| classical | |
| simp only [coordinateMarginal, Finset.sum_mul] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| simp [ite_mul] | |
| theorem independentProduct_isProbability (q : ι → α → ℝ) (hq : ∀ i, IsProbability (q i)) : | |
| IsProbability (independentProduct q) := by | |
| classical | |
| constructor | |
| · intro x | |
| exact Finset.prod_nonneg (fun i _ => (hq i).1 (x i)) | |
| · simp only [independentProduct, ← Fintype.prod_sum, (hq _).2, Finset.prod_const_one] | |
| theorem joint_supportedBy_product_coordinateMarginals (p : (ι → α) → ℝ) | |
| (hp : IsProbability p) : SupportedBy p (independentProduct (coordinateMarginal p)) := by | |
| intro x hx | |
| apply Finset.prod_ne_zero_iff.mpr | |
| intro i _ | |
| exact ne_of_gt ((lt_of_le_of_ne (hp.1 x) (Ne.symm hx)).trans_le | |
| (point_le_coordinateMarginal p hp i x)) | |
| theorem relativeEntropy_independent_reference (p : (ι → α) → ℝ) (q : ι → α → ℝ) | |
| (hp : IsProbability p) (_hq : ∀ i, IsProbability (q i)) | |
| (hs : ∀ i, SupportedBy (coordinateMarginal p i) (q i)) : | |
| relativeEntropy p (independentProduct q) = | |
| relativeEntropy p (independentProduct (coordinateMarginal p)) + | |
| ∑ i, relativeEntropy (coordinateMarginal p i) (q i) := by | |
| classical | |
| have hpoint : ∀ x : ι → α, p x * Real.log (p x / independentProduct q x) = | |
| p x * Real.log (p x / independentProduct (coordinateMarginal p) x) + | |
| ∑ i, p x * Real.log (coordinateMarginal p i (x i) / q i (x i)) := by | |
| intro x | |
| by_cases hx : p x = 0 | |
| · simp [hx] | |
| have hm : ∀ i, coordinateMarginal p i (x i) ≠ 0 := by | |
| intro i | |
| exact ne_of_gt ((lt_of_le_of_ne (hp.1 x) (Ne.symm hx)).trans_le | |
| (point_le_coordinateMarginal p hp i x)) | |
| have hqne : ∀ i, q i (x i) ≠ 0 := fun i => hs i (x i) (hm i) | |
| have hmp : (∏ i, coordinateMarginal p i (x i)) ≠ 0 := | |
| Finset.prod_ne_zero_iff.mpr (fun i _ => hm i) | |
| have hqp : (∏ i, q i (x i)) ≠ 0 := | |
| Finset.prod_ne_zero_iff.mpr (fun i _ => hqne i) | |
| simp only [independentProduct, Real.log_div hx hmp, Real.log_div hx hqp, | |
| Real.log_prod (fun i _ => hm i), Real.log_prod (fun i _ => hqne i)] | |
| simp_rw [Real.log_div (hm _) (hqne _)] | |
| rw [← Finset.mul_sum, Finset.sum_sub_distrib] | |
| ring | |
| calc | |
| relativeEntropy p (independentProduct q) = | |
| ∑ x, (p x * Real.log (p x / independentProduct (coordinateMarginal p) x) + | |
| ∑ i, p x * Real.log (coordinateMarginal p i (x i) / q i (x i))) := by | |
| exact Finset.sum_congr rfl (fun x _ => hpoint x) | |
| _ = relativeEntropy p (independentProduct (coordinateMarginal p)) + | |
| ∑ i, ∑ x, p x * Real.log (coordinateMarginal p i (x i) / q i (x i)) := by | |
| rw [Finset.sum_add_distrib, Finset.sum_comm] | |
| rfl | |
| _ = relativeEntropy p (independentProduct (coordinateMarginal p)) + | |
| ∑ i, relativeEntropy (coordinateMarginal p i) (q i) := by | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| exact marginal_expectation p i (fun a => Real.log (coordinateMarginal p i a / q i a)) | |
| theorem coordinate_relativeEntropy_sum_le (p : (ι → α) → ℝ) (q : ι → α → ℝ) | |
| (hp : IsProbability p) (hq : ∀ i, IsProbability (q i)) | |
| (hs : ∀ i, SupportedBy (coordinateMarginal p i) (q i)) : | |
| (∑ i, relativeEntropy (coordinateMarginal p i) (q i)) ≤ | |
| relativeEntropy p (independentProduct q) := by | |
| rw [relativeEntropy_independent_reference p q hp hq hs] | |
| exact le_add_of_nonneg_left (relativeEntropy_nonneg _ _ hp | |
| (independentProduct_isProbability _ (coordinateMarginal_isProbability p hp)) | |
| (joint_supportedBy_product_coordinateMarginals p hp)) | |
| theorem coordinate_totalVariation_sq_sum_le (p : (ι → α) → ℝ) (q : ι → α → ℝ) | |
| (hp : IsProbability p) (hq : ∀ i, IsProbability (q i)) | |
| (hs : ∀ i, SupportedBy (coordinateMarginal p i) (q i)) : | |
| (∑ i, totalVariation (coordinateMarginal p i) (q i) ^ 2) ≤ | |
| relativeEntropy p (independentProduct q) := by | |
| exact (Finset.sum_le_sum (fun i _ => totalVariation_sq_le_relativeEntropy _ _ | |
| (coordinateMarginal_isProbability p hp i) (hq i) (hs i))).trans | |
| (coordinate_relativeEntropy_sum_le p q hp hq hs) | |
| theorem posterior_coordinate_supportedBy (q : ι → α → ℝ) (w : (ι → α) → ℝ) | |
| (z : ℝ) (i : ι) : | |
| SupportedBy (coordinateMarginal (posterior (independentProduct q) w z) i) (q i) := by | |
| classical | |
| intro a ha hqa | |
| apply ha | |
| unfold coordinateMarginal | |
| apply Finset.sum_eq_zero | |
| intro x _ | |
| by_cases hxa : x i = a | |
| · have hzprod : independentProduct q x = 0 := by | |
| exact Finset.prod_eq_zero (Finset.mem_univ i) (by simpa only [hxa] using hqa) | |
| simp [hxa, posterior, hzprod] | |
| · simp [hxa] | |
| /-- The finite independent-coordinate conditioning inequality underlying | |
| Holenstein Lemma 4.1, with natural logarithms. `w x` is the conditional | |
| probability of the event given the coordinate tuple `x`. -/ | |
| theorem posterior_coordinate_totalVariation_sq_sum_le_log | |
| (q : ι → α → ℝ) (hq : ∀ i, IsProbability (q i)) (w : (ι → α) → ℝ) | |
| (hw : ∀ x, 0 ≤ w x) (hw_one : ∀ x, w x ≤ 1) {z : ℝ} (hz : 0 < z) | |
| (hmass : ∑ x, independentProduct q x * w x = z) : | |
| (∑ i, totalVariation | |
| (coordinateMarginal (posterior (independentProduct q) w z) i) (q i) ^ 2) ≤ | |
| Real.log (1 / z) := by | |
| have hp := independentProduct_isProbability q hq | |
| exact (coordinate_totalVariation_sq_sum_le _ q | |
| (posterior_isProbability _ w hp hw hz hmass) hq | |
| (posterior_coordinate_supportedBy q w z)).trans | |
| (posterior_relativeEntropy_le _ w hp hw hw_one hz hmass) | |
| /-- The summed-distance form (4.2), with natural logarithms. -/ | |
| theorem posterior_coordinate_totalVariation_sum_le_sqrt | |
| (q : ι → α → ℝ) (hq : ∀ i, IsProbability (q i)) (w : (ι → α) → ℝ) | |
| (hw : ∀ x, 0 ≤ w x) (hw_one : ∀ x, w x ≤ 1) {z : ℝ} (hz : 0 < z) | |
| (hmass : ∑ x, independentProduct q x * w x = z) : | |
| (∑ i, totalVariation | |
| (coordinateMarginal (posterior (independentProduct q) w z) i) (q i)) ≤ | |
| Real.sqrt ((Fintype.card ι : ℝ) * Real.log (1 / z)) := by | |
| let d : ι → ℝ := fun i => totalVariation | |
| (coordinateMarginal (posterior (independentProduct q) w z) i) (q i) | |
| have hsq := posterior_coordinate_totalVariation_sq_sum_le_log q hq w hw hw_one hz hmass | |
| have hcs := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset ι) d (fun _ => (1 : ℝ)) | |
| simp only [mul_one, one_pow, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] at hcs | |
| have hln : 0 ≤ Real.log (1 / z) := by | |
| have hp := independentProduct_isProbability q hq | |
| exact (relativeEntropy_nonneg _ _ (posterior_isProbability _ w hp hw hz hmass) hp | |
| (posterior_supportedBy _ w z)).trans | |
| (posterior_relativeEntropy_le _ w hp hw hw_one hz hmass) | |
| have hcard : 0 ≤ (Fintype.card ι : ℝ) := Nat.cast_nonneg _ | |
| have hmul := mul_le_mul_of_nonneg_left hsq hcard | |
| have hsqrt := Real.sq_sqrt (mul_nonneg hcard hln) | |
| have hsqrtpos := Real.sqrt_nonneg ((Fintype.card ι : ℝ) * Real.log (1 / z)) | |
| change (∑ i, d i) ≤ _ | |
| change (∑ i, d i ^ 2) ≤ _ at hsq | |
| change (Fintype.card ι : ℝ) * (∑ i, d i ^ 2) ≤ _ at hmul | |
| nlinarith | |
| /-- The base-two-logarithm normalization of the squared-distance bound. -/ | |
| theorem posterior_coordinate_totalVariation_sq_sum_le_binaryLog | |
| (q : ι → α → ℝ) (hq : ∀ i, IsProbability (q i)) (w : (ι → α) → ℝ) | |
| (hw : ∀ x, 0 ≤ w x) (hw_one : ∀ x, w x ≤ 1) {z : ℝ} (hz : 0 < z) | |
| (hmass : ∑ x, independentProduct q x * w x = z) : | |
| (∑ i, totalVariation | |
| (coordinateMarginal (posterior (independentProduct q) w z) i) (q i) ^ 2) ≤ | |
| Real.log (1 / z) / Real.log 2 := by | |
| exact le_binaryLog_of_le_log (Finset.sum_nonneg (fun _ _ => sq_nonneg _)) | |
| (posterior_coordinate_totalVariation_sq_sum_le_log q hq w hw hw_one hz hmass) | |
| end | |
| /-! Finite log-sum estimates, including the side-information entropy budget. -/ | |
| section | |
| open scoped BigOperators | |
| variable {α : Type*} [Fintype α] | |
| theorem normalize_isProbability (b : α → ℝ) (hb : ∀ a, 0 ≤ b a) | |
| {B : ℝ} (hB : 0 < B) (hmass : ∑ a, b a = B) : | |
| IsProbability (fun a => b a / B) := by | |
| constructor | |
| · intro a | |
| exact div_nonneg (hb a) hB.le | |
| · simp only [div_eq_mul_inv, ← Finset.sum_mul, hmass, mul_inv_cancel₀ hB.ne'] | |
| theorem relativeEntropy_normalize_right (p b : α → ℝ) (hp : IsProbability p) | |
| (hs : SupportedBy p b) {B : ℝ} (hB : 0 < B) : | |
| relativeEntropy p (fun a => b a / B) = relativeEntropy p b + Real.log B := by | |
| have hpoint : ∀ a, p a * Real.log (p a / (b a / B)) = | |
| p a * Real.log (p a / b a) + p a * Real.log B := by | |
| intro a | |
| by_cases hpa : p a = 0 | |
| · simp [hpa] | |
| have hbne := hs a hpa | |
| rw [Real.log_div hpa (div_ne_zero hbne hB.ne'), Real.log_div hbne hB.ne', | |
| Real.log_div hpa hbne] | |
| ring | |
| simp only [relativeEntropy, hpoint, Finset.sum_add_distrib, ← Finset.sum_mul, hp.2, one_mul] | |
| theorem neg_relativeEntropy_le_log_mass (p b : α → ℝ) (hp : IsProbability p) | |
| (hb : ∀ a, 0 ≤ b a) (hs : SupportedBy p b) {B : ℝ} (hB : 0 < B) | |
| (hmass : ∑ a, b a = B) : -relativeEntropy p b ≤ Real.log B := by | |
| have hs' : SupportedBy p (fun a => b a / B) := | |
| fun a ha => div_ne_zero (hs a ha) hB.ne' | |
| have hnonneg := relativeEntropy_nonneg p (fun a => b a / B) hp | |
| (normalize_isProbability b hb hB hmass) hs' | |
| rw [relativeEntropy_normalize_right p b hp hs hB] at hnonneg | |
| linarith | |
| /-- Entropy budget for a finite posterior indexed by side information. | |
| The baseline masses `b` may have total mass `B`, rather than one. In the | |
| application, `b(t,v)=P_T(t)` and `B` is the number of possible side labels. -/ | |
| theorem posterior_weighted_log_inverse_le (p b c : α → ℝ) (hp : IsProbability p) | |
| (hb : ∀ a, 0 ≤ b a) {z B : ℝ} (hz : 0 < z) (hB : 0 < B) | |
| (hmass : ∑ a, b a = B) (hpost : ∀ a, p a = b a * c a / z) : | |
| (∑ a, p a * Real.log (1 / c a)) ≤ Real.log (B / z) := by | |
| have hs : SupportedBy p b := by | |
| intro a ha hba | |
| apply ha | |
| rw [hpost, hba, zero_mul, zero_div] | |
| have hpoint : ∀ a, p a * Real.log (1 / c a) = | |
| p a * Real.log (1 / z) - p a * Real.log (p a / b a) := by | |
| intro a | |
| by_cases hpa : p a = 0 | |
| · simp [hpa] | |
| have hbne := hs a hpa | |
| have hcne : c a ≠ 0 := by | |
| intro hca | |
| apply hpa | |
| rw [hpost, hca, mul_zero, zero_div] | |
| have hratio : p a / b a = c a / z := by | |
| rw [hpost] | |
| field_simp [hbne, hz.ne'] | |
| rw [hratio, Real.log_div hcne hz.ne', Real.log_div one_ne_zero hcne, | |
| Real.log_div one_ne_zero hz.ne', Real.log_one] | |
| ring | |
| have hid : (∑ a, p a * Real.log (1 / c a)) = | |
| Real.log (1 / z) - relativeEntropy p b := by | |
| simp only [hpoint, Finset.sum_sub_distrib, ← Finset.sum_mul, hp.2, one_mul, | |
| relativeEntropy] | |
| have hkl := neg_relativeEntropy_le_log_mass p b hp hb hs hB hmass | |
| rw [hid, Real.log_div hB.ne' hz.ne', Real.log_div one_ne_zero hz.ne', Real.log_one] | |
| linarith | |
| end | |
| /-! Finite side-information conditioning bound from tensorization and log-sum. | |
| All zero likelihood rows have an explicit normalized fallback. -/ | |
| open scoped BigOperators | |
| noncomputable def posteriorOrOriginal | |
| {A : Type*} [Fintype A] (p e : A → ℝ) (z : ℝ) : A → ℝ := by | |
| classical | |
| exact if 0 < z then posterior p e z else p | |
| theorem posteriorOrOriginal_isProbability | |
| {A : Type*} [Fintype A] (p e : A → ℝ) | |
| (hp : IsProbability p) (he : ∀ a, 0 ≤ e a) | |
| {z : ℝ} (hmass : ∑ a, p a * e a = z) : | |
| IsProbability (posteriorOrOriginal p e z) := by | |
| classical | |
| by_cases hz : 0 < z | |
| · simpa only [posteriorOrOriginal, ite_eq_left hz] using | |
| posterior_isProbability p e hp he hz hmass | |
| · simpa only [posteriorOrOriginal, ite_eq_right hz] using hp | |
| theorem mass_mul_posteriorOrOriginal | |
| {A : Type*} [Fintype A] (p e : A → ℝ) | |
| (hp : IsProbability p) (he : ∀ a, 0 ≤ e a) | |
| {c : ℝ} (hmass : ∑ a, p a * e a = c) (x : A) : | |
| c * posteriorOrOriginal p e c x = p x * e x := by | |
| classical | |
| by_cases hc : 0 < c | |
| · simp only [posteriorOrOriginal, ite_eq_left hc, posterior] | |
| field_simp [hc.ne'] | |
| · have hcnonneg : 0 ≤ c := by | |
| rw [← hmass] | |
| exact Finset.sum_nonneg (fun a _ => mul_nonneg (hp.1 a) (he a)) | |
| have hc0 : c = 0 := le_antisymm (le_of_not_gt hc) hcnonneg | |
| have hpoint := Finset.single_le_sum | |
| (fun a (_ : a ∈ (Finset.univ : Finset A)) => mul_nonneg (hp.1 a) (he a)) | |
| (Finset.mem_univ x) | |
| rw [hmass, hc0] at hpoint | |
| have hzero : p x * e x = 0 := le_antisymm hpoint (mul_nonneg (hp.1 x) (he x)) | |
| simp [posteriorOrOriginal, hc0, hzero] | |
| theorem weighted_coordinate_posterior_recombine | |
| {I A : Type*} [Fintype I] [Fintype A] [DecidableEq I] [DecidableEq A] | |
| (p e : (I → A) → ℝ) (hp : IsProbability p) (he : ∀ x, 0 ≤ e x) | |
| {c : ℝ} (hmass : ∑ x, p x * e x = c) (b z : ℝ) (i : I) (a : A) : | |
| (b * c / z) * coordinateMarginal (posteriorOrOriginal p e c) i a = | |
| (b / z) * ∑ x, if x i = a then p x * e x else 0 := by | |
| classical | |
| simp only [coordinateMarginal, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hxa : x i = a | |
| · simp only [ite_eq_left hxa] | |
| calc | |
| (b * c / z) * posteriorOrOriginal p e c x = | |
| (b / z) * (c * posteriorOrOriginal p e c x) := by ring | |
| _ = (b / z) * (p x * e x) := by | |
| rw [mass_mul_posteriorOrOriginal p e hp he hmass x] | |
| · simp [hxa] | |
| variable {J I A : Type*} | |
| variable [Fintype J] [Fintype I] [Fintype A] [DecidableEq I] | |
| theorem side_information_bound | |
| (w b c : J → ℝ) | |
| (q : J → I → A → ℝ) | |
| (e : J → (I → A) → ℝ) | |
| (hw : IsProbability w) | |
| (hb : ∀ j, 0 ≤ b j) | |
| (hq : ∀ j i, IsProbability (q j i)) | |
| (he : ∀ j x, 0 ≤ e j x) | |
| (he_one : ∀ j x, e j x ≤ 1) | |
| (hmass : ∀ j, ∑ x, independentProduct (q j) x * e j x = c j) | |
| {z B : ℝ} (hz : 0 < z) (hB : 0 < B) | |
| (hbase : ∑ j, b j = B) | |
| (hweight : ∀ j, w j = b j * c j / z) : | |
| (∑ i, totalVariation | |
| (fun ja : J × A => w ja.1 * coordinateMarginal | |
| (posteriorOrOriginal (independentProduct (q ja.1)) | |
| (e ja.1) (c ja.1)) i ja.2) | |
| (fun ja : J × A => w ja.1 * q ja.1 i ja.2)) ≤ | |
| Real.sqrt ((Fintype.card I : ℝ) * Real.log (B / z)) := by | |
| classical | |
| let d : J → I → ℝ := fun j i => totalVariation | |
| (coordinateMarginal | |
| (posteriorOrOriginal (independentProduct (q j)) (e j) (c j)) i) | |
| (q j i) | |
| have hbudget : ∀ j, | |
| w j * (∑ i, d j i ^ 2) ≤ w j * Real.log (1 / c j) := by | |
| intro j | |
| by_cases hwzero : w j = 0 | |
| · simp [hwzero] | |
| have hcne : c j ≠ 0 := by | |
| intro hczero | |
| apply hwzero | |
| rw [hweight j, hczero, mul_zero, zero_div] | |
| have hcnonneg : 0 ≤ c j := by | |
| rw [← hmass j] | |
| exact Finset.sum_nonneg (fun x _ => mul_nonneg | |
| ((independentProduct_isProbability (q j) (hq j)).1 x) (he j x)) | |
| have hcpos : 0 < c j := lt_of_le_of_ne hcnonneg (Ne.symm hcne) | |
| have hlocal := posterior_coordinate_totalVariation_sq_sum_le_log | |
| (q j) (hq j) (e j) (he j) (he_one j) hcpos (hmass j) | |
| have hweighted := mul_le_mul_of_nonneg_left hlocal (hw.1 j) | |
| simpa only [d, posteriorOrOriginal, ite_eq_left hcpos] using hweighted | |
| have hcs := weighted_coordinate_sum_sq_le | |
| w d (fun j => Real.log (1 / c j)) hw hbudget | |
| have hlog := posterior_weighted_log_inverse_le w b c hw hb hz hB hbase hweight | |
| have hsq : (∑ i, ∑ j, w j * d j i)^2 ≤ | |
| (Fintype.card I : ℝ) * Real.log (B / z) := | |
| hcs.trans (mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg _)) | |
| have htv : ∀ i, totalVariation | |
| (fun ja : J × A => w ja.1 * coordinateMarginal | |
| (posteriorOrOriginal (independentProduct (q ja.1)) | |
| (e ja.1) (c ja.1)) i ja.2) | |
| (fun ja : J × A => w ja.1 * q ja.1 i ja.2) = | |
| ∑ j, w j * d j i := by | |
| intro i | |
| exact totalVariation_joint_common_weights w | |
| (fun j => coordinateMarginal | |
| (posteriorOrOriginal (independentProduct (q j)) (e j) (c j)) i) | |
| (fun j => q j i) hw.1 | |
| simp_rw [htv] | |
| have hradicand : 0 ≤ (Fintype.card I : ℝ) * Real.log (B / z) := | |
| (sq_nonneg _).trans hsq | |
| have hsqrt := Real.sq_sqrt hradicand | |
| have hsqrt_nonneg := Real.sqrt_nonneg ((Fintype.card I : ℝ) * Real.log (B / z)) | |
| nlinarith | |
| variable {T V : Type*} [Fintype T] [Fintype V] [Nonempty V] | |
| /-- Finite Corollary 4.3 in natural-log normalization, for actual likelihood | |
| profiles of the event jointly with the finite side label. -/ | |
| theorem finite_side_information_bound | |
| (pT : T → ℝ) (q : T → I → A → ℝ) | |
| (e : T × V → (I → A) → ℝ) (c w : T × V → ℝ) | |
| (hpT : IsProbability pT) | |
| (hq : ∀ t i, IsProbability (q t i)) | |
| (he : ∀ tv x, 0 ≤ e tv x) | |
| (he_sum : ∀ t x, (∑ v, e (t, v) x) ≤ 1) | |
| (hc : ∀ tv, ∑ x, independentProduct (q tv.1) x * e tv x = c tv) | |
| {z : ℝ} (hz : 0 < z) | |
| (hZ : ∑ tv, pT tv.1 * c tv = z) | |
| (hweight : ∀ tv, w tv = pT tv.1 * c tv / z) : | |
| (∑ i, totalVariation | |
| (fun tva : (T × V) × A => w tva.1 * coordinateMarginal | |
| (posteriorOrOriginal (independentProduct (q tva.1.1)) | |
| (e tva.1) (c tva.1)) i tva.2) | |
| (fun tva : (T × V) × A => w tva.1 * q tva.1.1 i tva.2)) ≤ | |
| Real.sqrt ((Fintype.card I : ℝ) * | |
| (Real.log (Fintype.card V : ℝ) + Real.log (1 / z))) := by | |
| classical | |
| have hcnonneg : ∀ tv, 0 ≤ c tv := by | |
| intro tv | |
| rw [← hc tv] | |
| exact Finset.sum_nonneg (fun x _ => mul_nonneg | |
| ((independentProduct_isProbability (q tv.1) (hq tv.1)).1 x) (he tv x)) | |
| have hw : IsProbability w := by | |
| constructor | |
| · intro tv | |
| rw [hweight tv] | |
| exact div_nonneg (mul_nonneg (hpT.1 tv.1) (hcnonneg tv)) hz.le | |
| · simp_rw [hweight, div_eq_mul_inv] | |
| rw [← Finset.sum_mul, hZ, mul_inv_cancel₀ hz.ne'] | |
| have he_one : ∀ tv x, e tv x ≤ 1 := by | |
| intro tv x | |
| have hsingle : e tv x ≤ ∑ v, e (tv.1, v) x := | |
| Finset.single_le_sum (fun v _ => he (tv.1, v) x) (Finset.mem_univ tv.2) | |
| exact hsingle.trans (he_sum tv.1 x) | |
| have hB : 0 < (Fintype.card V : ℝ) := Nat.cast_pos.mpr Fintype.card_pos | |
| have hbase : (∑ tv : T × V, pT tv.1) = (Fintype.card V : ℝ) := by | |
| simp only [Fintype.sum_prod_type, Finset.sum_const, Finset.card_univ, | |
| nsmul_eq_mul, ← Finset.mul_sum, hpT.2, mul_one] | |
| have h := side_information_bound w (fun tv : T × V => pT tv.1) c | |
| (fun tv => q tv.1) e hw (fun tv => hpT.1 tv.1) (fun tv => hq tv.1) | |
| he he_one hc hz hB hbase hweight | |
| have hlog : Real.log ((Fintype.card V : ℝ) / z) = | |
| Real.log (Fintype.card V : ℝ) + Real.log (1 / z) := by | |
| rw [Real.log_div hB.ne' hz.ne', Real.log_div one_ne_zero hz.ne', Real.log_one] | |
| ring | |
| simpa only [hlog] using h | |
| end MaxCutGames.Foundations.Information | |
| end OAI | |
Xet Storage Details
- Size:
- 24.5 kB
- Xet hash:
- 3af11138183ecd892f46ec16a609b042fdc4fd0bc6a552e6d61a06d52929d44a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.