mathlib
mathlib copied to clipboard
feat(data/nat/choose/multinomial): add multinomial theorem
Proof by induction on the number of summands. finset.sym is used to sum over. It means we have access to the finset tooling to rewrite it, and it's one of the more direct ways of expressing it.
Co-authored-by: Junyan Xu [email protected]
- [ ] depends on: #16859
- [x] depends on: #16170 [multinomial defintions and basic lemma's]
- [x] depends on: #16316 [basic sym lemma's to support definition]
- [x] depends on: #16486
Due to changes in #16316 this will need some changes and likely another PR dependency
@kmill If you're up for it, maybe you could take a look at this one too? 😇
Couple remarks/questions:
- Is is a good practice to work with named projections instead of
.1
,.2
? If yes, I'm happy to replace those. - I guess there is some stuff that could be extracted out of the main proof, but I don't think the main blocks are great candidates for that and I don't really know how else to approach it.
- In making this compatible with the modified sym lemma's I changed some parts in the last bit of the main proof, so those are not as golfed as the parts by @alreadydone that I didn't touch:P
-
I think using .1 and .2 for
iff.mp
/prod.fst
andiff.mpr
/prod.snd
is intuitive and accepted practice. -
I've done the lemma extraction at my fork. I also switched some argument from explicit to implicit. Feel free to merge if you think they're good. I switched to a proof using
finset.sum_bij'
so the extracted lemmas are now about left/right inverse (which are stronger) instead of injectivity/surjectivity.
If @pimotte no longer has time for this PR, can I take over? Let's start by merging my fork, if there's no objection.
If @pimotte no longer has time for this PR, can I take over? Let's start by merging my fork, if there's no objection.
Yeah, I'm currently otherwise occupied, feel free to take over:)
This PR/issue depends on:
- ~~leanprover-community/mathlib#16859~~
- ~~leanprover-community/mathlib#16170~~
- ~~leanprover-community/mathlib#16316~~
- ~~leanprover-community/mathlib#16486~~ By Dependent Issues (🤖). Happy coding!
bors d+
:v: pimotte can now approve this pull request. To approve and merge a pull request, simply reply with bors r+
. More detailed instructions are available here.
bors r+
This PR was included in a batch that was canceled, it will be automatically retried
Pull request successfully merged into master.
Build succeeded: