-
Notifications
You must be signed in to change notification settings - Fork 373
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
Conversation
#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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
?
This issue was solved by #8164 |
Replace
n.factorization.support
andn.factors.toFinset
withn.primeDivisors
wherever possible. Also rename lemmas that usefactorization
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 inNumberTheory/Divisors
, and (2) we're missing out on an intuitivesimp
lemma that yieldsp.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).