class
LawfulEmptyCollection
(C : Type u_3)
(α : outParam (Type u_4))
[Membership α C]
[EmptyCollection C]
:
- not_mem_empty : ∀ (x : α), x ∉ ∅
Instances
theorem
lawfulEmptyCollection_iff
(C : Type u_3)
(α : outParam (Type u_4))
[Membership α C]
[EmptyCollection C]
:
LawfulEmptyCollection C α ↔ ∀ (x : α), x ∉ ∅
theorem
LawfulEmptyCollection.not_mem_empty
{C : Type u_3}
{α : outParam (Type u_4)}
:
∀ {inst : Membership α C} {inst_1 : EmptyCollection C} [self : LawfulEmptyCollection C α] (x : α), x ∉ ∅
class
ToMultiset
(C : Type u_3)
(α : outParam (Type u_4))
extends
Membership
,
Size
:
Type (max u_3 u_4)
- mem : C → α → Prop
- size : C → ℕ
- isEmpty : C → Bool
- toMultiset : C → Multiset α
- mem_toMultiset : ∀ {x : α} {c : C}, x ∈ toMultiset c ↔ x ∈ c
- size_eq_card_toMultiset : ∀ (c : C), size c = Multiset.card (toMultiset c)
Instances
@[simp]
theorem
ToMultiset.mem_toMultiset
{C : Type u_3}
{α : outParam (Type u_4)}
[self : ToMultiset C α]
{x : α}
{c : C}
:
x ∈ toMultiset c ↔ x ∈ c
theorem
ToMultiset.size_eq_card_toMultiset
{C : Type u_3}
{α : outParam (Type u_4)}
[self : ToMultiset C α]
(c : C)
:
size c = Multiset.card (toMultiset c)
class
ToMultiset.LawfulInsert
(C : Type u_3)
(α : outParam (Type u_4))
[ToMultiset C α]
[Insert α C]
:
- toMultiset_insert : ∀ (a : α) (c : C), toMultiset (insert a c) = a ::ₘ toMultiset c
Instances
@[simp]
theorem
ToMultiset.LawfulInsert.toMultiset_insert
{C : Type u_3}
{α : outParam (Type u_4)}
:
∀ {inst : ToMultiset C α} {inst_1 : Insert α C} [self : ToMultiset.LawfulInsert C α] (a : α) (c : C),
toMultiset (insert a c) = a ::ₘ toMultiset c
- toMultiset_erase : ∀ [inst : DecidableEq α] (c : C) (a : α), toMultiset (erase c a) = (toMultiset c).erase a
Instances
theorem
lawfulErase_iff_toMultiset
(C : Type u_3)
(α : outParam (Type u_4))
[ToMultiset C α]
[Erase C α]
:
LawfulErase C α ↔ ∀ [inst : DecidableEq α] (c : C) (a : α), toMultiset (erase c a) = (toMultiset c).erase a
@[simp]
theorem
LawfulErase.toMultiset_erase
{C : Type u_3}
{α : outParam (Type u_4)}
:
∀ {inst : ToMultiset C α} {inst_1 : Erase C α} [self : LawfulErase C α] [inst_2 : DecidableEq α] (c : C) (a : α),
toMultiset (erase c a) = (toMultiset c).erase a
Equations
- instToMultisetList = ToMultiset.mk Multiset.ofList ⋯ ⋯
Equations
- instToMultisetArray = ToMultiset.mk (fun (c : Array α) => ↑c.toList) ⋯ ⋯
theorem
lawfulEmptyCollection_iff_toMultiset
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
[EmptyCollection C]
:
LawfulEmptyCollection C α ↔ toMultiset ∅ = 0
theorem
LawfulEmptyCollection.of_toMultiset
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
[EmptyCollection C]
:
toMultiset ∅ = 0 → LawfulEmptyCollection C α
Alias of the reverse direction of lawfulEmptyCollection_iff_toMultiset
.
@[simp]
theorem
toMultiset_empty
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
[EmptyCollection C]
[LawfulEmptyCollection C α]
:
toMultiset ∅ = 0
@[simp]
theorem
toMultiset_of_isEmpty
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
{c : C}
(h : isEmpty c = true)
:
toMultiset c = 0
@[simp]
theorem
ToMultiset.not_isEmpty_of_mem
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
{c : C}
{x : α}
(hx : x ∈ c)
:
theorem
count_toMultiset_eq_zero
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
[DecidableEq α]
{a : α}
{c : C}
:
Multiset.count a (toMultiset c) = 0 ↔ a ∉ c
theorem
count_toMultiset_ne_zero
{C : Type u_1}
{α : Type u_2}
[ToMultiset C α]
[DecidableEq α]
{a : α}
{c : C}
:
Multiset.count a (toMultiset c) ≠ 0 ↔ a ∈ c
- merge : C → C → C
- toMultiset_merge : ∀ (s t : C), toMultiset (merge s t) = toMultiset s + toMultiset t
Instances
@[simp]
theorem
Mergeable.toMultiset_merge
{C : Type u_3}
{α : outParam (Type u_4)}
:
∀ {inst : ToMultiset C α} [self : Mergeable C α] (s t : C), toMultiset (merge s t) = toMultiset s + toMultiset t