File size: 5,255 Bytes
4a56cd6 | 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 | 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
|