Skip to content

Commit 672bcd9

Browse files
committed
chore: dualize ConditionallyCompleteLattice/Indexed
1 parent 0d43c25 commit 672bcd9

2 files changed

Lines changed: 29 additions & 61 deletions

File tree

Mathlib/Order/ConditionallyCompleteLattice/Basic.lean

Lines changed: 5 additions & 22 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 α] :

Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,22 @@ Extension of `iSup` and `iInf` from a preorder `α` to `WithTop α` and `WithBot
3333

3434
variable [Preorder α]
3535

36-
@[simp]
36+
@[to_dual (attr := simp)]
3737
theorem WithTop.iInf_empty [IsEmpty ι] [InfSet α] (f : ι → WithTop α) :
3838
⨅ i, f i = ⊤ := by rw [iInf, range_eq_empty, WithTop.sInf_empty]
3939

40-
@[norm_cast]
40+
@[to_dual (attr := norm_cast)]
4141
theorem WithTop.coe_iInf [Nonempty ι] [InfSet α] {f : ι → α} (hf : BddBelow (range f)) :
4242
↑(⨅ i, f i) = (⨅ i, f i : WithTop α) := by
4343
rw [iInf, iInf, WithTop.coe_sInf' (range_nonempty f) hf, ← range_comp, Function.comp_def]
4444

45-
@[norm_cast]
45+
set_option pp.explicit true in
46+
@[to_dual (attr := norm_cast)]
4647
theorem WithTop.coe_iSup [SupSet α] (f : ι → α) (h : BddAbove (Set.range f)) :
4748
↑(⨆ i, f i) = (⨆ i, f i : WithTop α) := by
4849
rw [iSup, iSup, WithTop.coe_sSup' h, ← range_comp, Function.comp_def]
4950

50-
@[simp]
51-
theorem WithBot.ciSup_empty [IsEmpty ι] [SupSet α] (f : ι → WithBot α) :
52-
⨆ i, f i = ⊥ :=
53-
WithTop.iInf_empty (α := αᵒᵈ) _
54-
55-
@[norm_cast]
56-
theorem WithBot.coe_iSup [Nonempty ι] [SupSet α] {f : ι → α} (hf : BddAbove (range f)) :
57-
↑(⨆ i, f i) = (⨆ i, f i : WithBot α) :=
58-
WithTop.coe_iInf (α := αᵒᵈ) hf
51+
@[deprecated (since := "2026-05-04")] alias WithBot.ciSup_empty := WithBot.iSup_empty
5952

6053
theorem WithBot.coe_biSup {ι : Type*} {s : Set ι} (hs : s.Nonempty)
6154
{α : Type*} [CompleteLattice α] (f : ι → α) :
@@ -69,10 +62,11 @@ theorem WithBot.coe_biSup {ι : Type*} {s : Set ι} (hs : s.Nonempty)
6962
· simpa only [iSup_pos h] using by apply le_biSup _ h
7063
· simpa only [iSup_neg h] using le_trans (by simp) (le_biSup _ hj)
7164

72-
@[norm_cast]
73-
theorem WithBot.coe_iInf [InfSet α] (f : ι → α) (h : BddBelow (Set.range f)) :
74-
↑(⨅ i, f i) = (⨅ i, f i : WithBot α) :=
75-
WithTop.coe_iSup (α := αᵒᵈ) _ h
65+
@[to_dual existing]
66+
theorem WithTop.coe_biInf {ι : Type*} {s : Set ι} (hs : s.Nonempty)
67+
{α : Type*} [CompleteLattice α] (f : ι → α) :
68+
⨅ i ∈ s, f i = ⨅ i ∈ s, (f i : WithTop α) :=
69+
WithBot.coe_biSup (α := αᵒᵈ) hs f
7670

7771
theorem WithBot.coe_biInf {ι : Type*} {s : Set ι} {α : Type*} [CompleteLattice α] (f : ι → α) :
7872
⨅ i ∈ s, f i = ⨅ i ∈ s, (f i : WithBot α) := by
@@ -82,59 +76,47 @@ theorem WithBot.coe_biInf {ι : Type*} {s : Set ι} {α : Type*} [CompleteLattic
8276
· simpa only [iInf_pos h] using by apply biInf_le _ h
8377
· simp [iInf_neg h]
8478

79+
@[to_dual existing]
80+
theorem WithTop.coe_biSup {ι : Type*} {s : Set ι} {α : Type*} [CompleteLattice α] (f : ι → α) :
81+
⨆ i ∈ s, f i = ⨆ i ∈ s, (f i : WithTop α) :=
82+
WithBot.coe_biInf (α := αᵒᵈ) f
83+
8584
end
8685

8786
section ConditionallyCompleteLattice
8887

8988
variable [ConditionallyCompleteLattice α] {a b : α}
9089

90+
@[to_dual]
9191
theorem isLUB_ciSup [Nonempty ι] {f : ι → α} (H : BddAbove (range f)) :
9292
IsLUB (range f) (⨆ i, f i) :=
9393
isLUB_csSup (range_nonempty f) H
9494

95+
@[to_dual]
9596
theorem isLUB_ciSup_set {f : β → α} {s : Set β} (H : BddAbove (f '' s)) (Hne : s.Nonempty) :
9697
IsLUB (f '' s) (⨆ i : s, f i) := by
9798
rw [← sSup_image']
9899
exact isLUB_csSup (Hne.image _) H
99100

100-
theorem isGLB_ciInf [Nonempty ι] {f : ι → α} (H : BddBelow (range f)) :
101-
IsGLB (range f) (⨅ i, f i) :=
102-
isGLB_csInf (range_nonempty f) H
103-
104-
theorem isGLB_ciInf_set {f : β → α} {s : Set β} (H : BddBelow (f '' s)) (Hne : s.Nonempty) :
105-
IsGLB (f '' s) (⨅ i : s, f i) :=
106-
isLUB_ciSup_set (α := αᵒᵈ) H Hne
107-
101+
@[to_dual le_ciInf_iff]
108102
theorem ciSup_le_iff [Nonempty ι] {f : ι → α} {a : α} (hf : BddAbove (range f)) :
109103
iSup f ≤ a ↔ ∀ i, f i ≤ a :=
110104
(isLUB_le_iff <| isLUB_ciSup hf).trans forall_mem_range
111105

112-
theorem le_ciInf_iff [Nonempty ι] {f : ι → α} {a : α} (hf : BddBelow (range f)) :
113-
a ≤ iInf f ↔ ∀ i, a ≤ f i :=
114-
(le_isGLB_iff <| isGLB_ciInf hf).trans forall_mem_range
115-
106+
@[to_dual le_ciInf_set_iff]
116107
theorem ciSup_set_le_iff {ι : Type*} {s : Set ι} {f : ι → α} {a : α} (hs : s.Nonempty)
117108
(hf : BddAbove (f '' s)) : ⨆ i : s, f i ≤ a ↔ ∀ i ∈ s, f i ≤ a :=
118109
(isLUB_le_iff <| isLUB_ciSup_set hf hs).trans forall_mem_image
119110

120-
theorem le_ciInf_set_iff {ι : Type*} {s : Set ι} {f : ι → α} {a : α} (hs : s.Nonempty)
121-
(hf : BddBelow (f '' s)) : (a ≤ ⨅ i : s, f i) ↔ ∀ i ∈ s, a ≤ f i :=
122-
(le_isGLB_iff <| isGLB_ciInf_set hf hs).trans forall_mem_image
123-
111+
@[to_dual]
124112
theorem IsLUB.ciSup_eq [Nonempty ι] {f : ι → α} (H : IsLUB (range f) a) : ⨆ i, f i = a :=
125113
H.csSup_eq (range_nonempty f)
126114

115+
@[to_dual]
127116
theorem IsLUB.ciSup_set_eq {s : Set β} {f : β → α} (H : IsLUB (f '' s) a) (Hne : s.Nonempty) :
128117
⨆ i : s, f i = a :=
129118
IsLUB.csSup_eq (image_eq_range f s ▸ H) (image_eq_range f s ▸ Hne.image f)
130119

131-
theorem IsGLB.ciInf_eq [Nonempty ι] {f : ι → α} (H : IsGLB (range f) a) : ⨅ i, f i = a :=
132-
H.csInf_eq (range_nonempty f)
133-
134-
theorem IsGLB.ciInf_set_eq {s : Set β} {f : β → α} (H : IsGLB (f '' s) a) (Hne : s.Nonempty) :
135-
⨅ i : s, f i = a :=
136-
IsGLB.csInf_eq (image_eq_range f s ▸ H) (image_eq_range f s ▸ Hne.image f)
137-
138120
/-- The indexed supremum of a function is bounded above by a uniform bound -/
139121
@[to_dual le_ciInf /-- The indexed minimum of a function is bounded below by a uniform
140122
lower bound -/]
@@ -147,9 +129,12 @@ theorem ciSup₂_le [Nonempty ι] [∀ i, Nonempty (κ i)] {f : ∀ i, κ i →
147129
ciSup_le fun i ↦ ciSup_le <| h i
148130

149131
/-- The indexed supremum of a function is bounded below by the value taken at one point -/
132+
@[to_dual ciInf_le /-- The indexed infimum of a function is bounded above by the value taken at one
133+
point -/]
150134
theorem le_ciSup {f : ι → α} (H : BddAbove (range f)) (c : ι) : f c ≤ iSup f :=
151135
le_csSup H (mem_range_self _)
152136

137+
@[to_dual ciInf_le_of_le]
153138
theorem le_ciSup_of_le {f : ι → α} (H : BddAbove (range f)) (c : ι) (h : a ≤ f c) : a ≤ iSup f :=
154139
le_trans h (le_ciSup H c)
155140

0 commit comments

Comments
 (0)