Repository navigation
feat: likelihood ratios of sequential predictors and time-uniform KL concentration by the Laplace mixture [JKMDLV20, Proposition 1] - #296
Conversation
…concentration by the Laplace mixture [JKMDLV20, Proposition 1] Co-Authored-By: Claude Code <noreply@github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
There was a problem hiding this comment.
🟡 reuse — request_changes claude/claude-opus-5-5
The earlier duplication findings are fixed: the shared filtration, absolute continuity and the MethodOfTypes identities are now reused. The new public prod_pow_pullCount copies MethodOfTypes' prod_comp_eq_prod_pow_typeCount, and the PR's own bridge typeCount_eq_pullCount connects the two.
LMLExplore/SequentialLearning/FiniteActions.lean:116—prod_pow_pullCount(∏ a, f a ^ pullCount A a t ω = ∏ s ∈ range t, f (A s ω)) is a parallel API toprod_comp_eq_prod_pow_typeCount(∏ k, f (x k) = ∏ a, f a ^ typeCount x a) with the sameprod_fiberwise'proof. Its only consumer,LaplaceMixture.lean:172, already hasxandhN_type. Fix: Deleteprod_pow_pullCountand its docstring entry. AtLaplaceMixture.lean:172, rewriteP = ∏ t ∈ range n, ν.real {ξ t ω}as∏ k, ν.real {x k}withFin.prod_univ_eq_prod_range, then as∏ a, ν.real {a} ^ typeCount x awithprod_comp_eq_prod_pow_typeCount (fun a ↦ ν.real {a}) x, so it matcheshbeforehN_typeis applied.
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 · 47s · 266.6k in (208.5k cache read, 58.1k cache write) / 3.8k out tokens · reviewing this diff · rubric ·
There was a problem hiding this comment.
Fixed in 6b4cd1b, following the first option of the finding.
measureReal_empiricalFiniteMeasure_singleton_eq_pullCount_divis deleted. In its place is the bridgetypeCount_eq_pullCount : typeCount (fun k : Fin n ↦ ξ k ω) a = pullCount ξ a n ω, proved fromtypeCount_def,card_filter,pullCount_eq_sumandFin.sum_univ_eq_sum_range.h_maxnow comes from MethodOfTypes'prod_measureReal_pow_typeCount_eq_mul_exp hx, rewritten withmeasureReal_empiricalFiniteMeasure_singletonand the bridge, and fromtoReal_klDiv_eq_sum_mul_log_div (empiricalFiniteMeasure_absolutelyContinuous hx), as inmeasure_typeCount_eq_le.prod_pow_pullCountidentifies∏ₐ ν{a}^{N a}with∏_{t<n} ν{ξ t}.exp_mul_toReal_klDiv_empiricalFiniteMeasureis deleted because it was the parallel proof of that identity and had no other use. TheTauCeti...Decomposition.Lebesgueimport it needed is dropped, andMethodOfTypesis now a public import because the bridge's statement usestypeCount.
Both deleted declarations were new in this PR, so no downstream use is affected. Local checks pass: the whole-library lake build --iofail succeeds, and local-axioms reports 0 violations across the 7 changed modules.
There was a problem hiding this comment.
Re: your reply on reuse — re-reviewed on 6b4cd1b; the finding stands — The earlier duplication findings are fixed: the shared filtration, absolute continuity and the MethodOfTypes identities are now reused. The new public prod_pow_pullCount copies MethodOfTypes' prod_comp_eq_prod_pow_typeCount, and the PR's own bridge typeCount_eq_pullCount connects the two.
claude/claude-opus-5-5 · addresses your replies through comment 4569465490.
There was a problem hiding this comment.
Fixed in 375b19d, as the finding suggests.
prod_pow_pullCountand its module-docstring entry are deleted fromSequentialLearning/FiniteActions.lean. It was new in this PR, so nothing downstream used it.- In
exp_mul_toReal_klDiv_le_mul_predictorLikelihoodRatio_laplacePredictor(LaplaceMixture.lean), the left side∏ a, ν.real {a} ^ typeCount x aofprod_measureReal_pow_typeCount_eq_mul_exp hxis rewritten with← prod_comp_eq_prod_pow_typeCount (fun a ↦ ν.real {a}) xand thenFin.prod_univ_eq_prod_range, which givesP = ∏ t ∈ range n, ν.real {ξ t ω}beforehN_typeis applied.
This commit also merges current main (43d6b42); the merge had no conflicts. Local checks (not CI) pass: the whole-library lake build --iofail succeeds, and local-axioms reports 0 violations in the 7 changed modules.
AI review — changes requestedEach rubric is judged independently by multiple review agents; the PR merges only once every rubric is green — any rubric that is not green (changes requested, blocked, errored, stale, or not yet run) blocks the merge. See the rubrics.
♻️ = approved on an earlier commit, re-run before merge. Reviewing this diff at head |
…ture bounds Add Filtration.naturalLT with measurable_naturalLT and indep_naturalLT, used by LaplaceMixture, SubGaussian and RateFunction instead of three inline copies. Factor empiricalFiniteMeasure_absolutelyContinuous, and move the multinomial and ascending-factorial bounds to Data/Nat/Choose/Bounds.lean as Nat.prod_div_pow_le_prod_factorial_div and Nat.ascFactorial_div_factorial_le. Rename measureReal_empiricalFiniteMeasure_singleton_eq_pullCount to ..._eq_pullCount_div and credit the source formalization in LikelihoodRatio.lean. Co-Authored-By: Claude Code <noreply@github.com>
|
Do check what the conflict actually is before resolving it mechanically. If |
…re-essakine2026tight-reinforcementlearning # Conflicts: # LMLExplore/Probability/Process/Filtration.lean
Identify the counts of the observations with their type counts (typeCount_eq_pullCount) and derive the maximum-likelihood identity from prod_measureReal_pow_typeCount_eq_mul_exp and toReal_klDiv_eq_sum_mul_log_div, dropping the parallel exp_mul_toReal_klDiv_empiricalFiniteMeasure and measureReal_empiricalFiniteMeasure_singleton_eq_pullCount_div. Co-Authored-By: Claude Code <noreply@github.com>
…re-essakine2026tight-reinforcementlearning
…ullCount Delete prod_pow_pullCount, a parallel copy of MethodOfTypes' prod_comp_eq_prod_pow_typeCount; its only use in LaplaceMixture now goes through prod_comp_eq_prod_pow_typeCount and Fin.prod_univ_eq_prod_range. Co-Authored-By: Claude Code <noreply@github.com>
This PR proves the time-uniform concentration of the empirical distribution of independent observations on a finite type by the Laplace mixture [JKMDLV20, Proposition 1]. For
ξ 0, ξ 1, …with lawνon a type withmelements,p̂_nthe empirical distribution of the firstnobservations (Tau Ceti'sempiricalFiniteMeasure) andδ > 0, it showsP(∃ n ≥ 1, log (1/δ) + (m - 1) log (e (1 + n / (m - 1))) ≤ n KL(p̂_n ‖ ν)) ≤ δ. It also proves that the likelihood ratio of every predictable sequential predictor againstνis a nonnegative supermartingale, and a mean-one martingale for a probability predictor whenνcharges every point.Target: ReinforcementLearning, Layer 3 "Concentration", item 4 "Types and categorical KL bounds", second bullet: "the likelihood ratio of every predictable sequential predictor against p is a nonnegative mean-one martingale. Laplace's predictor q_t(i) = (N_i(t)+1)/(t+m) gives, by Ville, P(∃ n ≥ 1, n KL(p̂_n, p) > log(1/δ) + (m-1) log(e(1+n/(m-1)))) ≤ δ". This PR proves that bullet. The event here uses
≤, so it contains the roadmap's event with>. The mean-one martingale statement needsνto charge every point. Otherwise a predictor that puts mass on aν-null point loses that mass, and only the supermartingale property holds, which is what Ville's inequality uses. The first bullet of item 4, the count of types and the(n+1)^m e^{-nε}bound, is the subject of the open PR #290. After this PR and #290, item 4 of Layer 3 is complete.New declarations:
LMLExplore/Probability/Martingale/LikelihoodRatio.lean:LMLExplore.predictorLikelihoodRatio∏_{t<n} q t (ξ t) / ν{ξ t}, with_def,_zero,_succand_nonneg;measurable_predictorLikelihoodRatio,integrable_predictorLikelihoodRatio,supermartingale_predictorLikelihoodRatio,martingale_predictorLikelihoodRatioandintegral_predictorLikelihoodRatio(mean one). The observations are adapted to a filtrationℱ, withξ tℱ (t+1)-measurable, independent ofℱ tand of lawν. The predictor isℱ t-measurable.LMLExplore/InformationTheory/LaplaceMixture.lean:LMLExplore.laplacePredictor(the rule of succession, with counts given by LML'spullCount), with_def,_nonneg,sum_laplacePredictor,measurable_laplacePredictorand the closed formprod_range_laplacePredictor∏_{t<n} q_t(ξ t) = ∏ₐ N_n(a)! / m^{(n)}. It also hastypeCount_eq_pullCount, identifying the type counts ofξ 0, …, ξ (n - 1)(typeCountof feat: the method of types and Sanov's bound on a finite type #290,InformationTheory/MethodOfTypes.lean) with LML'spullCount, so that the maximum-likelihood identityexp (n KL(p̂_n ‖ ν)) ∏_{t<n} ν{ξ t} = ∏ₐ (N_n(a)/n)^{N_n(a)}comes from MethodOfTypes'prod_measureReal_pow_typeCount_eq_mul_expandmeasureReal_empiricalFiniteMeasure_singletonwithtoReal_klDiv_eq_sum_mul_log_div, and absolute continuity fromempiricalFiniteMeasure_absolutelyContinuous. The comparison with the maximum likelihood isexp_mul_toReal_klDiv_le_mul_predictorLikelihoodRatio_laplacePredictor. The time-uniform bound comes in two forms:measure_exists_le_mul_klDiv_empiricalFiniteMeasure_le(filtration form) andProbabilityTheory.iIndepFun.measure_exists_le_mul_klDiv_empiricalFiniteMeasure_le(independent form, reduced to the coordinates ofν^{⊗ℕ}).LMLExplore/Data/Nat/Choose/Bounds.lean:Nat.choose_le_exp_one_mul_div_pow(n.choose k ≤ (e n / k)^k),Nat.ascFactorial_div_factorial_le((m+1)^{(n)} / n! ≤ (e (1 + n/m))^m),Nat.multinomial_mul_prod_pow_le_one(a multinomial probability is at most1, in any ordered commutative semiring) andNat.prod_div_pow_le_prod_factorial_div(∏ (f i / n)^{f i} ≤ ∏ (f i)! / n!, in any linearly ordered field).LMLExplore/Probability/Process/Filtration.lean:MeasureTheory.Filtration.naturalLT, the filtration of the strict past⨆ j < i, comap (u j)of a measurable process, withnaturalLT_apply,measurable_naturalLT(u jis measurable at everyi > j) andindep_naturalLT(for independentu,u iis independent ofnaturalLT u hu i).LMLExplore/SequentialLearning/FiniteActions.lean:prod_comp_pullCount, the multiplicative form of LML'ssum_comp_pullCount, andprod_range_pullCount_action_add_one∏_{s<t} (N_s(A_s) + 1) = ∏ₐ N_t(a)!.Proof of the threshold. Write
N_n(a)for the count ofaamong the firstnobservations andP = ∏_{t<n} ν{ξ t}. The maximum likelihood isexp (n KL(p̂_n ‖ ν)) P = ∏ₐ (N_n(a)/n)^{N_n(a)}. The multinomial bound turns it into at most∏ₐ N_n(a)! / n!. The rule of succession has likelihoodL_n P = ∏ₐ N_n(a)! / m^{(n)}, andm^{(n)} / n! = binom(n+m-1, m-1) ≤ (e (1 + n/(m-1)))^{m-1}. Together these giveexp (n KL) ≤ (e (1 + n/(m-1)))^{m-1} L_n. On the deviation event,L_n ≥ 1/δ, and LMLExplore's Ville inequalityMeasureTheory.Supermartingale.measure_exists_le_leconcludes.Placement and reuse. The empirical distribution is Tau Ceti's
empiricalFiniteMeasure, and its divergence is computed by the method-of-types identities ofMethodOfTypes.lean(#290) through the bridgetypeCount_eq_pullCount. The counts of the predictor are LML'spullCount, not a new count.SequentialLearning/LikelihoodRatio.leanhandles mixtures of fixed alternatives along a bandit run, throughexp (∑ log-likelihood ratios)integrated against a prior. A sequential predictor needs no prior, and the Laplace mixture would need the Dirichlet integral there, so the new file sits inProbability/Martingale/, next to Ville's inequality. The strict-past filtration of the coordinates ofν^{⊗ℕ}isFiltration.naturalLT; it lives inProbability/Process/Filtration.lean, which main had deleted after moving its only lemma,measurable_eval_piLE, to Statlib'smeasurable_piLE_apply(#350); the file now contains onlynaturalLT. It replaces the identical inline constructions inmeasure_exists_sum_div_add_sqrt_add_le_zero_le_of_iIndepFun(Probability/Martingale/SubGaussian.lean) and in the privateexists_filtration_hasCondMGFBound(Probability/Martingale/RateFunction.lean), whose statements are unchanged. No public declaration is removed or renamed.Source: the time-uniform bound is adapted from the paper project RemyDegenne/Essakine2026Tight at commit 38bbd16fd759008cf5dbad67b88e442df1d116fb (Apache 2.0), file
Essakine2026Tight/ForLMLExplore/InformationTheory/KLTimeUniform.lean. That file proves the supermartingale property for the Laplace ratio only and bounds the mixture with Stirling's formula, which gives the thresholdlog (1/δ) + (m-1) log (n+1) + 1 + log n / 2. Following the note on R21 of itsPAPER_ROADMAP.md, this port proves the property for every predictor and the roadmap's threshold of [JKMDLV20], through the multinomial bound. The source's Stirling helpers and its own threshold are not ported. The module docstring credits the source and the reference.References: [JKMDLV20] A. Jonsson, E. Kaufmann, P. Ménard, O. D. Domingues, E. Leurent and M. Valko, Planning in Markov decision processes with gap-dependent sample complexity, NeurIPS 2020, Proposition 1. [EV26] Y. Essakine and C. Vernade, Tight sample complexity bounds for entropic best policy identification, Lemma 5.
Roadmap: ReinforcementLearning
Paper: RemyDegenne/Essakine2026Tight
Item: R21
🤖 Prepared with Claude Code