Skip to content

[Merged by Bors] - feat(NumberTheory/Bernoulli): von Staudt-Clausen theorem - #34906

Closed
seewoo5 wants to merge 88 commits into
leanprover-community:masterfrom
seewoo5:vsc
Closed

seewoo5 wants to merge 88 commits into
leanprover-community:masterfrom
seewoo5:vsc

Conversation

@seewoo5

@seewoo5 seewoo5 commented Feb 6, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Open in Gitpod

seewoo5 and others added 14 commits February 5, 2026 15:46
…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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
…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 <[email protected]>
@github-actions github-actions Bot added large-import Automatically added label for PRs with a significant increase in transitive imports t-number-theory Number theory (also use t-algebra or t-analysis to specialize) labels Feb 6, 2026
@github-actions

github-actions Bot commented Feb 6, 2026 •

Copy link
Copy Markdown

PR summary d6db0fd40d

Import changes exceeding 2%

% File
+18.53% Mathlib.NumberTheory.Bernoulli

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.NumberTheory.Bernoulli 1770 2098 +328 (+18.53%)
Import changes for all files
Files Import difference
10 files Mathlib.NumberTheory.ModularForms.CuspFormSubmodule Mathlib.NumberTheory.ModularForms.DedekindEta Mathlib.NumberTheory.ModularForms.Delta Mathlib.NumberTheory.ModularForms.Derivative Mathlib.NumberTheory.ModularForms.DimensionFormulas.LevelOne 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 79
Mathlib.NumberTheory.ZetaValues 80
Mathlib.NumberTheory.BernoulliPolynomials 326
Mathlib.NumberTheory.Bernoulli 328

Declarations diff

+ bernoulli_add_indicator_eq_sub
+ choose_two_mul_succ_mul_div_eq
+ den_prod_dvd_prod_den
+ 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
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


No changes to strong technical debt.
No changes to weak technical debt.

seewoo5 and others added 9 commits February 5, 2026 22:23
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
@seewoo5
seewoo5 marked this pull request as draft February 6, 2026 17:14
seewoo5 and others added 3 commits February 7, 2026 21:03
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 <[email protected]>
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 29, 2026
@seewoo5 seewoo5 removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label May 4, 2026
Comment thread Mathlib/NumberTheory/Bernoulli.lean Resolved
Comment thread Mathlib/NumberTheory/Bernoulli.lean Resolved
@MichaelStollBayreuth

Copy link
Copy Markdown
Contributor

LGTM, modulo minor things.

maintainer delegate

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by MichaelStollBayreuth.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label May 4, 2026
Comment thread Mathlib/NumberTheory/Bernoulli.lean Resolved
@faenuccio

Copy link
Copy Markdown
Contributor

Thanks

bors d+

@mathlib-bors

mathlib-bors Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

✌️ seewoo5 can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mathlib-triage mathlib-triage Bot added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels May 5, 2026
@seewoo5

seewoo5 commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

Thank you all!

bors r+

@mathlib-bors

mathlib-bors Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(NumberTheory/Bernoulli): von Staudt-Clausen theorem [Merged by Bors] - feat(NumberTheory/Bernoulli): von Staudt-Clausen theorem May 5, 2026
@mathlib-bors mathlib-bors Bot closed this May 5, 2026
@kenono691

Copy link
Copy Markdown

I love this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). large-import Automatically added label for PRs with a significant increase in transitive imports LLM-generated PRs with substantial input from LLMs - review accordingly t-number-theory Number theory (also use t-algebra or t-analysis to specialize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants