Download data/lean/OAI/Computability/VertexCover/Repetition/Variation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.91 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Repetition/Variation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/VertexCover/Repetition/Variation.lean
-
curl -L -o Variation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Repetition/Variation.lean
4.91 kB
| 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 | |