Skip to content

[Merged by Bors] - feat: add Mathlib.NumberTheory.NumberField.DirichletDensity - #41765

Closed
riccardobrasca wants to merge 20 commits into
leanprover-community:masterfrom
riccardobrasca:RB_density
Closed

riccardobrasca wants to merge 20 commits into
leanprover-community:masterfrom
riccardobrasca:RB_density

Conversation

@riccardobrasca

@riccardobrasca riccardobrasca commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

This PR defines the Dirichlet density of a set of ideals.


A first version of the code has been written by Claude, but it has gone through extensive review by the authors.

Open in Gitpod

@riccardobrasca riccardobrasca added the WIP Work in progress label Jul 15, 2026
@github-actions github-actions Bot added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

PR summary 7478e24828

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.NumberTheory.NumberField.DirichletDensity (new file) 2540

Declarations diff (regex)

+ HasDirichletDensity
+ HasDirichletDensity.dirichletDensity_eq
+ HasDirichletDensity.le_one
+ HasDirichletDensity.nonneg
+ dirichletDensity
+ dirichletDensity_empty
+ dirichletDensity_eq_zero_of_not_hasDirichletDensity
+ dirichletDensity_le_one
+ dirichletDensity_nonneg
+ hasDirichletDensity_empty
+ primeIdealZetaSum
+ primeIdealZetaSum_def
+ primeIdealZetaSum_le_card_of_finite
+ primeIdealZetaSum_nonneg

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.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 7478e24).

  • +16 new declarations
  • −0 removed declarations
+NumberField.Set.HasDirichletDensity
+NumberField.Set.HasDirichletDensity.congr_simp
+NumberField.Set.HasDirichletDensity.dirichletDensity_eq
+NumberField.Set.HasDirichletDensity.le_one
+NumberField.Set.HasDirichletDensity.nonneg
+NumberField.Set.dirichletDensity
+NumberField.Set.dirichletDensity_empty
+NumberField.Set.dirichletDensity_eq_zero_of_not_hasDirichletDensity
+NumberField.Set.dirichletDensity_le_one
+NumberField.Set.dirichletDensity_nonneg
+NumberField.Set.hasDirichletDensity_empty
+NumberField.Set.primeIdealZetaSum
+NumberField.Set.primeIdealZetaSum.congr_simp
+NumberField.Set.primeIdealZetaSum_def
+NumberField.Set.primeIdealZetaSum_le_card_of_finite
+NumberField.Set.primeIdealZetaSum_nonneg

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 7478e24828
Reference commit 1f0fbd1ad9

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).

@riccardobrasca riccardobrasca removed the WIP Work in progress label Jul 19, 2026
@riccardobrasca
riccardobrasca requested a review from tb65536 July 19, 2026 03:30
@loefflerd

Copy link
Copy Markdown
Contributor

The review-bot assigned this to me, but it looks like Thomas has it well in hand so I am reassigning it to him – don't hesitate to reach out to me if you want my input of course.

@tb65536 tb65536 added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jul 21, 2026
@xroblot xroblot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jul 22, 2026

@tb65536 tb65536 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

maintainer merge

@github-actions

Copy link
Copy Markdown

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

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jul 29, 2026

@faenuccio faenuccio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I left a couple of comments.

@xroblot

xroblot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@faenuccio, there is a very short proof that the density is less than one that I forgot to put in the PR in the first place. I could add it if you don't mind.

@faenuccio

Copy link
Copy Markdown
Contributor

@faenuccio, there is a very short proof that the density is less than one that I forgot to put in the PR in the first place. I could add it if you don't mind.

Sure, why would I mind!?

@xroblot

xroblot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@faenuccio, there is a very short proof that the density is less than one that I forgot to put in the PR in the first place. I could add it if you don't mind.

Sure, why would I mind!?

Well, it's more work for reviewers 😅

Anyway, I pushed a new version but CI seems to have difficulties at the moment.

@faenuccio

Copy link
Copy Markdown
Contributor

@faenuccio, there is a very short proof that the density is less than one that I forgot to put in the PR in the first place. I could add it if you don't mind.

Sure, why would I mind!?

Well, it's more work for reviewers 😅

Anyway, I pushed a new version but CI seems to have difficulties at the moment.

No problem! Don't hesitate to ping me once CI passes so I can have a new look.

@xroblot

xroblot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@faenuccio, there is a very short proof that the density is less than one that I forgot to put in the PR in the first place. I could add it if you don't mind.

Sure, why would I mind!?

Well, it's more work for reviewers 😅
Anyway, I pushed a new version but CI seems to have difficulties at the moment.

No problem! Don't hesitate to ping me once CI passes so I can have a new look.

@faenuccio CI is green again 😄

@faenuccio faenuccio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I left one comment and two very minor golfing, but I'm happy to delegate this.


open Filter IsDedekindDomain Topology Set

namespace NumberField

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you rather put this section in NumberField.Set either by writing namespace NumberField.Set or

namespace NumberField

namespace Set

and then open NumberField you can use dot notation and write S.primeIdealZetaSum and similarly S.HasDirichletDensity which seems nice, no?

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.

yes, it's a good ideal! Thanks for the review

Comment on lines +98 to +99
rw [dirichletDensity, dif_pos ⟨δ, h⟩]
exact tendsto_nhds_unique (Exists.choose_spec ⟨δ, h⟩) h

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
rw [dirichletDensity, dif_pos ⟨δ, h⟩]
exact tendsto_nhds_unique (Exists.choose_spec ⟨δ, h⟩) h
rw [dirichletDensity, dif_pos ⟨δ, h⟩, tendsto_nhds_unique (Exists.choose_spec ⟨δ, h⟩) h]

Comment on lines +135 to +136
· rw [tsum_eq_zero_of_not_summable hs, div_zero]
exact zero_le_one

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
· rw [tsum_eq_zero_of_not_summable hs, div_zero]
exact zero_le_one
· grw [tsum_eq_zero_of_not_summable hs, div_zero, zero_le_one]

@faenuccio

Copy link
Copy Markdown
Contributor

bors d=@xroblot

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Aug 5, 2026
@mathlib-bors

mathlib-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✌️ xroblot can now approve this pull request until 2026-08-19 12:02 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Aug 5, 2026
@xroblot

xroblot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

bors r+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Aug 6, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
This PR defines the Dirichlet density of a set of ideals.

Co-authored-by: Xavier Roblot <[email protected]>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Aug 7, 2026
@mathlib-bors

mathlib-bors Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: add Mathlib.NumberTheory.NumberField.DirichletDensity [Merged by Bors] - feat: add Mathlib.NumberTheory.NumberField.DirichletDensity Aug 7, 2026
@mathlib-bors mathlib-bors Bot closed this Aug 7, 2026
@mathlib-bors mathlib-bors Bot removed the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Aug 7, 2026
attilavjda pushed a commit to attilavjda/mathlib4 that referenced this pull request Sep 5, 2026
…er-community#41765)

This PR defines the Dirichlet density of a set of ideals.

Co-authored-by: Xavier Roblot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. 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