@@ -25,7 +25,7 @@ variables [semilattice_sup_bot α]
25
25
/-- Supremum of a finite set: `sup {a, b, c} f = f a ⊔ f b ⊔ f c` -/
26
26
def sup (s : finset β) (f : β → α) : α := s.fold (⊔) ⊥ f
27
27
28
- variables {s s₁ s₂ : finset β} {f : β → α}
28
+ variables {s s₁ s₂ : finset β} {f g : β → α}
29
29
30
30
lemma sup_def : s.sup f = (s.1 .map f).sup := rfl
31
31
@@ -38,7 +38,7 @@ fold_cons h
38
38
@[simp] lemma sup_insert [decidable_eq β] {b : β} : (insert b s : finset β).sup f = f b ⊔ s.sup f :=
39
39
fold_insert_idem
40
40
41
- lemma sup_image [decidable_eq β] (s : finset γ) (f : γ → β) (g : β → α):
41
+ lemma sup_image [decidable_eq β] (s : finset γ) (f : γ → β) (g : β → α) :
42
42
(s.image f).sup g = s.sup (g ∘ f) :=
43
43
fold_image_idem
44
44
@@ -53,6 +53,14 @@ lemma sup_union [decidable_eq β] : (s₁ ∪ s₂).sup f = s₁.sup f ⊔ s₂.
53
53
finset.induction_on s₁ (by rw [empty_union, sup_empty, bot_sup_eq]) $ λ a s has ih,
54
54
by rw [insert_union, sup_insert, sup_insert, ih, sup_assoc]
55
55
56
+ lemma sup_sup : s.sup (f ⊔ g) = s.sup f ⊔ s.sup g :=
57
+ begin
58
+ refine finset.cons_induction_on s _ (λ b t _ h, _),
59
+ { rw [sup_empty, sup_empty, sup_empty, bot_sup_eq] },
60
+ { rw [sup_cons, sup_cons, sup_cons, h],
61
+ exact sup_sup_sup_comm _ _ _ _ }
62
+ end
63
+
56
64
theorem sup_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀a∈s₂, f a = g a) : s₁.sup f = s₂.sup g :=
57
65
by subst hs; exact finset.fold_congr hfg
58
66
@@ -98,6 +106,26 @@ sup_le $ assume b hb, le_sup (h hb)
98
106
(λ h, ⟨c, or.inl rfl, h⟩) (λ h, let ⟨b, hb, hlt⟩ := ih h in ⟨b, or.inr hb, hlt⟩)),
99
107
(λ ⟨b, hb, hlt⟩, lt_of_lt_of_le hlt (le_sup hb))⟩
100
108
109
+ @[simp] lemma sup_attach (s : finset β) (f : β → α) : s.attach.sup (λ x, f x) = s.sup f :=
110
+ (s.attach.sup_map (function.embedding.subtype _) f).symm.trans $ congr_arg _ attach_map_val
111
+
112
+ @[simp] lemma sup_erase_bot [decidable_eq α] (s : finset α) : (s.erase ⊥).sup id = s.sup id :=
113
+ begin
114
+ refine (sup_mono (s.erase_subset _)).antisymm (finset.sup_le_iff.2 $ λ a ha, _),
115
+ obtain rfl | ha' := eq_or_ne a ⊥,
116
+ { exact bot_le },
117
+ { exact le_sup (mem_erase.2 ⟨ha', ha⟩) }
118
+ end
119
+
120
+ lemma sup_sdiff_right {α β : Type *} [generalized_boolean_algebra α] (s : finset β) (f : β → α)
121
+ (a : α) :
122
+ s.sup (λ b, f b \ a) = s.sup f \ a :=
123
+ begin
124
+ refine finset.cons_induction_on s _ (λ b t _ h, _),
125
+ { rw [sup_empty, sup_empty, bot_sdiff] },
126
+ { rw [sup_cons, sup_cons, h, sup_sdiff] }
127
+ end
128
+
101
129
lemma comp_sup_eq_sup_comp [semilattice_sup_bot γ] {s : finset β}
102
130
{f : β → α} (g : α → γ) (g_sup : ∀ x y, g (x ⊔ y) = g x ⊔ g y) (bot : g ⊥ = ⊥) :
103
131
g (s.sup f) = s.sup (g ∘ f) :=
@@ -137,7 +165,7 @@ begin
137
165
end
138
166
139
167
lemma sup_le_of_le_directed {α : Type *} [semilattice_sup_bot α] (s : set α)
140
- (hs : s.nonempty) (hdir : directed_on (≤) s) (t : finset α):
168
+ (hs : s.nonempty) (hdir : directed_on (≤) s) (t : finset α) :
141
169
(∀ x ∈ t, ∃ y ∈ s, x ≤ y) → ∃ x, x ∈ s ∧ t.sup id ≤ x :=
142
170
begin
143
171
classical,
@@ -188,7 +216,7 @@ variables [semilattice_inf_top α]
188
216
/-- Infimum of a finite set: `inf {a, b, c} f = f a ⊓ f b ⊓ f c` -/
189
217
def inf (s : finset β) (f : β → α) : α := s.fold (⊓) ⊤ f
190
218
191
- variables {s s₁ s₂ : finset β} {f : β → α}
219
+ variables {s s₁ s₂ : finset β} {f g : β → α}
192
220
193
221
lemma inf_def : s.inf f = (s.1 .map f).inf := rfl
194
222
@@ -201,7 +229,7 @@ fold_empty
201
229
@[simp] lemma inf_insert [decidable_eq β] {b : β} : (insert b s : finset β).inf f = f b ⊓ s.inf f :=
202
230
fold_insert_idem
203
231
204
- lemma inf_image [decidable_eq β] (s : finset γ) (f : γ → β) (g : β → α):
232
+ lemma inf_image [decidable_eq β] (s : finset γ) (f : γ → β) (g : β → α) :
205
233
(s.image f).inf g = s.inf (g ∘ f) :=
206
234
fold_image_idem
207
235
@@ -215,6 +243,9 @@ inf_singleton
215
243
lemma inf_union [decidable_eq β] : (s₁ ∪ s₂).inf f = s₁.inf f ⊓ s₂.inf f :=
216
244
@sup_union (order_dual α) _ _ _ _ _ _
217
245
246
+ lemma inf_inf : s.inf (f ⊓ g) = s.inf f ⊓ s.inf g :=
247
+ @sup_sup (order_dual α) _ _ _ _ _
248
+
218
249
theorem inf_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀a∈s₂, f a = g a) : s₁.inf f = s₂.inf g :=
219
250
by subst hs; exact finset.fold_congr hfg
220
251
@@ -249,6 +280,38 @@ le_inf $ assume b hb, inf_le (h hb)
249
280
@[simp] lemma inf_lt_iff [is_total α (≤)] {a : α} : s.inf f < a ↔ (∃ b ∈ s, f b < a) :=
250
281
@lt_sup_iff (order_dual α) _ _ _ _ _ _
251
282
283
+ lemma inf_attach (s : finset β) (f : β → α) : s.attach.inf (λ x, f x) = s.inf f :=
284
+ @sup_attach (order_dual α) _ _ _ _
285
+
286
+ @[simp] lemma inf_erase_top [decidable_eq α] (s : finset α) : (s.erase ⊤).inf id = s.inf id :=
287
+ @sup_erase_bot (order_dual α) _ _ _
288
+
289
+ lemma sup_sdiff_left {α β : Type *} [boolean_algebra α] (s : finset β) (f : β → α) (a : α) :
290
+ s.sup (λ b, a \ f b) = a \ s.inf f :=
291
+ begin
292
+ refine finset.cons_induction_on s _ (λ b t _ h, _),
293
+ { rw [sup_empty, inf_empty, sdiff_top] },
294
+ { rw [sup_cons, inf_cons, h, sdiff_inf] }
295
+ end
296
+
297
+ lemma inf_sdiff_left {α β : Type *} [boolean_algebra α] {s : finset β} (hs : s.nonempty) (f : β → α)
298
+ (a : α) :
299
+ s.inf (λ b, a \ f b) = a \ s.sup f :=
300
+ begin
301
+ refine hs.cons_induction (λ b, _) (λ b t _ h, _),
302
+ { rw [sup_singleton, inf_singleton] },
303
+ { rw [sup_cons, inf_cons, h, sdiff_sup] }
304
+ end
305
+
306
+ lemma inf_sdiff_right {α β : Type *} [boolean_algebra α] {s : finset β} (hs : s.nonempty) (f : β → α)
307
+ (a : α) :
308
+ s.inf (λ b, f b \ a) = s.inf f \ a :=
309
+ begin
310
+ refine hs.cons_induction (λ b, _) (λ b t _ h, _),
311
+ { rw [inf_singleton, inf_singleton] },
312
+ { rw [inf_cons, inf_cons, h, inf_sdiff] }
313
+ end
314
+
252
315
lemma comp_inf_eq_inf_comp [semilattice_inf_top γ] {s : finset β}
253
316
{f : β → α} (g : α → γ) (g_inf : ∀ x y, g (x ⊓ y) = g x ⊓ g y) (top : g ⊤ = ⊤) :
254
317
g (s.inf f) = s.inf (g ∘ f) :=
@@ -892,6 +955,12 @@ lemma sup_eq_bUnion {α β} [decidable_eq β] (s : finset α) (t : α → finset
892
955
s.sup t = s.bUnion t :=
893
956
by { ext, rw [mem_sup, mem_bUnion], }
894
957
958
+ @[simp] lemma sup_singleton' [decidable_eq α] (s : finset α) : s.sup singleton = s :=
959
+ begin
960
+ refine (finset.sup_le $ λ a, _).antisymm (λ a ha, mem_sup.2 ⟨a, ha, mem_singleton_self a⟩),
961
+ exact singleton_subset_iff.2 ,
962
+ end
963
+
895
964
end finset
896
965
897
966
section lattice
0 commit comments