LeanMachineLearning

Learning.sum_rewardByCount_eq_sumRewards๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Learning.sum_rewardByCount_eq_sumRewards.{u_1, u_2, u_3} {๐“ : Type u_1} {๐“จ : Type u_2} {ฮฉ : Type u_3} [DecidableEq ๐“] [AddCommGroup ๐“จ] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ ๐“จ} (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ ๐“จ)) : โˆ‘ m โˆˆ Finset.Icc 1 (pullCount A a t (Prod.fst ฯ‰)), rewardByCount A R a m ฯ‰ = sumRewards A R a t (Prod.fst ฯ‰)
Learning.sum_rewardByCount_eq_sumRewards.{u_1, u_2, u_3} {๐“ : Type u_1} {๐“จ : Type u_2} {ฮฉ : Type u_3} [DecidableEq ๐“] [AddCommGroup ๐“จ] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ ๐“จ} (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ ๐“จ)) : โˆ‘ m โˆˆ Finset.Icc 1 (pullCount A a t (Prod.fst ฯ‰)), rewardByCount A R a m ฯ‰ = sumRewards A R a t (Prod.fst ฯ‰)

Code

lemma sum_rewardByCount_eq_sumRewards {R : โ„• โ†’ ฮฉ โ†’ ๐“จ} (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ ๐“จ)) :
    โˆ‘ m โˆˆ Icc 1 (pullCount A a t ฯ‰.1), rewardByCount A R a m ฯ‰ = sumRewards A R a t ฯ‰.1
Proof
by
  induction t with
  | zero => simp [pullCount, sumRewards]
  | succ t ht =>
    by_cases hta : A t ฯ‰.1 = a
    ยท rw [โ† hta] at ht โŠข
      rw [pullCount_action_eq_pullCount_add_one, sum_Icc_succ_top (Nat.le_add_left 1 _), ht]
      unfold sumRewards
      rw [sum_range_succ, ite_eq_left rfl, rewardByCount_pullCount_add_one_eq_reward]
    ยท unfold sumRewards
      rwa [pullCount_eq_pullCount_of_action_ne hta, sum_range_succ, ite_eq_right hta, add_zero]

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