Repository navigation
feat: weighted sums of antitone functions, an implicit square-root bound, and quadratic bounds on log (1 + x) - #379
Merged
lmlexplore-automation[bot] merged 4 commits intoNov 14, 2026
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>
RemyDegenne
commented
Nov 14, 2026
RemyDegenne
commented
Nov 14, 2026
Contributor
Author
AI review — approvedEach 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>
RemyDegenne
commented
Nov 14, 2026
RemyDegenne
commented
Nov 14, 2026
Move the private `le_apply_zero_of_hasDerivAt` out of the log file into `LMLExplore/Analysis/Calculus/MeanValue.lean` as the public `LMLExplore.apply_le_apply_of_hasDerivAt_of_nonneg_of_nonpos`, with the point `0` generalised to an arbitrary `x₀`, and state the integrability hypothesis in the module overview of the weighted sum–integral comparison. Co-Authored-By: Claude Code <noreply@github.com>
RemyDegenne
commented
Nov 14, 2026
…parison to the open segment Assume continuity on the closed segment and a derivative only strictly between the endpoints, following Mathlib's mean-value lemmas. Co-Authored-By: Claude Code <noreply@github.com>
Merged
via the queue into
LeanMachineLearning:main
with commit Nov 14, 2026
a4fdeb8
23 of 25 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.New file
Analysis/Calculus/MeanValue.lean, named after the Mathlib file whosemonotoneOn_of_hasDerivWithinAt_nonnegandantitoneOn_of_hasDerivWithinAt_nonposit combines:LMLExplore.apply_le_apply_of_hasDerivAt_of_nonneg_of_nonpos: iffhas derivativef' yat eachybetweenxandx₀, withf' ≥ 0on(x, x₀)andf' ≤ 0on(x₀, x), thenf x ≤ f x₀. The two log bounds above apply it atx₀ = 0.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 4 changed module(s), 74 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 4 changed module(s), 74 declarations; 14 environment linters) passed, and the verify script exited 0.🤖 Prepared with Claude Code