Repository navigation
feat: weighted sums of antitone functions, an implicit square-root bound, and quadratic bounds on log (1 + x) - #379
Conversation
…und, and quadratic bounds on log (1 + x)
The numerical lemmas of online learning [Ora, Lemmas 4.13 and 4.29]: the
comparison of sum_t a_t f(c + sum_{s<=t} a_s) with the integral of f, its
square-root and logarithmic corollaries, the explicit solution of
x - sqrt(a x + b) <= c, and the bounds x - x^2 <= log (1 + x) and
log (1 + x) <= x - x^2 / 4.
Co-Authored-By: Claude Code <noreply@github.com>
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 |
… the log bounds Co-Authored-By: Claude Code <noreply@github.com>
There was a problem hiding this comment.
🟡 api-design — request_changes claude/claude-opus-5-5
The public surface is the Layer 1.7 targets plus the sharp form of Lemma 4.29 and the weighted integral comparison, and it is well-named and has no definitions or exposed bodies. One general mean-value monotonicity lemma is hidden as private in the log file instead of being made public in a calculus file.
LMLExplore/Analysis/SpecialFunctions/Log/Basic.lean:108—le_apply_zero_of_hasDerivAtis general one-variable calculus infrastructure: if f' ≥ 0 on (x, 0) and f' ≤ 0 on (0, x), then f x ≤ f 0. Its statement uses onlyHasDerivAt,Set.uIccandSet.Ioo, and its proof never useslog, yet it isprivatein the log file. Fix: Generalize the point0to an arbitraryx₀(f x ≤ f x₀) and make it public in a calculus file mirroring Mathlib, e.g.LMLExplore/Analysis/Calculus/MeanValue.lean, or send it upstream. KeephasDerivAt_log_one_add_addprivate, since it only serves this file.
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 · 24s · 80.9k in (71.5k cache read, 9.4k cache write) / 2k out tokens · reviewing this diff · rubric ·
There was a problem hiding this comment.
🟡 documentation — request_changes claude/claude-opus-5-5
The docstrings are accurate and mathematically motivated, except that the new file's module docstring states the weighted sum–integral comparison without the integrability hypothesis, which makes the statement false. Add the hypothesis to that sentence.
LMLExplore/Analysis/SumIntegralComparisons.lean:15— The module overview says 'forfantitone on(c, c + ∑ a t]anda t ≥ 0, ∑ a t f(c + ∑_{s≤t} a s) ≤ ∫ f', leaving out integrability on[c, c + ∑ a t]. Without it the claim is false, so the overview promises more than the theorem proves. Fix: Change it to 'forfantitone on(c, c + ∑_{t < n} a t]and integrable on[c, c + ∑_{t < n} a t], anda t ≥ 0, ...', matching the theorem's docstring.
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 · 22s · 48.6k in (41.9k cache read, 6.7k cache write) / 2.1k out tokens · reviewing this diff · rubric ·
This PR completes OnlineLearning Layer 1.7, Numerical lemmas [Ora, Lemmas 4.13 and 4.29]. It adds the weighted comparison of a sum with an integral, its square-root and logarithmic corollaries, the explicit solution of the implicit bound
x - √(a x + b) ≤ c, and the two quadratic bounds onlog (1 + x).Roadmap: OnlineLearning
New file
Analysis/SumIntegralComparisons.lean, named after the Mathlib file whoseAntitoneOn.sum_le_integral_of_integrableOnit generalizes:AntitoneOn.sum_mul_le_integral_of_integrableOnis Lemma 4.13. Takea t ≥ 0, andfantitone on(c, c + ∑_{t<n} a t]and integrable on[c, c + ∑_{t<n} a t]. Then∑_{t<n} a t * f (c + ∑_{s≤t} a s) ≤ ∫ x in c..c + ∑_t a t, f x. The hypotheses follow Mathlib's unit-step lemma, which is the casea t = 1. The integrability hypothesis cannot be dropped: forf = x⁻¹andc = 0the Bochner integral is0. Neitherc ≥ 0norf ≥ 0from the roadmap statement is needed.Real.sum_div_sqrt_le_two_mul_sqrtgives∑_{t<n} a t / √(∑_{s≤t} a s) ≤ 2 √(∑_t a t). It is derived from the lemma withf x = (√x)⁻¹and Mathlib'sintegral_rpow. A term with a zero denominator is0by Lean's convention, which matches the roadmap's "terms with a zero denominator omitted".Real.sum_div_add_le_log_divgives∑_{t<n} a t / (c + ∑_{s≤t} a s) ≤ log ((c + ∑_t a t) / c)forc > 0, from the lemma withf x = x⁻¹andintegral_inv_of_pos.In
Analysis/Real/Sqrt.lean:Real.le_div_two_add_add_sqrt_of_sub_sqrt_le: fora ≥ 0,x - √(a x + b) ≤ cimpliesx ≤ a/2 + c + √(a²/4 + b + a c). This is the sharp form of Lemma 4.29.Real.le_add_add_sqrt_of_sub_sqrt_le: fora ≥ 0,x ≤ a + c + √(b + a c), the roadmap's form. It follows from the sharp form and Tau Ceti'sReal.sqrt_add_le_add_sqrt.a ≥ 0is assumed. [Ora] also asksb, c, x ≥ 0, but the proof does not need them.a ≥ 0cannot be dropped:a = -4,b = -100,c = x = 0satisfies the hypothesis but not the conclusion.In
Analysis/SpecialFunctions/Log/Basic.lean:Real.sub_sq_le_log_one_add:x - x² ≤ log (1 + x)forx ≥ -1/2. [Ora, §13.7] uses it for|x| ≤ 1/2, for coin betting. It fails atx = -0.9.Real.log_one_add_le_sub_sq_div_four:log (1 + x) ≤ x - x²/4for-1 < x ≤ 1[Ora, Example 7.39, exp-concave losses]. It fails atx = 2.monotoneOn_/antitoneOn_of_hasDerivWithinAt_*). The casex ≥ 0of the lower bound comes from Mathlib'sle_log_one_add_of_nonneg. A private helper gives the derivative oflog (1 + y) + p y.Consumers: Layer 2.3 (adaptive rates, the
2√(B ∑‖y_t‖²/m)bound via the square-root sum, and theL⋆bound for self-bounded losses via Lemma 4.29, which the roadmap item names as "(Layer 1.7)"), Layer 2.4 (AdaGrad), Layer 8 (the logarithmic sum and the upper bound onlog (1 + x)for exp-concave losses), and Layer 13 (the lower bound onlog (1 + x)for coin betting).Reuse: I searched Mathlib, Tau Ceti, LML, Statlib and LMLExplore for a weighted sum–integral comparison, for sums
a t / √(∑_{s≤t} a s)anda t / (c + ∑_{s≤t} a s), for the implicit boundx - √(a x + b) ≤ c, and for quadratic bounds onlog (1 + x). None of them exists. Mathlib has only the unit-stepAntitoneOn.sum_le_integral*andle_log_one_add_of_nonneg(2x/(x+2) ≤ log (1 + x)). LMLExplore'sReal.le_add_sqrt_of_sq_leandReal.sum_div_sqrt_max_one_leare different statements: one solves a quadratic inequality, the other is the doubling bound with denominators clipped at1. The proofs reusesum_integral_adjacent_intervals,integral_mono_on_of_le_Ioo,integral_rpow,intervalIntegrable_rpow',integral_inv_of_posand Tau Ceti'sReal.sqrt_add_le_add_sqrt.No public declaration is removed or renamed.
What remains: Layer 1.7 is complete. Items 1.2–1.6 of Layer 1 remain, and Layer 2.3 can now be built on these lemmas.
Local checks only (CI verifies the pushed PR):
scope: scoped: against 34d96f1b8f111131d1e459ccaf61245f0e5ea285.local-axioms: checked 3 changed module(s), 72 declaration(s); 0 violation(s). The source guards, the whole-librarylake build --iofail, the module-system audit, the header check and the environment lint (checked 3 changed module(s), 72 declarations; 14 environment linters) passed, and the verify script exited 0.🤖 Prepared with Claude Code