Skip to content

Commit

Permalink
feat(data/multiset/basic): add multiset.filter_singleton (#14938)
Browse files Browse the repository at this point in the history
Adds a lemma, similar to `finset.filter_singleton`.
  • Loading branch information
BoltonBailey committed Jun 27, 2022
1 parent 927b468 commit 2cdded9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/data/multiset/basic.lean
Expand Up @@ -1415,6 +1415,10 @@ begin
{ rw [filter_cons_of_neg _ h, zero_add] },
end

lemma filter_singleton {a : α} (p : α → Prop) [decidable_pred p] :
filter p {a} = if p a then {a} else ∅ :=
by simp only [singleton, filter_cons, filter_zero, add_zero, empty_eq_zero]

lemma filter_nsmul (s : multiset α) (n : ℕ) :
filter p (n • s) = n • filter p s :=
begin
Expand Down

0 comments on commit 2cdded9

Please sign in to comment.