LeanMachineLearning

Bandits.UCB.constSum_le🔗

Lemma

From the authors

For c > 2, the sum constSum c n is at most 1 + 1 / (c - 2), uniformly in n.

Given
  • c :
  • n :
Assuming
  • hc : 2 < c
Then
constSum c n1 + 1 / (c - 2)
Code
lemma constSum_le {c : ℝ} (hc : 2 < c) (n : ℕ) : constSum c n ≤ 1 + 1 / (c - 2)
Proof
by
  have hc2 : 0 < c - 2 := by linarith
  cases n with
  | zero => simp only [constSum, range_zero, sum_empty]; positivity
  | succ m =>
    -- Comparison of the sum with the integral of `x ↦ x ^ (-(c - 1))` on `[1, 1 + m]`.
    have h_anti : AntitoneOn (fun x : ℝ ↦ x ^ (-(c - 1))) (Set.Icc 1 (1 + m)) :=
      (antitoneOn_rpow_Ioi_of_exponent_nonpos (by linarith)).mono
        fun x hx ↦ zero_lt_one.trans_le hx.1
    have h_sum := AntitoneOn.sum_le_integral h_anti
    rw [integral_rpow (Or.inr ⟨by linarith, ?_⟩)] at h_sum
    swap
    · rw [Set.uIcc_of_le (le_add_of_nonneg_right (by positivity))]
      simp
    have h_pow_nonneg : 0 ≤ (1 + (m : ℝ)) ^ (-(c - 1) + 1) := Real.rpow_nonneg (by positivity) _
    calc constSum c (m + 1)
    _ = 1 + ∑ i ∈ range m, (1 + ((i + 1 : ℕ) : ℝ)) ^ (-(c - 1)) := by
      rw [constSum, Finset.sum_range_succ', add_comm]
      congr 1
      · simp
      · refine Finset.sum_congr rfl fun i _ ↦ ?_
        rw [Real.rpow_neg (by positivity), one_div]
        push_cast
        ring_nf
    _ ≤ 1 + ((1 + m) ^ (-(c - 1) + 1) - 1 ^ (-(c - 1) + 1)) / (-(c - 1) + 1) := by gcongr
    _ = 1 + (1 - (1 + m) ^ (-(c - 1) + 1)) / (c - 2) := by
      rw [Real.one_rpow]
      congr 1
      rw [div_eq_div_iff (by linarith) hc2.ne']
      ring
    _ ≤ 1 + 1 / (c - 2) := by gcongr; linarith

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: 1 project declarations, 31 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.