Bandits.ArrayModel.prob_exists_pullCount_eq_and_sumRewards_mem_le
This page has the declaration's own card below, then its dependency graph, then a card for each dependency (type dependencies first, then the rest of the transitive closure). For a theorem, the graph and the dependency cards only follow its statement's dependencies (its proof is replaced by sorry, so what it proves doesn't depend on how); for everything else, both the type and the body/value are followed, since their content is part of what later declarations build on.
prob_exists_pullCount_eq_and_sumRewards_mem_le๐
Bandits.ArrayModel.prob_exists_pullCount_eq_and_sumRewards_mem_leNo docstring.
Bandits.ArrayModel.prob_exists_pullCount_eq_and_sumRewards_mem_le.{u_1} {๐ : Type u_1} {m๐ : MeasurableSpace ๐} [DecidableEq ๐] [Countable ๐] [StandardBorelSpace ๐] [Nonempty ๐] {alg : Learning.Algorithm ๐ โ} {ฮฝ : ProbabilityTheory.Kernel ๐ โ} [ProbabilityTheory.IsMarkovKernel ฮฝ] (a : ๐) (m : โ) {B : Set โ} (hB : MeasurableSet B) : (arrayMeasure ฮฝ) {ฯ | โ n, Learning.pullCount (action alg) a n ฯ = m โง Learning.sumRewards (action alg) (reward alg) a n ฯ โ B} โค (streamMeasure ฮฝ) {ฯ | โ i โ Finset.range m, ฯ i a โ B}Bandits.ArrayModel.prob_exists_pullCount_eq_and_sumRewards_mem_le.{u_1} {๐ : Type u_1} {m๐ : MeasurableSpace ๐} [DecidableEq ๐] [Countable ๐] [StandardBorelSpace ๐] [Nonempty ๐] {alg : Learning.Algorithm ๐ โ} {ฮฝ : ProbabilityTheory.Kernel ๐ โ} [ProbabilityTheory.IsMarkovKernel ฮฝ] (a : ๐) (m : โ) {B : Set โ} (hB : MeasurableSet B) : (arrayMeasure ฮฝ) {ฯ | โ n, Learning.pullCount (action alg) a n ฯ = m โง Learning.sumRewards (action alg) (reward alg) a n ฯ โ B} โค (streamMeasure ฮฝ) {ฯ | โ i โ Finset.range m, ฯ i a โ B}
Code
lemma prob_exists_pullCount_eq_and_sumRewards_mem_le (a : ๐) (m : โ) {B : Set โ}
(hB : MeasurableSet B) : ๐ {ฯ | โ n, pullCount A a n ฯ = m โง sumRewards A R a n ฯ โ B} โค
streamMeasure ฮฝ {ฯ | โ i โ range m, ฯ i a โ B}Type uses (9)
Body uses (2)
Used by (1)
Actions: Source ยท Open Issue
Proof
calc
_ โค ๐ {ฯ | โ i โ range m, ฯ.2 i a โ B} := by
apply measure_mono
intro ฯ โจn, hp, hnโฉ
rwa [sumRewards_eq alg a n ฯ, hp] at hn
_ = streamMeasure ฮฝ {ฯ | โ i โ range m, ฯ i a โ B} :=
(identDistrib_sum_range_snd a m).measure_mem_eq hBDependency graph
Type dependencies (9)
Algorithm๐
Learning.AlgorithmA stochastic, sequential algorithm.
Learning.Algorithm.{u_4, u_5} (๐ : Type u_4) (๐จ : Type u_5) [MeasurableSpace ๐] [MeasurableSpace ๐จ] : Type (max u_4 u_5)Learning.Algorithm.{u_4, u_5} (๐ : Type u_4) (๐จ : Type u_5) [MeasurableSpace ๐] [MeasurableSpace ๐จ] : Type (max u_4 u_5)
Code
structure Algorithm (๐ ๐จ : Type*) [MeasurableSpace ๐] [MeasurableSpace ๐จ] where /-- Policy or sampling rule: distribution of the next action. -/ policy : (n : โ) โ Kernel (Iic n โ ๐ ร ๐จ) ๐ /-- The policy is a Markov kernel. -/ [h_policy : โ n, IsMarkovKernel (policy n)] /-- Distribution of the first action. -/ p0 : Measure ๐ /-- The first action distribution is a probability measure. -/ [hp0 : IsProbabilityMeasure p0]
Used by (216)
Actions: Source ยท Open Issue
probSpace๐
Bandits.ArrayModel.probSpaceProbability space for the array model of stochastic bandits.
Bandits.ArrayModel.probSpace.{u_1, u_2} (๐ : Type u_1) (R : Type u_2) : Type (max u_1 u_2)Bandits.ArrayModel.probSpace.{u_1, u_2} (๐ : Type u_1) (R : Type u_2) : Type (max u_1 u_2)
Code
def probSpace : Type _ := (โ โ I) ร (โ โ ๐ โ R)
Actions: Source ยท Open Issue
instMeasurableSpaceProbSpace๐
Bandits.ArrayModel.instMeasurableSpaceProbSpaceNo docstring.
Bandits.ArrayModel.instMeasurableSpaceProbSpace.{u_3, u_4} {๐ : Type u_3} {R : Type u_4} [MeasurableSpace R] : MeasurableSpace (probSpace ๐ R)Bandits.ArrayModel.instMeasurableSpaceProbSpace.{u_3, u_4} {๐ : Type u_3} {R : Type u_4} [MeasurableSpace R] : MeasurableSpace (probSpace ๐ R)
Code
instance {๐ R : Type*} [MeasurableSpace R] : MeasurableSpace (probSpace ๐ R)Type uses (1)
Actions: Source ยท Open Issue
Proof
inferInstanceAs (MeasurableSpace ((โ โ I) ร (โ โ ๐ โ R)))
arrayMeasure๐
Bandits.ArrayModel.arrayMeasureProbability measure for the array model of stochastic bandits.
Bandits.ArrayModel.arrayMeasure.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} (ฮฝ : ProbabilityTheory.Kernel ๐ R) : MeasureTheory.Measure (probSpace ๐ R)Bandits.ArrayModel.arrayMeasure.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} (ฮฝ : ProbabilityTheory.Kernel ๐ R) : MeasureTheory.Measure (probSpace ๐ R)
Code
noncomputable def arrayMeasure (ฮฝ : Kernel ๐ R) : Measure (probSpace ๐ R) := (Measure.infinitePi fun _ โฆ volume).prod (streamMeasure ฮฝ)
Type uses (2)
Body uses (1)
Actions: Source ยท Open Issue
pullCount๐
Learning.pullCount
Number of times action a was chosen up to time t (excluding t).
Learning.pullCount.{u_1, u_3} {๐ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐] (A : โ โ ฮฉ โ ๐) (a : ๐) (t : โ) (ฯ : ฮฉ) : โLearning.pullCount.{u_1, u_3} {๐ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐] (A : โ โ ฮฉ โ ๐) (a : ๐) (t : โ) (ฯ : ฮฉ) : โ
Code
noncomputable def pullCount (A : โ โ ฮฉ โ ๐) (a : ๐) (t : โ) (ฯ : ฮฉ) : โ := #(filter (fun s โฆ A s ฯ = a) (range t))
Actions: Source ยท Open Issue
action๐
Bandits.ArrayModel.action
Action taken at time n in the array model.
Bandits.ArrayModel.action.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : ๐Bandits.ArrayModel.action.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : ๐
Code
noncomputable def action [DecidableEq ๐] (alg : Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : ๐ := (hist alg ฯ n โจn, by simpโฉ).1
Body uses (1)
Used by (43)
Actions: Source ยท Open Issue
sumRewards๐
Learning.sumRewards
Sum of rewards obtained when pulling action a up to time t (exclusive).
Learning.sumRewards.{u_1, u_3} {๐ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐] (A : โ โ ฮฉ โ ๐) (R' : โ โ ฮฉ โ โ) (a : ๐) (t : โ) (ฯ : ฮฉ) : โLearning.sumRewards.{u_1, u_3} {๐ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐] (A : โ โ ฮฉ โ ๐) (R' : โ โ ฮฉ โ โ) (a : ๐) (t : โ) (ฯ : ฮฉ) : โ
Code
def sumRewards (A : โ โ ฮฉ โ ๐) (R' : โ โ ฮฉ โ โ) (a : ๐) (t : โ) (ฯ : ฮฉ) : โ := โ s โ range t, if A s ฯ = a then R' s ฯ else 0
Used by (44)
Actions: Source ยท Open Issue
reward๐
Bandits.ArrayModel.reward
Reward received at time n in the array model.
Bandits.ArrayModel.reward.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : RBandits.ArrayModel.reward.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : R
Code
noncomputable def reward [DecidableEq ๐] (alg : Algorithm ๐ R) (n : โ) (ฯ : probSpace ๐ R) : R := (hist alg ฯ n โจn, by simpโฉ).2
Body uses (1)
Used by (24)
Actions: Source ยท Open Issue
streamMeasure๐
Bandits.streamMeasureMeasure of an infinite stream of rewards from each action.
Bandits.streamMeasure.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} (ฮฝ : ProbabilityTheory.Kernel ๐ R) : MeasureTheory.Measure (โ โ ๐ โ R)Bandits.streamMeasure.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} (ฮฝ : ProbabilityTheory.Kernel ๐ R) : MeasureTheory.Measure (โ โ ๐ โ R)
Code
noncomputable def streamMeasure (ฮฝ : Kernel ๐ R) : Measure (โ โ ๐ โ R) := Measure.infinitePi fun _ โฆ Measure.infinitePi ฮฝ
Used by (56)
Actions: Source ยท Open Issue
All dependencies, transitively (6)
instIsProbabilityMeasureP0๐
Learning.instIsProbabilityMeasureP0No docstring.
Learning.instIsProbabilityMeasureP0.{u_1, u_2} {๐ : Type u_1} {๐จ : Type u_2} {m๐ : MeasurableSpace ๐} {m๐จ : MeasurableSpace ๐จ} (alg : Algorithm ๐ ๐จ) : MeasureTheory.IsProbabilityMeasure (Algorithm.p0 alg)Learning.instIsProbabilityMeasureP0.{u_1, u_2} {๐ : Type u_1} {๐จ : Type u_2} {m๐ : MeasurableSpace ๐} {m๐จ : MeasurableSpace ๐จ} (alg : Algorithm ๐ ๐จ) : MeasureTheory.IsProbabilityMeasure (Algorithm.p0 alg)
Code
instance (alg : Algorithm ๐ ๐จ) : IsProbabilityMeasure alg.p0
Type uses (1)
Used by (13)
Actions: Source ยท Open Issue
Proof
alg.hp0
initAlgFunction๐
Bandits.ArrayModel.initAlgFunctionThe initial action is the image of a uniform random variable by this function.
Bandits.ArrayModel.initAlgFunction.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] (alg : Learning.Algorithm ๐ R) : โunitInterval โ ๐Bandits.ArrayModel.initAlgFunction.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] (alg : Learning.Algorithm ๐ R) : โunitInterval โ ๐
Code
noncomputable def initAlgFunction (alg : Algorithm ๐ R) : I โ ๐ := (Measure.exists_measurable_map_eq alg.p0).choose
Type uses (1)
Body uses (1)
Used by (12)
Actions: Source ยท Open Issue
instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy๐
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicyNo docstring.
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy.{u_1, u_2} {๐ : Type u_1} {๐จ : Type u_2} {m๐ : MeasurableSpace ๐} {m๐จ : MeasurableSpace ๐จ} (alg : Algorithm ๐ ๐จ) (n : โ) : ProbabilityTheory.IsMarkovKernel (Algorithm.policy alg n)Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy.{u_1, u_2} {๐ : Type u_1} {๐จ : Type u_2} {m๐ : MeasurableSpace ๐} {m๐จ : MeasurableSpace ๐จ} (alg : Algorithm ๐ ๐จ) (n : โ) : ProbabilityTheory.IsMarkovKernel (Algorithm.policy alg n)
Code
instance (alg : Algorithm ๐ ๐จ) (n : โ) : IsMarkovKernel (alg.policy n)
Type uses (1)
Actions: Source ยท Open Issue
Proof
alg.h_policy n
algFunction๐
Bandits.ArrayModel.algFunctionThe next action is the image of the history and a uniform random variable by this function.
Bandits.ArrayModel.algFunction.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] (alg : Learning.Algorithm ๐ R) (n : โ) : (โฅ(Finset.Iic n) โ ๐ ร R) โ โunitInterval โ ๐Bandits.ArrayModel.algFunction.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] (alg : Learning.Algorithm ๐ R) (n : โ) : (โฅ(Finset.Iic n) โ ๐ ร R) โ โunitInterval โ ๐
Code
noncomputable
def algFunction (alg : Algorithm ๐ R) (n : โ) :
(Iic n โ ๐ ร R) โ I โ ๐ :=
(Kernel.exists_measurable_map_eq_unitInterval (alg.policy n)).chooseType uses (1)
Body uses (1)
Used by (17)
Actions: Source ยท Open Issue
pullCount'๐
Learning.pullCount'
Number of pulls of arm a up to (and including) time n.
This is the number of entries in h in which the arm is a.
Learning.pullCount'.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} [DecidableEq ๐] (n : โ) (h : โฅ(Finset.Iic n) โ ๐ ร R) (a : ๐) : โLearning.pullCount'.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} [DecidableEq ๐] (n : โ) (h : โฅ(Finset.Iic n) โ ๐ ร R) (a : ๐) : โ
Code
noncomputable
def pullCount' (n : โ) (h : Iic n โ ๐ ร R) (a : ๐) := #{s | (h s).1 = a}Used by (29)
Actions: Source ยท Open Issue
hist๐
Bandits.ArrayModel.hist
History of actions and rewards up to time n in the array model.
Bandits.ArrayModel.hist.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (ฯ : probSpace ๐ R) (n : โ) : โฅ(Finset.Iic n) โ ๐ ร RBandits.ArrayModel.hist.{u_1, u_2} {๐ : Type u_1} {R : Type u_2} {m๐ : MeasurableSpace ๐} {mR : MeasurableSpace R} [Nonempty ๐] [StandardBorelSpace ๐] [DecidableEq ๐] (alg : Learning.Algorithm ๐ R) (ฯ : probSpace ๐ R) (n : โ) : โฅ(Finset.Iic n) โ ๐ ร R
Code
noncomputable def hist [DecidableEq ๐] (alg : Algorithm ๐ R) (ฯ : probSpace ๐ R) : (n : โ) โ Iic n โ ๐ ร R | 0 => fun _ โฆ (initAlgFunction alg (ฯ.1 0), ฯ.2 0 (initAlgFunction alg (ฯ.1 0))) | n + 1 => let hn : Iic n โ ๐ ร R := hist alg ฯ n let a : ๐ := algFunction alg n hn (ฯ.1 (n + 1)) fun i โฆ if hin : i โค n then hn โจi, by simp [hin]โฉ else (a, ฯ.2 (pullCount' n hn a) a)
Body uses (3)
Used by (30)
Actions: Source ยท Open Issue