File size: 4,906 Bytes
92416a2 | 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | import Mathlib
import OAI.Computability.VertexCover.Information.Kernels
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.Repetition
open scoped BigOperators
open Information
variable {α β : Type*} [Fintype α] [Fintype β]
theorem totalVariation_triangle (p q r : α → ℝ) :
totalVariation p r ≤ totalVariation p q + totalVariation q r := by
have hpoint : ∀ a, |p a - r a| ≤ |p a - q a| + |q a - r a| := by
intro a
have := abs_add_le (p a - q a) (q a - r a)
simpa only [sub_add_sub_cancel] using this
have hsum := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset α)) => hpoint a)
simp only [Finset.sum_add_distrib] at hsum
unfold totalVariation
linarith
noncomputable def conditionWeights (p : α → ℝ) (event : α → Bool) (z : ℝ) : α → ℝ :=
fun a => if event a then p a / z else 0
theorem conditionWeights_isProbability (p : α → ℝ) (hp : IsProbability p)
(event : α → Bool) {z : ℝ} (hz : 0 < z)
(hmass : ∑ a, (if event a then p a else 0) = z) :
IsProbability (conditionWeights p event z) := by
constructor
· intro a
dsimp [conditionWeights]
split
· exact div_nonneg (hp.1 a) hz.le
· exact le_rfl
· have hpoint : ∀ a, conditionWeights p event z a =
(if event a then p a else 0) / z := by
intro a
simp only [conditionWeights]
split <;> simp
simp only [hpoint, div_eq_mul_inv, ← Finset.sum_mul, hmass, mul_inv_cancel₀ hz.ne']
theorem totalVariation_condition_le (p q : α → ℝ) (event : α → Bool)
{z : ℝ} (hz : 0 < z) :
totalVariation (conditionWeights p event z) (conditionWeights q event z) ≤
totalVariation p q / z := by
have hpoint : ∀ a,
|conditionWeights p event z a - conditionWeights q event z a| ≤
|p a - q a| / z := by
intro a
dsimp [conditionWeights]
split
· rw [← sub_div, abs_div, abs_of_pos hz]
· simp only [sub_self, abs_zero]
positivity
have hsum := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset α)) => hpoint a)
simp only [div_eq_mul_inv, ← Finset.sum_mul] at hsum
have hsum' : (∑ a, |conditionWeights p event z a - conditionWeights q event z a|) ≤
(∑ a, |p a - q a|) / z := by
simpa only [div_eq_mul_inv] using hsum
unfold totalVariation
calc
_ ≤ (∑ a, |p a - q a|) / z / 2 := div_le_div_of_nonneg_right hsum' (by norm_num)
_ = _ := by ring
theorem totalVariation_condition_half_le (p q : α → ℝ) (event : α → Bool) :
totalVariation (conditionWeights p event (1 / 2))
(conditionWeights q event (1 / 2)) ≤ 2 * totalVariation p q := by
have h := totalVariation_condition_le p q event (z := 1 / 2) (by norm_num)
convert h using 1 ; ring
theorem totalVariation_append_kernel (p q : α → ℝ) (kernel : α → β → ℝ)
(hk : ∀ a, IsProbability (kernel a)) :
totalVariation (fun ab : α × β => p ab.1 * kernel ab.1 ab.2)
(fun ab : α × β => q ab.1 * kernel ab.1 ab.2) = totalVariation p q := by
unfold totalVariation
congr 1
rw [Fintype.sum_prod_type]
apply Finset.sum_congr rfl
intro a _
have habs : ∀ b, |kernel a b| = kernel a b := fun b => abs_of_nonneg ((hk a).1 b)
simp only [← sub_mul, abs_mul, habs, ← Finset.mul_sum, (hk a).2,
mul_one]
noncomputable def kernelPushforward (p : α → ℝ) (kernel : α → β → ℝ) : β → ℝ :=
fun b => ∑ a, p a * kernel a b
theorem totalVariation_kernelPushforward_le (p q : α → ℝ) (kernel : α → β → ℝ)
(hk : ∀ a, IsProbability (kernel a)) :
totalVariation (kernelPushforward p kernel) (kernelPushforward q kernel) ≤
totalVariation p q := by
have hpoint : ∀ b,
|kernelPushforward p kernel b - kernelPushforward q kernel b| ≤
∑ a, |p a - q a| * kernel a b := by
intro b
simp only [kernelPushforward, ← Finset.sum_sub_distrib, ← sub_mul]
have h := Finset.abs_sum_le_sum_abs (fun a => (p a - q a) * kernel a b) Finset.univ
have habs : ∀ a, |kernel a b| = kernel a b := fun a => abs_of_nonneg ((hk a).1 b)
simpa only [abs_mul, habs] using h
have hsum := Finset.sum_le_sum (fun b (_ : b ∈ (Finset.univ : Finset β)) => hpoint b)
rw [Finset.sum_comm] at hsum
simp only [← Finset.mul_sum, (hk _).2, mul_one] at hsum
exact div_le_div_of_nonneg_right hsum (by norm_num : (0 : ℝ) ≤ 2)
end UniqueGames.Foundations.Repetition
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
|