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: the n
th symmetric power is equivalent to maps of total mass n
.
#11360
Conversation
ocfnash
commented
Mar 13, 2024
Mathlib/Data/Finsupp/Multiset.lean
Outdated
noncomputable def equivNatSumOfFintype [Fintype α] : | ||
Sym α n ≃ {P : α → ℕ // ∑ i, P i = n} := | ||
(equivNatSum α n).trans <| (Finsupp.equivFunOnFinite.image _).trans <| Equiv.Set.ofEq <| 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.
If you pass this through DFinsupp.equivFunOnFintype
and Finsupp.toDFinsupp
, then it would be computable, which is nice for #eval
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.
If it could be rendered computable for free I would do it, but I think even the low price of having to depend on DFinsupp.equivFunOnFintype
(incidentally not imported in this file) makes it not worth it for me (especially as it's really just accident that we have computable DFinsupp.equivFunOnFintype
and noncomputable Finsupp.equivFunOnFinite
).
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.
Perhaps the better resolution here is to have a Multiset.countEquiv
or similar that is the Fintype
analog to Multiset.toFinsupp
, with a nice defeq for the summation. I'll let you decide if that sounds out of scope
bors d+
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 guess we should probably have this somewhere:
def Multiset.countAddEquiv (α : Type*) [Fintype α] [DecidableEq α] :
Multiset α ≃+ (α → ℕ) where
toFun s := s.count
invFun P := ∑ a, P a • {a}
map_add' s t := by ext; simp
left_inv s := by
ext a
change count a (sum _) = _
rw [count_sum]
simp [count_singleton]
right_inv P := by
ext a
change count a (sum _) = _
rw [count_sum]
simp [count_singleton]
I'll try to come back to this (in a separate PR).
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
✌️ ocfnash can now approve this pull request. To approve and merge a pull request, simply reply with |
The `simps`-generated lemma is rejected by the linter because it generates a LHS which is simplified by `Sym.val_eq_coe`.
bors merge |
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Pull request successfully merged into master. Build succeeded: |
n
th symmetric power is equivalent to maps of total mass n
.n
th symmetric power is equivalent to maps of total mass n
.
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
…n`. (#11360) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>