LeanMachineLearning exposition

Learning.sum_comp_pullCount🔗

This page has the declaration's own card below, then its dependency graph, then a card for each dependency (type dependencies first, then the rest of the transitive closure). For a theorem, the graph and the dependency cards only follow its statement's dependencies (its proof is replaced by sorry, so what it proves doesn't depend on how); for everything else, both the type and the body/value are followed, since their content is part of what later declarations build on.

Minimal Lean file

sum_comp_pullCount🔗

LemmaLearning.sum_comp_pullCount

No docstring.

🔗theorem
Learning.sum_comp_pullCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} [DecidableEq 𝓐] {A : Ω 𝓐} [Fintype 𝓐] [AddCommMonoid R] (f : R) (t : ) (ω : Ω) : s Finset.range t, f (pullCount A (A s ω) s ω) = a, j Finset.range (pullCount A a t ω), f j
Learning.sum_comp_pullCount.{u_1, u_2, u_3} {𝓐 : Type u_1} {R : Type u_2} {Ω : Type u_3} [DecidableEq 𝓐] {A : Ω 𝓐} [Fintype 𝓐] [AddCommMonoid R] (f : R) (t : ) (ω : Ω) : s Finset.range t, f (pullCount A (A s ω) s ω) = a, j Finset.range (pullCount A a t ω), f j

Code

lemma sum_comp_pullCount [Fintype 𝓐] [AddCommMonoid R] (f : ℕ → R) (t : ℕ) (ω : Ω) :
    ∑ s ∈ range t, f (pullCount A (A s ω) s ω) = ∑ a, ∑ j ∈ range (pullCount A a t ω), f j
Type uses (1)
Body uses (2)
Used by (1)

Actions: Source · Open Issue

Proof
by
  induction t with
  | zero => simp
  | succ n ih =>
    have hf : f (pullCount A (A n ω) n ω) =
      ∑ a, if A n ω = a then f (pullCount A a n ω) else 0 := by simp
    simp_rw [sum_range_succ, ih, hf, ← sum_add_distrib, pullCount_add_one]
    congr 1 with a
    split_ifs
    · simp [sum_range_succ]
    · simp

Dependency graph

Type dependencies (1)

pullCount🔗

DefinitionLearning.pullCount

Number of times action a was chosen up to time t (excluding t).

🔗def
Learning.pullCount.{u_1, u_3} {𝓐 : Type u_1} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (a : 𝓐) (t : ) (ω : Ω) :
Learning.pullCount.{u_1, u_3} {𝓐 : Type u_1} {Ω : Type u_3} [DecidableEq 𝓐] (A : Ω 𝓐) (a : 𝓐) (t : ) (ω : Ω) :

Code

noncomputable
def pullCount (A : ℕ → Ω → 𝓐) (a : 𝓐) (t : ℕ) (ω : Ω) : ℕ :=
  #(filter (fun s ↦ A s ω = a) (range t))
Used by (146)

Actions: Source · Open Issue