-
Notifications
You must be signed in to change notification settings - Fork 378
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
chore(Nat): Nat factorization multiplicity #22503
base: master
Are you sure you want to change the base?
Conversation
PR summary cddbb691c5Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
have p1: n + 1 ≠ 0 := by exact Ne.symm (zero_ne_add_one n) | ||
apply factorization_mul₀ p1 (factorial_ne_zero n) |
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.
Note that you should be able to avoid using new lemmas such as factorization_mul₀
by using already existing API for factorization
and Finsupp
.
have p1: n + 1 ≠ 0 := by exact Ne.symm (zero_ne_add_one n) | |
apply factorization_mul₀ p1 (factorial_ne_zero n) | |
_ = (n + 1).factorization p + (n !).factorization p := by | |
rw [factorization_mul (zero_ne_add_one n).symm (factorial_ne_zero n), coe_add, Pi.add_apply] |
One useful trick for finding such lemmas when you're writing proofs is to use the simp?
tactic.
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.
Is it always preferable to use old lemmas? Like is it a convention?
I feel as though: exact factorization_mul₀ ((zero_ne_add_one n).symm) (factorial_ne_zero n)
is more readable then rw [factorization_mul (zero_ne_add_one n).symm (factorial_ne_zero n), coe_add, Pi.add_apply]
.
Like, factorization_mul₀ was a lemma I made so that I didn't need to use coe_add, Pi.add_apply
each time I apply the old one.
Ported lemmas from
Data/Nat/Multiplicity
to into a new file calledData/Nat/Factorization/Multiplicity
, re-written in terms offactorization
.Also, I'm new to this so is it fine to have a lemma copied over from another file? Like, I copied over
@[simp]
theorem Prime.factorization_self {p : ℕ} (hp : Prime p) : p.factorization p = 1 := by simp [hp]
from Dat/Nat/Factorization/Basic.