refactor(Bernstein): decompose the repeated integration-by-parts proof#1168
Merged
tauceti-review-bot[bot] merged 4 commits intoJul 24, 2026
Merged
Conversation
`chafai_repeated_ibp` was a 76-line induction whose two branches were both far past the point where a case should be extracted (base ~20 lines, inductive step ~42), burying the shape of the argument. Extract three private helpers, each a self-contained fact: * `integral_Ioi_neg_iteratedDerivWithin_one` (14L) — the order-one case `∫_(x,∞) -f' = f x - L`, via the FTC on `[x, T]` and `f → L`; * `intervalIntegral_neg_one_pow_succ_kernel` (10L) — raising the sign exponent of the order-`k` kernel negates its integral; * `chafai_repeated_ibp_succ` (31L) — the inductive step: one integration by parts lowers the kernel order, the boundary term decays, `T → ∞` concludes. `chafai_repeated_ibp` is now a 15-line induction skeleton. Two simplifications fall out: the sign flip was an inline 13-line `integral_congr_ae` argument that golfs to 4 lines standalone, and the base case's 10-line `hsimpl` function rewrite becomes a single `simpa` once the order-one fact is stated cleanly. No signature changes; the sole consumer is untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
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 |
kim-em
reviewed
Jul 24, 2026
Address the documentation review: * add a docstring to `chafai_repeated_ibp` stating the order-`n` kernel identity and its role in the Chafaï reconstruction (the lemma carried only inline proof comments before); * rewrite the `integral_Ioi_neg_iteratedDerivWithin_one` and `chafai_repeated_ibp_succ` docstrings to describe what they prove — the order-one drop `f x - L`, and that the order-`k` identity implies the order-`k + 1` one — instead of narrating the FTC / integration-by-parts / limit mechanics, which move into one-line comments inside the proofs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kim-em
reviewed
Jul 24, 2026
…tegral to the integral API Address the placement review: the extracted order-one helper is a general completely-monotone integral fact with no Bernstein dependency, so it does not belong as a private Bernstein helper — and it shared a name with the existing zero-endpoint theorem. Move it to `Analysis/CompletelyMonotone/Integral.lean` as public API under the distinct name `IsCompletelyMonotone.integral_Ioi_neg_iteratedDerivWithin_one_of_nonneg`, next to the zero-endpoint theorem it generalises, and route the Bernstein call site through it. Since the existing `integral_Ioi_neg_iteratedDerivWithin_one` is exactly the `x = 0` case, it is now a one-line corollary (`le_rfl`) rather than a second near-identical proof; it had no call sites outside its own module docstring. Module docstring updated to list the new declaration. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kim-em
reviewed
Jul 24, 2026
…'s improper FTC Address the reuse review: the arbitrary-endpoint lemma re-derived Mathlib's improper fundamental theorem of calculus by hand, evaluating on `[x, T]` and passing to the limit, instead of applying `integral_Ioi_of_hasDerivAt_of_nonpos` directly. Supply that theorem's three hypotheses at the endpoint `x` — continuity within `Ici x`, the derivative on `Ioi x`, and nonpositivity there — and negate. This is the route the zero-endpoint proof already used, so the general lemma is now literally that proof with `x` in place of `0`, which is what makes the zero-endpoint case a `le_rfl` corollary. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
chafai_repeated_ibpwas a 76-line induction — the largest proof inBernstein/Measures.leanand one of the longest in the repo. Both branches of the inductionwere far past the point where a case should be extracted (the base case ~20 lines, the
inductive step ~42), so the mathematical shape of the argument was buried.
Split into three helpers, each proving one self-contained fact:
integral_Ioi_neg_iteratedDerivWithin_one∫_{(x,∞)} -f' = f x - L, by the FTC on[x, T]plusf → LintervalIntegral_neg_one_pow_succ_kernelkkernel negates its integralchafai_repeated_ibp_succk + 1 → k, the boundary term decays, andT → ∞gives the resultchafai_repeated_ibpEvery resulting proof is comfortably inside the project's ~50-line limit, and the main theorem
reads as the outline of the argument rather than its implementation.
Two incidental improvements fell out of the extraction:
havedoingintervalIntegral.integral_congr_aeby hand; as its own lemma it golfs to a 4-line proof;
hsimplfunction-rewrite to strip the0 + 1/(0+1-1)!dressing off the goal. With the order-one fact stated cleanly in its own lemma,
simpadischarges that in one line.
No statement changes:
chafai_repeated_ibpkeeps its exact signature, and its only consumer(
chafaiRescaled_integral_bernsteinKernel_eq_sub_tendsto_atTop) is untouched. All helpers areprivate, matching the surroundingibp_finite_interval/boundary_term_decay/ibp_kernel_integrableOnmachinery they sit with.Gates:
lake build✓,lake exe axioms(allowlist) ✓,lake exe module-system✓,scripts/lint-env.shPASS ✓.