@@ -149,8 +149,8 @@ theorem eq_of_veq : ∀ {s t : finset α}, s.1 = t.1 → s = t
149
149
@[simp] theorem val_inj {s t : finset α} : s.1 = t.1 ↔ s = t :=
150
150
⟨eq_of_veq, congr_arg _⟩
151
151
152
- @[simp] theorem erase_dup_eq_self [decidable_eq α] (s : finset α) : erase_dup s.1 = s.1 :=
153
- s.2 .erase_dup
152
+ @[simp] theorem dedup_eq_self [decidable_eq α] (s : finset α) : dedup s.1 = s.1 :=
153
+ s.2 .dedup
154
154
155
155
instance has_decidable_eq [decidable_eq α] : decidable_eq (finset α)
156
156
| s₁ s₂ := decidable_of_iff _ val_inj
@@ -550,8 +550,8 @@ theorem insert_def (a : α) (s : finset α) : insert a s = ⟨_, nodup_ndinsert
550
550
551
551
@[simp] theorem insert_val (a : α) (s : finset α) : (insert a s).1 = ndinsert a s.1 := rfl
552
552
553
- theorem insert_val' (a : α) (s : finset α) : (insert a s).1 = erase_dup (a ::ₘ s.1 ) :=
554
- by rw [erase_dup_cons, erase_dup_eq_self ]; refl
553
+ theorem insert_val' (a : α) (s : finset α) : (insert a s).1 = dedup (a ::ₘ s.1 ) :=
554
+ by rw [dedup_cons, dedup_eq_self ]; refl
555
555
556
556
theorem insert_val_of_not_mem {a : α} {s : finset α} (h : a ∉ s) : (insert a s).1 = a ::ₘ s.1 :=
557
557
by rw [insert_val, ndinsert_of_not_mem h]
@@ -1658,30 +1658,30 @@ def not_mem_range_equiv (k : ℕ) : {n // n ∉ range k} ≃ ℕ :=
1658
1658
@[simp] lemma coe_not_mem_range_equiv_symm (k : ℕ) :
1659
1659
((not_mem_range_equiv k).symm : ℕ → {n // n ∉ range k}) = λ j, ⟨j + k, by simp⟩ := rfl
1660
1660
1661
- /-! ### erase_dup on list and multiset -/
1661
+ /-! ### dedup on list and multiset -/
1662
1662
1663
1663
namespace multiset
1664
1664
variable [decidable_eq α]
1665
1665
1666
1666
/-- `to_finset s` removes duplicates from the multiset `s` to produce a finset. -/
1667
- def to_finset (s : multiset α) : finset α := ⟨_, nodup_erase_dup s⟩
1667
+ def to_finset (s : multiset α) : finset α := ⟨_, nodup_dedup s⟩
1668
1668
1669
- @[simp] theorem to_finset_val (s : multiset α) : s.to_finset.1 = s.erase_dup := rfl
1669
+ @[simp] theorem to_finset_val (s : multiset α) : s.to_finset.1 = s.dedup := rfl
1670
1670
1671
1671
theorem to_finset_eq {s : multiset α} (n : nodup s) : finset.mk s n = s.to_finset :=
1672
- finset.val_inj.1 n.erase_dup .symm
1672
+ finset.val_inj.1 n.dedup .symm
1673
1673
1674
1674
lemma nodup.to_finset_inj {l l' : multiset α} (hl : nodup l) (hl' : nodup l')
1675
1675
(h : l.to_finset = l'.to_finset) : l = l' :=
1676
1676
by simpa [←to_finset_eq hl, ←to_finset_eq hl'] using h
1677
1677
1678
- @[simp] lemma mem_to_finset {a : α} {s : multiset α} : a ∈ s.to_finset ↔ a ∈ s := mem_erase_dup
1678
+ @[simp] lemma mem_to_finset {a : α} {s : multiset α} : a ∈ s.to_finset ↔ a ∈ s := mem_dedup
1679
1679
1680
1680
@[simp] lemma to_finset_zero : to_finset (0 : multiset α) = ∅ := rfl
1681
1681
1682
1682
@[simp] lemma to_finset_cons (a : α) (s : multiset α) :
1683
1683
to_finset (a ::ₘ s) = insert a (to_finset s) :=
1684
- finset.eq_of_veq erase_dup_cons
1684
+ finset.eq_of_veq dedup_cons
1685
1685
1686
1686
@[simp] lemma to_finset_singleton (a : α) : to_finset ({a} : multiset α) = {a} :=
1687
1687
by rw [singleton_eq_cons, to_finset_cons, to_finset_zero, is_lawful_singleton.insert_emptyc_eq]
@@ -1706,7 +1706,7 @@ finset.ext $ by simp
1706
1706
by ext; simp
1707
1707
1708
1708
theorem to_finset_eq_empty {m : multiset α} : m.to_finset = ∅ ↔ m = 0 :=
1709
- finset.val_inj.symm.trans multiset.erase_dup_eq_zero
1709
+ finset.val_inj.symm.trans multiset.dedup_eq_zero
1710
1710
1711
1711
@[simp] lemma to_finset_subset (s t : multiset α) : s.to_finset ⊆ t.to_finset ↔ s ⊆ t :=
1712
1712
by simp only [finset.subset_iff, multiset.subset_iff, multiset.mem_to_finset]
@@ -1729,32 +1729,32 @@ variables [decidable_eq α] {l l' : list α} {a : α}
1729
1729
/-- `to_finset l` removes duplicates from the list `l` to produce a finset. -/
1730
1730
def to_finset (l : list α) : finset α := multiset.to_finset l
1731
1731
1732
- @[simp] theorem to_finset_val (l : list α) : l.to_finset.1 = (l.erase_dup : multiset α) := rfl
1732
+ @[simp] theorem to_finset_val (l : list α) : l.to_finset.1 = (l.dedup : multiset α) := rfl
1733
1733
1734
1734
lemma to_finset_eq (n : nodup l) : @finset.mk α l n = l.to_finset := multiset.to_finset_eq n
1735
1735
1736
- @[simp] lemma mem_to_finset : a ∈ l.to_finset ↔ a ∈ l := mem_erase_dup
1736
+ @[simp] lemma mem_to_finset : a ∈ l.to_finset ↔ a ∈ l := mem_dedup
1737
1737
@[simp] lemma to_finset_nil : to_finset (@nil α) = ∅ := rfl
1738
1738
1739
1739
@[simp] lemma to_finset_cons : to_finset (a :: l) = insert a (to_finset l) :=
1740
- finset.eq_of_veq $ by by_cases h : a ∈ l; simp [finset.insert_val', multiset.erase_dup_cons , h]
1740
+ finset.eq_of_veq $ by by_cases h : a ∈ l; simp [finset.insert_val', multiset.dedup_cons , h]
1741
1741
1742
1742
lemma to_finset_surj_on : set.surj_on to_finset {l : list α | l.nodup} set.univ :=
1743
1743
by { rintro ⟨⟨l⟩, hl⟩ _, exact ⟨l, hl, (to_finset_eq hl).symm⟩ }
1744
1744
1745
1745
theorem to_finset_surjective : surjective (to_finset : list α → finset α) :=
1746
1746
λ s, let ⟨l, _, hls⟩ := to_finset_surj_on (set.mem_univ s) in ⟨l, hls⟩
1747
1747
1748
- lemma to_finset_eq_iff_perm_erase_dup : l.to_finset = l'.to_finset ↔ l.erase_dup ~ l'.erase_dup :=
1749
- by simp [finset.ext_iff, perm_ext (nodup_erase_dup _) (nodup_erase_dup _)]
1748
+ lemma to_finset_eq_iff_perm_dedup : l.to_finset = l'.to_finset ↔ l.dedup ~ l'.dedup :=
1749
+ by simp [finset.ext_iff, perm_ext (nodup_dedup _) (nodup_dedup _)]
1750
1750
1751
1751
lemma to_finset.ext_iff {a b : list α} : a.to_finset = b.to_finset ↔ ∀ x, x ∈ a ↔ x ∈ b :=
1752
1752
by simp only [finset.ext_iff, mem_to_finset]
1753
1753
1754
1754
lemma to_finset.ext : (∀ x, x ∈ l ↔ x ∈ l') → l.to_finset = l'.to_finset := to_finset.ext_iff.mpr
1755
1755
1756
1756
lemma to_finset_eq_of_perm (l l' : list α) (h : l ~ l') : l.to_finset = l'.to_finset :=
1757
- to_finset_eq_iff_perm_erase_dup .mpr h.erase_dup
1757
+ to_finset_eq_iff_perm_dedup .mpr h.dedup
1758
1758
1759
1759
lemma perm_of_nodup_nodup_to_finset_eq (hl : nodup l) (hl' : nodup l')
1760
1760
(h : l.to_finset = l'.to_finset) : l ~ l' :=
@@ -1907,14 +1907,14 @@ variables [decidable_eq β]
1907
1907
/-- `image f s` is the forward image of `s` under `f`. -/
1908
1908
def image (f : α → β) (s : finset α) : finset β := (s.1 .map f).to_finset
1909
1909
1910
- @[simp] theorem image_val (f : α → β) (s : finset α) : (image f s).1 = (s.1 .map f).erase_dup := rfl
1910
+ @[simp] theorem image_val (f : α → β) (s : finset α) : (image f s).1 = (s.1 .map f).dedup := rfl
1911
1911
1912
1912
@[simp] theorem image_empty (f : α → β) : (∅ : finset α).image f = ∅ := rfl
1913
1913
1914
1914
variables {f g : α → β} {s : finset α} {t : finset β} {a : α} {b c : β}
1915
1915
1916
1916
@[simp] lemma mem_image : b ∈ s.image f ↔ ∃ a ∈ s, f a = b :=
1917
- by simp only [mem_def, image_val, mem_erase_dup , multiset.mem_map, exists_prop]
1917
+ by simp only [mem_def, image_val, mem_dedup , multiset.mem_map, exists_prop]
1918
1918
1919
1919
lemma mem_image_of_mem (f : α → β) {a} (h : a ∈ s) : f a ∈ s.image f := mem_image.2 ⟨_, h, rfl⟩
1920
1920
@@ -1969,18 +1969,18 @@ theorem image_to_finset [decidable_eq α] {s : multiset α} :
1969
1969
ext $ λ _, by simp only [mem_image, multiset.mem_to_finset, exists_prop, multiset.mem_map]
1970
1970
1971
1971
theorem image_val_of_inj_on (H : set.inj_on f s) : (image f s).1 = s.1 .map f :=
1972
- (nodup_map_on H s.2 ).erase_dup
1972
+ (nodup_map_on H s.2 ).dedup
1973
1973
1974
1974
@[simp] lemma image_id [decidable_eq α] : s.image id = s :=
1975
1975
ext $ λ _, by simp only [mem_image, exists_prop, id, exists_eq_right]
1976
1976
1977
1977
@[simp] theorem image_id' [decidable_eq α] : s.image (λ x, x) = s := image_id
1978
1978
1979
1979
theorem image_image [decidable_eq γ] {g : β → γ} : (s.image f).image g = s.image (g ∘ f) :=
1980
- eq_of_veq $ by simp only [image_val, erase_dup_map_erase_dup_eq , multiset.map_map]
1980
+ eq_of_veq $ by simp only [image_val, dedup_map_dedup_eq , multiset.map_map]
1981
1981
1982
1982
theorem image_subset_image {s₁ s₂ : finset α} (h : s₁ ⊆ s₂) : s₁.image f ⊆ s₂.image f :=
1983
- by simp only [subset_def, image_val, subset_erase_dup ', erase_dup_subset ',
1983
+ by simp only [subset_def, image_val, subset_dedup ', dedup_subset ',
1984
1984
multiset.map_subset_map h]
1985
1985
1986
1986
lemma image_subset_iff : s.image f ⊆ t ↔ ∀ x ∈ s, f x ∈ t :=
@@ -2064,7 +2064,7 @@ lemma range_add (a b : ℕ) : range (a + b) = range a ∪ (range b).map (add_lef
2064
2064
by { rw [←val_inj, union_val], exact multiset.range_add_eq_union a b }
2065
2065
2066
2066
@[simp] lemma attach_image_val [decidable_eq α] {s : finset α} : s.attach.image subtype.val = s :=
2067
- eq_of_veq $ by rw [image_val, attach_val, multiset.attach_map_val, erase_dup_eq_self ]
2067
+ eq_of_veq $ by rw [image_val, attach_val, multiset.attach_map_val, dedup_eq_self ]
2068
2068
2069
2069
@[simp] lemma attach_image_coe [decidable_eq α] {s : finset α} : s.attach.image coe = s :=
2070
2070
finset.attach_image_val
@@ -2078,7 +2078,7 @@ ext $ λ ⟨x, hx⟩, ⟨or.cases_on (mem_insert.1 hx)
2078
2078
λ _, finset.mem_attach _ _⟩
2079
2079
2080
2080
theorem map_eq_image (f : α ↪ β) (s : finset α) : s.map f = s.image f :=
2081
- eq_of_veq (s.map f).2 .erase_dup .symm
2081
+ eq_of_veq (s.map f).2 .dedup .symm
2082
2082
2083
2083
lemma image_const {s : finset α} (h : s.nonempty) (b : β) : s.image (λa, b) = singleton b :=
2084
2084
ext $ assume b', by simp only [mem_image, exists_prop, exists_and_distrib_right,
@@ -2173,7 +2173,7 @@ end image
2173
2173
2174
2174
lemma _root_.multiset.to_finset_map [decidable_eq α] [decidable_eq β] (f : α → β) (m : multiset α) :
2175
2175
(m.map f).to_finset = m.to_finset.image f :=
2176
- finset.val_inj.1 (multiset.erase_dup_map_erase_dup_eq _ _).symm
2176
+ finset.val_inj.1 (multiset.dedup_map_dedup_eq _ _).symm
2177
2177
2178
2178
section to_list
2179
2179
@@ -2224,12 +2224,12 @@ protected def bUnion (s : finset α) (t : α → finset β) : finset β :=
2224
2224
(s.1 .bind (λ a, (t a).1 )).to_finset
2225
2225
2226
2226
@[simp] theorem bUnion_val (s : finset α) (t : α → finset β) :
2227
- (s.bUnion t).1 = (s.1 .bind (λ a, (t a).1 )).erase_dup := rfl
2227
+ (s.bUnion t).1 = (s.1 .bind (λ a, (t a).1 )).dedup := rfl
2228
2228
2229
2229
@[simp] theorem bUnion_empty : finset.bUnion ∅ t = ∅ := rfl
2230
2230
2231
2231
@[simp] lemma mem_bUnion {b : β} : b ∈ s.bUnion t ↔ ∃ a ∈ s, b ∈ t a :=
2232
- by simp only [mem_def, bUnion_val, mem_erase_dup , mem_bind, exists_prop]
2232
+ by simp only [mem_def, bUnion_val, mem_dedup , mem_bind, exists_prop]
2233
2233
2234
2234
@[simp] lemma coe_bUnion : (s.bUnion t : set β) = ⋃ x ∈ (s : set α), t x :=
2235
2235
by simp only [set.ext_iff, mem_bUnion, set.mem_Union, iff_self, mem_coe, implies_true_iff]
0 commit comments