Skip to content

Commit 1a11f9b

Browse files
committed
feat: basic API for ConditionallyCompletePartialOrder (#35047)
This develops the basic API for `ConditionallyCompletePartialOrder`. The API is copied from `ConditionallyCompleteLattice`, with `DirectedOn` assumptions added, and these lemmas are `protected` within that namespace. In a few cases, the lemmas were capable of being generalized outright, which we have done here. As a result, some material moved out of `ConditionallyCompleteLattice/Basic` to `ConditionallyCompletePartialOrder/Basic`.
1 parent df5c1e1 commit 1a11f9b

File tree

9 files changed

+506
-174
lines changed

9 files changed

+506
-174
lines changed

Mathlib.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5592,7 +5592,9 @@ public import Mathlib.Order.ConditionallyCompleteLattice.Defs
55925592
public import Mathlib.Order.ConditionallyCompleteLattice.Finset
55935593
public import Mathlib.Order.ConditionallyCompleteLattice.Group
55945594
public import Mathlib.Order.ConditionallyCompleteLattice.Indexed
5595+
public import Mathlib.Order.ConditionallyCompletePartialOrder.Basic
55955596
public import Mathlib.Order.ConditionallyCompletePartialOrder.Defs
5597+
public import Mathlib.Order.ConditionallyCompletePartialOrder.Indexed
55965598
public import Mathlib.Order.Copy
55975599
public import Mathlib.Order.CountableDenseLinearOrder
55985600
public import Mathlib.Order.Cover

Mathlib/Order/CompleteLattice/Basic.lean

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ protected theorem Equiv.iSup_congr {g : ι' → α} (e : ι ≃ ι') (h : ∀ x,
225225
⨆ x, f x = ⨆ y, g y :=
226226
e.surjective.iSup_congr _ h
227227

228-
@[congr]
228+
@[to_dual (attr := congr)]
229229
theorem iSup_congr_Prop {p q : Prop} {f₁ : p → α} {f₂ : q → α} (pq : p ↔ q)
230230
(f : ∀ x, f₁ (pq.mpr x) = f₂ x) : iSup f₁ = iSup f₂ := by
231231
obtain rfl := propext pq
@@ -241,6 +241,7 @@ theorem iSup_plift_down (f : ι → α) : ⨆ i, f (PLift.down i) = ⨆ i, f i :
241241
theorem iSup_range' (g : β → α) (f : ι → β) : ⨆ b : range f, g b = ⨆ i, g (f i) := by
242242
rw [iSup, iSup, ← image_eq_range, ← range_comp']
243243

244+
@[to_dual]
244245
theorem sSup_image' {s : Set β} {f : β → α} : sSup (f '' s) = ⨆ a : s, f a := by
245246
rw [iSup, image_eq_range]
246247

@@ -283,11 +284,6 @@ protected theorem Equiv.iInf_congr {g : ι' → α} (e : ι ≃ ι') (h : ∀ x,
283284
⨅ x, f x = ⨅ y, g y :=
284285
@Equiv.iSup_congr αᵒᵈ _ _ _ _ _ e h
285286

286-
@[congr]
287-
theorem iInf_congr_Prop {p q : Prop} {f₁ : p → α} {f₂ : q → α} (pq : p ↔ q)
288-
(f : ∀ x, f₁ (pq.mpr x) = f₂ x) : iInf f₁ = iInf f₂ :=
289-
@iSup_congr_Prop αᵒᵈ _ p q f₁ f₂ pq f
290-
291287
theorem iInf_plift_up (f : PLift ι → α) : ⨅ i, f (PLift.up i) = ⨅ i, f i :=
292288
(PLift.up_surjective.iInf_congr _) fun _ => rfl
293289

@@ -297,9 +293,6 @@ theorem iInf_plift_down (f : ι → α) : ⨅ i, f (PLift.down i) = ⨅ i, f i :
297293
theorem iInf_range' (g : β → α) (f : ι → β) : ⨅ b : range f, g b = ⨅ i, g (f i) :=
298294
@iSup_range' αᵒᵈ _ _ _ _ _
299295

300-
theorem sInf_image' {s : Set β} {f : β → α} : sInf (f '' s) = ⨅ a : s, f a :=
301-
@sSup_image' αᵒᵈ _ _ _ _
302-
303296
end InfSet
304297

305298
section
@@ -1034,13 +1027,10 @@ end le
10341027
### `iSup` and `iInf` under `Type`
10351028
-/
10361029

1037-
1030+
@[to_dual iInf_of_isEmpty]
10381031
theorem iSup_of_empty' {α ι} [SupSet α] [IsEmpty ι] (f : ι → α) : iSup f = sSup (∅ : Set α) :=
10391032
congr_arg sSup (range_eq_empty f)
10401033

1041-
theorem iInf_of_isEmpty {α ι} [InfSet α] [IsEmpty ι] (f : ι → α) : iInf f = sInf (∅ : Set α) :=
1042-
congr_arg sInf (range_eq_empty f)
1043-
10441034
theorem iSup_of_empty [IsEmpty ι] (f : ι → α) : iSup f = ⊥ :=
10451035
(iSup_of_empty' f).trans sSup_empty
10461036

Mathlib/Order/CompletePartialOrder.lean

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Christopher Hoskin
66
module
77

88
public import Mathlib.Order.OmegaCompletePartialOrder
9+
public import Mathlib.Order.ConditionallyCompletePartialOrder.Defs
910

1011
/-!
1112
# Complete Partial Orders
@@ -75,14 +76,20 @@ lemma CompletePartialOrder.scottContinuous {f : α → β} :
7576
open OmegaCompletePartialOrder
7677

7778
/-- A complete partial order is an ω-complete partial order. -/
78-
instance CompletePartialOrder.toOmegaCompletePartialOrder : OmegaCompletePartialOrder α where
79+
instance (priority := 100) CompletePartialOrder.toOmegaCompletePartialOrder :
80+
OmegaCompletePartialOrder α where
7981
ωSup c := ⨆ n, c n
8082
le_ωSup c := c.directed.le_iSup
8183
ωSup_le c _ := c.directed.iSup_le
8284

85+
/-- A complete partial order is an conditionally complete partial order. -/
86+
instance (priority := 100) [CompletePartialOrder α] : ConditionallyCompletePartialOrderSup α where
87+
isLUB_csSup_of_directed _ h_dir _ _ := h_dir.isLUB_sSup
88+
8389
end CompletePartialOrder
8490

8591
/-- A complete lattice is a complete partial order. -/
86-
instance CompleteLattice.toCompletePartialOrder [CompleteLattice α] : CompletePartialOrder α where
92+
instance (priority := 100) CompleteLattice.toCompletePartialOrder [CompleteLattice α] :
93+
CompletePartialOrder α where
8794
sSup := sSup
8895
lubOfDirected _ _ := isLUB_sSup _

Mathlib/Order/ConditionallyCompleteLattice/Basic.lean

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module
77

88
public import Mathlib.Data.Set.Lattice
99
public import Mathlib.Order.ConditionallyCompleteLattice.Defs
10+
public import Mathlib.Order.ConditionallyCompletePartialOrder.Basic
1011

1112
/-!
1213
# Theory of conditionally complete lattices
@@ -224,22 +225,13 @@ theorem isGLB_csInf (ne : s.Nonempty) (H : BddBelow s) : IsGLB s (sInf s) :=
224225
theorem IsLUB.csSup_eq (H : IsLUB s a) (ne : s.Nonempty) : sSup s = a :=
225226
(isLUB_csSup ne ⟨a, H.1⟩).unique H
226227

227-
/-- A greatest element of a set is the supremum of this set. -/
228-
theorem IsGreatest.csSup_eq (H : IsGreatest s a) : sSup s = a :=
229-
H.isLUB.csSup_eq H.nonempty
230-
231-
theorem IsGreatest.csSup_mem (H : IsGreatest s a) : sSup s ∈ s :=
232-
H.csSup_eq.symm ▸ H.1
233-
234228
theorem IsGLB.csInf_eq (H : IsGLB s a) (ne : s.Nonempty) : sInf s = a :=
235229
(isGLB_csInf ne ⟨a, H.1⟩).unique H
236230

237-
/-- A least element of a set is the infimum of this set. -/
238-
theorem IsLeast.csInf_eq (H : IsLeast s a) : sInf s = a :=
239-
H.isGLB.csInf_eq H.nonempty
240-
241-
theorem IsLeast.csInf_mem (H : IsLeast s a) : sInf s ∈ s :=
242-
H.csInf_eq.symm ▸ H.1
231+
instance (priority := 100) ConditionallyCompleteLattice.toConditionallyCompletePartialOrder :
232+
ConditionallyCompletePartialOrder α where
233+
isGLB_csInf_of_directed _ _ non bdd := isGLB_csInf non bdd
234+
isLUB_csSup_of_directed _ _ non bdd := isLUB_csSup non bdd
243235

244236
theorem subset_Icc_csInf_csSup (hb : BddBelow s) (ha : BddAbove s) : s ⊆ Icc (sInf s) (sSup s) :=
245237
fun _ hx => ⟨csInf_le hb hx, le_csSup ha hx⟩
@@ -310,16 +302,6 @@ theorem exists_between_of_forall_le (sne : s.Nonempty) (tne : t.Nonempty)
310302
(hst : ∀ x ∈ s, ∀ y ∈ t, x ≤ y) : (upperBounds s ∩ lowerBounds t).Nonempty :=
311303
⟨sInf t, fun x hx => le_csInf tne <| hst x hx, fun _ hy => csInf_le (sne.mono hst) hy⟩
312304

313-
/-- The supremum of a singleton is the element of the singleton -/
314-
@[simp]
315-
theorem csSup_singleton (a : α) : sSup {a} = a :=
316-
isGreatest_singleton.csSup_eq
317-
318-
/-- The infimum of a singleton is the element of the singleton -/
319-
@[simp]
320-
theorem csInf_singleton (a : α) : sInf {a} = a :=
321-
isLeast_singleton.csInf_eq
322-
323305
theorem csSup_pair (a b : α) : sSup {a, b} = a ⊔ b :=
324306
(@isLUB_pair _ _ a b).csSup_eq (insert_nonempty _ _)
325307

@@ -367,18 +349,6 @@ nonempty and bounded below. -/
367349
theorem csInf_insert (hs : BddBelow s) (sne : s.Nonempty) : sInf (insert a s) = a ⊓ sInf s :=
368350
csSup_insert (α := αᵒᵈ) hs sne
369351

370-
@[simp]
371-
theorem csInf_Icc (h : a ≤ b) : sInf (Icc a b) = a :=
372-
(isGLB_Icc h).csInf_eq (nonempty_Icc.2 h)
373-
374-
@[simp]
375-
theorem csInf_Ici : sInf (Ici a) = a :=
376-
isLeast_Ici.csInf_eq
377-
378-
@[simp]
379-
theorem csInf_Ico (h : a < b) : sInf (Ico a b) = a :=
380-
(isGLB_Ico h).csInf_eq (nonempty_Ico.2 h)
381-
382352
@[simp]
383353
theorem csInf_Ioc [DenselyOrdered α] (h : a < b) : sInf (Ioc a b) = a :=
384354
(isGLB_Ioc h).csInf_eq (nonempty_Ioc.2 h)
@@ -392,27 +362,15 @@ theorem csInf_Ioi [NoMaxOrder α] [DenselyOrdered α] : sInf (Ioi a) = a :=
392362
theorem csInf_Ioo [DenselyOrdered α] (h : a < b) : sInf (Ioo a b) = a :=
393363
(isGLB_Ioo h).csInf_eq (nonempty_Ioo.2 h)
394364

395-
@[simp]
396-
theorem csSup_Icc (h : a ≤ b) : sSup (Icc a b) = b :=
397-
(isLUB_Icc h).csSup_eq (nonempty_Icc.2 h)
398-
399365
@[simp]
400366
theorem csSup_Ico [DenselyOrdered α] (h : a < b) : sSup (Ico a b) = b :=
401367
(isLUB_Ico h).csSup_eq (nonempty_Ico.2 h)
402368

403-
@[simp]
404-
theorem csSup_Iic : sSup (Iic a) = a :=
405-
isGreatest_Iic.csSup_eq
406-
407369
@[simp]
408370
theorem csSup_Iio [NoMinOrder α] [DenselyOrdered α] : sSup (Iio a) = a :=
409371
csSup_eq_of_forall_le_of_forall_lt_exists_gt nonempty_Iio (fun _ => le_of_lt) fun w hw => by
410372
simpa [and_comm] using exists_between hw
411373

412-
@[simp]
413-
theorem csSup_Ioc (h : a < b) : sSup (Ioc a b) = b :=
414-
(isLUB_Ioc h).csSup_eq (nonempty_Ioc.2 h)
415-
416374
@[simp]
417375
theorem csSup_Ioo [DenselyOrdered α] (h : a < b) : sSup (Ioo a b) = b :=
418376
(isLUB_Ioo h).csSup_eq (nonempty_Ioo.2 h)
@@ -424,12 +382,6 @@ theorem csSup_eq_of_is_forall_le_of_forall_le_imp_ge (hs : s.Nonempty) (h_is_ub
424382
(h_b_le_ub : ∀ ub, (∀ a ∈ s, a ≤ ub) → b ≤ ub) : sSup s = b :=
425383
(csSup_le hs h_is_ub).antisymm ((h_b_le_ub _) fun _ => le_csSup ⟨b, h_is_ub⟩)
426384

427-
lemma sup_eq_top_of_top_mem [OrderTop α] (h : ⊤ ∈ s) : sSup s = ⊤ :=
428-
top_unique <| le_csSup (OrderTop.bddAbove s) h
429-
430-
lemma inf_eq_bot_of_bot_mem [OrderBot α] (h : ⊥ ∈ s) : sInf s = ⊥ :=
431-
bot_unique <| csInf_le (OrderBot.bddBelow s) h
432-
433385
end ConditionallyCompleteLattice
434386

435387
instance Pi.conditionallyCompleteLattice {ι : Type*} {α : ι → Type*}

Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Sébastian Gouëzel
66
module
77

88
public import Mathlib.Order.ConditionallyCompleteLattice.Basic
9+
public import Mathlib.Order.ConditionallyCompletePartialOrder.Indexed
910

1011
/-!
1112
# Indexed sup / inf in conditionally complete lattices
@@ -181,68 +182,6 @@ lemma ciInf_le_ciSup [Nonempty ι] {f : ι → α} (hf : BddBelow (range f)) (hf
181182
⨅ i, f i ≤ ⨆ i, f i :=
182183
(ciInf_le hf (Classical.arbitrary _)).trans <| le_ciSup hf' (Classical.arbitrary _)
183184

184-
@[simp]
185-
theorem ciSup_const [hι : Nonempty ι] {a : α} : ⨆ _ : ι, a = a := by
186-
rw [iSup, range_const, csSup_singleton]
187-
188-
@[simp]
189-
theorem ciInf_const [Nonempty ι] {a : α} : ⨅ _ : ι, a = a :=
190-
ciSup_const (α := αᵒᵈ)
191-
192-
@[simp]
193-
theorem ciSup_unique [Unique ι] {s : ι → α} : ⨆ i, s i = s default := by
194-
have : ∀ i, s i = s default := fun i => congr_arg s (Unique.eq_default i)
195-
simp only [this, ciSup_const]
196-
197-
@[simp]
198-
theorem ciInf_unique [Unique ι] {s : ι → α} : ⨅ i, s i = s default :=
199-
ciSup_unique (α := αᵒᵈ)
200-
201-
theorem ciSup_subsingleton [Subsingleton ι] (i : ι) (s : ι → α) : ⨆ i, s i = s i :=
202-
@ciSup_unique α ι _ ⟨⟨i⟩, fun j => Subsingleton.elim j i⟩ _
203-
204-
theorem ciInf_subsingleton [Subsingleton ι] (i : ι) (s : ι → α) : ⨅ i, s i = s i :=
205-
@ciInf_unique α ι _ ⟨⟨i⟩, fun j => Subsingleton.elim j i⟩ _
206-
207-
theorem ciSup_pos {p : Prop} {f : p → α} (hp : p) : ⨆ h : p, f h = f hp := by
208-
simp [hp]
209-
210-
theorem ciInf_pos {p : Prop} {f : p → α} (hp : p) : ⨅ h : p, f h = f hp := by
211-
simp [hp]
212-
213-
lemma ciSup_neg {p : Prop} {f : p → α} (hp : ¬ p) :
214-
⨆ (h : p), f h = sSup (∅ : Set α) := by
215-
rw [iSup]
216-
congr
217-
rwa [range_eq_empty_iff, isEmpty_Prop]
218-
219-
lemma ciInf_neg {p : Prop} {f : p → α} (hp : ¬ p) :
220-
⨅ (h : p), f h = sInf (∅ : Set α) :=
221-
ciSup_neg (α := αᵒᵈ) hp
222-
223-
lemma ciSup_eq_ite {p : Prop} [Decidable p] {f : p → α} :
224-
(⨆ h : p, f h) = if h : p then f h else sSup (∅ : Set α) := by
225-
by_cases H : p <;> simp [ciSup_neg, H]
226-
227-
lemma ciInf_eq_ite {p : Prop} [Decidable p] {f : p → α} :
228-
(⨅ h : p, f h) = if h : p then f h else sInf (∅ : Set α) :=
229-
ciSup_eq_ite (α := αᵒᵈ)
230-
231-
theorem cbiSup_eq_of_forall {p : ι → Prop} {f : Subtype p → α} (hp : ∀ i, p i) :
232-
⨆ (i) (h : p i), f ⟨i, h⟩ = iSup f := by
233-
simp only [hp, ciSup_unique]
234-
simp only [iSup]
235-
congr
236-
apply Subset.antisymm
237-
· rintro - ⟨i, rfl⟩
238-
simp
239-
· rintro - ⟨i, rfl⟩
240-
simp
241-
242-
theorem cbiInf_eq_of_forall {p : ι → Prop} {f : Subtype p → α} (hp : ∀ i, p i) :
243-
⨅ (i) (h : p i), f ⟨i, h⟩ = iInf f :=
244-
cbiSup_eq_of_forall (α := αᵒᵈ) hp
245-
246185
/-- Introduction rule to prove that `b` is the supremum of `f`: it suffices to check that `b`
247186
is larger than `f i` for all `i`, and that this is not the case of any `w<b`.
248187
See `iSup_eq_of_forall_le_of_forall_lt_exists_gt` for a version in complete lattices. -/
@@ -258,24 +197,6 @@ theorem ciInf_eq_of_forall_ge_of_forall_gt_exists_lt [Nonempty ι] {f : ι →
258197
(h₂ : ∀ w, b < w → ∃ i, f i < w) : ⨅ i : ι, f i = b :=
259198
ciSup_eq_of_forall_le_of_forall_lt_exists_gt (α := αᵒᵈ) h₁ h₂
260199

261-
/-- **Nested intervals lemma**: if `f` is a monotone sequence, `g` is an antitone sequence, and
262-
`f n ≤ g n` for all `n`, then `⨆ n, f n` belongs to all the intervals `[f n, g n]`. -/
263-
theorem Monotone.ciSup_mem_iInter_Icc_of_antitone [SemilatticeSup β] {f g : β → α} (hf : Monotone f)
264-
(hg : Antitone g) (h : f ≤ g) : (⨆ n, f n) ∈ ⋂ n, Icc (f n) (g n) := by
265-
refine mem_iInter.2 fun n => ?_
266-
haveI : Nonempty β := ⟨n⟩
267-
have : ∀ m, f m ≤ g n := fun m => hf.forall_le_of_antitone hg h m n
268-
exact ⟨le_ciSup ⟨g <| n, forall_mem_range.2 this⟩ _, ciSup_le this⟩
269-
270-
/-- Nested intervals lemma: if `[f n, g n]` is an antitone sequence of nonempty
271-
closed intervals, then `⨆ n, f n` belongs to all the intervals `[f n, g n]`. -/
272-
theorem ciSup_mem_iInter_Icc_of_antitone_Icc [SemilatticeSup β] {f g : β → α}
273-
(h : Antitone fun n => Icc (f n) (g n)) (h' : ∀ n, f n ≤ g n) :
274-
(⨆ n, f n) ∈ ⋂ n, Icc (f n) (g n) :=
275-
Monotone.ciSup_mem_iInter_Icc_of_antitone
276-
(fun _ n hmn => ((Icc_subset_Icc_iff (h' n)).1 (h hmn)).1)
277-
(fun _ n hmn => ((Icc_subset_Icc_iff (h' n)).1 (h hmn)).2) h'
278-
279200
lemma Set.Iic_ciInf [Nonempty ι] {f : ι → α} (hf : BddBelow (range f)) :
280201
Iic (⨅ i, f i) = ⋂ i, Iic (f i) := by
281202
ext
@@ -285,22 +206,6 @@ lemma Set.Ici_ciSup [Nonempty ι] {f : ι → α} (hf : BddAbove (range f)) :
285206
Ici (⨆ i, f i) = ⋂ i, Ici (f i) :=
286207
Iic_ciInf (α := αᵒᵈ) hf
287208

288-
theorem ciSup_Iic [Preorder β] {f : β → α} (a : β) (hf : Monotone f) :
289-
⨆ x : Iic a, f x = f a := by
290-
have H : BddAbove (range fun x : Iic a ↦ f x) := ⟨f a, fun _ ↦ by aesop⟩
291-
apply (le_ciSup H (⟨a, le_refl a⟩ : Iic a)).antisymm'
292-
rw [ciSup_le_iff H]
293-
rintro ⟨a, h⟩
294-
exact hf h
295-
296-
theorem ciInf_Ici [Preorder β] {f : β → α} (a : β) (hf : Monotone f) :
297-
⨅ x : Ici a, f x = f a := by
298-
have H : BddBelow (range fun x : Ici a ↦ f x) := ⟨f a, fun _ ↦ by aesop⟩
299-
apply (ciInf_le H (⟨a, le_refl a⟩ : Ici a)).antisymm
300-
rw [le_ciInf_iff H]
301-
rintro ⟨a, h⟩
302-
exact hf h
303-
304209
theorem ciSup_subtype [Nonempty ι] {p : ι → Prop} [Nonempty (Subtype p)] {f : Subtype p → α}
305210
(hf : BddAbove (Set.range f)) (hf' : sSup ∅ ≤ iSup f) :
306211
iSup f = ⨆ (i) (h : p i), f ⟨i, h⟩ := by

0 commit comments

Comments
 (0)