LeanMachineLearning

Learning.rewardByCountUntil_apply_of_lt_pullCount๐Ÿ”—

Lemma

From the authors

If action a was pulled more than m times before time t, then the entry (a, m) of rewardByCountUntil A R' t ฯ‰ is the reward received at the (m + 1)-th pull of a.

Types
  • ๐“ : Type u_2DecidableEq ๐“
  • R : Type u_3
  • ฮฉ : Type u_4
Given
  • A : โ„• โ†’ ฮฉ โ†’ ๐“
  • R' : โ„• โ†’ ฮฉ โ†’ R
  • a : ๐“
  • m : โ„•
  • t : โ„•
  • ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R)
Assuming
  • h : m < pullCount A a t ฯ‰.1
Then
rewardByCountUntil A R' t ฯ‰ (a, m) = rewardByCount A R' a (m + 1) ฯ‰
Code
lemma rewardByCountUntil_apply_of_lt_pullCount (h : m < pullCount A a t ฯ‰.1) :
    rewardByCountUntil A R' t ฯ‰ (a, m) = rewardByCount A R' a (m + 1) ฯ‰
Proof
by
  induction t with
  | zero => simp at h
  | succ t ih =>
    rw [rewardByCountUntil_add_one]
    by_cases hp : (a, m) = (A t ฯ‰.1, pullCount A (A t ฯ‰.1) t ฯ‰.1)
    ยท obtain โŸจrfl, rflโŸฉ := Prod.mk.inj hp
      rw [Function.update_self, rewardByCount_pullCount_add_one_eq_reward]
    ยท rw [Function.update_of_ne hp]
      refine ih ?_
      rw [pullCount_add_one] at h
      split_ifs at h with hA
      ยท rw [hA] at hp
        have hm : m โ‰  pullCount A a t ฯ‰.1 := fun hm โ†ฆ hp (by rw [hm])
        omega
      ยท simpa using h

Meaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10).

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, 43 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.