Learning.measurable_rewardByCountUntil_of
From the authors
Measurability of rewardByCountUntil A R' t with respect to a ฯ-algebra m for which the
actions and rewards before time t and the auxiliary array are measurable.
-
๐ : Type u_2m๐ : MeasurableSpace ๐A measurable space is a space equipped with a ฯ-algebra.DecidableEq ๐MeasurableEq ๐Typeclass for a measurable spaceฮฑfor which the diagonal ofฮฑ ร ฮฑis measurable. -
R : Type u_3mR : MeasurableSpace R -
ฮฉ : Type u_4m : MeasurableSpace (ฮฉ ร (โ โ ๐ โ R))
-
A : โ โ ฮฉ โ ๐ -
R' : โ โ ฮฉ โ R -
t : โ
-
hA : โ i < t, Measurable fun ฯ => A i ฯ.1A functionfbetween measurable spaces is measurable if the preimage of every measurable set is measurable. -
hR : โ i < t, Measurable fun ฯ => R' i ฯ.1 -
hZ : Measurable Prod.snd
Measurable (rewardByCountUntil A R' t)MeasurableSpace : Type u_6 โ Type u_6A measurable space is a space equipped with a ฯ-algebra.
DecidableEq : Sort u โ Sort (max 1 u)Propositional equality is `Decidable` for all elements of a type. In other words, an instance of `DecidableEq ฮฑ` is a means of deciding the proposition `a = b` is for all `a b : ฮฑ`.
MeasurableEq : (ฮฑ : Type u_1) โ [MeasurableSpace ฮฑ] โ PropTypeclass for a measurable space `ฮฑ` for which the diagonal of `ฮฑ ร ฮฑ` is measurable.
Prod : Type u โ Type v โ Type (max u v)The product type, usually written `ฮฑ ร ฮฒ`. Product types are also called pair or tuple types. Elements of this type are pairs in which the first element is an `ฮฑ` and the second element is a `ฮฒ`. Products nest to the right, so `(x, y, z) : ฮฑ ร ฮฒ ร ฮณ` is equivalent to `(x, (y, z)) : ฮฑ ร (ฮฒ ร ฮณ)`. Conventions for notations in identifiers: * The recommended spelling of `ร` in identifiers is `Prod`.
Nat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
Measurable : {ฮฑ : Type u_1} โ {ฮฒ : Type u_2} โ [MeasurableSpace ฮฑ] โ [MeasurableSpace ฮฒ] โ (ฮฑ โ ฮฒ) โ PropA function `f` between measurable spaces is measurable if the preimage of every measurable set is measurable.
Prod.snd : {ฮฑ : Type u} โ {ฮฒ : Type v} โ ฮฑ ร ฮฒ โ ฮฒThe second element of a pair.
Learning.rewardByCountUntil : {๐ : Type u_2} โ
{R : Type u_3} โ {ฮฉ : Type u_4} โ [DecidableEq ๐] โ (โ โ ฮฉ โ ๐) โ (โ โ ฮฉ โ R) โ โ โ ฮฉ ร (โ โ ๐ โ R) โ ๐ ร โ โ RArray of rewards by count, truncated at time `t`: the entry `(a, m)` is the reward received at the `(m + 1)`-th pull of action `a` if that pull happened before time `t`, and the entry `(m + 1, a)` of the auxiliary array `ฯ.2` otherwise. This is an auxiliary definition used to prove results about the distribution of `rewardByCount`. It is defined recursively: at time `t`, the entry `(A t, pullCount A (A t) t)` is replaced by the reward `R' t`. See `rewardByCountUntil_apply_of_lt_pullCount` and `rewardByCountUntil_apply_of_pullCount_le`.Go to its page
Code
lemma measurable_rewardByCountUntil_of {m : MeasurableSpace (ฮฉ ร (โ โ ๐ โ R))}
[MeasurableEq ๐] (t : โ)
(hA : โ i < t, Measurable[m] (fun ฯ : ฮฉ ร (โ โ ๐ โ R) โฆ A i ฯ.1))
(hR : โ i < t, Measurable[m] (fun ฯ : ฮฉ ร (โ โ ๐ โ R) โฆ R' i ฯ.1))
(hZ : Measurable[m] (Prod.snd : ฮฉ ร (โ โ ๐ โ R) โ โ โ ๐ โ R)) :
Measurable[m] (rewardByCountUntil A R' t)Proof
by
induction t with
| zero =>
have : rewardByCountUntil A R' 0 = (fun z (p : ๐ ร โ) โฆ z (p.2 + 1) p.1) โ Prod.snd := rfl
rw [this]
exact Measurable.comp (by fun_prop) hZ
| succ t ih =>
have ht : t < t + 1 := Nat.lt_succ_self t
have ih := ih (fun i hi โฆ hA i (hi.trans ht)) (fun i hi โฆ hR i (hi.trans ht))
have hg : Measurable[m] (fun ฯ : ฮฉ ร (โ โ ๐ โ R) โฆ
(A t ฯ.1, pullCount A (A t ฯ.1) t ฯ.1)) := by
refine Measurable.prodMk (hA t ht) ?_
simp_rw [pullCount_eq_sum]
refine Finset.measurable_sum _ fun s hs โฆ Measurable.ite ?_ measurable_const measurable_const
exact measurableSet_eq_fun (hA s ((Finset.mem_range.1 hs).trans ht)) (hA t ht)
refine measurable_pi_iff.2 fun p โฆ ?_
simp_rw [rewardByCountUntil_add_one, Function.update_apply]
refine Measurable.ite ?_ (hR t ht) ((measurable_pi_apply p).comp ih)
have h_set : {ฯ : ฮฉ ร (โ โ ๐ โ R) | p = (A t ฯ.1, pullCount A (A t ฯ.1) t ฯ.1)}
= (fun ฯ : ฮฉ ร (โ โ ๐ โ R) โฆ (A t ฯ.1, pullCount A (A t ฯ.1) t ฯ.1)) โปยน' {p} := by
ext ฯ
simp [eq_comm]
rw [h_set]
exact hg (measurableSet_singleton p)New in v4.34.0-rc2-31-g21d7e67 (2026-09-07), and its meaning has not changed since.
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: 2 project declarations, 29 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.