Skip to content

[Merged by Bors] - refactor(NumberTheory): golf Mathlib/NumberTheory/ArithmeticFunction/Zeta#38278

Closed
yuanyi-350 wants to merge 3 commits intoleanprover-community:masterfrom
yuanyi-350:N_2
Closed

[Merged by Bors] - refactor(NumberTheory): golf Mathlib/NumberTheory/ArithmeticFunction/Zeta#38278
yuanyi-350 wants to merge 3 commits intoleanprover-community:masterfrom
yuanyi-350:N_2

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

  • proves coe_zeta_mul_comm directly by reindexing the divisor antidiagonal with map_swap_divisorsAntidiagonal
  • derives coe_mul_zeta_apply from coe_zeta_mul_comm and coe_zeta_mul_apply

Extracted from #38144

Open in Gitpod

@yuanyi-350 yuanyi-350 added codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

PR summary 4fceb4697e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

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 relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Apr 20, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

I ran a profiler comparison for the changed declarations in this PR.

Results (seconds):

  • ArithmeticFunction.coe_zeta_mul_comm: 0.027800 -> 0.108736 (+291.1%)
  • ArithmeticFunction.coe_mul_zeta_apply: 0.031816 -> 0.036930 (+16.1%)

Overall:

  • Both declarations remain small in absolute terms; coe_zeta_mul_comm is slower by about 0.081s, while coe_mul_zeta_apply is roughly unchanged.

@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

!radar

@yuanyi-350 yuanyi-350 requested a review from loefflerd April 20, 2026 11:54
@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 20, 2026

Benchmark results for c4aa6b0 against 4fceb46 are in. No significant results found. @yuanyi-350

  • build//instructions: -7.3G (-0.00%)

Small changes (1✅, 1🟥)

  • build/module/Mathlib.Tactic.Basic//instructions: -290.4M (-4.16%)
  • 🟥 build/module/Mathlib.Tactic.Linarith//instructions: +270.6M (+6.33%)

Copy link
Copy Markdown
Collaborator

@FLDutchmann FLDutchmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! These proofs are much nicer.

Comment on lines +81 to +84
theorem coe_zeta_mul_comm [Semiring R] {f : ArithmeticFunction R} : ζ * f = f * ζ := by
ext x
rw [coe_zeta_mul_apply, coe_mul_zeta_apply]
rw [mul_apply, ← map_swap_divisorsAntidiagonal, Finset.sum_map]
simp [mul_apply]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to be above coe_zeta_mul_apply? That way moe_coe_zeta and coe_zeta_mul will be next to eachother in the docs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this lemma is true for zeta replaced by any ArithmeticFunction Nat, but if this breaks anything I'm happy to fix this in a follow-up PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion! I'm actually not an expert in this field and don't completely understand the broader definitions. Given that, I'd rather not touch this part right now just to be safe. Would it be okay if we hold off on this change for now?

Comment thread Mathlib/NumberTheory/ArithmeticFunction/Zeta.lean Outdated
@MichaelStollBayreuth MichaelStollBayreuth added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 23, 2026
Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com>
@yuanyi-350 yuanyi-350 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 24, 2026
Copy link
Copy Markdown
Contributor

@MichaelStollBayreuth MichaelStollBayreuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainer merge

@github-actions
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 Apr 24, 2026
@riccardobrasca
Copy link
Copy Markdown
Member

Thanks!

bors merge

@mathlib-triage mathlib-triage Bot added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Apr 24, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Apr 24, 2026
…/Zeta` (#38278)

- proves `coe_zeta_mul_comm` directly by reindexing the divisor antidiagonal with `map_swap_divisorsAntidiagonal`
- derives `coe_mul_zeta_apply` from `coe_zeta_mul_comm` and `coe_zeta_mul_apply`

Extracted from #38144

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors Bot commented Apr 24, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(NumberTheory): golf Mathlib/NumberTheory/ArithmeticFunction/Zeta [Merged by Bors] - refactor(NumberTheory): golf Mathlib/NumberTheory/ArithmeticFunction/Zeta Apr 24, 2026
@mathlib-bors mathlib-bors Bot closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly ready-to-merge This PR has been sent to bors. 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.

5 participants