Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add primeDivisors as an abbreviation for n.factorization.support #7607

Closed
wants to merge 6 commits into from

Conversation

FLDutchmann
Copy link
Collaborator

Replace n.factorization.support and n.factors.toFinset with n.primeDivisors wherever possible. Also rename lemmas that use factorization to mean the Finset of prime divisors.

see zulip


The biggest drawbacks with making it an abbreviation are that (1) we can't eliminate factors.toFinset lower down the import hierarchy, notably in NumberTheory/Divisors, and (2) we're missing out on an intuitive simp lemma that yields p.Prime ∧ p ∣ n ∧ n ≠ 0 akin to Nat.mem_divisors. That said, people with much more experience than me have expressed a preference for this abbreviation, and indeed this change is relatively painless (modulo some renames).

Open in Gitpod

@FLDutchmann FLDutchmann added WIP Work in progress awaiting-CI t-number-theory Number theory (also use t-algebra or t-analysis to specialize) labels Oct 10, 2023
@FLDutchmann FLDutchmann added awaiting-review and removed WIP Work in progress labels Oct 10, 2023
#align nat.factor_iff_mem_factorization Nat.factor_iff_mem_factorization
#align nat.factor_iff_mem_factorization Nat.mem_primeDivisors_iff_factor

theorem mem_primeDivisors {n p : ℕ} : p ∈ n.primeDivisors ↔ p.Prime ∧ p ∣ n ∧ n ≠ 0 := by
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sadly this can't be a simp lemma, because primeDivisors is an abbreviation and Finsupp.mem_support_iff gets to it first.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you could instead add a simp lemma as n.factorization p ≠ 0 ↔ p.Prime ∧ p ∣ n ∧ n ≠ 0?

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe just don't use abbrev?

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 10, 2023
@FLDutchmann
Copy link
Collaborator Author

This issue was solved by #8164

@FLDutchmann FLDutchmann deleted the arend/primeDivisors branch January 13, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) 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.

4 participants