Bandits.UCB.pullCount_ae_le_add_two
No docstring.
-
Ω : Type u_1mΩ : MeasurableSpace ΩA measurable space is a space equipped with a σ-algebra.
-
K : ℕNeZero K -
c : ℝ -
ν : ProbabilityTheory.Kernel (Fin K) ℝ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. -
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. -
O : ℕ → Ω → Unit -
A : ℕ → Ω → Fin K -
R : ℕ → Ω → ℝ -
σ2 : NNReal -
a : Fin K -
n : ℕ -
C : ℕ
-
h : Learning.IsAlgEnvSeq O A R (ucbAlgorithm K (c * ↑σ2)) (Learning.stationaryEnv ν) PAn algorithm-environment sequence: a sequence of observations, actions and feedbacks generated by an algorithm interacting with an environment. -
hc : 0 ≤ c -
h_gap : 0 < gap ν a -
hC : C ≠ 0 -
hC' : 8 * c * ↑σ2 * Real.log (↑n + 1) / gap ν a ^ 2 ≤ ↑C
∀ᵐ (ω : Ω) ∂P,
Learning.pullCount A a n ω ≤
C + 1 +
∑ s ∈ Finset.range n,
{s |
0 < Learning.pullCount A (bestArm ν) s ω ∧
Learning.empMean A R (bestArm ν) s ω + ucbWidth A (c * ↑σ2) (bestArm ν) s ω <
∫ (x : ℝ), id x ∂ν (bestArm ν)}.indicator
1 s +
∑ s ∈ Finset.range n,
{s |
0 < Learning.pullCount A a s ω ∧
∫ (x : ℝ), id x ∂ν a < Learning.empMean A R a s ω - ucbWidth A (c * ↑σ2) a s ω}.indicator
1 sf.Eventually p or ∀ᶠ x in f, p x mean that {x | p x} ∈ f.MeasurableSpace : Type u_6 → Type u_6A measurable space is a space equipped with a σ-algebra.
NeZero : {R : Type u_1} → [Zero R] → R → PropA type-class version of `n ≠ 0`.
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)`.
Fin : ℕ → TypeNatural numbers less than some upper bound. In particular, a `Fin n` is a natural number `i` with the constraint that `i < n`. It is the canonical type with `n` elements.
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`.
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.
NNReal : TypeNonnegative real numbers, denoted as `ℝ≥0` within the NNReal namespace
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
Bandits.ucbAlgorithm : (K : ℕ) → [NeZero K] → ℝ → Learning.Algorithm Unit (Fin K) ℝThe UCB algorithm.Go to its page
HMul.hMul : {α : Type u} → {β : Type v} → {γ : outParam (Type w)} → [self : HMul α β γ] → α → β → γ`a * b` computes the product of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `*` in identifiers is `mul`.
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
LE.le : {α : Type u} → [self : LE α] → α → α → PropThe less-equal relation: `x ≤ y` Conventions for notations in identifiers: * The recommended spelling of `≤` in identifiers is `le`.
LT.lt : {α : Type u} → [self : LT α] → α → α → PropThe less-than relation: `x < y` Conventions for notations in identifiers: * The recommended spelling of `<` in identifiers is `lt`.
Bandits.gap : {𝓐 : Type u_2} → {m𝓐 : MeasurableSpace 𝓐} → ProbabilityTheory.Kernel 𝓐 ℝ → 𝓐 → ℝGap of an action `a`: difference between the highest mean of the actions and the mean of `a`.Go to its page
Ne : {α : Sort u} → α → α → Prop`a ≠ b`, or `Ne a b` is defined as `¬ (a = b)` or `a = b → False`, and asserts that `a` and `b` are not equal. Conventions for notations in identifiers: * The recommended spelling of `≠` in identifiers is `ne`.
Real.log : ℝ → ℝThe real logarithm function, equal to the inverse of the exponential for `x > 0`, to `log |x|` for `x < 0`, and to `0` for `0`. We use this unconventional extension to `(-∞, 0]` as it gives the formula `log (x * y) = log x + log y` for all nonzero `x` and `y`, and the derivative of `log` is `1/x` away from `0`.
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`.
HDiv.hDiv : {α : Type u} → {β : Type v} → {γ : outParam (Type w)} → [self : HDiv α β γ] → α → β → γ`a / b` computes the result of dividing `a` by `b`. The meaning of this notation is type-dependent. * For most types like `Nat`, `Int`, `Rat`, `Real`, `a / 0` is defined to be `0`. * For `Nat`, `a / b` rounds downwards. * For `Int`, `a / b` rounds downwards if `b` is positive or upwards if `b` is negative. It is implemented as `Int.ediv`, the unique function satisfying `a % b + b * (a / b) = a` and `0 ≤ a % b < natAbs b` for `b ≠ 0`. Other rounding conventions are available using the functions `Int.fdiv` (floor rounding) and `Int.tdiv` (truncation rounding). * For `Float`, `a / 0` follows the IEEE 754 semantics for division, usually resulting in `inf` or `nan`. Conventions for notations in identifiers: * The recommended spelling of `/` in identifiers is `div`.
HPow.hPow : {α : Type u} → {β : Type v} → {γ : outParam (Type w)} → [self : HPow α β γ] → α → β → γ`a ^ b` computes `a` to the power of `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `^` in identifiers is `pow`.
Filter.Eventually : {α : Type u_1} → (α → Prop) → Filter α → Prop`f.Eventually p` or `∀ᶠ x in f, p x` mean that `{x | p x} ∈ f`. E.g., `∀ᶠ x in atTop, p x`
means that `p` holds true for sufficiently large `x`.Learning.pullCount : {𝓐 : Type u_2} → {Ω : Type u_4} → [DecidableEq 𝓐] → (ℕ → Ω → 𝓐) → 𝓐 → ℕ → Ω → ℕNumber of times action `a` was chosen up to time `t` (excluding `t`).Go to its page
Finset.range : ℕ → Finset ℕ`range n` is the set of natural numbers less than `n`.
Set.ofPred : {α : Type u} → (α → Prop) → Set αTurn a predicate `p : α → Prop` into a set, also written as `{x | p x}`Bandits.bestArm : {𝓐 : Type u_2} → {m𝓐 : MeasurableSpace 𝓐} → [Fintype 𝓐] → [Nonempty 𝓐] → ProbabilityTheory.Kernel 𝓐 ℝ → 𝓐action with the highest mean.Go to its page
And : Prop → Prop → Prop`And a b`, or `a ∧ b`, is the conjunction of propositions. It can be constructed and destructed like a pair: if `ha : a` and `hb : b` then `⟨ha, hb⟩ : a ∧ b`, and if `h : a ∧ b` then `h.left : a` and `h.right : b`. Conventions for notations in identifiers: * The recommended spelling of `∧` in identifiers is `and`.
Learning.empMean : {𝓐 : Type u_2} → {Ω : Type u_4} → [DecidableEq 𝓐] → (ℕ → Ω → 𝓐) → (ℕ → Ω → ℝ) → 𝓐 → ℕ → Ω → ℝEmpirical mean reward obtained when pulling action `a` up to time `t` (exclusive).Go to its page
Bandits.UCB.ucbWidth : {K : ℕ} → {Ω : Type u_1} → (ℕ → Ω → Fin K) → ℝ → Fin K → ℕ → Ω → ℝThe exploration bonus of the UCB algorithm, which corresponds to the width of a confidence interval.Go to its page
MeasureTheory.integral : {α : Type u_6} →
{G : Type u_7} →
[inst : NormedAddCommGroup G] → [NormedSpace ℝ G] → {x : MeasurableSpace α} → MeasureTheory.Measure α → (α → G) → GThe Bochner integral
id : {α : Sort u} → α → αThe identity function. `id` takes an implicit argument `α : Sort u` (a type in any universe), and an argument `a : α`, and returns `a`. Although this may look like a useless function, one application of the identity function is to explicitly put a type on an expression. If `e` has type `T`, and `T'` is definitionally equal to `T`, then `@id T' e` typechecks, and Lean knows that this expression has type `T'` rather than `T`. This can make a difference for typeclass inference, since `T` and `T'` may have different typeclass instances on them. `show T' from e` is sugar for an `@id T' e` expression.
Set.indicator : {α : Type u_1} → {M : Type u_3} → [Zero M] → Set α → (α → M) → α → M`Set.indicator s f a` is `f a` if `a ∈ s`, `0` otherwise.
HSub.hSub : {α : Type u} → {β : Type v} → {γ : outParam (Type w)} → [self : HSub α β γ] → α → β → γ`a - b` computes the difference of `a` and `b`. The meaning of this notation is type-dependent. * For natural numbers, this operator saturates at 0: `a - b = 0` when `a ≤ b`. Conventions for notations in identifiers: * The recommended spelling of `-` in identifiers is `sub` (when used as a binary operator).
Code
lemma pullCount_ae_le_add_two (h : IsAlgEnvSeq O A R (ucbAlgorithm K (c * σ2)) (stationaryEnv ν) P)
(hc : 0 ≤ c) (a : Fin K) (h_gap : 0 < gap ν a)
(n C : ℕ) (hC : C ≠ 0) (hC' : 8 * c * σ2 * log (n + 1) / gap ν a ^ 2 ≤ C) :
∀ᵐ ω ∂P,
pullCount A a n ω ≤ C + 1 +
∑ s ∈ range n,
{s | 0 < pullCount A (bestArm ν) s ω ∧
empMean A R (bestArm ν) s ω + ucbWidth A (c * σ2) (bestArm ν) s ω <
(ν (bestArm ν))[id]}.indicator 1 s +
∑ s ∈ range n,
{s | 0 < pullCount A a s ω ∧ (ν a)[id] <
empMean A R a s ω - ucbWidth A (c * σ2) a s ω}.indicator 1 sProof
by
filter_upwards [sum_indicator_good_event_eq_zero h hc a h_gap n C hC hC',
pullCount_le_add_three_ae h a n C hC] with ω hω_zero hω_le
refine (hω_le).trans_eq ?_
rw [hω_zero]Meaning last changed in v4.34.0-rc2-90-gdde3322 (2026-09-16), the 9th 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: 27 project declarations, 152 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.