Skip to content
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/Basic): Finset.univ_map_subtype lemmas #12903

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Mathlib/Data/Fintype/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,21 @@ theorem coe_filter_univ (p : α → Prop) [DecidablePred p] : (univ.filter p : S
@[simp] lemma subtype_univ [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
univ.subtype p = univ := by simp

lemma univ_map_subtype [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
univ.map (Function.Embedding.subtype p) = univ.filter p := by
rw [← subtype_map, subtype_univ]

lemma univ_val_map_subtype [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
univ.val.map ((↑) : { a // p a } → α) = (univ.filter p).val := by
apply (map_val (Function.Embedding.subtype p) univ).symm.trans
apply congr_arg
apply univ_map_subtype

lemma univ_val_map_subtype_val [Fintype α] (f : α → β)
(p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
univ.val.map (fun a : { a // p a } => f a.val) = (univ.filter p).val.map f := by
madvorak marked this conversation as resolved.
Show resolved Hide resolved
rw [← univ_val_map_subtype, Multiset.map_map, comp_def]

end Finset

open Finset Function
Expand Down
Loading