LeanMachineLearning

Bandits.hasLaw_rewardByCount๐Ÿ”—

Lemma

The reward received at the m-th pull of action a has law ฮฝ a.

๐Ÿ”—theorem
Bandits.hasLaw_rewardByCount.{u_1, u_2} {๐“ : Type u_1} {ฮฉ : Type u_2} {m๐“ : MeasurableSpace ๐“} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ โ„} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {alg : Learning.Algorithm ๐“ โ„} {ฮฝ : ProbabilityTheory.Kernel ๐“ โ„} [ProbabilityTheory.IsMarkovKernel ฮฝ] [StandardBorelSpace ๐“] [Nonempty ๐“] [StandardBorelSpace ฮฉ] [Countable ๐“] (h : Learning.IsAlgEnvSeq A R alg (Learning.stationaryEnv ฮฝ) P) (a : ๐“) (m : โ„•) (hm : m โ‰  0) : ProbabilityTheory.HasLaw (Learning.rewardByCount A R a m) (ฮฝ a) (MeasureTheory.Measure.prod P (streamMeasure ฮฝ))
Bandits.hasLaw_rewardByCount.{u_1, u_2} {๐“ : Type u_1} {ฮฉ : Type u_2} {m๐“ : MeasurableSpace ๐“} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ โ„} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {alg : Learning.Algorithm ๐“ โ„} {ฮฝ : ProbabilityTheory.Kernel ๐“ โ„} [ProbabilityTheory.IsMarkovKernel ฮฝ] [StandardBorelSpace ๐“] [Nonempty ๐“] [StandardBorelSpace ฮฉ] [Countable ๐“] (h : Learning.IsAlgEnvSeq A R alg (Learning.stationaryEnv ฮฝ) P) (a : ๐“) (m : โ„•) (hm : m โ‰  0) : ProbabilityTheory.HasLaw (Learning.rewardByCount A R a m) (ฮฝ a) (MeasureTheory.Measure.prod P (streamMeasure ฮฝ))

Code

lemma hasLaw_rewardByCount [StandardBorelSpace ฮฉ] [Countable ๐“]
    (h : IsAlgEnvSeq A R alg (stationaryEnv ฮฝ) P) (a : ๐“) (m : โ„•) (hm : m โ‰  0) :
    HasLaw (rewardByCount A R a m) (ฮฝ a) ๐”“ where
  aemeasurable
Proof
(measurable_rewardByCount h.measurable_action h.measurable_feedback a m).aemeasurable
  map_eq := by
    have hA := h.measurable_action
    have hR := h.measurable_feedback
    have h_condDistrib :
        condDistrib (rewardByCount A R a m) (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1) ๐”“
        =แต[(๐”“).map (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1)]
          Kernel.const _ (ฮฝ a) := condDistrib_rewardByCount_stepsUntil h a m hm
    calc (๐”“).map (rewardByCount A R a m)
    _ = (condDistrib (rewardByCount A R a m) (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1) ๐”“)
        โˆ˜โ‚˜ ((๐”“).map (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1)) := by
      rw [condDistrib_comp_map (by fun_prop) (by fun_prop)]
    _ = (Kernel.const _ (ฮฝ a)) โˆ˜โ‚˜ ((๐”“).map (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1)) :=
      Measure.comp_congr h_condDistrib
    _ = ฮฝ a := by
      have : IsProbabilityMeasure ((๐”“).map (fun ฯ‰ โ†ฆ stepsUntil A a m ฯ‰.1)) :=
        Measure.isProbabilityMeasure_map (by fun_prop)
      simp

Actions: Source ยท Open Issue

Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23), the 4th recorded change.

Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file ยท open it in the Lean web editor.

Dependency graph

Audit surface: 10 project declarations, 77 external constants

โœ“ Proved: no sorry anywhere in its closure

This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.