Zulip Chat Archive
Stream: Is there code for X?
Topic: Kind of pigeonhole
Antoine Chambert-Loir (Apr 16 2025 at 21:59):
Here are 4 versions of basic pigeon hole principles that I need. Are there somewhere in mathlib?
(I have proofs, they are given below hidden by a spoiler.)
import Mathlib.Data.Set.Card
namespace Set
variable {α : Type*} {s t : Set α}
theorem ncard_pigeonhole [Finite α] (h : Nat.card α < s.ncard + t.ncard) :
(s ∩ t).Nonempty := sorry
theorem ncard_pigeonhole_compl (h : s.ncard + t.ncard < Nat.card α) :
(sᶜ ∩ tᶜ).Nonempty := sorry
theorem ncard_pigeonhole_compl' (h : s.ncard + t.ncard < Nat.card α) :
s ∪ t ≠ ⊤ := sorry
theorem ncard_pigeonhole' [Finite α]
(h' : Nat.card α ≤ s.ncard + t.ncard) (h : s ∪ t ≠ ⊤) :
(s ∩ t).Nonempty := sorry
Antoine Chambert-Loir (Apr 16 2025 at 21:59):
Proofs for the above results
Kevin Buzzard (Apr 16 2025 at 22:02):
(to quote code in spoiler blocks, use four backticks not three)
I am suspicious about the third one being a pigeonhole principle :-) The pigeonhole principle is that if you have two pigeons in one hole then there's one hole which contains two pigeons (or a mild generalization of this). In the third one you only have one pigeon and two holes.
Antoine Chambert-Loir (Apr 16 2025 at 22:04):
These are quantum pigeons. I have two boxes with pigeons, and some pigeon is in both boxes.
Ruben Van de Velde (Apr 16 2025 at 22:04):
It's dual waves hands
Antoine Chambert-Loir (Apr 16 2025 at 22:06):
(This said, it is remarkable that the stuff I do in mathlib always ends up in proving stuff like that, which is never difficult, but neither direct. These results wouldn't even been proved in research papers!)
Kevin Buzzard (Apr 16 2025 at 22:07):
What they told us in 2017 was that if we kept doing nontrivial projects then we would quickly ensure that all the API for basic stuff was complete and after a while we'd never have to prove a basic theorem ever again. I am beginning to wonder whether this is true!
Ruben Van de Velde (Apr 16 2025 at 22:08):
I think ncard didn't exist in 2017
Antoine Chambert-Loir (Apr 16 2025 at 22:09):
The stuff would work with docs#Finset.card. (By the way, if such a thing goes into mathlib, under what form should it?)
Kevin Buzzard (Apr 16 2025 at 22:10):
There are apparently 20 pigeonhole principles in Mathlib/Combinatorics/Pigeonhole.lean
so by the pigeonhole principle you would imagine that your theorems are there somewhere, but it seems that all of them involve finite sums rather than just two sets.
Kevin Buzzard (Apr 16 2025 at 22:10):
We need a good upper bound for the number of pigeonhole principles
Antoine Chambert-Loir (Apr 16 2025 at 22:11):
It's forbidden to feed the pigeons.
Kevin Buzzard (Apr 16 2025 at 22:12):
Maybe docs#Set.exists_ne_map_eq_of_ncard_lt_of_maps_to is the only tool which we have for two sets right now.
Kevin Buzzard (Apr 16 2025 at 22:13):
(oh let me revise my spoiler comment: to quote code in spoiler blocks you apparently need to write ````lean
to get syntax highlighting)
Antoine Chambert-Loir (Apr 16 2025 at 22:16):
This is that lemma, applied to the map from the Sigma type of my two sets to the ambient set. This will take longer to translate than the actual proof!
Jz Pan (Apr 17 2025 at 06:28):
Kevin Buzzard said:
What they told us in 2017 was that if we kept doing nontrivial projects then we would quickly ensure that all the API for basic stuff was complete and after a while we'd never have to prove a basic theorem ever again. I am beginning to wonder whether this is true!
I think we should expect that all these basic stuff should be proven by AI tools so we don't need to prove them by ourselves. Is this happening?
Antoine Chambert-Loir (Apr 17 2025 at 07:54):
If such a thing is to happen, then I'll leave the field.
Martin Dvořák (Apr 17 2025 at 09:25):
I would like to have all of the above in Mathlib.
BTW, I recently PRed a few more pidgeonholes:
#22792
Yaël Dillies (Apr 17 2025 at 09:37):
Careful to PR more pigeons simultaneously!
Yaël Dillies (Apr 17 2025 at 09:38):
Antoine Chambert-Loir said:
If such a thing is to happen, then I'll leave the field.
Out of interest, why is that so?
Antoine Chambert-Loir (Apr 17 2025 at 13:24):
Because AI, by which I mean the thing which is presently developed by means of tremendous amounts of money and energy, is a threat to humanity.
Bhavik Mehta (Apr 17 2025 at 13:58):
There's docs#Finset.inter_nonempty_of_card_lt_card_add_card, which is the closest thing I'm aware of to what you're looking for. Putting variants of this for Finset into the Pigeonhole.lean file, plus a duplicate of that file for Set.ncard, seems reasonable to me. All of these should have short proofs, but it's useful to have them all in one place (and explicitly written in mathlib) so that someone unfamiliar with cardinality in mathlib (whether it be Finset.card or Set.ncard) can easily find what they need.
Last updated: May 02 2025 at 03:31 UTC