Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e07cac5

Browse files
committed
feat(data/finset): add to_finset_smul
1 parent f24b01b commit e07cac5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/data/finset.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,17 @@ finset.eq_of_veq erase_dup_cons
696696
to_finset (s + t) = to_finset s ∪ to_finset t :=
697697
finset.ext' $ by simp
698698

699+
@[simp] lemma to_finset_smul (s : multiset α) :
700+
∀(n : ℕ) (hn : n ≠ 0), (add_monoid.smul n s).to_finset = s.to_finset
701+
| 0 h := by contradiction
702+
| (n+1) h :=
703+
begin
704+
by_cases n = 0,
705+
{ rw [h, zero_add, add_monoid.one_smul] },
706+
{ rw [add_monoid.add_smul, to_finset_add, add_monoid.one_smul, to_finset_smul n h,
707+
finset.union_idempotent] }
708+
end
709+
699710
end multiset
700711

701712
namespace list

0 commit comments

Comments
 (0)