LeanMachineLearning

Bandits.ClippedUCB.sum_ucb_sub_mean_le๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
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_nf

Actions: 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.