feat(NumberTheory/Bernoulli): von Staudt-Clausen theorem#34906
feat(NumberTheory/Bernoulli): von Staudt-Clausen theorem#34906seewoo5 wants to merge 79 commits intoleanprover-community:masterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n section - Remove unused `Units.val_mk` from simp calls - Convert deprecated `induction'` to `induction` in three lemmas - Fix whitespace: `2*m` → `2 * m`, `2*k` → `2 * k`, `)^(` → `) ^ (` - Fix resulting lines exceeding 100 char limit - Add `set_option linter.style.longFile 1800` for file length Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Simplify several proofs by inlining single-use haves, using pow_succ, removing redundant intermediate steps, and leveraging Finset.sum_filter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…a proofs Remove `have IH := IH` identity bindings, unwrap redundant `have h1 := ...; exact h1` wrapping, inline single-use omega equalities into pow_succ rewrites, and merge consecutive single-use rewrite steps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…o callers Merge trivial single-use helper lemmas directly into their sole call sites to reduce declaration count and improve code locality. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Golf 4 verbose proofs by replacing manual have-chains with field_simp/ring, leveraging core_algebraic_identity, and eliminating redundant cast round-trips. Net savings: ~130 lines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…callers Remove lemmas with 1-2 line proof bodies that are used only once or not at all, inlining their proofs at call sites to reduce indirection. Dead code removed: pIntegral_add, pIntegral_even_term Inlined: geom_sum_of_root_of_unity, generator_pow_card_sub_one_eq_one, pIntegral_neg_pow_div_two, pIntegral_odd_term, power_sum_eq_faulhaber, coprime_add_of_coprime_den, von_staudt_clausen_pos Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d_rest Replace ~120-line proof with ~15-line proof using by_cases on divisibility, Finset.add_sum_erase for the positive case, and Finset.filter_congr for the negative case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR summary ee3a5404e5Import changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.NumberTheory.Bernoulli | 1639 | 2058 | +419 (+25.56%) |
Import changes for all files
| Files | Import difference |
|---|---|
8 filesMathlib.NumberTheory.ModularForms.DedekindEta Mathlib.NumberTheory.ModularForms.Delta Mathlib.NumberTheory.ModularForms.Derivative Mathlib.NumberTheory.ModularForms.Discriminant Mathlib.NumberTheory.ModularForms.EisensteinSeries.E2.MDifferentiable Mathlib.NumberTheory.ModularForms.EisensteinSeries.E2.Summable Mathlib.NumberTheory.ModularForms.EisensteinSeries.E2.Transform Mathlib.NumberTheory.ModularForms.EisensteinSeries.QExpansion |
8 |
Mathlib.NumberTheory.LSeries.HurwitzZetaValues |
80 |
Mathlib.NumberTheory.ZetaValues |
81 |
Mathlib.NumberTheory.BernoulliPolynomials |
417 |
Mathlib.NumberTheory.Bernoulli |
419 |
Mathlib.Algebra.BigOperators.Group.Finset.Rat (new file) |
701 |
Declarations diff
+ bernoulli_add_indicator_eq_sub
+ choose_two_mul_succ_mul_div_eq
+ den_sum_dvd_lcm_den
+ den_sum_dvd_prod_den
+ factorization_succ_le_sub_one
+ faulhaber_sum_div_prime_eq
+ not_dvd_den_bernoulli_add_indicator
+ not_dvd_den_vonStaudt_sum
+ pIntegral
+ pIntegral_bernoulli_even_term
+ pIntegral_choose_mul_pow_div
+ pIntegral_faulhaber_sum
+ pIntegral_mul
+ pIntegral_pow_div
+ prod_one_div_prime_den_coprime
+ sum_one_div_prime_eq_indicator_div_add
+ sum_pow_add_indicator_eq_zero
+ sum_pow_filter_eq_faulhaber
+ vonStaudtIndicator
+ vonStaudtPrimes
+ vonStaudt_clausen
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.
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/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).
Add missing documentation for `vonStaudtIndicator` and `pIntegral`. Remove unused arguments from `cast_ne_zero_of_mem_filter`, `generator_pow_ne_one`, `sum_units_pow_eq_zero_of_not_dvd`, `den_pow_div_dvd`, `valuation_bound`, `pIntegral_pow_div_factor`, and `pIntegral_T1`, along with their call sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unused arguments from pIntegral_T2, pIntegral_case_one, even_term_decomposition_identity, power_sum_indicator_divisible_by_p, divisibility_to_rat_eq, sum_other_primes_coprime_p_pos, and cascading unused arguments in pIntegral_second_term, pIntegral_coeff_term, pIntegral_first_term, and pIntegral_even_term_in_sum. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ther Move pIntegral_of_int, pIntegral_mul, pIntegral_mul_int, pIntegral_mul_nat, and pIntegral_sub to directly after pIntegral_sum so all basic pIntegral closure properties are co-located. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove pIntegral_nat_mul and use pIntegral_int_mul directly at call sites, relying on Lean's automatic ℕ → ℤ coercion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge the single-use von_staudt_clausen_zero lemma directly into the k = 0 case of von_staudt_clausen. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove single-use i1_term_forms_eq and replace it with a shorter `convert` + `push_cast` + `field_simp` proof inside pIntegral_i1_term_in_sum. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inline ~20 single-use helper lemmas into their callers, reducing the file from ~1053 to 884 lines and from ~80 to 60 definitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com>
|
A general remark: |
|
I think more of the explicit arguments of the private lemmas could be made implicit. |
Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com>
MichaelStollBayreuth
left a comment
There was a problem hiding this comment.
You could actually move the new lemmas to Mathlib.Algebra.GCDMonoid.FinsetLemmas (and change the title/module docstring of that file to also mention Rat.den or so).
|
|
||
|
|
||
| @[expose] public section | ||
|
|
There was a problem hiding this comment.
| namespace Rat | |
|
|
||
| theorem den_sum_dvd_prod_den {ι : Type*} (s : Finset ι) (f : ι → ℚ) : | ||
| (∑ i ∈ s, f i).den ∣ ∏ i ∈ s, (f i).den := | ||
| dvd_trans (den_sum_dvd_lcm_den s f) (s.lcm_dvd_prod (fun i ↦ (f i).den)) |
There was a problem hiding this comment.
| dvd_trans (den_sum_dvd_lcm_den s f) (s.lcm_dvd_prod (fun i ↦ (f i).den)) | |
| (den_sum_dvd_lcm_den s f).trans <|s.lcm_dvd_prod _ | |
| theorem den_prod_dvd_prod_den {ι : Type*} (s : Finset ι) (f : ι → ℚ) : | |
| (∏ i ∈ s, f i).den ∣ ∏ i ∈ s, (f i).den := by | |
| classical | |
| induction s using Finset.induction_on with | |
| | empty => simp | |
| | insert _ _ has ih => | |
| simp_rw [Finset.prod_insert has] | |
| exact (mul_den_dvd ..).trans <| mul_dvd_mul_left _ ih | |
| end Rat |
Rado's proof ("A New Proof of a Theorem of v. Staudt", JLMS 1935) of von Staudt-Clausen theorem. Initially written by AxiomProver (see commit 97a308e) with further golfs with Claude and Codex.