Skip to content

Commit 4ff10ea

Browse files
committed
chore: dualize ConditionallyCompleteLattice/Indexed
1 parent 0d43c25 commit 4ff10ea

2 files changed

Lines changed: 55 additions & 153 deletions

File tree

Mathlib/Order/ConditionallyCompleteLattice/Basic.lean

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,18 @@ Extension of `sSup` and `sInf` from a preorder `α` to `WithTop α` and `WithBot
4646
variable [Preorder α]
4747

4848
open Classical in
49+
@[to_dual]
4950
noncomputable instance WithTop.instSupSet [SupSet α] :
5051
SupSet (WithTop α) :=
5152
fun S =>
5253
if ⊤ ∈ S thenelse if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then
5354
↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩
5455

5556
open Classical in
57+
@[to_dual]
5658
noncomputable instance WithTop.instInfSet [InfSet α] : InfSet (WithTop α) :=
5759
fun S => if S ⊆ {⊤} ∨ ¬BddBelow S thenelse ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩
5860

59-
noncomputable instance WithBot.instSupSet [SupSet α] : SupSet (WithBot α) :=
60-
⟨(WithTop.instInfSet (α := αᵒᵈ)).sInf⟩
61-
62-
noncomputable instance WithBot.instInfSet [InfSet α] :
63-
InfSet (WithBot α) :=
64-
⟨(WithTop.instSupSet (α := αᵒᵈ)).sSup⟩
65-
6661
theorem WithTop.sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s)
6762
(hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
6863
(if_neg hs).trans <| if_pos hs'
@@ -79,10 +74,11 @@ theorem WithBot.sSup_eq [SupSet α] {s : Set (WithBot α)} (hs : ¬s ⊆ {⊥})
7974
sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
8075
WithTop.sInf_eq (α := αᵒᵈ) hs h's
8176

82-
@[simp]
77+
@[to_dual (attr := simp)]
8378
theorem WithTop.sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ :=
8479
if_pos <| by simp
8580

81+
@[to_dual (attr := norm_cast)]
8682
theorem WithTop.coe_sInf' [InfSet α] {s : Set α} (hs : s.Nonempty) (h's : BddBelow s) :
8783
↑(sInf s) = (sInf ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
8884
classical
@@ -95,6 +91,7 @@ theorem WithTop.coe_sInf' [InfSet α] {s : Set α} (hs : s.Nonempty) (h's : BddB
9591
· rw [preimage_image_eq]
9692
exact Option.some_injective _
9793

94+
@[to_dual (attr := norm_cast)]
9895
theorem WithTop.coe_sSup' [SupSet α] {s : Set α} (hs : BddAbove s) :
9996
↑(sSup s) = (sSup ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
10097
classical
@@ -103,24 +100,10 @@ theorem WithTop.coe_sSup' [SupSet α] {s : Set α} (hs : BddAbove s) :
103100
· exact Option.some_injective _
104101
· rintro ⟨x, _, ⟨⟩⟩
105102

106-
@[simp]
107-
theorem WithBot.sSup_empty [SupSet α] : sSup (∅ : Set (WithBot α)) = ⊥ :=
108-
WithTop.sInf_empty (α := αᵒᵈ)
109-
110103
theorem WithBot.sInf_empty (α : Type*) [CompleteLattice α] : (sInf ∅ : WithBot α) = ⊤ := by
111104
rw [WithBot.sInf_eq (by simp) (OrderBot.bddBelow _), Set.preimage_empty, _root_.sInf_empty,
112105
WithBot.coe_top]
113106

114-
@[norm_cast]
115-
theorem WithBot.coe_sSup' [SupSet α] {s : Set α} (hs : s.Nonempty) (h's : BddAbove s) :
116-
↑(sSup s) = (sSup ((fun (a : α) ↦ ↑a) '' s) : WithBot α) :=
117-
WithTop.coe_sInf' (α := αᵒᵈ) hs h's
118-
119-
@[norm_cast]
120-
theorem WithBot.coe_sInf' [InfSet α] {s : Set α} (hs : BddBelow s) :
121-
↑(sInf s) = (sInf ((fun (a : α) ↦ ↑a) '' s) : WithBot α) :=
122-
WithTop.coe_sSup' (α := αᵒᵈ) hs
123-
124107
end
125108

126109
instance ConditionallyCompleteLinearOrder.toLinearOrder [h : ConditionallyCompleteLinearOrder α] :
@@ -253,19 +236,16 @@ theorem notMem_of_csSup_lt {x : α} {s : Set α} (h : sSup s < x) (hs : BddAbove
253236
/-- Introduction rule to prove that `b` is the supremum of `s`: it suffices to check that `b`
254237
is larger than all elements of `s`, and that this is not the case of any `w<b`.
255238
See `sSup_eq_of_forall_le_of_forall_lt_exists_gt` for a version in complete lattices. -/
239+
@[to_dual csInf_eq_of_forall_ge_of_forall_gt_exists_lt /-- Introduction rule to prove that `b` is
240+
the infimum of `s`: it suffices to check that `b` is smaller than all elements of `s`, and that this
241+
is not the case of any `w>b`. See `sInf_eq_of_forall_ge_of_forall_gt_exists_lt` for a version in
242+
complete lattices. -/]
256243
theorem csSup_eq_of_forall_le_of_forall_lt_exists_gt (hs : s.Nonempty) (H : ∀ a ∈ s, a ≤ b)
257244
(H' : ∀ w, w < b → ∃ a ∈ s, w < a) : sSup s = b :=
258245
(eq_of_le_of_not_lt (csSup_le hs H)) fun hb =>
259246
let ⟨_, ha, ha'⟩ := H' _ hb
260247
lt_irrefl _ <| ha'.trans_le <| le_csSup ⟨b, H⟩ ha
261248

262-
/-- Introduction rule to prove that `b` is the infimum of `s`: it suffices to check that `b`
263-
is smaller than all elements of `s`, and that this is not the case of any `w>b`.
264-
See `sInf_eq_of_forall_ge_of_forall_gt_exists_lt` for a version in complete lattices. -/
265-
theorem csInf_eq_of_forall_ge_of_forall_gt_exists_lt :
266-
s.Nonempty → (∀ a ∈ s, b ≤ a) → (∀ w, b < w → ∃ a ∈ s, a < w) → sInf s = b :=
267-
csSup_eq_of_forall_le_of_forall_lt_exists_gt (α := αᵒᵈ)
268-
269249
/-- `b < sSup s` when there is an element `a` in `s` with `b < a`, when `s` is bounded above.
270250
This is essentially an iff, except that the assumptions for the two implications are
271251
slightly different (one needs boundedness above for one direction, nonemptiness and linear
@@ -390,21 +370,16 @@ variable [ConditionallyCompleteLinearOrder α] {f : ι → α} {s : Set α} {a b
390370

391371
/-- When `b < sSup s`, there is an element `a` in `s` with `b < a`, if `s` is nonempty and the order
392372
is a linear order. -/
373+
@[to_dual exists_lt_of_csInf_lt /-- When `sInf s < b`, there is an element `a` in `s` with `a < b`,
374+
if `s` is nonempty and the order is a linear order. -/]
393375
theorem exists_lt_of_lt_csSup (hs : s.Nonempty) (hb : b < sSup s) : ∃ a ∈ s, b < a := by
394376
contrapose! hb
395377
exact csSup_le hs hb
396378

397-
/-- When `sInf s < b`, there is an element `a` in `s` with `a < b`, if `s` is nonempty and the order
398-
is a linear order. -/
399-
theorem exists_lt_of_csInf_lt (hs : s.Nonempty) (hb : sInf s < b) : ∃ a ∈ s, a < b :=
400-
exists_lt_of_lt_csSup (α := αᵒᵈ) hs hb
401-
379+
@[to_dual csInf_lt_iff]
402380
theorem lt_csSup_iff (hb : BddAbove s) (hs : s.Nonempty) : a < sSup s ↔ ∃ b ∈ s, a < b :=
403381
lt_isLUB_iff <| isLUB_csSup hs hb
404382

405-
theorem csInf_lt_iff (hb : BddBelow s) (hs : s.Nonempty) : sInf s < a ↔ ∃ b ∈ s, b < a :=
406-
isGLB_lt_iff <| isGLB_csInf hs hb
407-
408383
@[simp] lemma csSup_of_not_bddAbove (hs : ¬BddAbove s) : sSup s = sSup ∅ :=
409384
ConditionallyCompleteLinearOrder.csSup_of_not_bddAbove s hs
410385

0 commit comments

Comments
 (0)