@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Yaël Dillies
5
5
-/
6
6
import data.finset.n_ary
7
+ import data.set.sups
7
8
8
9
/-!
9
10
# Set family operations
@@ -12,16 +13,16 @@ This file defines a few binary operations on `finset α` for use in set family c
12
13
13
14
## Main declarations
14
15
15
- * `finset.sups s t`: Finset of elements of the form `a ⊔ b` where `a ∈ s`, `b ∈ t`.
16
- * `finset.infs s t`: Finset of elements of the form `a ⊓ b` where `a ∈ s`, `b ∈ t`.
16
+ * `s ⊻ t`: Finset of elements of the form `a ⊔ b` where `a ∈ s`, `b ∈ t`.
17
+ * `s ⊼ t`: Finset of elements of the form `a ⊓ b` where `a ∈ s`, `b ∈ t`.
17
18
* `finset.disj_sups s t`: Finset of elements of the form `a ⊔ b` where `a ∈ s`, `b ∈ t` and `a`
18
19
and `b` are disjoint.
19
20
20
21
## Notation
21
22
22
23
We define the following notation in locale `finset_family`:
23
- * `s ⊻ t` for `finset.sups s t`
24
- * `s ⊼ t` for `finset.infs s t`
24
+ * `s ⊻ t`
25
+ * `s ⊼ t`
25
26
* `s ○ t` for `finset.disj_sups s t`
26
27
27
28
## References
@@ -30,25 +31,26 @@ We define the following notation in locale `finset_family`:
30
31
-/
31
32
32
33
open function
34
+ open_locale set_family
33
35
34
36
variables {α : Type *} [decidable_eq α]
35
37
36
38
namespace finset
37
39
section sups
38
- variables [semilattice_sup α] (s s₁ s₂ t t₁ t₂ u : finset α)
40
+ variables [semilattice_sup α] (s s₁ s₂ t t₁ t₂ u v : finset α)
39
41
40
- /-- The finset of elements of the form `a ⊔ b` where `a ∈ s`, `b ∈ t`. -/
41
- def sups (s t : finset α) : finset α := image₂ (⊔) s t
42
+ /-- `s ⊻ t` is the finset of elements of the form `a ⊔ b` where `a ∈ s`, `b ∈ t`. -/
43
+ protected def has_sups : has_sups ( finset α) := ⟨ image₂ (⊔)⟩
42
44
43
- localized " infix (name := finset.sups) ` ⊻ `:74 := finset.sups " in finset_family
45
+ localized " attribute [instance] finset.has_sups " in finset_family
44
46
45
47
variables {s t} {a b c : α}
46
48
47
- @[simp] lemma mem_sups : c ∈ s ⊻ t ↔ ∃ (a ∈ s) (b ∈ t), a ⊔ b = c := by simp [sups ]
49
+ @[simp] lemma mem_sups : c ∈ s ⊻ t ↔ ∃ (a ∈ s) (b ∈ t), a ⊔ b = c := by simp [(⊻) ]
48
50
49
51
variables (s t)
50
52
51
- @[simp, norm_cast] lemma coe_sups : (s ⊻ t : set α) = set.image2 (⊔) s t := coe_image₂ _ _ _
53
+ @[simp, norm_cast] lemma coe_sups : (↑( s ⊻ t) : set α) = s ⊻ t := coe_image₂ _ _ _
52
54
53
55
lemma card_sups_le : (s ⊻ t).card ≤ s.card * t.card := card_image₂_le _ _ _
54
56
@@ -63,29 +65,28 @@ lemma sups_subset : s₁ ⊆ s₂ → t₁ ⊆ t₂ → s₁ ⊻ t₁ ⊆ s₂
63
65
lemma sups_subset_left : t₁ ⊆ t₂ → s ⊻ t₁ ⊆ s ⊻ t₂ := image₂_subset_left
64
66
lemma sups_subset_right : s₁ ⊆ s₂ → s₁ ⊻ t ⊆ s₂ ⊻ t := image₂_subset_right
65
67
66
- lemma image_subset_sups_left : b ∈ t → (λ a, a ⊔ b) '' s ⊆ s ⊻ t := image_subset_image₂_left
67
- lemma image_subset_sups_right : a ∈ s → ( ⊔) a '' t ⊆ s ⊻ t := image_subset_image₂_right
68
+ lemma image_subset_sups_left : b ∈ t → s.image (λ a, a ⊔ b) ⊆ s ⊻ t := image_subset_image₂_left
69
+ lemma image_subset_sups_right : a ∈ s → t.image (( ⊔) a) ⊆ s ⊻ t := image_subset_image₂_right
68
70
69
71
lemma forall_sups_iff {p : α → Prop } : (∀ c ∈ s ⊻ t, p c) ↔ ∀ (a ∈ s) (b ∈ t), p (a ⊔ b) :=
70
72
forall_image₂_iff
71
73
72
74
@[simp] lemma sups_subset_iff : s ⊻ t ⊆ u ↔ ∀ (a ∈ s) (b ∈ t), a ⊔ b ∈ u := image₂_subset_iff
73
75
74
- @[simp] lemma sups_nonempty_iff : (s ⊻ t).nonempty ↔ s.nonempty ∧ t.nonempty := image₂_nonempty_iff
76
+ @[simp] lemma sups_nonempty : (s ⊻ t).nonempty ↔ s.nonempty ∧ t.nonempty := image₂_nonempty_iff
75
77
76
- lemma nonempty.sups : s.nonempty → t.nonempty → (s ⊻ t).nonempty := nonempty.image₂
78
+ protected lemma nonempty.sups : s.nonempty → t.nonempty → (s ⊻ t).nonempty := nonempty.image₂
77
79
lemma nonempty.of_sups_left : (s ⊻ t).nonempty → s.nonempty := nonempty.of_image₂_left
78
80
lemma nonempty.of_sups_right : (s ⊻ t).nonempty → t.nonempty := nonempty.of_image₂_right
79
81
80
- @[simp] lemma sups_empty_left : ∅ ⊻ t = ∅ := image₂_empty_left
81
- @[simp] lemma sups_empty_right : s ⊻ ∅ = ∅ := image₂_empty_right
82
- @[simp] lemma sups_eq_empty_iff : s ⊻ t = ∅ ↔ s = ∅ ∨ t = ∅ := image₂_eq_empty_iff
82
+ @[simp] lemma empty_sups : ∅ ⊻ t = ∅ := image₂_empty_left
83
+ @[simp] lemma sups_empty : s ⊻ ∅ = ∅ := image₂_empty_right
84
+ @[simp] lemma sups_eq_empty : s ⊻ t = ∅ ↔ s = ∅ ∨ t = ∅ := image₂_eq_empty_iff
83
85
84
- @[simp] lemma sups_singleton_left : {a} ⊻ t = t.image (λ b, a ⊔ b) := image₂_singleton_left
85
- @[simp] lemma sups_singleton_right : s ⊻ {b} = s.image (λ a, a ⊔ b) := image₂_singleton_right
86
- lemma sups_singleton_left' : {a} ⊻ t = t.image ((⊔) a) := image₂_singleton_left'
86
+ @[simp] lemma singleton_sups : {a} ⊻ t = t.image (λ b, a ⊔ b) := image₂_singleton_left
87
+ @[simp] lemma sups_singleton : s ⊻ {b} = s.image (λ a, a ⊔ b) := image₂_singleton_right
87
88
88
- lemma sups_singleton : ({a} ⊻ {b} : finset α) = {a ⊔ b} := image₂_singleton
89
+ lemma singleton_sups_singleton : ({a} ⊻ {b} : finset α) = {a ⊔ b} := image₂_singleton
89
90
90
91
lemma sups_union_left : (s₁ ∪ s₂) ⊻ t = s₁ ⊻ t ∪ s₂ ⊻ t := image₂_union_left
91
92
lemma sups_union_right : s ⊻ (t₁ ∪ t₂) = s ⊻ t₁ ∪ s ⊻ t₂ := image₂_union_right
@@ -94,10 +95,10 @@ lemma sups_inter_subset_left : (s₁ ∩ s₂) ⊻ t ⊆ s₁ ⊻ t ∩ s₂ ⊻
94
95
lemma sups_inter_subset_right : s ⊻ (t₁ ∩ t₂) ⊆ s ⊻ t₁ ∩ s ⊻ t₂ := image₂_inter_subset_right
95
96
96
97
lemma subset_sups {s t : set α} :
97
- ↑u ⊆ set.image2 (⊔) s t → ∃ s' t' : finset α, ↑s' ⊆ s ∧ ↑t' ⊆ t ∧ u ⊆ s' ⊻ t' :=
98
+ ↑u ⊆ s ⊻ t → ∃ s' t' : finset α, ↑s' ⊆ s ∧ ↑t' ⊆ t ∧ u ⊆ s' ⊻ t' :=
98
99
subset_image₂
99
100
100
- variables (s t u)
101
+ variables (s t u v )
101
102
102
103
lemma bUnion_image_sup_left : s.bUnion (λ a, t.image $ (⊔) a) = s ⊻ t := bUnion_image_left
103
104
lemma bUnion_image_sup_right : t.bUnion (λ b, s.image $ λ a, a ⊔ b) = s ⊻ t := bUnion_image_right
@@ -109,24 +110,26 @@ lemma sups_assoc : (s ⊻ t) ⊻ u = s ⊻ (t ⊻ u) := image₂_assoc $ λ _ _
109
110
lemma sups_comm : s ⊻ t = t ⊻ s := image₂_comm $ λ _ _, sup_comm
110
111
lemma sups_left_comm : s ⊻ (t ⊻ u) = t ⊻ (s ⊻ u) := image₂_left_comm sup_left_comm
111
112
lemma sups_right_comm : (s ⊻ t) ⊻ u = (s ⊻ u) ⊻ t := image₂_right_comm sup_right_comm
113
+ lemma sups_sups_sups_comm : (s ⊻ t) ⊻ (u ⊻ v) = (s ⊻ u) ⊻ (t ⊻ v) :=
114
+ image₂_image₂_image₂_comm sup_sup_sup_comm
112
115
113
116
end sups
114
117
115
118
section infs
116
- variables [semilattice_inf α] (s s₁ s₂ t t₁ t₂ u : finset α)
119
+ variables [semilattice_inf α] (s s₁ s₂ t t₁ t₂ u v : finset α)
117
120
118
- /-- The finset of elements of the form `a ⊓ b` where `a ∈ s`, `b ∈ t`. -/
119
- def infs (s t : finset α) : finset α := image₂ (⊓) s t
121
+ /-- `s ⊼ t` is the finset of elements of the form `a ⊓ b` where `a ∈ s`, `b ∈ t`. -/
122
+ protected def has_infs : has_infs ( finset α) := ⟨ image₂ (⊓)⟩
120
123
121
- localized " infix (name := finset.infs) ` ⊼ `:74 := finset.infs " in finset_family
124
+ localized " attribute [instance] finset.has_infs " in finset_family
122
125
123
126
variables {s t} {a b c : α}
124
127
125
- @[simp] lemma mem_infs : c ∈ s ⊼ t ↔ ∃ (a ∈ s) (b ∈ t), a ⊓ b = c := by simp [infs ]
128
+ @[simp] lemma mem_infs : c ∈ s ⊼ t ↔ ∃ (a ∈ s) (b ∈ t), a ⊓ b = c := by simp [(⊼) ]
126
129
127
130
variables (s t)
128
131
129
- @[simp, norm_cast] lemma coe_infs : (s ⊼ t : set α) = set.image2 (⊓) s t := coe_image₂ _ _ _
132
+ @[simp, norm_cast] lemma coe_infs : (↑( s ⊼ t) : set α) = s ⊼ t := coe_image₂ _ _ _
130
133
131
134
lemma card_infs_le : (s ⊼ t).card ≤ s.card * t.card := card_image₂_le _ _ _
132
135
@@ -141,29 +144,28 @@ lemma infs_subset : s₁ ⊆ s₂ → t₁ ⊆ t₂ → s₁ ⊼ t₁ ⊆ s₂
141
144
lemma infs_subset_left : t₁ ⊆ t₂ → s ⊼ t₁ ⊆ s ⊼ t₂ := image₂_subset_left
142
145
lemma infs_subset_right : s₁ ⊆ s₂ → s₁ ⊼ t ⊆ s₂ ⊼ t := image₂_subset_right
143
146
144
- lemma image_subset_infs_left : b ∈ t → (λ a, a ⊓ b) '' s ⊆ s ⊼ t := image_subset_image₂_left
145
- lemma image_subset_infs_right : a ∈ s → ( ⊓) a '' t ⊆ s ⊼ t := image_subset_image₂_right
147
+ lemma image_subset_infs_left : b ∈ t → s.image (λ a, a ⊓ b) ⊆ s ⊼ t := image_subset_image₂_left
148
+ lemma image_subset_infs_right : a ∈ s → t.image (( ⊓) a) ⊆ s ⊼ t := image_subset_image₂_right
146
149
147
150
lemma forall_infs_iff {p : α → Prop } : (∀ c ∈ s ⊼ t, p c) ↔ ∀ (a ∈ s) (b ∈ t), p (a ⊓ b) :=
148
151
forall_image₂_iff
149
152
150
153
@[simp] lemma infs_subset_iff : s ⊼ t ⊆ u ↔ ∀ (a ∈ s) (b ∈ t), a ⊓ b ∈ u := image₂_subset_iff
151
154
152
- @[simp] lemma infs_nonempty_iff : (s ⊼ t).nonempty ↔ s.nonempty ∧ t.nonempty := image₂_nonempty_iff
155
+ @[simp] lemma infs_nonempty : (s ⊼ t).nonempty ↔ s.nonempty ∧ t.nonempty := image₂_nonempty_iff
153
156
154
- lemma nonempty.infs : s.nonempty → t.nonempty → (s ⊼ t).nonempty := nonempty.image₂
157
+ protected lemma nonempty.infs : s.nonempty → t.nonempty → (s ⊼ t).nonempty := nonempty.image₂
155
158
lemma nonempty.of_infs_left : (s ⊼ t).nonempty → s.nonempty := nonempty.of_image₂_left
156
159
lemma nonempty.of_infs_right : (s ⊼ t).nonempty → t.nonempty := nonempty.of_image₂_right
157
160
158
- @[simp] lemma infs_empty_left : ∅ ⊼ t = ∅ := image₂_empty_left
159
- @[simp] lemma infs_empty_right : s ⊼ ∅ = ∅ := image₂_empty_right
160
- @[simp] lemma infs_eq_empty_iff : s ⊼ t = ∅ ↔ s = ∅ ∨ t = ∅ := image₂_eq_empty_iff
161
+ @[simp] lemma empty_infs : ∅ ⊼ t = ∅ := image₂_empty_left
162
+ @[simp] lemma infs_empty : s ⊼ ∅ = ∅ := image₂_empty_right
163
+ @[simp] lemma infs_eq_empty : s ⊼ t = ∅ ↔ s = ∅ ∨ t = ∅ := image₂_eq_empty_iff
161
164
162
- @[simp] lemma infs_singleton_left : {a} ⊼ t = t.image (λ b, a ⊓ b) := image₂_singleton_left
163
- @[simp] lemma infs_singleton_right : s ⊼ {b} = s.image (λ a, a ⊓ b) := image₂_singleton_right
164
- lemma infs_singleton_left' : {a} ⊼ t = t.image ((⊓) a) := image₂_singleton_left'
165
+ @[simp] lemma singleton_infs : {a} ⊼ t = t.image (λ b, a ⊓ b) := image₂_singleton_left
166
+ @[simp] lemma infs_singleton : s ⊼ {b} = s.image (λ a, a ⊓ b) := image₂_singleton_right
165
167
166
- lemma infs_singleton : ({a} ⊼ {b} : finset α) = {a ⊓ b} := image₂_singleton
168
+ lemma singleton_infs_singleton : ({a} ⊼ {b} : finset α) = {a ⊓ b} := image₂_singleton
167
169
168
170
lemma infs_union_left : (s₁ ∪ s₂) ⊼ t = s₁ ⊼ t ∪ s₂ ⊼ t := image₂_union_left
169
171
lemma infs_union_right : s ⊼ (t₁ ∪ t₂) = s ⊼ t₁ ∪ s ⊼ t₂ := image₂_union_right
@@ -172,10 +174,10 @@ lemma infs_inter_subset_left : (s₁ ∩ s₂) ⊼ t ⊆ s₁ ⊼ t ∩ s₂ ⊼
172
174
lemma infs_inter_subset_right : s ⊼ (t₁ ∩ t₂) ⊆ s ⊼ t₁ ∩ s ⊼ t₂ := image₂_inter_subset_right
173
175
174
176
lemma subset_infs {s t : set α} :
175
- ↑u ⊆ set.image2 (⊓) s t → ∃ s' t' : finset α, ↑s' ⊆ s ∧ ↑t' ⊆ t ∧ u ⊆ s' ⊼ t' :=
177
+ ↑u ⊆ s ⊼ t → ∃ s' t' : finset α, ↑s' ⊆ s ∧ ↑t' ⊆ t ∧ u ⊆ s' ⊼ t' :=
176
178
subset_image₂
177
179
178
- variables (s t u)
180
+ variables (s t u v )
179
181
180
182
lemma bUnion_image_inf_left : s.bUnion (λ a, t.image $ (⊓) a) = s ⊼ t := bUnion_image_left
181
183
lemma bUnion_image_inf_right : t.bUnion (λ b, s.image $ λ a, a ⊓ b) = s ⊼ t := bUnion_image_right
@@ -187,11 +189,30 @@ lemma infs_assoc : (s ⊼ t) ⊼ u = s ⊼ (t ⊼ u) := image₂_assoc $ λ _ _
187
189
lemma infs_comm : s ⊼ t = t ⊼ s := image₂_comm $ λ _ _, inf_comm
188
190
lemma infs_left_comm : s ⊼ (t ⊼ u) = t ⊼ (s ⊼ u) := image₂_left_comm inf_left_comm
189
191
lemma infs_right_comm : (s ⊼ t) ⊼ u = (s ⊼ u) ⊼ t := image₂_right_comm inf_right_comm
192
+ lemma infs_infs_infs_comm : (s ⊼ t) ⊼ (u ⊼ v) = (s ⊼ u) ⊼ (t ⊼ v) :=
193
+ image₂_image₂_image₂_comm inf_inf_inf_comm
190
194
191
195
end infs
192
196
193
197
open_locale finset_family
194
198
199
+ section distrib_lattice
200
+ variables [distrib_lattice α] (s t u : finset α)
201
+
202
+ lemma sups_infs_subset_left : s ⊻ (t ⊼ u) ⊆ (s ⊻ t) ⊼ (s ⊻ u) :=
203
+ image₂_distrib_subset_left $ λ _ _ _, sup_inf_left
204
+
205
+ lemma sups_infs_subset_right : (t ⊼ u) ⊻ s ⊆ (t ⊻ s) ⊼ (u ⊻ s) :=
206
+ image₂_distrib_subset_right $ λ _ _ _, sup_inf_right
207
+
208
+ lemma infs_sups_subset_left : s ⊼ (t ⊻ u) ⊆ (s ⊼ t) ⊻ (s ⊼ u) :=
209
+ image₂_distrib_subset_left $ λ _ _ _, inf_sup_left
210
+
211
+ lemma infs_sups_subset_right : (t ⊻ u) ⊼ s ⊆ (t ⊼ s) ⊻ (u ⊼ s) :=
212
+ image₂_distrib_subset_right $ λ _ _ _, inf_sup_right
213
+
214
+ end distrib_lattice
215
+
195
216
section disj_sups
196
217
variables [semilattice_sup α] [order_bot α] [@decidable_rel α disjoint]
197
218
(s s₁ s₂ t t₁ t₂ u : finset α)
@@ -271,7 +292,7 @@ end disj_sups
271
292
open_locale finset_family
272
293
273
294
section distrib_lattice
274
- variables [distrib_lattice α] [order_bot α] [@decidable_rel α disjoint] (s t u : finset α)
295
+ variables [distrib_lattice α] [order_bot α] [@decidable_rel α disjoint] (s t u v : finset α)
275
296
276
297
lemma disj_sups_assoc : ∀ s t u : finset α, (s ○ t) ○ u = s ○ (t ○ u) :=
277
298
begin
@@ -288,5 +309,8 @@ by simp_rw [←disj_sups_assoc, disj_sups_comm s]
288
309
lemma disj_sups_right_comm : (s ○ t) ○ u = (s ○ u) ○ t :=
289
310
by simp_rw [disj_sups_assoc, disj_sups_comm]
290
311
312
+ lemma disj_sups_disj_sups_disj_sups_comm : (s ○ t) ○ (u ○ v) = (s ○ u) ○ (t ○ v) :=
313
+ by simp_rw [←disj_sups_assoc, disj_sups_right_comm]
314
+
291
315
end distrib_lattice
292
316
end finset
0 commit comments