File size: 5,156 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 | import OAI.Probability.MatroidProphet.Model
namespace OAI
open MeasureTheory
open scoped BigOperators
namespace MatroidProphet
theorem decisionAt_congr {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v v' : Weights n) (Ο Ο' : ArrivalOrder n) (k : Fin n)
(h : history v Ο k = history v' Ο' k) :
decisionAt A r s v Ο k = decisionAt A r s v' Ο' k := by
simp only [decisionAt, h]
theorem acceptedThrough_mono {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (Ο : ArrivalOrder n) {t t' : β} (h : t β€ t') :
acceptedThrough A r s v Ο t β acceptedThrough A r s v Ο t' := by
classical
intro e he
simp only [acceptedThrough, Finset.mem_filter, Finset.mem_univ, true_and] at he β’
exact β¨lt_of_lt_of_le he.1 h, he.2β©
theorem acceptedThrough_arrived {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (Ο : ArrivalOrder n) (t : β) (e : Fin n)
(he : e β acceptedThrough A r s v Ο t) : (Ο.symm e).val < t := by
classical
exact ((Finset.mem_filter.mp he).2).1
theorem acceptedThrough_iff_decision {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (Ο : ArrivalOrder n) (t : β) (e : Fin n)
(he : (Ο.symm e).val < t) :
e β acceptedThrough A r s v Ο t β decisionAt A r s v Ο (Ο.symm e) = true := by
classical
simp only [acceptedThrough, Finset.mem_filter, Finset.mem_univ, true_and, he]
theorem sum_le_optimum {n : β} (M : Matroid (Fin n)) (v : Weights n)
(I : Finset (Fin n)) (hI : M.Indep (I : Set (Fin n))) :
(β e β I, v e) β€ optimum M v := by
classical
have h := Finset.le_sup' (s := (Finset.univ : Finset (Finset (Fin n))))
(f := fun J => if M.Indep (J : Set (Fin n)) then β e β J, v e else 0)
(Finset.mem_univ I)
change _ β€ Finset.univ.sup' Finset.univ_nonempty _
simpa only [ite_eq_left hI] using h
theorem measurable_optimum {n : β} (M : Matroid (Fin n)) : Measurable (optimum M) := by
classical
have hm (I : Finset (Fin n)) :
Measurable (fun v : Weights n =>
if M.Indep (I : Set (Fin n)) then β e β I, v e else 0) := by
by_cases hI : M.Indep (I : Set (Fin n))
Β· simpa [hI] using I.measurable_sum (fun e _ => measurable_pi_apply e)
Β· simp [hI]
have hsup := Finset.measurable_sup' (s := (Finset.univ : Finset (Finset (Fin n))))
Finset.univ_nonempty (fun I _ => hm I)
convert hsup using 1
ext v
simp only [optimum, Finset.sup'_apply]
theorem optimum_nonneg {n : β} (M : Matroid (Fin n)) (v : Weights n) :
0 β€ optimum M v := by
simpa using sum_le_optimum M v β
(by simp)
theorem reward_nonneg {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (Ο : ArrivalOrder n) (hv : β e, 0 β€ v e) :
0 β€ reward A r s v Ο := by
exact Finset.sum_nonneg fun e _ => hv e
theorem reward_le_optimum {n bits : β} (M : Matroid (Fin n)) (A : OnlineRule n bits)
(hA : Feasible M A) (r : Seed bits) (s v : Weights n) (Ο : ArrivalOrder n)
(hs : β e, 0 β€ s e) (hv : β e, 0 β€ v e) :
reward A r s v Ο β€ optimum M v :=
sum_le_optimum M v (accepted A r s v Ο) (hA r s v Ο n hs hv)
lemma measurable_history {n : β} (Ο : ArrivalOrder n) (k : Fin n) :
Measurable (fun v : Weights n => history v Ο k) := by
apply Measurable.of_eval
intro j
exact measurable_const.prodMk (measurable_pi_apply (Ο (prefixIndex k j)))
lemma measurable_decisionAt {n bits : β} (A : OnlineRule n bits)
(Ο : ArrivalOrder n) (k : Fin n) :
Measurable (fun x : Seed bits Γ (Weights n Γ Weights n) =>
decisionAt A x.1 x.2.1 x.2.2 Ο k) :=
(A.measurable_decide k).comp
(measurable_fst.prodMk ((measurable_fst.comp measurable_snd).prodMk
((measurable_history Ο k).comp (measurable_snd.comp measurable_snd))))
lemma reward_eq_sum {n bits : β} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (Ο : ArrivalOrder n) :
reward A r s v Ο =
β e : Fin n, if decisionAt A r s v Ο (Ο.symm e) = true then v e else 0 := by
classical
unfold reward accepted acceptedThrough
rw [Finset.sum_filter]
apply Finset.sum_congr rfl
intro e _
simp only [(Ο.symm e).isLt, true_and]
lemma measurable_reward_fixed_order {n bits : β} (A : OnlineRule n bits)
(Ο : ArrivalOrder n) :
Measurable (fun x : Seed bits Γ (Weights n Γ Weights n) =>
reward A x.1 x.2.1 x.2.2 Ο) := by
classical
simp_rw [reward_eq_sum]
apply Finset.measurable_sum
intro e _
have hd := measurable_decisionAt A Ο (Ο.symm e)
have ht : MeasurableSet {x : Seed bits Γ (Weights n Γ Weights n) |
decisionAt A x.1 x.2.1 x.2.2 Ο (Ο.symm e) = true} :=
hd (measurableSet_singleton true)
exact Measurable.ite ht
((measurable_pi_apply e).comp (measurable_snd.comp measurable_snd)) measurable_const
theorem measurable_reward {n bits : β} (A : OnlineRule n bits) :
Measurable (fun x : ArrivalOrder n Γ (Seed bits Γ (Weights n Γ Weights n)) =>
reward A x.2.1 x.2.2.1 x.2.2.2 x.1) :=
measurable_from_prod_countable_right (measurable_reward_fixed_order A)
end MatroidProphet
end OAI
|