@@ -186,7 +186,7 @@ instance decidable_mem' [decidable_eq α] (a : α) (s : finset α) :
186
186
187
187
/-! ### extensionality -/
188
188
theorem ext_iff {s₁ s₂ : finset α} : s₁ = s₂ ↔ ∀ a, a ∈ s₁ ↔ a ∈ s₂ :=
189
- val_inj.symm.trans $ nodup_ext s₁.2 s₂.2
189
+ val_inj.symm.trans $ s₁.nodup.ext s₂.nodup
190
190
191
191
@[ext]
192
192
theorem ext {s₁ s₂ : finset α} : (∀ a, a ∈ s₁ ↔ a ∈ s₂) → s₁ = s₂ :=
@@ -548,9 +548,9 @@ section decidable_eq
548
548
variables [decidable_eq α] {s t u v : finset α} {a b : α}
549
549
550
550
/-- `insert a s` is the set `{a} ∪ s` containing `a` and the elements of `s`. -/
551
- instance : has_insert α (finset α) := ⟨λ a s, ⟨_, nodup_ndinsert a s.2 ⟩⟩
551
+ instance : has_insert α (finset α) := ⟨λ a s, ⟨_, s.2 .ndinsert a ⟩⟩
552
552
553
- theorem insert_def (a : α) (s : finset α) : insert a s = ⟨_, nodup_ndinsert a s.2 ⟩ := rfl
553
+ lemma insert_def (a : α) (s : finset α) : insert a s = ⟨_, s.2 .ndinsert a ⟩ := rfl
554
554
555
555
@[simp] theorem insert_val (a : α) (s : finset α) : (insert a s).1 = ndinsert a s.1 := rfl
556
556
@@ -715,10 +715,10 @@ end
715
715
/-! ### Lattice structure -/
716
716
717
717
/-- `s ∪ t` is the set such that `a ∈ s ∪ t` iff `a ∈ s` or `a ∈ t`. -/
718
- instance : has_union (finset α) := ⟨λ s t, ⟨_, nodup_ndunion s.1 t. 2 ⟩⟩
718
+ instance : has_union (finset α) := ⟨λ s t, ⟨_, t. 2 .ndunion s.1 ⟩⟩
719
719
720
720
/-- `s ∩ t` is the set such that `a ∈ s ∩ t` iff `a ∈ s` and `a ∈ t`. -/
721
- instance : has_inter (finset α) := ⟨λ s t, ⟨_, nodup_ndinter t.1 s. 2 ⟩⟩
721
+ instance : has_inter (finset α) := ⟨λ s t, ⟨_, s. 2 .ndinter t.1 ⟩⟩
722
722
723
723
instance : lattice (finset α) :=
724
724
{ sup := (∪),
@@ -993,14 +993,14 @@ lemma inter_subset_ite (s s' : finset α) (P : Prop) [decidable P] :
993
993
994
994
/-- `erase s a` is the set `s - {a}`, that is, the elements of `s` which are
995
995
not equal to `a`. -/
996
- def erase (s : finset α) (a : α) : finset α := ⟨_, nodup_erase_of_nodup a s.2 ⟩
996
+ def erase (s : finset α) (a : α) : finset α := ⟨_, s.2 .erase a ⟩
997
997
998
998
@[simp] theorem erase_val (s : finset α) (a : α) : (erase s a).1 = s.1 .erase a := rfl
999
999
1000
1000
@[simp] theorem mem_erase {a b : α} {s : finset α} : a ∈ erase s b ↔ a ≠ b ∧ a ∈ s :=
1001
- mem_erase_iff_of_nodup s.2
1001
+ s.2 .mem_erase_iff
1002
1002
1003
- theorem not_mem_erase (a : α) (s : finset α) : a ∉ erase s a := mem_erase_of_nodup s.2
1003
+ lemma not_mem_erase (a : α) (s : finset α) : a ∉ erase s a := s.2 .not_mem_erase
1004
1004
1005
1005
-- While this can be solved by `simp`, this lemma is eligible for `dsimp`
1006
1006
@[nolint simp_nf, simp] theorem erase_empty (a : α) : erase ∅ a = ∅ := rfl
@@ -1395,8 +1395,7 @@ section filter
1395
1395
variables (p q : α → Prop ) [decidable_pred p] [decidable_pred q]
1396
1396
1397
1397
/-- `filter p s` is the set of elements of `s` that satisfy `p`. -/
1398
- def filter (s : finset α) : finset α :=
1399
- ⟨_, nodup_filter p s.2 ⟩
1398
+ def filter (s : finset α) : finset α := ⟨_, s.2 .filter p⟩
1400
1399
1401
1400
@[simp] theorem filter_val (s : finset α) : (filter p s).1 = s.1 .filter p := rfl
1402
1401
@@ -1817,8 +1816,7 @@ open function
1817
1816
1818
1817
/-- When `f` is an embedding of `α` in `β` and `s` is a finset in `α`, then `s.map f` is the image
1819
1818
finset in `β`. The embedding condition guarantees that there are no duplicates in the image. -/
1820
- def map (f : α ↪ β) (s : finset α) : finset β :=
1821
- ⟨s.1 .map f, nodup_map f.2 s.2 ⟩
1819
+ def map (f : α ↪ β) (s : finset α) : finset β := ⟨s.1 .map f, s.2 .map f.2 ⟩
1822
1820
1823
1821
@[simp] theorem map_val (f : α ↪ β) (s : finset α) : (map f s).1 = s.1 .map f := rfl
1824
1822
@@ -1977,8 +1975,7 @@ instance [can_lift β α] : can_lift (finset β) (finset α) :=
1977
1975
begin
1978
1976
rintro ⟨⟨l⟩, hd : l.nodup⟩ hl,
1979
1977
lift l to list α using hl,
1980
- refine ⟨⟨l, list.nodup_of_nodup_map _ hd⟩, ext $ λ a, _⟩,
1981
- simp
1978
+ exact ⟨⟨l, hd.of_map _⟩, ext $ λ a, by simp⟩,
1982
1979
end }
1983
1980
1984
1981
lemma image_congr (h : (s : set α).eq_on f g) : finset.image f s = finset.image g s :=
@@ -2014,8 +2011,7 @@ theorem image_to_finset [decidable_eq α] {s : multiset α} :
2014
2011
s.to_finset.image f = (s.map f).to_finset :=
2015
2012
ext $ λ _, by simp only [mem_image, multiset.mem_to_finset, exists_prop, multiset.mem_map]
2016
2013
2017
- theorem image_val_of_inj_on (H : set.inj_on f s) : (image f s).1 = s.1 .map f :=
2018
- (nodup_map_on H s.2 ).dedup
2014
+ lemma image_val_of_inj_on (H : set.inj_on f s) : (image f s).1 = s.1 .map f := (s.2 .map_on H).dedup
2019
2015
2020
2016
@[simp] lemma image_id [decidable_eq α] : s.image id = s :=
2021
2017
ext $ λ _, by simp only [mem_image, exists_prop, id, exists_eq_right]
0 commit comments