diff --git a/LeanMachineLearning/Online/Bandit/ArrayProbSpace.lean b/LeanMachineLearning/Online/Bandit/ArrayProbSpace.lean index 84010b2a..ea673dd0 100644 --- a/LeanMachineLearning/Online/Bandit/ArrayProbSpace.lean +++ b/LeanMachineLearning/Online/Bandit/ArrayProbSpace.lean @@ -209,12 +209,11 @@ lemma map_snd_apply_arrayMeasure {Ξ½ : Kernel 𝓐 𝓑} [IsMarkovKernel Ξ½] (n (arrayMeasure Ξ½).map (fun Ο‰ ↦ Ο‰.2 n a) = Ξ½ a := (hasLaw_snd_apply_arrayMeasure Ξ½ n a).map_eq -/-- Modification of `Ο‰` in which the rewards of action `a` are read only up to index `m - 1`: -in row `a` of the reward array, the entry at index `i` is kept if `i < m` and replaced by the entry -at index `m + 1 + i` otherwise. The result does not depend on the coordinate `(m, a)` of the -array. -/ +/-- Modification of `Ο‰` in which the entry at index `m` of row `a` of the reward array is +removed: in row `a`, the entry at index `i` is kept if `i < m` and replaced by the entry at index +`i + 1` otherwise. The result does not depend on the coordinate `(m, a)` of the array. -/ def truncRow [DecidableEq 𝓐] (a : 𝓐) (m : β„•) (Ο‰ : ProbSpace 𝓐 𝓑) : ProbSpace 𝓐 𝓑 := - (Ο‰.1, fun i b ↦ if b = a then Ο‰.2 (if i < m then i else m + 1 + i) b else Ο‰.2 i b) + (Ο‰.1, fun i b ↦ if b = a then Ο‰.2 (if i < m then i else i + 1) b else Ο‰.2 i b) @[fun_prop] lemma measurable_truncRow [DecidableEq 𝓐] (a : 𝓐) (m : β„•) : @@ -601,7 +600,7 @@ omit [Nonempty 𝓐] [StandardBorelSpace 𝓐] in lemma indepFun_snd_apply_truncRow (Ξ½ : Kernel 𝓐 𝓑) [IsMarkovKernel Ξ½] (a : 𝓐) (m : β„•) : (fun Ο‰ ↦ Ο‰.2 m a) βŸ‚α΅’[arrayMeasure Ξ½] (truncRow a m) := by let T : (β„• β†’ 𝓐 β†’ 𝓑) β†’ (β„• β†’ 𝓐 β†’ 𝓑) := - fun Ο‰ k b ↦ if b = a then Ο‰ (if k < m then k else m + 1 + k) b else Ο‰ k b + fun Ο‰ k b ↦ if b = a then Ο‰ (if k < m then k else k + 1) b else Ο‰ k b have hT : Measurable[⨆ p ∈ {p : β„• Γ— 𝓐 | p β‰  (m, a)}, MeasurableSpace.comap (fun Ο‰ : β„• β†’ 𝓐 β†’ 𝓑 ↦ Ο‰ p.1 p.2) inferInstance] T := by rw [measurable_iff_comap_le, MeasurableSpace.comap_pi] @@ -610,7 +609,7 @@ lemma indepFun_snd_apply_truncRow (Ξ½ : Kernel 𝓐 𝓑) [IsMarkovKernel Ξ½] (a refine iSup_le fun b ↦ ?_ by_cases hb : b = a Β· simp only [T, hb, ↓reduceIte] - refine le_iSupβ‚‚_of_le (if k < m then k else m + 1 + k, a) ?_ (le_of_eq rfl) + refine le_iSupβ‚‚_of_le (if k < m then k else k + 1, a) ?_ (le_of_eq rfl) simp only [Set.mem_ofPred_eq, ne_eq, Prod.mk.injEq, and_true] split_ifs <;> omega Β· simp only [T, hb, ↓reduceIte]