Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 48104c3

Browse files
committed
feat(data/set/lattice): (b)Union and (b)Inter lemmas (#7557)
from LTE
1 parent b577697 commit 48104c3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/data/set/lattice.lean

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,32 @@ notation `⋂` binders `, ` r:(scoped f, Inter f) := r
8080
-- TODO: more rewrite rules wrt forall / existentials and logical connectives
8181
-- TODO: also eliminate ∃i, ... ∧ i = t ∧ ...
8282

83+
lemma Union_prop (f : ι → set α) (p : ι → Prop) (i : ι) [decidable $ p i] :
84+
(⋃ (h : p i), f i) = if p i then f i else ∅ :=
85+
begin
86+
ext x,
87+
rw mem_Union,
88+
split_ifs ; tauto,
89+
end
90+
91+
@[simp]
92+
lemma Union_prop_pos {p : ι → Prop} {i : ι} (hi : p i) (f : ι → set α) :
93+
(⋃ (h : p i), f i) = f i :=
94+
begin
95+
classical,
96+
ext x,
97+
rw [Union_prop, if_pos hi]
98+
end
99+
100+
@[simp]
101+
lemma Union_prop_neg {p : ι → Prop} {i : ι} (hi : ¬ p i) (f : ι → set α) :
102+
(⋃ (h : p i), f i) = ∅ :=
103+
begin
104+
classical,
105+
ext x,
106+
rw [Union_prop, if_neg hi]
107+
end
108+
83109
lemma exists_set_mem_of_union_eq_top {ι : Type*} (t : set ι) (s : ι → set β)
84110
(w : (⋃ i ∈ t, s i) = ⊤) (x : β) :
85111
∃ (i ∈ t), x ∈ s i :=
@@ -259,6 +285,10 @@ infi_option s
259285
theorem mem_bUnion_iff {s : set α} {t : α → set β} {y : β} :
260286
y ∈ (⋃ x ∈ s, t x) ↔ ∃ x ∈ s, y ∈ t x := by simp
261287

288+
lemma mem_bUnion_iff' {p : α → Prop} {t : α → set β} {y : β} :
289+
y ∈ (⋃ i (h : p i), t i) ↔ ∃ i (h : p i), y ∈ t i :=
290+
mem_bUnion_iff
291+
262292
theorem mem_bInter_iff {s : set α} {t : α → set β} {y : β} :
263293
y ∈ (⋂ x ∈ s, t x) ↔ ∀ x ∈ s, y ∈ t x := by simp
264294

@@ -370,6 +400,20 @@ theorem bInter_pair (a b : α) (s : α → set β) :
370400
(⋂ x ∈ ({a, b} : set α), s x) = s a ∩ s b :=
371401
by simp [inter_comm]
372402

403+
lemma bInter_inter {ι α : Type*} {s : set ι} (hs : s.nonempty) (f : ι → set α) (t : set α) :
404+
(⋂ i ∈ s, f i ∩ t) = (⋂ i ∈ s, f i) ∩ t :=
405+
begin
406+
haveI : nonempty s := hs.to_subtype,
407+
simp [bInter_eq_Inter, ← Inter_inter]
408+
end
409+
410+
lemma inter_bInter {ι α : Type*} {s : set ι} (hs : s.nonempty) (f : ι → set α) (t : set α) :
411+
(⋂ i ∈ s, t ∩ f i) = t ∩ ⋂ i ∈ s, f i :=
412+
begin
413+
rw [inter_comm, ← bInter_inter hs],
414+
simp [inter_comm]
415+
end
416+
373417
theorem bUnion_empty (s : α → set β) : (⋃ x ∈ (∅ : set α), s x) = ∅ :=
374418
supr_emptyset
375419

0 commit comments

Comments
 (0)