mathlib icon indicating copy to clipboard operation
mathlib copied to clipboard

feat(data/nat/choose/multinomial): add multinomial theorem

Open pimotte opened this issue 2 years ago • 6 comments

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

Open in Gitpod

pimotte avatar Aug 30 '22 18:08 pimotte

Due to changes in #16316 this will need some changes and likely another PR dependency

pimotte avatar Sep 12 '22 16:09 pimotte

@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

pimotte avatar Sep 16 '22 16:09 pimotte

  • I think using .1 and .2 for iff.mp/prod.fst and iff.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.

alreadydone avatar Sep 20 '22 07:09 alreadydone

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.

alreadydone avatar Oct 01 '22 20:10 alreadydone

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:)

pimotte avatar Oct 02 '22 08:10 pimotte

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+

riccardobrasca avatar Oct 23 '22 18:10 riccardobrasca

: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[bot] avatar Oct 23 '22 18:10 bors[bot]

bors r+

pimotte avatar Oct 24 '22 09:10 pimotte

This PR was included in a batch that was canceled, it will be automatically retried

bors[bot] avatar Oct 24 '22 10:10 bors[bot]

Build failed (retrying...):

bors[bot] avatar Oct 24 '22 14:10 bors[bot]

Pull request successfully merged into master.

Build succeeded:

bors[bot] avatar Oct 24 '22 18:10 bors[bot]