Repository navigation
feat: test martingales for which e-BH on running maxima rejects with probability 2Kα/(K+1), so that the bounds 4α/3 and 3α/2 are attained #453
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
Closed
RemyDegenne
wants to merge
5
commits into
LeanMachineLearning:main
from
RemyDegenne:evr/ebh-running-maxima-attained
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9b6507d
feat: test martingales for which e-BH on running maxima rejects with …
RemyDegenne df9947c
refactor: make the general helpers of the e-BH lower bound public, ci…
RemyDegenne 0e456de
refactor: expose the finite Doob martingales and the general counting…
RemyDegenne 07f22b1
refactor: rename fiberAvg_of_sum_eq_zero to fiberAvg_eq_zero_of_sum_e…
RemyDegenne f4ad5dd
refactor: export two_mul_sum_range_sub from Algebra.BigOperators.Inte…
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
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,41 @@ | ||
| /- | ||
| 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.Data.Fintype.BigOperators | ||
|
|
||
| /-! | ||
| # Counting functions with a coordinatewise condition | ||
|
|
||
| The functions `f : ∀ i, α i` with `Q i (f i)` for every `i` form the box | ||
| `Fintype.piFinset fun i ↦ {a | Q i a}`, so there are `∏ i, #{a | Q i a}` of them. The lower | ||
| bound for e-BH on running maxima (`LMLExplore.EValues.MultipleTesting.RunningMaxima.LowerBound`) | ||
| counts the height vectors in a fiber of its information this way. | ||
|
|
||
| ## Main statements | ||
|
|
||
| * `Fintype.card_filter_forall`: the number of functions satisfying a coordinatewise condition is | ||
| the product of the numbers of values satisfying it at each coordinate. | ||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| namespace Fintype | ||
|
|
||
| variable {ι : Type*} [Fintype ι] [DecidableEq ι] {α : ι → Type*} [∀ i, Fintype (α i)] | ||
|
|
||
| /-- The number of functions `f : ∀ i, α i` with `Q i (f i)` for every `i` is the product over `i` | ||
| of the number of values `a : α i` with `Q i a`. -/ | ||
| theorem card_filter_forall (Q : ∀ i, α i → Prop) | ||
| [∀ i, DecidablePred (Q i)] [DecidablePred fun f : ∀ i, α i ↦ ∀ i, Q i (f i)] : | ||
| (Finset.univ.filter fun f : ∀ i, α i ↦ ∀ i, Q i (f i)).card = | ||
| ∏ i, (Finset.univ.filter (Q i)).card := by | ||
| rw [← card_piFinset] | ||
| congr 1 | ||
| ext f | ||
| simp [mem_piFinset] | ||
|
|
||
| end Fintype |
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,40 @@ | ||
| /- | ||
| 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.Data.Finset.Max | ||
| public import Mathlib.Data.Int.Interval | ||
|
|
||
| /-! | ||
| # Finite sets of integers of small diameter | ||
|
|
||
| A finite set of integers whose elements are pairwise less than `d` apart lies in an interval | ||
| `[a, a + d)`, so it has at most `d` elements. The cycle lemma in | ||
| `LMLExplore.EValues.MultipleTesting.RunningMaxima.LowerBound` uses it to count the shifts of a | ||
| walk whose values are pairwise close. | ||
|
|
||
| ## Main statements | ||
|
|
||
| * `Int.card_le_toNat_of_forall_lt_add`: a finite set of integers whose elements are less than `d` | ||
| apart has at most `d.toNat` elements. | ||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| namespace Int | ||
|
|
||
| /-- A finite set of integers whose elements are less than `d` apart has at most `d` elements. -/ | ||
| theorem card_le_toNat_of_forall_lt_add {S : Finset ℤ} {d : ℤ} | ||
| (h : ∀ x ∈ S, ∀ y ∈ S, x ≤ y → y < x + d) : | ||
| S.card ≤ d.toNat := by | ||
| rcases S.eq_empty_or_nonempty with rfl | hS | ||
| · simp | ||
| have hsub : S ⊆ Finset.Ico (S.min' hS) (S.min' hS + d) := fun x hx ↦ | ||
| Finset.mem_Ico.2 ⟨S.min'_le x hx, h _ (S.min'_mem hS) x hx (S.min'_le x hx)⟩ | ||
| calc S.card ≤ (Finset.Ico (S.min' hS) (S.min' hS + d)).card := Finset.card_le_card hsub | ||
| _ = d.toNat := by simp | ||
|
|
||
| end Int |
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.Data.Nat.Init | ||
| import Mathlib.Tactic.SplitIfs | ||
|
|
||
| /-! | ||
| # Shifting residues modulo `K` | ||
|
|
||
| For residues `h`, `u` and `x` modulo `K`, the shift `(h + u) % K` is `x` exactly when `h` is the | ||
| shift `(x + K - u) % K` of `x` by `-u`. The cycle lemma of the lower bound for e-BH on running | ||
| maxima (`LMLExplore.EValues.MultipleTesting.RunningMaxima.LowerBound`) uses it to count shifted | ||
| heights. | ||
|
|
||
| ## Main statements | ||
|
|
||
| * `Nat.add_mod_eq_iff`: `(h + u) % K = x ↔ h = (x + K - u) % K` for `h, u, x < K`. | ||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| namespace Nat | ||
|
|
||
| /-- Shifting residues modulo `K`: for `h, u, x < K`, `(h + u) % K = x` exactly when | ||
| `h = (x + K - u) % K`. -/ | ||
| theorem add_mod_eq_iff {K h u x : ℕ} (hh : h < K) (hu : u < K) (hx : x < K) : | ||
| (h + u) % K = x ↔ h = (x + K - u) % K := by | ||
| have e1 : (h + u) % K = if h + u < K then h + u else h + u - K := by | ||
| split_ifs with h' | ||
| · exact Nat.mod_eq_of_lt h' | ||
| · rw [Nat.mod_eq_sub_mod (by omega), Nat.mod_eq_of_lt (by omega)] | ||
| have e2 : (x + K - u) % K = if x < u then x + K - u else x - u := by | ||
| split_ifs with h' | ||
| · exact Nat.mod_eq_of_lt (by omega) | ||
| · rw [Nat.mod_eq_sub_mod (by omega), Nat.mod_eq_of_lt (by omega)] | ||
| omega | ||
| rw [e1, e2] | ||
| split_ifs <;> omega | ||
|
|
||
| end Nat |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 generality — request_changes
claude/claude-opus-5-5The public statements are at the natural level, and the
card_eq_two/card_eq_threecorollaries are derived from the general theorem; onlytwo_mul_sum_range_subis under-generalized, being stated forn + 1where the formula holds for everyn.LMLExplore/Algebra/BigOperators/Intervals.lean:102—two_mul_sum_range_subis stated only forrange (n + 1)with(n + 1 - i)and(n + 1) * (n + 2). That is the successor case of Gauss' formula, which holds for everyn. Fix: State it astheorem two_mul_sum_range_sub (n : ℕ) : 2 * ∑ i ∈ range n, (n - i) = n * (n + 1)(the samesum_range_reflectproof works) and call it atn + 1inLowerBound.lean:601. Update the module docstring entry to match.Reply in this thread to contest a finding; that re-runs only this rubric and posts an answer here. (To fix it, just push a commit — that re-reviews on its own. To contest again after an answer, post a NEW reply rather than editing an old one.)
claude/claude-opus-5-5· 26s · 107.5k in (100.7k cache read, 6.8k cache write) / 2.3k out tokens · reviewing this diff · rubric ·