Bandits.UCB.regret_le_of_gt_two'
From the authors
Regret bound for the UCB algorithm with exploration constant c > 2 * Ο2, for Ο2-subgaussian
rewards, with an explicit constant.
-
Ξ© : 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 -
n : β
-
h : Learning.IsAlgEnvSeq O A R (ucbAlgorithm K c) (Learning.stationaryEnv Ξ½) PAn algorithm-environment sequence: a sequence of observations, actions and feedbacks generated by an algorithm interacting with an environment. -
hΞ½ : β (a : Fin K), ProbabilityTheory.HasSubgaussianMGF (fun x => x - β« (x : β), id x βΞ½ a) Ο2 (Ξ½ a)A random variableXhas a sub-Gaussian moment-generating function with parametercwith respect to a measureΞΌif for allt : β,exp (t * X)isΞΌ-integrable and the moment-generating functβ¦ -
hΟ2 : Ο2 β 0 -
hc : 2 * βΟ2 < c
β« (x : Ξ©), regret Ξ½ A n x βP β€ β a, (8 * c * Real.log (βn + 1) / gap Ξ½ a + gap Ξ½ a * (4 + 2 * βΟ2 / (c - 2 * βΟ2)))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
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.HasSubgaussianMGF : {Ξ© : Type u_1} β
{mΞ© : MeasurableSpace Ξ©} β
(Ξ© β β) β NNReal β autoParam (MeasureTheory.Measure Ξ©) ProbabilityTheory.HasSubgaussianMGF._auto_1 β PropA random variable `X` has a sub-Gaussian moment-generating function with parameter `c` with respect to a measure `ΞΌ` if for all `t : β`, `exp (t * X)` is `ΞΌ`-integrable and the moment-generating function of `X` is bounded by `exp (c * t ^ 2 / 2)` for all `t : β`. This implies in particular that `X` has expectation 0. This is equivalent to `Kernel.HasSubgaussianMGF X c (Kernel.const Unit ΞΌ) (Measure.dirac ())`, as proved in `HasSubgaussianMGF_iff_kernel`. Properties about sub-Gaussian moment-generating functions should be proved first for `Kernel.HasSubgaussianMGF` when possible.
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).
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.
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`.
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`.
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`.
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`.
Bandits.regret : {π : Type u_2} β {Ξ© : Type u_3} β {mπ : MeasurableSpace π} β ProbabilityTheory.Kernel π β β (β β Ξ© β π) β β β Ξ© β βRegret of a sequence of pulls `k : β β π` at time `t` for the reward kernel `Ξ½ ; Kernel π β`.Go to its page
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`.
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
Code
theorem regret_le_of_gt_two' (h : IsAlgEnvSeq O A R (ucbAlgorithm K c) (stationaryEnv Ξ½) P)
(hΞ½ : β a, HasSubgaussianMGF (fun x β¦ x - (Ξ½ a)[id]) Ο2 (Ξ½ a))
(hΟ2 : Ο2 β 0) (hc : 2 * Ο2 < c) (n : β) :
P[regret Ξ½ A n] β€
β a, (8 * c * log (n + 1) / gap Ξ½ a + gap Ξ½ a * (4 + 2 * Ο2 / (c - 2 * Ο2)))Proof
by
have hΟ2' : (0 : β) < Ο2 := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hΟ2)
have h' : IsAlgEnvSeq O A R (ucbAlgorithm K (c / Ο2 * Ο2)) (stationaryEnv Ξ½) P := by
rwa [div_mul_cancelβ _ hΟ2'.ne']
have hc' : 2 < c / Ο2 := by rwa [lt_div_iffβ hΟ2']
refine (regret_le_of_gt_two h' hΞ½ hΟ2 hc' n).trans_eq ?_
rw [show (8 : β) * (c / Ο2) * Ο2 = 8 * c by rw [mul_assoc, div_mul_cancelβ _ hΟ2'.ne'],
show c / Ο2 - 2 = (c - 2 * Ο2) / Ο2 by rw [sub_div, mul_div_assoc, div_self hΟ2'.ne', mul_one],
div_div_eq_mul_div]New in v4.34.0-rc2-90-gdde3322 (2026-09-16), 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: 23 project declarations, 124 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.