Bandits.hasLaw_rewardByCount_infinitePi
From the authors
The array of rewards by count (a, m) โฆ rewardByCount A R a (m + 1) has law
โจ (a, m), ฮฝ a: its entries are independent, and the entry (a, m) has law ฮฝ a.
-
๐ : 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 ฮฉ
-
O : โ โ ฮฉ โ Unit -
A : โ โ ฮฉ โ ๐ -
R : โ โ ฮฉ โ โ -
P : 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 PA measureฮผis called a probability measure ifฮผ univ = 1. -
alg : Learning.Algorithm Unit ๐ โA stochastic, sequential algorithm. -
ฮฝ : 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.
-
h : Learning.IsAlgEnvSeq O A R alg (Learning.stationaryEnv ฮฝ) PAn algorithm-environment sequence: a sequence of observations, actions and feedbacks generated by an algorithm interacting with an environment.
ProbabilityTheory.HasLaw (fun ฯ p => Learning.rewardByCount A R p.1 (p.2 + 1) ฯ)
(MeasureTheory.Measure.infinitePi fun p => ฮฝ p.1) (P.prod (streamMeasure ฮฝ))The predicate HasLaw X ฮผ P registers the fact that the random variable X has law ฮผ under the measure P, in other words that P.map X = ฮผ.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 `ฮฑ โ โ`.
Unit : TypeThe canonical type with one element. This element is written `()`. `Unit` has a number of uses: * It can be used to model control flow that returns from a function call without providing other information. * Monadic actions that return `Unit` have side effects without computing values. * In polymorphic types, it can be used to indicate that no data is to be stored in a particular field.
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.
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`.
Learning.Algorithm : (๐ : Type u_5) โ
(๐ : Type u_6) โ
(๐จ : Type u_7) โ [MeasurableSpace ๐] โ [MeasurableSpace ๐] โ [MeasurableSpace ๐จ] โ Type (max (max u_5 u_6) u_7)A stochastic, sequential algorithm. At each round, it sees an observation in `๐`, then takes an action in `๐`, and finally receives feedback in `๐จ`. The action is a random function of the past rounds and the current observation.Go to its page
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)`.
Learning.IsAlgEnvSeq : {๐ : Type u_1} โ
{๐ : Type u_2} โ
{๐จ : Type u_3} โ
{ฮฉ : Type u_4} โ
{m๐ : MeasurableSpace ๐} โ
{m๐ : MeasurableSpace ๐} โ
{m๐จ : MeasurableSpace ๐จ} โ
{mฮฉ : MeasurableSpace ฮฉ} โ
(โ โ ฮฉ โ ๐) โ
(โ โ ฮฉ โ ๐) โ
(โ โ ฮฉ โ ๐จ) โ
Learning.Algorithm ๐ ๐ ๐จ โโฆAn algorithm-environment sequence: a sequence of observations, actions and feedbacks generated by an algorithm interacting with an environment.Go to its page
Learning.stationaryEnv : {๐ : Type u_2} โ
{๐จ : Type u_3} โ
{m๐ : MeasurableSpace ๐} โ
{m๐จ : MeasurableSpace ๐จ} โ
(ฮฝ : ProbabilityTheory.Kernel ๐ ๐จ) โ [ProbabilityTheory.IsMarkovKernel ฮฝ] โ Learning.Environment Unit ๐ ๐จA stationary environment without observations, in which the distribution of the next feedback depends only on the last action.Go to its page
ProbabilityTheory.HasLaw : {ฮฉ : Type u_1} โ
{๐ง : Type u_2} โ
{mฮฉ : MeasurableSpace ฮฉ} โ
{m๐ง : MeasurableSpace ๐ง} โ
(ฮฉ โ ๐ง) โ MeasureTheory.Measure ๐ง โ autoParam (MeasureTheory.Measure ฮฉ) ProbabilityTheory.HasLaw._auto_1 โ PropThe predicate `HasLaw X ฮผ P` registers the fact that the random variable `X` has law `ฮผ` under the measure `P`, in other words that `P.map X = ฮผ`. We also require `X` to be `AEMeasurable`, to allow for nice interactions with operations on the codomain of `X`. See for instance `HasLaw.comp`, `IndepFun.hasLaw_mul` and `IndepFun.hasLaw_add`.
Learning.rewardByCount : {๐ : Type u_2} โ
{R : Type u_3} โ {ฮฉ : Type u_4} โ [DecidableEq ๐] โ (โ โ ฮฉ โ ๐) โ (โ โ ฮฉ โ R) โ ๐ โ โ โ ฮฉ ร (โ โ ๐ โ R) โ RReward 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.Go to its page
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.infinitePi : {ฮน : Type u_1} โ
{X : ฮน โ Type u_2} โ
{mX : (i : ฮน) โ MeasurableSpace (X i)} โ
((i : ฮน) โ MeasureTheory.Measure (X i)) โ MeasureTheory.Measure ((i : ฮน) โ X i)The product measure of an arbitrary family of probability measures. It is defined as the unique extension of the function which gives to cylinders the measure given by the associated product measure. It is defined via an `if ... then ... else` so that it can be manipulated without carrying a proof that the measures are probability measures.
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 hasLaw_rewardByCount_infinitePi (h : IsAlgEnvSeq O A R alg (stationaryEnv ฮฝ) P) :
HasLaw (fun ฯ (p : ๐ ร โ) โฆ rewardByCount A R p.1 (p.2 + 1) ฯ)
(Measure.infinitePi fun p : ๐ ร โ โฆ ฮฝ p.1) ๐Proof
by
have hY : Measurable fun ฯ (p : ๐ ร โ) โฆ rewardByCount A R p.1 (p.2 + 1) ฯ :=
.of_eval fun p โฆ
measurable_rewardByCount h.measurable_action h.measurable_feedback p.1 (p.2 + 1)
-- `rewardByCountUntil A R t` has that law for all `t` and converges entrywise to the array
exact hasLaw_of_forall_eventually_eq (L := Filter.atTop)
(measurable_rewardByCountUntil h.measurable_action h.measurable_feedback) hY.aemeasurable
(hasLaw_rewardByCountUntil h) eventually_rewardByCountUntil_eqMeaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10), the 3th 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: 12 project declarations, 69 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.