Skip to content

Commit aa57306

Browse files
committed
delete AuxSums file
1 parent 2fa53e7 commit aa57306

3 files changed

Lines changed: 43 additions & 60 deletions

File tree

‎LeanMachineLearning.lean‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public import LeanMachineLearning.MeasureTheory.Constructions.Polish.StandardBor
1919
public import LeanMachineLearning.Probability.Moments.SubGaussian
2020
public import LeanMachineLearning.Probability.Kernel.IonescuTulcea.Traj
2121
public import LeanMachineLearning.SequentialLearning.Algorithm
22-
public import LeanMachineLearning.SequentialLearning.Algorithms.AuxSums
2322
public import LeanMachineLearning.SequentialLearning.Algorithms.RoundRobin
2423
public import LeanMachineLearning.SequentialLearning.Deterministic
2524
public import LeanMachineLearning.SequentialLearning.FiniteActions

‎LeanMachineLearning/SequentialLearning/Algorithms/AuxSums.lean‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎LeanMachineLearning/SequentialLearning/Algorithms/RoundRobin.lean‎

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Authors: Rémy Degenne
55
-/
66
module
77

8-
public import LeanMachineLearning.SequentialLearning.Algorithms.AuxSums
98
public import LeanMachineLearning.SequentialLearning.Deterministic
109
public import LeanMachineLearning.SequentialLearning.FiniteActions
1110
public import LeanMachineLearning.SequentialLearning.StationaryEnv
@@ -27,7 +26,48 @@ he action `n % K`.
2726
open MeasureTheory ProbabilityTheory Finset Learning
2827
open scoped ENNReal NNReal
2928

30-
namespace Bandits
29+
section Aux
30+
31+
lemma sum_mod_range {K : ℕ} (hK : 0 < K) (a : Fin K) :
32+
(∑ s ∈ range K, if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) = 1 := by
33+
have h_iff (s : ℕ) (hs : s < K) : ⟨s % K, Nat.mod_lt _ hK⟩ = a ↔ s = a := by
34+
simp only [Nat.mod_eq_of_lt hs, Fin.ext_iff]
35+
calc (∑ s ∈ range K, if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0)
36+
_ = ∑ s ∈ range K, if s = a then 1 else 0 := sum_congr rfl fun s hs ↦ by grind
37+
_ = _ := by
38+
rw [sum_ite_eq']
39+
simp
40+
41+
lemma sum_mod_range_mul {K : ℕ} (hK : 0 < K) (m : ℕ) (a : Fin K) :
42+
(∑ s ∈ range (K * m), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) = m := by
43+
induction m with
44+
| zero => simp
45+
| succ n hn =>
46+
calc (∑ s ∈ range (K * (n + 1)), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0)
47+
_ = (∑ s ∈ range (K * n + K), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) := by ring_nf
48+
_ = (∑ s ∈ range (K * n), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0)
49+
+ (∑ s ∈ Ico (K * n) (K * n + K), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) := by
50+
rw [sum_range_add_sum_Ico]
51+
grind
52+
_ = n + (∑ s ∈ Ico (K * n) (K * n + K), if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) := by
53+
rw [hn]
54+
_ = n + (∑ s ∈ range K, if ⟨(s + K * n) % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) := by
55+
congr 1
56+
let e : ℕ ↪ ℕ := ⟨fun i : ℕ ↦ i + K * n, fun i j hij ↦ by grind⟩
57+
have : Finset.map e (range K) = Ico (K * n) (K * n + K) := by
58+
ext x
59+
simp only [mem_map, mem_range, Function.Embedding.coeFn_mk, mem_Ico, e]
60+
refine ⟨fun h ↦ by grind, fun h ↦ ?_⟩
61+
use x - K * n
62+
grind
63+
rw [← this, Finset.sum_map]
64+
congr
65+
_ = n + (∑ s ∈ range K, if ⟨s % K, Nat.mod_lt _ hK⟩ = a then 1 else 0) := by simp
66+
_ = n + 1 := by rw [sum_mod_range hK]
67+
68+
end Aux
69+
70+
namespace Learning
3171

3272
variable {K : ℕ}
3373

@@ -123,4 +163,4 @@ lemma pullCount_pos_of_pullCount_gt_one [Nonempty (Fin K)]
123163

124164
end RoundRobin
125165

126-
end Bandits
166+
end Learning

0 commit comments

Comments
 (0)