Skip to content

Commit 224a0be

Browse files
vihdzpriccardobrasca
authored andcommitted
feat: union/intersection lemmas for DirSupInacc/DirSupClosed (leanprover-community#37639)
1 parent 7ee52ff commit 224a0be

1 file changed

Lines changed: 64 additions & 4 deletions

File tree

Mathlib/Order/DirSupClosed.lean

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module
88
public import Mathlib.Order.CompleteLattice.Defs
99
public import Mathlib.Order.UpperLower.Basic
1010

11+
import Mathlib.Data.Set.Lattice
12+
1113
/-!
1214
# Sets closed under directed suprema
1315
@@ -90,12 +92,70 @@ alias ⟨DirSupInaccOn.of_compl, DirSupClosedOn.compl⟩ := dirSupInaccOn_compl
9092
alias ⟨DirSupClosed.of_compl, DirSupInacc.compl⟩ := dirSupClosed_compl
9193
alias ⟨DirSupInacc.of_compl, DirSupClosed.compl⟩ := dirSupInacc_compl
9294

93-
lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) :=
94-
fun _d hds hd hd' _a ha ↦
95-
⟨hs (hds.trans inter_subset_left) hd hd' ha, ht (hds.trans inter_subset_right) hd hd' ha⟩
95+
@[simp] theorem DirSupClosed.empty : DirSupClosed (∅ : Set α) := by simp [DirSupClosed]
96+
@[simp] theorem DirSupInacc.empty : DirSupInacc (∅ : Set α) := by simp [DirSupInacc]
97+
theorem DirSupClosedOn.empty : DirSupClosedOn D ∅ := by simp
98+
theorem DirSupInaccOn.empty : DirSupInaccOn D ∅ := by simp
99+
100+
@[simp] theorem DirSupClosed.univ : DirSupClosed (univ : Set α) := by simp [DirSupClosed]
101+
@[simp] theorem DirSupInacc.univ : DirSupInacc (univ : Set α) := by simp [← compl_empty]
102+
theorem DirSupClosedOn.univ : DirSupClosedOn D univ := by simp
103+
theorem DirSupInaccOn.univ : DirSupInaccOn D univ := by simp
104+
105+
theorem DirSupClosedOn.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosedOn D x) :
106+
DirSupClosedOn D (⋂₀ s) :=
107+
fun _d hD hds hd hd' _a ha t ht ↦ hs t ht hD (hds.trans fun _x hx ↦ hx _ ht) hd hd' ha
108+
109+
theorem DirSupClosed.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosed x) :
110+
DirSupClosed (⋂₀ s) := by
111+
simpa using DirSupClosedOn.sInter fun x hx ↦ (hs x hx).dirSupClosedOn (D := .univ)
112+
113+
theorem DirSupInaccOn.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInaccOn D x) :
114+
DirSupInaccOn D (⋃₀ s) := by
115+
rw [← dirSupClosedOn_compl, Set.compl_sUnion]
116+
apply DirSupClosedOn.sInter
117+
rintro x ⟨x, hx, rfl⟩
118+
exact (hs x hx).compl
119+
120+
theorem DirSupInacc.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInacc x) :
121+
DirSupInacc (⋃₀ s) := by
122+
simpa using DirSupInaccOn.sUnion fun x hx ↦ (hs x hx).dirSupInaccOn (D := .univ)
123+
124+
theorem DirSupClosedOn.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosedOn D (f i)) :
125+
DirSupClosedOn D (⋂ i, f i) := by
126+
rw [← sInter_range f]
127+
exact DirSupClosedOn.sInter (by simpa)
128+
129+
theorem DirSupClosed.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosed (f i)) :
130+
DirSupClosed (⋂ i, f i) := by
131+
rw [← sInter_range f]
132+
exact DirSupClosed.sInter (by simpa)
133+
134+
theorem DirSupInaccOn.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInaccOn D (f i)) :
135+
DirSupInaccOn D (⋃ i, f i) := by
136+
rw [← sUnion_range f]
137+
exact DirSupInaccOn.sUnion (by simpa)
138+
139+
theorem DirSupInacc.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInacc (f i)) :
140+
DirSupInacc (⋃ i, f i) := by
141+
rw [← sUnion_range f]
142+
exact DirSupInacc.sUnion (by simpa)
143+
144+
lemma DirSupClosedOn.inter (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) :
145+
DirSupClosedOn D (s ∩ t) := by
146+
rw [← sInter_pair]
147+
refine .sInter ?_
148+
simpa [hs]
149+
150+
lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) := by
151+
simpa using hs.dirSupClosedOn.inter ht.dirSupClosedOn (D := .univ)
152+
153+
lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) :
154+
DirSupInaccOn D (s ∪ t) := by
155+
rw [← dirSupClosedOn_compl, compl_union]; exact hs.compl.inter ht.compl
96156

97157
lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by
98-
rw [← dirSupClosed_compl, compl_union]; exact hs.compl.inter ht.compl
158+
simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ)
99159

100160
lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s :=
101161
fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb

0 commit comments

Comments
 (0)