-
Notifications
You must be signed in to change notification settings - Fork 299
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(data/fintype): pigeonhole principles #4096
Conversation
Also added strong pigeonhole principles: there is a preimage whose cardinality is at least as large as the average cardinality.
Also added finset.univ_nonempty to give a proof of univ.nonempty
This now should contain all the pigeonhole principles in the linked issue (along with some versions for infinitely many pigeons). I'm still not sure what all these lemmas should be called or where they should go, especially the ones that are currently in For the strong pigeonhole principles, I opted to have them include a nonemptiness hypothesis: lemma strong_pigeonhole [fintype α] [fintype β] [nonempty β] [decidable_eq β] (f : α → β)
(n : ℕ) (hn : fintype.card β * n ≤ fintype.card α) :
∃ y : β, n ≤ (univ.filter (λ x, f x = y)).card := sorry This can be eliminated with a trick (as in the linked issue) like so: lemma strong_pigeonhole [fintype α] [fintype β] [decidable_eq β] (f : α → β)
(n : ℕ) (hn : fintype.card β * n < fintype.card α) :
∃ y : β, n < (univ.filter (λ x, f x = y)).card := sorry The rationale is that in the first case, |
These lemmas might be too specialized, but they help relate filter and image a little more.
Some things that still need to be figured out are (1) what to call these lemmas and (2) where these lemmas should live. (Started a thread on Zulip.) |
@semorrison or @robertylewis Could you please look at this one more time? I did some golfing, so I should be the one who merges it into |
Other than naming, it looks good to me. I agree with the discussion on Zulip that we should keep the declaration names (approximately) following the naming scheme and save the word "pigeonhole" for the doc strings. |
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.
Forgot to rename 2 lemmas.
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.
Looks good to me! Let's merge.
bors merge |
Add pigeonhole principles for finitely and infinitely many pigeons in finitely many holes. There are also strong versions of these, which say that there is a hole containing at least as many pigeons as the average number of pigeons per hole. Fixes #2272. Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
Pull request successfully merged into master. Build succeeded: |
Add pigeonhole principles for finitely and infinitely many pigeons in finitely many holes. There are also strong versions of these, which say that there is a hole containing at least as many pigeons as the average number of pigeons per hole. Fixes #2272. Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
Add pigeonhole principles for finitely and infinitely many pigeons in finitely many holes. There are also strong versions of these, which say that there is a hole containing at least as many pigeons as the average number of pigeons per hole. Fixes #2272.
I'm not sure what they should be called or where they should go. Also, the proof of
fintype.strong_pigeonhole
can surely be simplified!