File size: 9,250 Bytes
dd14c26 | 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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | import Mathlib
namespace OAI
/-!
# One-sample matroid selection
The rule and its finite seed law depend only on the known labeled matroid.
A decision sees the initial sample vector, the entire seed, and the arriving
label/value prefix. Every prefix is feasible, and decisions are irrevocable.
The arrival permutation may depend on all samples, values, and seed bits.
Only the actual offline optimum is required to be integrable.
-/
open scoped BigOperators
section
open MeasureTheory ProbabilityTheory
open scoped BigOperators
namespace MatroidProphet
abbrev Weights (n : ℕ) := Fin n → ℝ
abbrev Seed (bits : ℕ) := Fin bits → Bool
abbrev ArrivalOrder (n : ℕ) := Equiv.Perm (Fin n)
instance arrivalOrderMeasurableSpace (n : ℕ) : MeasurableSpace (ArrivalOrder n) := ⊤
abbrev History (n : ℕ) (k : Fin n) := Fin (k.val + 1) → Fin n × ℝ
structure OnlineRule (n bits : ℕ) where
decide : (k : Fin n) → Seed bits → Weights n → History n k → Bool
measurable_decide : ∀ k, Measurable
(fun x : Seed bits × (Weights n × History n k) => decide k x.1 x.2.1 x.2.2)
def prefixIndex {n : ℕ} (k : Fin n) (j : Fin (k.val + 1)) : Fin n :=
⟨j.val, Nat.lt_of_lt_of_le j.isLt (Nat.succ_le_of_lt k.isLt)⟩
def history {n : ℕ} (v : Weights n) (π : ArrivalOrder n) (k : Fin n) : History n k :=
fun j => let e := π (prefixIndex k j); (e, v e)
def decisionAt {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (π : ArrivalOrder n) (k : Fin n) : Bool :=
A.decide k r s (history v π k)
noncomputable def acceptedThrough {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (π : ArrivalOrder n) (t : ℕ) : Finset (Fin n) := by
classical
exact Finset.univ.filter fun e =>
(π.symm e).val < t ∧ decisionAt A r s v π (π.symm e) = true
noncomputable def accepted {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (π : ArrivalOrder n) : Finset (Fin n) :=
acceptedThrough A r s v π n
noncomputable def reward {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits)
(s v : Weights n) (π : ArrivalOrder n) : ℝ :=
∑ e ∈ accepted A r s v π, v e
noncomputable def optimum {n : ℕ} (M : Matroid (Fin n)) (v : Weights n) : ℝ := by
classical
exact Finset.univ.sup' Finset.univ_nonempty
(fun I : Finset (Fin n) => if M.Indep (I : Set (Fin n)) then ∑ e ∈ I, v e else 0)
def Feasible {n bits : ℕ} (M : Matroid (Fin n)) (A : OnlineRule n bits) : Prop :=
∀ (r : Seed bits) (s v : Weights n) (π : ArrivalOrder n) (t : ℕ),
(∀ e, 0 ≤ s e) → (∀ e, 0 ≤ v e) →
M.Indep (acceptedThrough A r s v π t : Set (Fin n))
def pairedCoordinates.{u} {n : ℕ} {Ω : Type u} (S V : Ω → Weights n)
(i : Fin n × Bool) : Ω → ℝ :=
if i.2 then fun ω => S ω i.1 else fun ω => V ω i.1
def OneSampleChallenge.{u} : Prop :=
∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ →
∃ (bits : ℕ) (ν : Measure (Seed bits)), IsProbabilityMeasure ν ∧
∃ (A : OnlineRule n bits), Feasible M A ∧
∀ {Ω : Type u} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ]
(S V : Ω → Weights n) (R : Ω → Seed bits),
Measurable S → Measurable V → Measurable R →
(∀ᵐ ω ∂μ, ∀ e, 0 ≤ S ω e) →
(∀ᵐ ω ∂μ, ∀ e, 0 ≤ V ω e) →
iIndepFun (pairedCoordinates S V) μ →
(∀ e, Measure.map (fun ω => S ω e) μ = Measure.map (fun ω => V ω e) μ) →
IndepFun (fun ω => (S ω, V ω)) R μ →
Measure.map R μ = ν →
Integrable (fun ω => optimum M (V ω)) μ →
∀ (π : Ω → ArrivalOrder n), Measurable π →
Integrable (fun ω => reward A (R ω) (S ω) (V ω) (π ω)) μ ∧
((2 : ℝ) ^ 310)⁻¹ * (∫ ω, optimum M (V ω) ∂μ) ≤
∫ ω, reward A (R ω) (S ω) (V ω) (π ω) ∂μ
end MatroidProphet
end
section
open MeasureTheory
open scoped BigOperators
namespace MatroidProphet
instance arrivalOrderMeasurableSingletonClass (n : ℕ) :
MeasurableSingletonClass (ArrivalOrder n) := ⟨fun _ => trivial⟩
structure HiddenRule (n bits : ℕ) where
mask : Seed bits → Finset (Fin n)
core : OnlineRule n bits
noncomputable def observed {n bits : ℕ} (A : HiddenRule n bits) (r : Seed bits)
(w : Weights n) : Weights n := by
classical
exact fun e => if e ∈ A.mask r then w e else 0
noncomputable def hiddenAcceptedThrough {n bits : ℕ} (A : HiddenRule n bits)
(r : Seed bits) (w : Weights n) (π : ArrivalOrder n) (t : ℕ) : Finset (Fin n) :=
acceptedThrough A.core r (observed A r w) w π t \ A.mask r
noncomputable def hiddenReward {n bits : ℕ} (A : HiddenRule n bits)
(r : Seed bits) (w : Weights n) (π : ArrivalOrder n) : ℝ :=
∑ e ∈ hiddenAcceptedThrough A r w π n, w e
noncomputable def hiddenWorstReward {n bits : ℕ} (A : HiddenRule n bits)
(w : Weights n) (r : Seed bits) : ℝ := by
classical
exact Finset.univ.inf' Finset.univ_nonempty (hiddenReward A r w)
end MatroidProphet
end
section
open MeasureTheory ProbabilityTheory
namespace MatroidProphet
def HiddenVectorChallenge : Prop :=
∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ →
∃ (bits : ℕ) (ν : Measure (Seed bits)), IsProbabilityMeasure ν ∧
∃ (A : HiddenRule n bits),
(∀ (w : Weights n), (∀ e, 0 ≤ w e) →
∀ (r : Seed bits) (π : ArrivalOrder n) (t : ℕ),
M.Indep (hiddenAcceptedThrough A r w π t : Set (Fin n))) ∧
∀ (w : Weights n), (∀ e, 0 ≤ w e) →
((2 : ℝ) ^ 293)⁻¹ * optimum M w ≤
∫ r, hiddenWorstReward A w r ∂ν
end MatroidProphet
end
section
open MeasureTheory
namespace MatroidProphet
/-- A measurable secretary rule with an initially fixed observation-prefix length. -/
structure SecretaryRule (n : ℕ) (Q : Type*) [MeasurableSpace Q] where
prefixLength : Q → Fin (n + 1)
measurable_prefixLength : Measurable prefixLength
decide : (k : Fin n) → Q → History n k → Bool
measurable_decide : ∀ k, Measurable
(fun x : Q × History n k => decide k x.1 x.2)
/-- Full permutations describing the same ordered observation prefix. -/
def SamePrefix {n : ℕ} (K : ℕ) (σ π : ArrivalOrder n) : Prop :=
∀ k : Fin n, k.val < K → σ k = π k
/-- Execution forces rejection of every observation-prefix arrival. -/
def secretaryDecisionAt {n : ℕ} {Q : Type*} [MeasurableSpace Q]
(A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n)
(k : Fin n) : Bool :=
if k.val < (A.prefixLength q).val then false else A.decide k q (history w π k)
/-- Irrevocable accepted labels through an arbitrary number of arrivals. -/
noncomputable def secretaryAcceptedThrough {n : ℕ} {Q : Type*} [MeasurableSpace Q]
(A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n)
(t : ℕ) : Finset (Fin n) := by
classical
exact Finset.univ.filter fun e =>
(π.symm e).val < t ∧ secretaryDecisionAt A q w π (π.symm e) = true
noncomputable def secretaryReward {n : ℕ} {Q : Type*} [MeasurableSpace Q]
(A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n) : ℝ :=
∑ e ∈ secretaryAcceptedThrough A q w π n, w e
/-- Feasibility is pointwise for every seed, vector, order, and arrival prefix. -/
def SecretaryFeasible {n : ℕ} {Q : Type*} [MeasurableSpace Q]
(M : Matroid (Fin n)) (A : SecretaryRule n Q) : Prop :=
∀ (q : Q) (w : Weights n), (∀ e, 0 ≤ w e) →
∀ (π : ArrivalOrder n) (t : ℕ),
M.Indep (secretaryAcceptedThrough A q w π t : Set (Fin n))
end MatroidProphet
end
section
namespace MatroidProphet.Secretary
open MeasureTheory
/-- Uniform random arrival order, including the unique order on the empty ground set. -/
noncomputable def uniformArrivalLaw (n : ℕ) : Measure (ArrivalOrder n) :=
(PMF.uniformOfFintype (ArrivalOrder n)).toMeasure
end MatroidProphet.Secretary
end
section
open MeasureTheory ProbabilityTheory
namespace MatroidProphet
/-- The full order-oblivious conclusion of `cor:secretary`, including a
measurable history-only rule, every-prefix feasibility, prefix rejection,
arbitrary full-seed suffix adversaries, and the unchanged `2⁻²⁹³` ratio. -/
def SecretaryChallenge.{u} : Prop :=
∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ →
∃ (q : ℕ) (ν : Measure (Fin q)), IsProbabilityMeasure ν ∧
∃ (A : SecretaryRule n (Fin q)), SecretaryFeasible M A ∧
∀ (w : Weights n), (∀ e, 0 ≤ w e) →
∀ {Ω : Type u} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ]
(Q : Ω → Fin q) (σ π : Ω → ArrivalOrder n),
Measurable Q → Measurable σ → Measurable π →
Measure.map Q μ = ν →
Measure.map σ μ = Secretary.uniformArrivalLaw n →
IndepFun Q σ μ →
(∀ᵐ ω ∂μ, SamePrefix (A.prefixLength (Q ω)).val (σ ω) (π ω)) →
Integrable (fun ω => secretaryReward A (Q ω) w (π ω)) μ ∧
((2 : ℝ) ^ 293)⁻¹ * optimum M w ≤
∫ ω, secretaryReward A (Q ω) w (π ω) ∂μ
end MatroidProphet
end
end OAI
|