LeanMachineLearning exposition

Learning.measurable_rewardByCount🔗

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.

Minimal Lean file

measurable_rewardByCount🔗

LemmaLearning.measurable_rewardByCount

No docstring.

🔗theorem
Learning.measurable_rewardByCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} {m𝓐 : MeasurableSpace 𝓐} {mR : MeasurableSpace R} { : MeasurableSpace Ω} [DecidableEq 𝓐] {A : Ω 𝓐} {R' : Ω R} [MeasurableSingletonClass 𝓐] (hA : (n : ), Measurable (A n)) (hR' : (n : ), Measurable (R' n)) (a : 𝓐) (m : ) : Measurable fun ω => rewardByCount A R' a m ω
Learning.measurable_rewardByCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} {m𝓐 : MeasurableSpace 𝓐} {mR : MeasurableSpace R} { : MeasurableSpace Ω} [DecidableEq 𝓐] {A : Ω 𝓐} {R' : Ω R} [MeasurableSingletonClass 𝓐] (hA : (n : ), Measurable (A n)) (hR' : (n : ), Measurable (R' n)) (a : 𝓐) (m : ) : Measurable fun ω => rewardByCount A R' a m ω

Code

lemma measurable_rewardByCount [MeasurableSingletonClass 𝓐]
    (hA : ∀ n, Measurable (A n)) (hR' : ∀ n, Measurable (R' n)) (a : 𝓐) (m : ℕ) :
    Measurable (fun ω : Ω × (ℕ → 𝓐 → R) ↦ rewardByCount A R' a m ω)
Type uses (1)
Body uses (4)
Used by (4)

Actions: Source · Open Issue

Proof
by
  simp_rw [rewardByCount_eq_ite]
  refine Measurable.ite ?_ ?_ ?_
  · exact (measurableSet_singleton _).preimage <| measurable_stepsUntil' hA a m
  · fun_prop
  · change Measurable ((fun p : ℕ × Ω ↦ R' p.1 p.2)
      ∘ (fun ω : Ω × (ℕ → 𝓐 → R) ↦ ((stepsUntil A a m ω.1).toNat, ω.1)))
    have : Measurable fun ω : Ω × (ℕ → 𝓐 → R) ↦ ((stepsUntil A a m ω.1).toNat, ω.1) :=
      (measurable_stepsUntil' hA a m).toNat.prodMk (by fun_prop)
    refine Measurable.comp ?_ this
    refine measurable_from_prod_countable_right fun n ↦ ?_
    simp only
    fun_prop

Dependency graph

Type dependencies (1)

rewardByCount🔗

DefinitionLearning.rewardByCount

Reward obtained when pulling action a for the m-th time. If it is never pulled m times, the reward is given by the second component of ω, which in applications will be indepedent with same law.

🔗def
Learning.rewardByCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (R' : Ω R) (a : 𝓐) (m : ) (ω : Ω × ( 𝓐 R)) : R
Learning.rewardByCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (R' : Ω R) (a : 𝓐) (m : ) (ω : Ω × ( 𝓐 R)) : R

Code

noncomputable
def rewardByCount (A : ℕ → Ω → 𝓐) (R' : ℕ → Ω → R) (a : 𝓐) (m : ℕ) (ω : Ω × (ℕ → 𝓐 → R)) : R :=
  match (stepsUntil A a m ω.1) with
  | ⊤ => ω.2 m a
  | (n : ℕ) => R' n ω.1
Body uses (1)
Used by (15)

Actions: Source · Open Issue

All dependencies, transitively (2)

pullCount🔗

DefinitionLearning.pullCount

Number of times action a was chosen up to time t (excluding t).

🔗def
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))
Used by (146)

Actions: Source · Open Issue

stepsUntil🔗

DefinitionLearning.stepsUntil

Number of steps until action a was pulled exactly m times.

🔗def
Learning.stepsUntil.{u_1, u_3} {𝓐 : Type u_1} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (a : 𝓐) (m : ) (ω : Ω) : ℕ∞
Learning.stepsUntil.{u_1, u_3} {𝓐 : Type u_1} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (a : 𝓐) (m : ) (ω : Ω) : ℕ∞

Code

noncomputable
def stepsUntil (A : ℕ → Ω → 𝓐) (a : 𝓐) (m : ℕ) (ω : Ω) : ℕ∞ :=
  sInf ((↑) '' {s | pullCount A a (s + 1) ω = m})
Body uses (1)
Used by (46)

Actions: Source · Open Issue