feat(Data/Fintype/Card): existsUnique_notMem_image_of_injective_of_card_succ#37720
feat(Data/Fintype/Card): existsUnique_notMem_image_of_injective_of_card_succ#37720cjrl wants to merge 13 commits into
Conversation
Co-authored-by: Christopher J. R. Lloyd <cjl8zf@virginia.edu> Co-authored-by: George H. Seelinger <ghseeli@gmail.com>
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary 03d14ad0b5Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
Co-authored-by: Christopher J. R. Lloyd <cjl8zf@virginia.edu> Co-authored-by: George H. Seelinger <ghseeli@gmail.com>
|
+t-set-theory |
Co-authored-by: Iván Renison <85908989+IvanRenison@users.noreply.github.com>
Thanks for this! Co-authored-by: Iván Renison <85908989+IvanRenison@users.noreply.github.com>
…image_of_card_succ
Co-authored-by: Dagur Asgeirsson <dagurtomas@gmail.com>
|
-awaiting-author |
|
Here is a slightly better approach, that results in more usable lemmas: theorem card_image_compl_of_injective [DecidableEq β]
(f : α → β) (hf : f.Injective) : #(univ \ univ.image f) = card β - card α := by
simp [card_sdiff, card_image_of_injective _ hf]
/-- Given an injective map `f : α → β` such that `β` has cardinality one more
than `α`, there exists a unique element of `β` not in the image of `f`. -/
theorem existsUnique_notMem_image_of_injective_of_card_eq_add_one [DecidableEq β]
(f : α → β) (hf : f.Injective) (h : card β = card α + 1) : ∃! x, x ∉ univ.image f := by
have : #(univ \ univ.image f) = 1 := by grind [card_image_compl_of_injective]
suffices ∃! x, x ∈ univ \ univ.image f by convert this; grind
sorry -- prove a lemma saying `#s = 1 ↔ ∃! x, x ∈ s` for finsets in general (add it in the same place as `card_eq_one`) |
|
-awaiting-author |
Co-authored-by: Christopher J. R. Lloyd <cjl8zf@virginia.edu> Co-authored-by: George H. Seelinger <ghseeli@gmail.com>
|
-awaiting-author |
| /-- Given an injective map `f : α → β` for finite sets `s ⊂ α` and `t ⊂ β` such that `t` has | ||
| cardinality one more than `s`, there exists a unique element of `t` not in `f(s)`. -/ | ||
| theorem existsUnique_mem_codomain_notMem_image_of_injective_of_card_eq_add_one {α β : Type*} | ||
| {s : Finset α} {t : Finset β} [DecidableEq β] | ||
| (f : α → β) (hf : f.Injective) (hf' : Set.MapsTo f s t) (h : #t = #s + 1) : | ||
| ∃! x, x ∈ t ∧ x ∉ s.image f := by | ||
| have : #(t \ s.image f) = 1 := by | ||
| grind [card_sdiff_of_subset hf'.finsetImage_subset, card_image_of_injective _ hf] | ||
| simpa [card_eq_one_iff_existsUnique] using this |
There was a problem hiding this comment.
Oops - I should've mentioned this before, but this one should go in Data/Finset/Card, rather than being here. You can also likely avoid some of the variables, because they'll be in the local context already.
There was a problem hiding this comment.
We went ahead and moved it to the Finset/Card file as you suggested, but we were not quite sure where to put it. It had to go pretty far down in the file, though, since the proof used other lemmas that were down there!
Placed it lower in the file so it can use dependent lemmas in proof. Co-authored-by: Christopher J. R. Lloyd <cjl8zf@virginia.edu> Co-authored-by: George H. Seelinger <ghseeli@gmail.com>
Co-authored-by: Christopher J. R. Lloyd <cjl8zf@virginia.edu> Co-authored-by: George H. Seelinger <ghseeli@gmail.com>
This pull requests adds a small theorem
existsUnique_notMem_image_of_injective_of_card_succtoMathlib/Data/Fintype/Cardthat says given an injective map f : α → β such that β has cardinality one more than α, there exists a unique element of β not in the image of f.This can be viewed as going in the opposite direction of
card_lt_of_injective_of_notMem.This little fact is needed for our Latin Square PR #36698.