Skip to content

Commit 5e04dca

Browse files
committed
feat(Order/Interval/Set/Disjoint): generalize ⋃ x ∈ s, Iic x = Iic a from LinearOrder to Preorder (#42512)
and add an `IsLeast` version.
1 parent 7c673cc commit 5e04dca

2 files changed

Lines changed: 43 additions & 13 deletions

File tree

Mathlib/Order/Bounds/Basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,14 @@ theorem Set.Nonempty.bddAbove_lowerBounds (hs : s.Nonempty) : BddAbove (lowerBou
268268
theorem IsLeast.isGLB (h : IsLeast s a) : IsGLB s a :=
269269
⟨h.2, fun _ hb => hb h.1
270270

271+
@[to_dual]
272+
theorem IsGLB.isLeast (h : IsGLB s a) (hmem : a ∈ s) : IsLeast s a :=
273+
⟨hmem, h.left⟩
274+
275+
@[to_dual]
276+
theorem isLeast_iff_isGLB_and_mem : IsLeast s a ↔ IsGLB s a ∧ a ∈ s :=
277+
fun h ↦ ⟨h.isGLB, h.left⟩, fun ⟨h, hmem⟩ ↦ h.isLeast hmem⟩
278+
271279
@[to_dual]
272280
theorem IsLUB.upperBounds_eq (h : IsLUB s a) : upperBounds s = Ici a :=
273281
Set.ext fun _ => ⟨fun hb => h.2 hb, fun hb => upperBounds_mono_mem hb h.1

Mathlib/Order/Interval/Set/Disjoint.lean

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,36 @@ end Set
169169

170170
section UnionIxx
171171

172+
section Preorder
173+
174+
variable [Preorder α] {s : Set α} {a : α}
175+
176+
@[to_dual]
177+
theorem IsLeast.biUnion_Ici_eq_Ici (h : IsLeast s a) : ⋃ x ∈ s, Ici x = Ici a := by
178+
refine (iUnion₂_subset fun x hx ↦ ?_).antisymm fun x hx ↦ mem_iUnion₂.mpr ⟨a, h.left, hx⟩
179+
exact Ici_subset_Ici.mpr <| mem_lowerBounds.mp h.right x hx
180+
181+
@[to_dual (attr := deprecated IsLeast.biUnion_Ici_eq_Ici (since := "2026-08-13"))]
182+
theorem IsGLB.biUnion_Ici_eq_Ici (a_glb : IsGLB s a) (a_mem : a ∈ s) : ⋃ x ∈ s, Ici x = Ici a :=
183+
a_glb.isLeast a_mem |>.biUnion_Ici_eq_Ici
184+
185+
end Preorder
186+
187+
section PartialOrder
188+
189+
variable [PartialOrder α] {s : Set α} {a : α}
190+
191+
@[to_dual]
192+
theorem biUnion_Ici_eq_Ici_iff : ⋃ x ∈ s, Ici x = Ici a ↔ IsLeast s a := by
193+
refine ⟨fun h ↦ ?_, IsLeast.biUnion_Ici_eq_Ici⟩
194+
have hlb : a ∈ lowerBounds s := fun b hbs ↦ h.le <| mem_biUnion hbs self_mem_Ici
195+
have ⟨b, hbs, hba⟩ := mem_iUnion₂.mp <| h.ge self_mem_Ici
196+
exact ⟨hlb hbs |>.antisymm hba ▸ hbs, hlb⟩
197+
198+
end PartialOrder
199+
200+
section LinearOrder
201+
172202
variable [LinearOrder α] {s : Set α} {a : α} {f : ι → α}
173203

174204
theorem IsGLB.biUnion_Ioi_eq (h : IsGLB s a) : ⋃ x ∈ s, Ioi x = Ioi a := by
@@ -202,19 +232,10 @@ theorem IsGLB.biUnion_Ici_eq_Ioi (a_glb : IsGLB s a) (a_notMem : a ∉ s) :
202232
rw [mem_iUnion₂]
203233
exact ⟨y, hys, hyx.le⟩
204234

205-
theorem IsGLB.biUnion_Ici_eq_Ici (a_glb : IsGLB s a) (a_mem : a ∈ s) :
206-
⋃ x ∈ s, Ici x = Ici a := by
207-
refine (iUnion₂_subset fun x hx => ?_).antisymm fun x hx => ?_
208-
· exact Ici_subset_Ici.mpr (mem_lowerBounds.mp a_glb.1 x hx)
209-
· exact mem_iUnion₂.mpr ⟨a, a_mem, hx⟩
210-
211235
theorem IsLUB.biUnion_Iic_eq_Iio (a_lub : IsLUB s a) (a_notMem : a ∉ s) :
212236
⋃ x ∈ s, Iic x = Iio a :=
213237
a_lub.dual.biUnion_Ici_eq_Ioi a_notMem
214238

215-
theorem IsLUB.biUnion_Iic_eq_Iic (a_lub : IsLUB s a) (a_mem : a ∈ s) : ⋃ x ∈ s, Iic x = Iic a :=
216-
a_lub.dual.biUnion_Ici_eq_Ici a_mem
217-
218239
theorem iUnion_Ici_eq_Ioi_iInf {R : Type*} [CompleteLinearOrder R] {f : ι → R}
219240
(no_least_elem : ⨅ i, f i ∉ range f) : ⋃ i : ι, Ici (f i) = Ioi (⨅ i, f i) := by
220241
simp only [← IsGLB.biUnion_Ici_eq_Ioi (@isGLB_iInf _ _ _ f) no_least_elem, mem_range,
@@ -224,12 +245,11 @@ theorem iUnion_Iic_eq_Iio_iSup {R : Type*} [CompleteLinearOrder R] {f : ι → R
224245
(no_greatest_elem : (⨆ i, f i) ∉ range f) : ⋃ i : ι, Iic (f i) = Iio (⨆ i, f i) :=
225246
@iUnion_Ici_eq_Ioi_iInf ι (OrderDual R) _ f no_greatest_elem
226247

227-
theorem iUnion_Ici_eq_Ici_iInf {R : Type*} [CompleteLinearOrder R] {f : ι → R}
248+
theorem iUnion_Ici_eq_Ici_iInf {R : Type*} [CompleteLattice R] {f : ι → R}
228249
(has_least_elem : (⨅ i, f i) ∈ range f) : ⋃ i : ι, Ici (f i) = Ici (⨅ i, f i) := by
229-
simp only [← IsGLB.biUnion_Ici_eq_Ici (@isGLB_iInf _ _ _ f) has_least_elem, mem_range,
230-
iUnion_exists, iUnion_iUnion_eq']
250+
simp [← isGLB_iInf.isLeast has_least_elem |>.biUnion_Ici_eq_Ici]
231251

232-
theorem iUnion_Iic_eq_Iic_iSup {R : Type*} [CompleteLinearOrder R] {f : ι → R}
252+
theorem iUnion_Iic_eq_Iic_iSup {R : Type*} [CompleteLattice R] {f : ι → R}
233253
(has_greatest_elem : (⨆ i, f i) ∈ range f) : ⋃ i : ι, Iic (f i) = Iic (⨆ i, f i) :=
234254
@iUnion_Ici_eq_Ici_iInf ι (OrderDual R) _ f has_greatest_elem
235255

@@ -250,4 +270,6 @@ theorem iInter_Iio_of_not_bddBelow_range (hf : ¬ BddBelow (range f)) : ⋂ i, I
250270
gcongr
251271
exact Iio_subset_Iic_self
252272

273+
end LinearOrder
274+
253275
end UnionIxx

0 commit comments

Comments
 (0)