LeanMachineLearning

Bandits.UCB.some_sum_eq_zero๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Bandits.UCB.some_sum_eq_zero.{u_1} {K : โ„•} {hK : 0 < K} {c : โ„} {ฮฝ : ProbabilityTheory.Kernel (Fin K) โ„} [ProbabilityTheory.IsMarkovKernel ฮฝ] {ฮฉ : Type u_1} {mฮฉ : MeasurableSpace ฮฉ} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {A : โ„• โ†’ ฮฉ โ†’ Fin K} {R : โ„• โ†’ ฮฉ โ†’ โ„} {ฯƒ2 : NNReal} [Nonempty (Fin K)] (h : Learning.IsAlgEnvSeq A R (ucbAlgorithm hK (c * โ†‘ฯƒ2)) (Learning.stationaryEnv ฮฝ) P) (hc : 0 โ‰ค c) (a : Fin K) (h_gap : 0 < gap ฮฝ a) (n C : โ„•) (hC : C โ‰  0) (hC' : 8 * c * โ†‘ฯƒ2 * Real.log (โ†‘n + 1) / gap ฮฝ a ^ 2 โ‰ค โ†‘C) : โˆ€แต (ฯ‰ : ฮฉ) โˆ‚P, โˆ‘ s โˆˆ Finset.range n, Set.indicator {s | A s ฯ‰ = a โˆง C < Learning.pullCount A a s ฯ‰ โˆง โˆซ (x : โ„), id x โˆ‚ฮฝ (bestArm ฮฝ) โ‰ค Learning.empMean A R (bestArm ฮฝ) s ฯ‰ + ucbWidth A (c * โ†‘ฯƒ2) (bestArm ฮฝ) s ฯ‰ โˆง Learning.empMean A R (A s ฯ‰) s ฯ‰ - ucbWidth A (c * โ†‘ฯƒ2) (A s ฯ‰) s ฯ‰ โ‰ค โˆซ (x : โ„), id x โˆ‚ฮฝ (A s ฯ‰)} 1 s = 0
Bandits.UCB.some_sum_eq_zero.{u_1} {K : โ„•} {hK : 0 < K} {c : โ„} {ฮฝ : ProbabilityTheory.Kernel (Fin K) โ„} [ProbabilityTheory.IsMarkovKernel ฮฝ] {ฮฉ : Type u_1} {mฮฉ : MeasurableSpace ฮฉ} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {A : โ„• โ†’ ฮฉ โ†’ Fin K} {R : โ„• โ†’ ฮฉ โ†’ โ„} {ฯƒ2 : NNReal} [Nonempty (Fin K)] (h : Learning.IsAlgEnvSeq A R (ucbAlgorithm hK (c * โ†‘ฯƒ2)) (Learning.stationaryEnv ฮฝ) P) (hc : 0 โ‰ค c) (a : Fin K) (h_gap : 0 < gap ฮฝ a) (n C : โ„•) (hC : C โ‰  0) (hC' : 8 * c * โ†‘ฯƒ2 * Real.log (โ†‘n + 1) / gap ฮฝ a ^ 2 โ‰ค โ†‘C) : โˆ€แต (ฯ‰ : ฮฉ) โˆ‚P, โˆ‘ s โˆˆ Finset.range n, Set.indicator {s | A s ฯ‰ = a โˆง C < Learning.pullCount A a s ฯ‰ โˆง โˆซ (x : โ„), id x โˆ‚ฮฝ (bestArm ฮฝ) โ‰ค Learning.empMean A R (bestArm ฮฝ) s ฯ‰ + ucbWidth A (c * โ†‘ฯƒ2) (bestArm ฮฝ) s ฯ‰ โˆง Learning.empMean A R (A s ฯ‰) s ฯ‰ - ucbWidth A (c * โ†‘ฯƒ2) (A s ฯ‰) s ฯ‰ โ‰ค โˆซ (x : โ„), id x โˆ‚ฮฝ (A s ฯ‰)} 1 s = 0

Code

lemma some_sum_eq_zero [Nonempty (Fin K)]
    (h : IsAlgEnvSeq A R (ucbAlgorithm hK (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,
    โˆ‘ s โˆˆ range n, {s | A s ฯ‰ = a โˆง C < pullCount A a s ฯ‰ โˆง
      (ฮฝ (bestArm ฮฝ))[id] โ‰ค empMean A R (bestArm ฮฝ) s ฯ‰ + ucbWidth A (c * ฯƒ2) (bestArm ฮฝ) s ฯ‰ โˆง
      empMean A R (A s ฯ‰) s ฯ‰ - ucbWidth A (c * ฯƒ2) (A s ฯ‰) s ฯ‰
        โ‰ค (ฮฝ (A s ฯ‰))[id]}.indicator 1 s = 0
Proof
by
  have h_ae := forall_ucbIndex_le_ucbIndex_arm h (bestArm ฮฝ) (ฮฝ := ฮฝ) (c := c * ฯƒ2) (hK := hK)
  have h_gt := time_gt_of_pullCount_gt_one h a (ฮฝ := ฮฝ) (c := c * ฯƒ2) (hK := hK)
  filter_upwards [h_ae, h_gt] with ฯ‰ h_le h_time_ge
  simp only [id_eq, tsub_le_iff_right, sum_eq_zero_iff, mem_range, Set.indicator_apply_eq_zero,
    Set.mem_ofPred_eq, Pi.one_apply, one_ne_zero, imp_false, not_and, not_le]
  intro k hn h_arm hC_lt h_le_best
  by_contra! h_le_arm
  have h := pullCount_arm_le (by positivity : 0 โ‰ค c * ฯƒ2) h_le_best (by simpa) ?_ ?_ ?_
  rotate_left
  ยท refine h_le _ ?_
    refine (h_time_ge _ ?_).le
    refine lt_of_le_of_lt ?_ hC_lt
    grind
  ยท rwa [h_arm]
  ยท rw [h_arm]
    exact zero_le.trans_lt hC_lt
  refine lt_irrefl (8 * c * ฯƒ2 * log (n + 1) / gap ฮฝ a ^ 2) ?_
  refine hC'.trans_lt (lt_of_lt_of_le ?_ (h.trans ?_))
  ยท rw [h_arm]
    exact mod_cast hC_lt
  ยท rw [h_arm]
    simp_rw [โ† mul_assoc]
    gcongr

Actions: Source ยท Open Issue

Meaning last changed in v4.34.0-rc2-14-gf86702d (2026-08-25), the 5th 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: 23 project declarations, 155 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.