feat(Probability): add gamma distribution MGF, mean and variance#37802
feat(Probability): add gamma distribution MGF, mean and variance#37802huaizhangchu wants to merge 3 commits intoleanprover-community:masterfrom
Conversation
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary 2d105a290dImport changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Probability.Distributions.Gamma | 2516 | 2667 | +151 (+6.00%) |
Import changes for all files
| Files | Import difference |
|---|---|
Mathlib.Probability.Distributions.Exponential Mathlib.Probability.Distributions.Gamma |
151 |
Declarations diff
+ deriv_rpow_div_sub_zero
+ gammaMeasure_integrable_exp_mul
+ gammaMeasure_mean
+ gammaMeasure_mgf
+ gammaMeasure_variance
+ gammaMeasure_zero_mem_interior_integrableExpSet
+ hasDerivAt_rpow_div_sub
+ hasDerivAt_rpow_div_sub'
+ iteratedDeriv_two_rpow_div_sub
+ mgf_id_gammaMeasure_eventually
You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
3cade7e to
b248203
Compare
|
Hello from the triage team! Can I ask if you used AI to prepare your PR? (Your code shares some features of AI-generated code.) If so, please indicate so in the PR description; this is useful information for reviewing your PR.) |
Hi! Yes, I used Claude to help prepare this PR. My process was to provide the mathematical goals to the AI and then iteratively refine the code by feeding Lean's compiler errors back into it until it bypassed the checks. I have added a note to the PR description as requested. Since the code was largely AI-generated, I’d particularly appreciate feedback on whether the proof style and lemma naming align with Mathlib’s idiomatic standards. Thanks for the heads-up! |
|
-awaiting-author |
|
We appreciate your desire to contribute to mathlib, but unfortunately we will have to close this PR. The LLM-generated code in this PR fails to meet our standards, and while reviewers and maintainers are willing to help new contributors to improve the quality of their code through the review process, this can only be done if the code is indeed written by somebody who learns in the process, otherwise the quality will not improve in future PRs and the effort required will be larger than the benefit. |
This PR adds the moment generating function, mean, and variance for the gamma distribution.
gammaMeasure_mgf: the MGF of the gamma distribution with shapeaand rateratt < ris(r / (r - t)) ^ a.gammaMeasure_mean: the mean of the gamma distribution isa / r.gammaMeasure_variance: the variance of the gamma distribution isa / r ^ 2.The auxiliary lemmas in section
RPowDivSub(e.g.,hasDerivAt_rpow_div_sub,iteratedDeriv_two_rpow_div_sub) are currently placed in this file. Happy to move them elsewhere if reviewers think they belong in a more general location.AI Disclosure: This PR was primarily authored with the assistance of Claude. The workflow involved providing mathematical requirements and iteratively resolving compilation errors based on Lean's compiler feedback. I have manually reviewed the final output for mathematical correctness and logical consistency.