Bandits.ClippedUCB.sum_ucb_sub_mean_le
No docstring.
Bandits.ClippedUCB.sum_ucb_sub_mean_le.{u_1} {K : โ} {l u ฯ2 ฮด : โ} {ฮฉ : Type u_1} {A : โ โ ฮฉ โ Fin K} {R : โ โ ฮฉ โ โ} {n : โ} {ฯ : ฮฉ} (ฮผ : Fin K โ โ) (hฮผ : โ (a : Fin K), ฮผ a โ Set.Icc l u) (hi : l โค u) (hc : โ s < n, Learning.pullCount A (A s ฯ) s ฯ โ 0 โ Learning.empMean A R (A s ฯ) s ฯ - ฮผ (A s ฯ) < โ(2 * ฯ2 * Real.log (1 / ฮด) / โ(Learning.pullCount A (A s ฯ) s ฯ))) : โ s โ Finset.range n, (ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ - ฮผ (A s ฯ)) โค (u - l) * โK + 4 * โ(2 * ฯ2 * Real.log (1 / ฮด) * โK * โn)Bandits.ClippedUCB.sum_ucb_sub_mean_le.{u_1} {K : โ} {l u ฯ2 ฮด : โ} {ฮฉ : Type u_1} {A : โ โ ฮฉ โ Fin K} {R : โ โ ฮฉ โ โ} {n : โ} {ฯ : ฮฉ} (ฮผ : Fin K โ โ) (hฮผ : โ (a : Fin K), ฮผ a โ Set.Icc l u) (hi : l โค u) (hc : โ s < n, Learning.pullCount A (A s ฯ) s ฯ โ 0 โ Learning.empMean A R (A s ฯ) s ฯ - ฮผ (A s ฯ) < โ(2 * ฯ2 * Real.log (1 / ฮด) / โ(Learning.pullCount A (A s ฯ) s ฯ))) : โ s โ Finset.range n, (ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ - ฮผ (A s ฯ)) โค (u - l) * โK + 4 * โ(2 * ฯ2 * Real.log (1 / ฮด) * โK * โn)
Code
lemma sum_ucb_sub_mean_le {n : โ} {ฯ : ฮฉ} (ฮผ : Fin K โ โ) (hฮผ : โ a, ฮผ a โ Set.Icc l u) (hi : l โค u)
(hc : โ s < n, pullCount A (A s ฯ) s ฯ โ 0 โ empMean A R (A s ฯ) s ฯ - ฮผ (A s ฯ)
< โ(2 * ฯ2 * Real.log (1 / ฮด) / (pullCount A (A s ฯ) s ฯ))) :
โ s โ range n, (ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ - ฮผ (A s ฯ))
โค (u - l) * K + 4 * โ(2 * ฯ2 * Real.log (1 / ฮด) * K * n)Proof
by
let Sโ := {s โ range n | pullCount A (A s ฯ) s ฯ = 0}
let Sโ := {s โ range n | pullCount A (A s ฯ) s ฯ โ 0}
have hu : Sโ โช Sโ = range n := filter_union_filter_not_eq _ _
have hd : Disjoint Sโ Sโ := disjoint_filter_filter_not _ _ _
rw [โ hu, sum_union hd]
gcongr
ยท calc โ s โ Sโ, (ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ - ฮผ (A s ฯ))
โค โ s โ Sโ, (u - l) :=
have (s : โ) : ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ โ Set.Icc l u := ucb_mem_Icc hi
sum_le_sum (by grind)
_ = โ s โ range n, if pullCount A (A s ฯ) s ฯ = 0 then (u - l) else 0 := by
rw [sum_filter]
_ = โ a, โ j โ range (pullCount A a n ฯ), if j = 0 then (u - l) else 0 :=
sum_comp_pullCount (fun j => if j = 0 then (u - l) else 0) n ฯ
_ โค โ a, (u - l) := by
gcongr
rw [sum_ite_eq']
grind
_ = (u - l) * K := by
rw [Fin.sum_const, nsmul_eq_mul, mul_comm]
ยท calc โ s โ Sโ, (ucb A R l u ฯ2 ฮด (A s ฯ) s ฯ - ฮผ (A s ฯ))
โค โ s โ Sโ, 2 * โ(2 * ฯ2 * Real.log (1 / ฮด) / (pullCount A (A s ฯ) s ฯ)) := by
gcongr with s hs
unfold ucb
have : 0 โค โ(2 * ฯ2 * Real.log (1 / ฮด) / (pullCount A (A s ฯ) s ฯ)) := by positivity
grind
_ โค โ s โ range n, 2 * โ(2 * ฯ2 * Real.log (1 / ฮด) / (pullCount A (A s ฯ) s ฯ)) :=
sum_le_sum_of_subset_of_nonneg (filter_subset _ _) (fun _ _ _ => by positivity)
_ = 2 * โ(2 * ฯ2 * Real.log (1 / ฮด)) * โ s โ range n, (1 / โ(pullCount A (A s ฯ) s ฯ)) := by
rw [mul_sum]
congr with s
rw [Real.sqrt_div' _ (by positivity)]
ring
_ = 2 * โ(2 * ฯ2 * Real.log (1 / ฮด)) *
โ a, โ j โ range (pullCount A a n ฯ), (1 / โj) := by
rw [sum_comp_pullCount (fun j => 1 / โj)]
_ โค 2 * โ(2 * ฯ2 * Real.log (1 / ฮด)) * (2 * โ a, โ(pullCount A a n ฯ)) := by -- loose
rw [mul_sum _ _ 2]
gcongr with a
by_cases ha : pullCount A a n ฯ = 0
ยท simp [ha]
ยท have hi := sum_inv_sqrt_le (Nat.pos_of_ne_zero ha)
rw [sum_range_succ] at hi
have : 0 โค 1 / โ(pullCount A a n ฯ) := by positivity
linarith
_ โค 2 * โ(2 * ฯ2 * Real.log (1 / ฮด)) * (2 * โ(K * โ a, (pullCount A a n ฯ))) := by
gcongr
have h := sum_sqrt_le Finset.univ (fun a => Nat.cast_nonneg (pullCount A a n ฯ))
rw [Finset.card_fin] at h
exact_mod_cast h
_ = 2 * โ(2 * ฯ2 * Real.log (1 / ฮด)) * (2 * โ(K * n)) := by
congr
exact sum_pullCount (ฯ := ฯ)
_ = 4 * โ(2 * ฯ2 * Real.log (1 / ฮด) * K * n) := by
ring_nf
rw [โ Real.sqrt_mul' _ (by positivity)]
ring_nfActions: Source ยท Open Issue
Meaning last changed in v4.34.0-rc2-14-gf86702d (2026-08-25), 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: 4 project declarations, 61 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.