Deduplicating Multisets to make Finsets #
This file concerns Multiset.dedup
and List.dedup
as a way to create Finset
s.
Tags #
finite sets, finset
@[simp]
dedup on list and multiset #
@[simp]
theorem
Multiset.toFinset_val
{α : Type u_1}
[DecidableEq α]
(s : Multiset α)
:
s.toFinset.val = s.dedup
theorem
Multiset.toFinset_eq
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
(n : s.Nodup)
:
{ val := s, nodup := n } = s.toFinset
theorem
Multiset.Nodup.toFinset_inj
{α : Type u_1}
[DecidableEq α]
{l l' : Multiset α}
(hl : l.Nodup)
(hl' : l'.Nodup)
(h : l.toFinset = l'.toFinset)
:
l = l'
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Multiset.toFinset_dedup
{α : Type u_1}
[DecidableEq α]
(m : Multiset α)
:
m.dedup.toFinset = m.toFinset
instance
Multiset.isWellFounded_ssubset
{β : Type u_2}
:
IsWellFounded (Multiset β) fun (x1 x2 : Multiset β) => x1 ⊂ x2
@[simp]
@[simp]
@[simp]
theorem
List.toFinset_eq
{α : Type u_1}
[DecidableEq α]
{l : List α}
(n : l.Nodup)
:
{ val := ↑l, nodup := n } = l.toFinset
@[simp]
@[simp]
theorem
List.toFinset_surj_on
{α : Type u_1}
[DecidableEq α]
:
Set.SurjOn List.toFinset {l : List α | l.Nodup} Set.univ
theorem
List.toFinset_eq_of_perm
{α : Type u_1}
[DecidableEq α]
(l l' : List α)
(h : l.Perm l')
:
l.toFinset = l'.toFinset
theorem
List.perm_of_nodup_nodup_toFinset_eq
{α : Type u_1}
[DecidableEq α]
{l l' : List α}
(hl : l.Nodup)
(hl' : l'.Nodup)
(h : l.toFinset = l'.toFinset)
:
l.Perm l'
@[simp]
theorem
List.toFinset_reverse
{α : Type u_1}
[DecidableEq α]
{l : List α}
:
l.reverse.toFinset = l.toFinset
@[simp]
theorem
List.toFinset_toList
{α : Type u_1}
[DecidableEq α]
{s : List α}
(hs : s.Nodup)
:
s.toFinset.toList.Perm s