Bandits.indepFun_update_rewardByCountUntil_eval
From the authors
The array rewardByCountUntil A R t with the entry (b, k) erased is independent of the
entry (k + 1, b) of the auxiliary array.
-
š : Type u_1mš : MeasurableSpace šA measurable space is a space equipped with a Ļ-algebra.DecidableEq šMeasurableSingletonClass šA typeclass mixin forMeasurableSpaces such that each singleton is measurable.Countable šA typeαis countable if there exists an injective mapα ā ā. -
Ω : Type u_2mΩ : MeasurableSpace Ω
-
A : ā ā Ī© ā š -
R : ā ā Ī© ā ā -
ν : ProbabilityTheory.Kernel š āA kernel from a measurable spaceαto another measurable spaceβis a measurable functionĪŗ : α ā Measure β.ProbabilityTheory.IsMarkovKernel νA kernel is a Markov kernel if every measure in its image is a probability measure. -
μ : MeasureTheory.Measure ΩA measure is defined to be an outer measure that is countably additive on measurable sets, with the additional assumption that the outer measure is the canonical extension of the restricted measure.MeasureTheory.IsProbabilityMeasure μA measureμis called a probability measure ifμ univ = 1. -
t : ā -
b : š -
k : ā
-
hA : ā (n : ā), Measurable (A n)A functionfbetween measurable spaces is measurable if the preimage of every measurable set is measurable. -
hR : ā (n : ā), Measurable (R n)
ProbabilityTheory.IndepFun (fun Ļ => Function.update (Learning.rewardByCountUntil A R t Ļ) (b, k) 0)
(fun Ļ => Ļ.2 (k + 1) b) (μ.prod (streamMeasure ν))Two functions are independent if the two measurable space structures they generate are independent.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 : α`.
MeasurableSingletonClass : (α : Type u_6) ā [MeasurableSpace α] ā PropA typeclass mixin for `MeasurableSpace`s such that each singleton is measurable.
Countable : Sort u ā PropA type `α` is countable if there exists an injective map `α ā ā`.
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.
Real : TypeThe type `ā` of real numbers constructed as equivalence classes of Cauchy sequences of rational numbers.
ProbabilityTheory.IsMarkovKernel : {α : Type u_1} ā
{β : Type u_2} ā {mα : MeasurableSpace α} ā {mβ : MeasurableSpace β} ā ProbabilityTheory.Kernel α β ā PropA kernel is a Markov kernel if every measure in its image is a probability measure.
ProbabilityTheory.Kernel : (α : Type u_1) ā (β : Type u_2) ā [MeasurableSpace α] ā [MeasurableSpace β] ā Type (max u_1 u_2)A kernel from a measurable space `α` to another measurable space `β` is a measurable function `Īŗ : α ā Measure β`. The measurable space structure on `MeasureTheory.Measure β` is given by `MeasureTheory.Measure.instMeasurableSpace`. A map `Īŗ : α ā MeasureTheory.Measure β` is measurable iff `ā s : Set β, MeasurableSet s ā Measurable (fun a ⦠κ a s)`.
MeasureTheory.IsProbabilityMeasure : {α : Type u_1} ā {m0 : MeasurableSpace α} ā MeasureTheory.Measure α ā PropA measure `μ` is called a probability measure if `μ univ = 1`.
MeasureTheory.Measure : (α : Type u_5) ā [MeasurableSpace α] ā Type u_5A measure is defined to be an outer measure that is countably additive on measurable sets, with the additional assumption that the outer measure is the canonical extension of the restricted measure. The measure of a set `s`, denoted `μ s`, is an extended nonnegative real. The real-valued version is written `μ.real s`.
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.
ProbabilityTheory.IndepFun : {Ī© : Type u_1} ā
{β : Type u_6} ā
{γ : Type u_7} ā
{_mĪ© : MeasurableSpace Ī©} ā
[MeasurableSpace β] ā
[MeasurableSpace γ] ā
(Ī© ā β) ā (Ī© ā γ) ā autoParam (MeasureTheory.Measure Ī©) ProbabilityTheory.IndepFun._auto_1 ā PropTwo functions are independent if the two measurable space structures they generate are independent. For a function `f` with codomain having measurable space structure `m`, the generated measurable space structure is `MeasurableSpace.comap f m`. We use the notation `f āįµ¢[μ] g` for `IndepFun f g μ` (scoped in `ProbabilityTheory`).
Function.update : {α : Sort u} ā {β : α ā Sort v} ā [DecidableEq α] ā ((a : α) ā β a) ā (a' : α) ā β a' ā (a : α) ā β aReplacing the value of a function at a given point by a given value.
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
Prod.mk : {α : Type u} ā {β : Type v} ā α ā β ā α à βConstructs a pair. This is usually written `(x, y)` instead of `Prod.mk x y`. Conventions for notations in identifiers: * The recommended spelling of `(a, b)` in identifiers is `mk`.
HAdd.hAdd : {α : Type u} ā {β : Type v} ā {γ : outParam (Type w)} ā [self : HAdd α β γ] ā α ā β ā γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.
MeasureTheory.Measure.prod : {α : Type u_4} ā
{β : Type u_5} ā
[inst : MeasurableSpace α] ā
[inst_1 : MeasurableSpace β] ā MeasureTheory.Measure α ā MeasureTheory.Measure β ā MeasureTheory.Measure (α à β)The binary product of measures. They are defined for arbitrary measures, but we basically prove all properties under the assumption that at least one of them is s-finite.
Bandits.streamMeasure : {š : Type u_1} ā
{š” : Type u_2} ā
{mš : MeasurableSpace š} ā
{mš” : MeasurableSpace š”} ā ProbabilityTheory.Kernel š š” ā MeasureTheory.Measure (ā ā š ā š”)Measure of an infinite stream of rewards from each action.Go to its page
Code
lemma indepFun_update_rewardByCountUntil_eval [Countable š] (hA : ā n, Measurable (A n))
(hR : ā n, Measurable (R n)) (μ : Measure Ī©) [IsProbabilityMeasure μ] (t : ā) (b : š) (k : ā) :
(fun Ļ ā¦ Function.update (rewardByCountUntil A R t Ļ) (b, k) 0)
āįµ¢[μ.prod (streamMeasure ν)] (fun Ļ ā¦ Ļ.2 (k + 1) b)Proof
by
refine ((indepFun_snd_apply_prod_streamMeasure_update μ ν (k + 1) b 0).of_measurable_right
?_).symm
have h_eq : (fun Ļ : Ī© Ć (ā ā š ā ā) ⦠Function.update (rewardByCountUntil A R t Ļ) (b, k) 0)
= (fun Ļ ā¦ Function.update (rewardByCountUntil A R t Ļ) (b, k) 0)
ā (fun Ļ ā¦ (Ļ.1, fun i c ⦠if i = k + 1 ā§ c = b then 0 else Ļ.2 i c)) := by
ext āØx, zā© p
simp only [Function.comp_apply]
by_cases hp : p = (b, k)
Ā· rw [hp, Function.update_self, Function.update_self]
Ā· rw [Function.update_of_ne hp, Function.update_of_ne hp]
refine rewardByCountUntil_congr t p ?_
split_ifs with hc
Ā· exact absurd (Prod.ext hc.2 (by have := hc.1; omega)) hp
Ā· rfl
rw [h_eq]
exact measurable_comp_comap _
(measurable_update_left.comp (measurable_rewardByCountUntil hA hR t))Meaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10).
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: 3 project declarations, 42 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.