LeanMachineLearning

Learning.sumRewards_sub_pullCount_smul_eq_sumπŸ”—

Lemma

No docstring.

πŸ”—theorem
Learning.sumRewards_sub_pullCount_smul_eq_sum.{u_1, u_2, u_3} {𝓐 : Type u_1} {𝓨 : Type u_2} {Ξ© : Type u_3} [DecidableEq 𝓐] [AddCommGroup 𝓨] {A : β„• β†’ Ξ© β†’ 𝓐} {a : 𝓐} {n : β„•} {Ο‰ : Ξ©} {R : β„• β†’ Ξ© β†’ 𝓨} (c : 𝓐 β†’ 𝓨) : sumRewards A R a (n + 1) Ο‰ - pullCount A a (n + 1) Ο‰ β€’ c a = βˆ‘ i ∈ Finset.range (n + 1), if A i Ο‰ = a then R i Ο‰ - c a else 0
Learning.sumRewards_sub_pullCount_smul_eq_sum.{u_1, u_2, u_3} {𝓐 : Type u_1} {𝓨 : Type u_2} {Ξ© : Type u_3} [DecidableEq 𝓐] [AddCommGroup 𝓨] {A : β„• β†’ Ξ© β†’ 𝓐} {a : 𝓐} {n : β„•} {Ο‰ : Ξ©} {R : β„• β†’ Ξ© β†’ 𝓨} (c : 𝓐 β†’ 𝓨) : sumRewards A R a (n + 1) Ο‰ - pullCount A a (n + 1) Ο‰ β€’ c a = βˆ‘ i ∈ Finset.range (n + 1), if A i Ο‰ = a then R i Ο‰ - c a else 0

Code

lemma sumRewards_sub_pullCount_smul_eq_sum {R : β„• β†’ Ξ© β†’ 𝓨} (c : 𝓐 β†’ 𝓨) :
    sumRewards A R a (n + 1) Ο‰ - pullCount A a (n + 1) Ο‰ β€’ c a =
      βˆ‘ i ∈ range (n + 1), (if A i Ο‰ = a then R i Ο‰ - c a else 0)
Proof
by
  induction n with
  | zero => simp_rw [sumRewards_add_one, pullCount_add_one]; simp; grind
  | succ n hn =>
    simp_rw [sumRewards_add_one (t := n + 1), pullCount_add_one (t := n + 1)]
    split_ifs with ha
    Β· conv_rhs => rw [sum_range_succ]
      simp only [ha, ↓reduceIte]
      rw [add_smul]
      grind
    Β· simp only [add_zero, hn]
      conv_rhs => rw [sum_range_succ]
      simp [ha]

Actions: Source Β· Open Issue

New in v4.34.0-rc2-14-gf86702d (2026-08-25), 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: 2 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.