Download data/lean/OAI/Combinatorics/BalancedRyser/Selection/SelectionCensorProbability.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.26 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Selection/SelectionCensorProbability.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/BalancedRyser/Selection/SelectionCensorProbability.lean
-
curl -L -o SelectionCensorProbability.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Selection/SelectionCensorProbability.lean
5.26 kB
| import Mathlib.Tactic | |
| import OAI.Combinatorics.BalancedRyser.Selection.SelectionProcessLaw | |
| namespace OAI | |
| namespace Balanced.Selection.Process | |
| noncomputable section | |
| attribute [local instance] Classical.propDecidable | |
| open scoped BigOperators | |
| variable {I V : Type*} [Fintype I] [Fintype V] | |
| omit [Fintype V] in | |
| theorem sum_drawWeight_over_slots (G : Input I V) (S : State I V) (w : V) : | |
| (β i : I, drawWeight G S i w) = | |
| if w β currentVertices G S then | |
| ((S.remaining.card : β) * (domain G S (G.slot w)).card)β»ΒΉ else 0 := by | |
| rw [Finset.sum_eq_single (G.slot w)] | |
| Β· simp only [drawWeight, domain, currentVertices, Finset.mem_filter] | |
| by_cases ha : w β S.alive <;> by_cases hr : G.slot w β S.remaining <;> | |
| simp [ha, hr] | |
| Β· intro i _ hi | |
| have hslot : G.slot w β i := Ne.symm hi | |
| simp [drawWeight, domain, hslot] | |
| Β· simp | |
| omit [Fintype V] in | |
| theorem sum_drawWeight_over_slots_le (G : Input I V) (S : State I V) | |
| (L : β) (hL : 0 < L) (hS : S.remaining.Nonempty) | |
| (hdom : β i β S.remaining, L β€ ((domain G S i).card : β)) (w : V) : | |
| (β i : I, drawWeight G S i w) β€ 1 / ((S.remaining.card : β) * L) := by | |
| have hcard : (0 : β) < S.remaining.card := by | |
| exact_mod_cast Finset.card_pos.mpr hS | |
| rw [sum_drawWeight_over_slots] | |
| split_ifs with hw | |
| Β· have hslot : G.slot w β S.remaining := (Finset.mem_filter.mp hw).2 | |
| rw [inv_eq_one_div] | |
| exact one_div_le_one_div_of_le (mul_pos hcard hL) | |
| (mul_le_mul_of_nonneg_left (hdom _ hslot) hcard.le) | |
| Β· positivity | |
| theorem drawWeight_event_le_card_div (G : Input I V) (S : State I V) | |
| (A : Finset V) (L : β) (hL : 0 < L) (hS : S.remaining.Nonempty) | |
| (hdom : β i β S.remaining, L β€ ((domain G S i).card : β)) : | |
| (β i : I, β w : V, if w β A then drawWeight G S i w else 0) β€ | |
| (A.card : β) / ((S.remaining.card : β) * L) := by | |
| rw [Finset.sum_comm] | |
| have hswap (w : V) : | |
| (β i : I, if w β A then drawWeight G S i w else 0) = | |
| if w β A then β i : I, drawWeight G S i w else 0 := by | |
| by_cases hw : w β A <;> simp [hw] | |
| simp_rw [hswap] | |
| rw [β Finset.sum_filter] | |
| simp only [Finset.filter_mem_eq_inter, Finset.univ_inter] | |
| calc | |
| (β w β A, β i : I, drawWeight G S i w) β€ | |
| β _w β A, 1 / ((S.remaining.card : β) * L) := by | |
| exact Finset.sum_le_sum fun w _ => | |
| sum_drawWeight_over_slots_le G S L hL hS hdom w | |
| _ = (A.card : β) / ((S.remaining.card : β) * L) := by | |
| simp [div_eq_mul_inv] | |
| theorem noiseWeight_vertex_event_eq_drawWeight (p : Parameters) (q : β) | |
| (G : Input I V) (S : State I V) (A : Finset V) : | |
| (β r : Noise I V, if r.2.1 β A then noiseWeight p q G S r else 0) = | |
| β i : I, β w : V, if w β A then drawWeight G S i w else 0 := by | |
| simp only [Noise, Fintype.sum_prod_type, noiseWeight] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| apply Finset.sum_congr rfl | |
| intro w _ | |
| by_cases hw : w β A | |
| Β· simp only [hw, ite_true, β Finset.mul_sum, sum_flagsWeight, mul_one] | |
| Β· simp [hw] | |
| theorem exceptional_noise_mass_le | |
| {G : Input I V} {q : β} {c C : β} (hG : GraphBounds G q c C) | |
| (p : Parameters) (S : State I V) (v : V) | |
| (L : β) (hL : 0 < L) (hS : S.remaining.Nonempty) | |
| (hdom : β i β S.remaining, L β€ ((domain G S i).card : β)) : | |
| (β r : Noise I V, if r.2.1 β G.exceptional v then noiseWeight p q G S r else 0) β€ | |
| (q : β) ^ (1 / 8 : β) / ((S.remaining.card : β) * L) := by | |
| rw [noiseWeight_vertex_event_eq_drawWeight] | |
| exact (drawWeight_event_le_card_div G S (G.exceptional v) L hL hS hdom).trans | |
| (div_le_div_of_nonneg_right (hG.2.2.2.2.2.1 v) | |
| (mul_nonneg (Nat.cast_nonneg _) hL.le)) | |
| theorem exceptional_noise_mass_le_source_bound | |
| {G : Input I V} {q t : β} (p : Parameters) (hp : p.Admissible) | |
| (hq : 0 < q) (hG : GraphBounds G q p.c p.C) | |
| (S : State I V) (v : V) (hpre : Precheck p q t G S) | |
| (hscale : p.smin β€ p.sizeScale q t) | |
| (hremaining : p.a * (q : β) β€ (S.remaining.card : β)) : | |
| (β r : Noise I V, if r.2.1 β G.exceptional v then noiseWeight p q G S r else 0) β€ | |
| 2 * (q : β) ^ (1 / 8 : β) / (p.a * p.smin * p.c * (q : β) ^ 2) := by | |
| have hc : 0 < p.c := hp.1 | |
| have ha : 0 < p.a := hp.2.2.2.2.1 | |
| have hqR : (0 : β) < q := by exact_mod_cast hq | |
| have hsmin : 0 < p.smin := Real.exp_pos _ | |
| let L : β := p.smin * p.c * q / 2 | |
| have hL : 0 < L := by dsimp [L]; positivity | |
| have hdom : β i β S.remaining, L β€ ((domain G S i).card : β) := by | |
| intro i hi | |
| apply le_trans _ (hpre.2.2.2.1 i hi).2 | |
| dsimp [L] | |
| gcongr | |
| have hprob := exceptional_noise_mass_le hG p S v L hL hpre.1 hdom | |
| calc | |
| (β r : Noise I V, if r.2.1 β G.exceptional v then noiseWeight p q G S r else 0) β€ | |
| (q : β) ^ (1 / 8 : β) / ((S.remaining.card : β) * L) := hprob | |
| _ β€ (q : β) ^ (1 / 8 : β) / ((p.a * q) * L) := | |
| div_le_div_of_nonneg_left (Real.rpow_nonneg (Nat.cast_nonneg _) _) | |
| (mul_pos (mul_pos ha hqR) hL) | |
| (mul_le_mul_of_nonneg_right hremaining hL.le) | |
| _ = 2 * (q : β) ^ (1 / 8 : β) / (p.a * p.smin * p.c * (q : β) ^ 2) := by | |
| dsimp [L] | |
| field_simp | |
| end | |
| end Balanced.Selection.Process | |
| end OAI | |