Nodup s
means that s
has no duplicates, i.e. the multiplicity of
any element is at most 1.
Equations
- Multiset.Nodup s = Quot.liftOn s List.Nodup ⋯
Instances For
@[simp]
@[simp]
theorem
Multiset.nodup_cons
{α : Type u_1}
{a : α}
{s : Multiset α}
:
Multiset.Nodup (a ::ₘ s) ↔ a ∉ s ∧ Multiset.Nodup s
theorem
Multiset.Nodup.cons
{α : Type u_1}
{s : Multiset α}
{a : α}
(m : a ∉ s)
(n : Multiset.Nodup s)
:
Multiset.Nodup (a ::ₘ s)
theorem
Multiset.Nodup.of_cons
{α : Type u_1}
{s : Multiset α}
{a : α}
(h : Multiset.Nodup (a ::ₘ s))
:
theorem
Multiset.Nodup.not_mem
{α : Type u_1}
{s : Multiset α}
{a : α}
(h : Multiset.Nodup (a ::ₘ s))
:
a ∉ s
theorem
Multiset.nodup_of_le
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
(h : s ≤ t)
:
Multiset.Nodup t → Multiset.Nodup s
theorem
Multiset.nodup_iff_count_le_one
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
:
Multiset.Nodup s ↔ ∀ (a : α), Multiset.count a s ≤ 1
theorem
Multiset.nodup_iff_count_eq_one
{α : Type u_1}
{s : Multiset α}
[DecidableEq α]
:
Multiset.Nodup s ↔ ∀ a ∈ s, Multiset.count a s = 1
@[simp]
theorem
Multiset.count_eq_one_of_mem
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
(d : Multiset.Nodup s)
(h : a ∈ s)
:
Multiset.count a s = 1
theorem
Multiset.count_eq_of_nodup
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
(d : Multiset.Nodup s)
:
Multiset.count a s = if a ∈ s then 1 else 0
theorem
Multiset.nodup_iff_pairwise
{α : Type u_4}
{s : Multiset α}
:
Multiset.Nodup s ↔ Multiset.Pairwise (fun (x x_1 : α) => x ≠ x_1) s
theorem
Multiset.Nodup.pairwise
{α : Type u_1}
{r : α → α → Prop}
{s : Multiset α}
:
(∀ a ∈ s, ∀ b ∈ s, a ≠ b → r a b) → Multiset.Nodup s → Multiset.Pairwise r s
theorem
Multiset.Pairwise.forall
{α : Type u_1}
{r : α → α → Prop}
{s : Multiset α}
(H : Symmetric r)
(hs : Multiset.Pairwise r s)
⦃a : α⦄
:
theorem
Multiset.nodup_add
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
:
Multiset.Nodup (s + t) ↔ Multiset.Nodup s ∧ Multiset.Nodup t ∧ Multiset.Disjoint s t
theorem
Multiset.disjoint_of_nodup_add
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
(d : Multiset.Nodup (s + t))
:
theorem
Multiset.Nodup.add_iff
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
(d₁ : Multiset.Nodup s)
(d₂ : Multiset.Nodup t)
:
Multiset.Nodup (s + t) ↔ Multiset.Disjoint s t
theorem
Multiset.Nodup.of_map
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
(f : α → β)
:
Multiset.Nodup (Multiset.map f s) → Multiset.Nodup s
theorem
Multiset.Nodup.map_on
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{f : α → β}
:
(∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y) → Multiset.Nodup s → Multiset.Nodup (Multiset.map f s)
theorem
Multiset.Nodup.map
{α : Type u_1}
{β : Type u_2}
{f : α → β}
{s : Multiset α}
(hf : Function.Injective f)
:
Multiset.Nodup s → Multiset.Nodup (Multiset.map f s)
theorem
Multiset.nodup_map_iff_of_inj_on
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{f : α → β}
(d : ∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y)
:
Multiset.Nodup (Multiset.map f s) ↔ Multiset.Nodup s
theorem
Multiset.nodup_map_iff_of_injective
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{f : α → β}
(d : Function.Injective f)
:
Multiset.Nodup (Multiset.map f s) ↔ Multiset.Nodup s
theorem
Multiset.inj_on_of_nodup_map
{α : Type u_1}
{β : Type u_2}
{f : α → β}
{s : Multiset α}
:
Multiset.Nodup (Multiset.map f s) → ∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y
theorem
Multiset.nodup_map_iff_inj_on
{α : Type u_1}
{β : Type u_2}
{f : α → β}
{s : Multiset α}
(d : Multiset.Nodup s)
:
Multiset.Nodup (Multiset.map f s) ↔ ∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y
theorem
Multiset.Nodup.filter
{α : Type u_1}
(p : α → Prop)
[DecidablePred p]
{s : Multiset α}
:
Multiset.Nodup s → Multiset.Nodup (Multiset.filter p s)
@[simp]
Alias of the reverse direction of Multiset.nodup_attach
.
theorem
Multiset.Nodup.pmap
{α : Type u_1}
{β : Type u_2}
{p : α → Prop}
{f : (a : α) → p a → β}
{s : Multiset α}
{H : ∀ a ∈ s, p a}
(hf : ∀ (a : α) (ha : p a) (b : α) (hb : p b), f a ha = f b hb → a = b)
:
Multiset.Nodup s → Multiset.Nodup (Multiset.pmap f s H)
Equations
- Multiset.nodupDecidable s = Quotient.recOnSubsingleton s fun (l : List α) => List.nodupDecidable l
theorem
Multiset.Nodup.erase_eq_filter
{α : Type u_1}
[DecidableEq α]
(a : α)
{s : Multiset α}
:
Multiset.Nodup s → Multiset.erase s a = Multiset.filter (fun (x : α) => x ≠ a) s
theorem
Multiset.Nodup.erase
{α : Type u_1}
[DecidableEq α]
(a : α)
{l : Multiset α}
:
Multiset.Nodup l → Multiset.Nodup (Multiset.erase l a)
theorem
Multiset.Nodup.mem_erase_iff
{α : Type u_1}
[DecidableEq α]
{a : α}
{b : α}
{l : Multiset α}
(d : Multiset.Nodup l)
:
theorem
Multiset.Nodup.not_mem_erase
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
(h : Multiset.Nodup s)
:
a ∉ Multiset.erase s a
theorem
Multiset.Nodup.product
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{t : Multiset β}
:
Multiset.Nodup s → Multiset.Nodup t → Multiset.Nodup (s ×ˢ t)
theorem
Multiset.Nodup.sigma
{α : Type u_1}
{s : Multiset α}
{σ : α → Type u_4}
{t : (a : α) → Multiset (σ a)}
:
Multiset.Nodup s → (∀ (a : α), Multiset.Nodup (t a)) → Multiset.Nodup (Multiset.sigma s t)
theorem
Multiset.Nodup.filterMap
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
(f : α → Option β)
(H : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a')
:
Multiset.Nodup s → Multiset.Nodup (Multiset.filterMap f s)
theorem
Multiset.Nodup.inter_left
{α : Type u_1}
{s : Multiset α}
[DecidableEq α]
(t : Multiset α)
:
Multiset.Nodup s → Multiset.Nodup (s ∩ t)
theorem
Multiset.Nodup.inter_right
{α : Type u_1}
{t : Multiset α}
[DecidableEq α]
(s : Multiset α)
:
Multiset.Nodup t → Multiset.Nodup (s ∩ t)
@[simp]
theorem
Multiset.nodup_union
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
:
Multiset.Nodup (s ∪ t) ↔ Multiset.Nodup s ∧ Multiset.Nodup t
@[simp]
theorem
Multiset.nodup_bind
{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{t : α → Multiset β}
:
Multiset.Nodup (Multiset.bind s t) ↔ (∀ a ∈ s, Multiset.Nodup (t a)) ∧ Multiset.Pairwise (fun (a b : α) => Multiset.Disjoint (t a) (t b)) s
theorem
Multiset.Nodup.ext
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
:
Multiset.Nodup s → Multiset.Nodup t → (s = t ↔ ∀ (a : α), a ∈ s ↔ a ∈ t)
theorem
Multiset.le_iff_subset
{α : Type u_1}
{s : Multiset α}
{t : Multiset α}
:
Multiset.Nodup s → (s ≤ t ↔ s ⊆ t)
theorem
Multiset.mem_sub_of_nodup
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
{t : Multiset α}
(d : Multiset.Nodup s)
:
theorem
Multiset.map_eq_map_of_bij_of_nodup
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → γ)
(g : β → γ)
{s : Multiset α}
{t : Multiset β}
(hs : Multiset.Nodup s)
(ht : Multiset.Nodup t)
(i : (a : α) → a ∈ s → β)
(hi : ∀ (a : α) (ha : a ∈ s), i a ha ∈ t)
(i_inj : ∀ (a₁ : α) (ha₁ : a₁ ∈ s) (a₂ : α) (ha₂ : a₂ ∈ s), i a₁ ha₁ = i a₂ ha₂ → a₁ = a₂)
(i_surj : ∀ b ∈ t, ∃ (a : α) (ha : a ∈ s), i a ha = b)
(h : ∀ (a : α) (ha : a ∈ s), f a = g (i a ha))
:
Multiset.map f s = Multiset.map g t