Repository navigation
feat: large deviations of the empirical means of a run under static allocations, and the error exponent of static proportions #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lmlexplore-automation
merged 7 commits into
LeanMachineLearning:main
from
RemyDegenne:roadmap/static-proportions-error-exponent-worker1
Nov 14, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
23fea68
feat: large deviations of the empirical means of a run under static a…
RemyDegenne 52b71a5
refactor: address review of the static-allocation LDP
RemyDegenne 4a91366
refactor: move infinitePi_fin_mem_and_forall_add_mem to MeasureTheory…
RemyDegenne ef40cba
refactor: make the defeq step in infinitePi_fin_mem_and_forall_add_me…
RemyDegenne ed5fbcb
refactor: cite exists_pos_measure_of_cover and clarify neg_sum_le_lim…
RemyDegenne 800cfbd
refactor: move infinitePi_fin_mem_and_forall_add_mem to Probability/P…
RemyDegenne e8f17ce
refactor: rename streamMeasure_forall_row_mem to streamMeasure_forall…
RemyDegenne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /- | ||
| Copyright (c) 2026 LMLExplore contributors. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: LMLExplore contributors | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.Analysis.Normed.Group.Continuity | ||
| public import Mathlib.Analysis.Normed.Group.Real | ||
| public import Mathlib.Analysis.SpecificLimits.Basic | ||
|
|
||
| /-! | ||
| # Limits of ratios to `n` of sequences within bounded distance of a linear sequence | ||
|
|
||
| A real sequence `u` that stays within a fixed distance `c` of the linear sequence `n ↦ n w` | ||
| satisfies `u n / n → w`. Numbers of pulls of bandit algorithms that track static proportions `w` | ||
| up to a bounded error have this form. | ||
|
|
||
| ## Main statements | ||
|
|
||
| * `LMLExplore.tendsto_div_natCast_of_abs_sub_mul_le`: if `|u n - n w| ≤ c` for every `n`, then | ||
| `u n / n → w`. | ||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| open Filter Topology | ||
|
|
||
| namespace LMLExplore | ||
|
|
||
| /-- If `|u n - n w| ≤ c` for every `n`, then `u n / n → w`. -/ | ||
| theorem tendsto_div_natCast_of_abs_sub_mul_le {u : ℕ → ℝ} {w c : ℝ} | ||
| (h : ∀ n : ℕ, |u n - n * w| ≤ c) : Tendsto (fun n : ℕ ↦ u n / n) atTop (𝓝 w) := by | ||
| have h0 : Tendsto (fun n : ℕ ↦ (u n - n * w) / n) atTop (𝓝 0) := by | ||
| refine squeeze_zero_norm (fun n ↦ ?_) (tendsto_const_div_atTop_nhds_zero_nat c) | ||
| rw [Real.norm_eq_abs, abs_div, Nat.abs_cast] | ||
| exact div_le_div_of_nonneg_right (h n) n.cast_nonneg | ||
| have h1 : Tendsto (fun n : ℕ ↦ (u n - n * w) / n + w) atTop (𝓝 w) := by | ||
| simpa using h0.add_const w | ||
| refine h1.congr' ?_ | ||
| filter_upwards [eventually_ne_atTop 0] with n hn | ||
| rw [sub_div, mul_div_cancel_left₀ _ (Nat.cast_ne_zero.2 hn), sub_add_cancel] | ||
|
|
||
| end LMLExplore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
RemyDegenne marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /- | ||
| Copyright (c) 2026 LMLExplore contributors. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: LMLExplore contributors | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.Probability.Independence.InfinitePi | ||
|
|
||
| /-! | ||
| # Infinite products of probability measures: the first terms and the next terms | ||
|
|
||
| Under the infinite product `Measure.infinitePi` of copies of a probability measure `μ`, the first | ||
| `n` coordinates and the next `m` coordinates are independent. | ||
|
|
||
| ## Main statements | ||
|
|
||
| * `MeasureTheory.Measure.infinitePi_fin_mem_and_forall_add_mem`: for an i.i.d. sequence, the | ||
| first `n` terms and the next `m` terms are independent. | ||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| namespace MeasureTheory.Measure | ||
|
|
||
| open ProbabilityTheory Finset in | ||
| /-- **The first terms of an i.i.d. sequence and the next terms are independent.** For an i.i.d. | ||
| sequence `z` of law `μ`, the first `n` terms `(z i)_{i < n}` lie in `B` and the next `m` terms lie | ||
| in `C` with probability `μ^⊗n(B) μ(C)^m`. -/ | ||
| theorem infinitePi_fin_mem_and_forall_add_mem {X : Type*} [MeasurableSpace X] (μ : Measure X) | ||
| [IsProbabilityMeasure μ] (n m : ℕ) {B : Set (Fin n → X)} {C : Set X} (hB : MeasurableSet B) | ||
| (hC : MeasurableSet C) : | ||
| (Measure.infinitePi fun _ : ℕ ↦ μ) {z | (fun i : Fin n ↦ z i) ∈ B ∧ ∀ j < m, z (n + j) ∈ C} = | ||
| Measure.pi (fun _ : Fin n ↦ μ) B * μ C ^ m := by | ||
| -- The first `n` terms and the next `m` terms are independent. | ||
| have h_ind := (iIndepFun_infinitePi (P := fun _ : ℕ ↦ μ) (X := fun _ ↦ id) | ||
| (fun _ ↦ measurable_id)).indepFun_finset (range n) (Ico n (n + m)) | ||
| (Finset.disjoint_left.2 fun i hi hi' ↦ by simp at hi hi'; omega) (fun _ ↦ by fun_prop) | ||
| simp only [id] at h_ind | ||
| have h_fin : Measurable fun (u : {i // i ∈ range n} → X) (i : Fin n) ↦ | ||
| u ⟨i, mem_range.2 i.2⟩ := by fun_prop | ||
| have h_set : {z : ℕ → X | (fun i : Fin n ↦ z i) ∈ B ∧ ∀ j < m, z (n + j) ∈ C} = | ||
| (fun z (i : range n) ↦ z i) ⁻¹' ((fun u (i : Fin n) ↦ u ⟨i, mem_range.2 i.2⟩) ⁻¹' B) ∩ | ||
| (fun z (i : Ico n (n + m)) ↦ z i) ⁻¹' (Set.univ.pi fun _ ↦ C) := by | ||
| ext z | ||
| simp only [Set.mem_ofPred_eq, Set.mem_inter_iff, Set.mem_preimage, Set.mem_pi, | ||
| Set.mem_univ, true_implies, Subtype.forall, mem_Ico] | ||
| refine and_congr Iff.rfl ⟨fun h i hi ↦ ?_, fun h j hj ↦ h _ ⟨by omega, by omega⟩⟩ | ||
| obtain ⟨j, rfl⟩ := Nat.exists_eq_add_of_le hi.1 | ||
| exact h j (by omega) | ||
| rw [h_set, h_ind.measure_inter_preimage_eq_mul _ _ (h_fin hB) (.univ_pi fun _ ↦ hC)] | ||
| congr 1 | ||
| · -- The first `n` terms are `n` independent samples of `μ`. | ||
| have h_pi : (Measure.infinitePi fun _ : ℕ ↦ μ).map (fun z (i : Fin n) ↦ z i) = | ||
| Measure.pi fun _ : Fin n ↦ μ := by | ||
| rw [Measure.map_infinitePi_infinitePi_of_inj Fin.val_injective, Measure.infinitePi_eq_pi] | ||
| rw [← h_pi, Measure.map_apply (by fun_prop) hB, ← Set.preimage_comp] | ||
| -- Both sides are the preimage of `B` under `z ↦ (z i)_{i : Fin n}`: the composite | ||
| -- `(fun u i ↦ u ⟨i, _⟩) ∘ (fun z i ↦ z i)` unfolds to `fun z i ↦ z ↑⟨i, _⟩`, and | ||
| -- `↑⟨i, _⟩ = i` is `Subtype.val` applied to a constructor. | ||
| rfl | ||
| · have h_pi : (fun z (i : Ico n (n + m)) ↦ z i) ⁻¹' (Set.univ.pi fun _ ↦ C) = | ||
| ((Ico n (n + m) : Finset ℕ) : Set ℕ).pi fun _ ↦ C := by | ||
| ext z | ||
| simp | ||
| rw [h_pi, Measure.infinitePi_pi _ fun _ _ ↦ hC, Finset.prod_const, Nat.card_Ico, | ||
| Nat.add_sub_cancel_left] | ||
|
|
||
| end MeasureTheory.Measure |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.