-
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
[Merged by Bors] - feat: define prodPrimeFactors
as an ArithmeticFunction
#6662
Conversation
| `(∏ᵖ $f) => `(prodToFinsetFactors $f) | ||
|
||
@[simp] | ||
theorem prodToFinsetFactors_apply [CommMonoidWithZero R] {f: ℕ → R} {n : ℕ} [hn : NeZero 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.
This looks like a mis-use of NeZero
to me
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.
I chose to do this based on a suggestion by @kbuzzard, and it does come in handy for IsMultiplicative.prodToFinsetFactors
in that (a) it works with simp_rw
and (b) it automatically deduces NeZero (x*y)
Co-authored-by: Eric Wieser <[email protected]>
scoped macro_rules (kind := bigproddvd) | ||
| `(∏ᵖ $x:ident ∣ $n, $r) => `(prodToFinsetFactors (fun $x ↦ $r) $n) | ||
|
||
/-- `∏ᵖ f` is custom notation for `prodToFinsetFactors f` -/ |
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.
I'm not sure this notation is a good idea - it could also refer to the product over primes (rather than prime divisors of a fixed number)
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.
That's a fair concern. It was only used in one place so I've removed it.
It does make me think about other possible notations for the bare arithmetic function. Something like ∏ᵖ p ∣ _, f p
or ∏ᵖ p ∣ ·, f p
comes to mind but they obviously interfere with much more fundamental notation.
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.
ToFinsetFactors
occurs in a lot of places. I think that's a sign that we should define the prime divisors of a number as a finset, and give it a name. Could be factorsSet
or factors'
. Or maybe we have a quick poll on zulip about a good name.
prodToFinsetFactors
as an ArithmeticFunction
prodPrimeFactors
as an ArithmeticFunction
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.
Thanks 🎉
bors merge
Define the arithmetic function $n \mapsto \prod_{p \mid n} f(p)$. This PR further proves that it's multiplicative and relates it to Dirichlet convolution. Finally it proves two identities that can be applied in a context where you're not working exclusively with `ArithmeticFunction`s This construction was mentioned on [zulip](https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/finite.20product.20of.20infinite.20sums/near/379577022) Co-authored-by: Arend Mellendijk <[email protected]>
Pull request successfully merged into master. Build succeeded: |
prodPrimeFactors
as an ArithmeticFunction
prodPrimeFactors
as an ArithmeticFunction
Define the arithmetic function$n \mapsto \prod_{p \mid n} f(p)$ . This PR further proves that it's multiplicative and relates it to Dirichlet convolution. Finally it proves two identities that can be applied in a context where you're not working exclusively with
ArithmeticFunction
sThis construction was mentioned on zulip
prodToFinsetFactors_add_of_squarefree
usesNat
division, as discussed earlier in #6344. To summarise why I think it is helpful:On the LHS we have a product over the distinct factors of
n
, which is expanded to a product over the subsets offactors n
.On the RHS we have Dirichlet convolution. The natural thing to try is to write it as a sum over
divisorsAntidiagonal
, but relating that to subsets offactors n
is difficult. Instead I write it as a sum overdivisors
, introducingNat
division, so that I can apply the existing (nontrivial!) theorem Nat.sum_divisors_filter_squarefree, which perfectly lines up the sums along the powerset.Avoiding
Nat
division here would mean re-provingNat.sum_divisors_filter_squarefree
fordivisorsAntidiagonal
(likely only for squarefreen
, since you can't filter bySquarefree
). I claim it's easier to have a six-line lemma aboutNat
division instead.