@@ -37,6 +37,92 @@ open Function OrderDual Set
3737
3838variable {α β γ : Type *} {ι : Sort *}
3939
40+ section
41+
42+ /-!
43+ Extension of `sSup` and `sInf` from a preorder `α` to `WithTop α` and `WithBot α`
44+ -/
45+
46+ variable [Preorder α]
47+
48+ open Classical in
49+ noncomputable instance WithTop.instSupSet [SupSet α] :
50+ SupSet (WithTop α) :=
51+ ⟨fun S =>
52+ if ⊤ ∈ S then ⊤ else if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then
53+ ↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩
54+
55+ open Classical in
56+ noncomputable instance WithTop.instInfSet [InfSet α] : InfSet (WithTop α) :=
57+ ⟨fun S => if S ⊆ {⊤} ∨ ¬BddBelow S then ⊤ else ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩
58+
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+
66+ theorem WithTop.sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s)
67+ (hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
68+ (if_neg hs).trans <| if_pos hs'
69+
70+ theorem WithTop.sInf_eq [InfSet α] {s : Set (WithTop α)} (hs : ¬s ⊆ {⊤}) (h's : BddBelow s) :
71+ sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
72+ if_neg <| by simp [hs, h's]
73+
74+ theorem WithBot.sInf_eq [InfSet α] {s : Set (WithBot α)} (hs : ⊥ ∉ s)
75+ (hs' : BddBelow ((↑) ⁻¹' s : Set α)) : sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
76+ (if_neg hs).trans <| if_pos hs'
77+
78+ theorem WithBot.sSup_eq [SupSet α] {s : Set (WithBot α)} (hs : ¬s ⊆ {⊥}) (h's : BddAbove s) :
79+ sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
80+ WithTop.sInf_eq (α := αᵒᵈ) hs h's
81+
82+ @[simp]
83+ theorem WithTop.sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ :=
84+ if_pos <| by simp
85+
86+ theorem WithTop.coe_sInf' [InfSet α] {s : Set α} (hs : s.Nonempty) (h's : BddBelow s) :
87+ ↑(sInf s) = (sInf ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
88+ classical
89+ obtain ⟨x, hx⟩ := hs
90+ change _ = ite _ _ _
91+ split_ifs with h
92+ · rcases h with h1 | h2
93+ · cases h1 (mem_image_of_mem _ hx)
94+ · exact (h2 (Monotone.map_bddBelow coe_mono h's)).elim
95+ · rw [preimage_image_eq]
96+ exact Option.some_injective _
97+
98+ theorem WithTop.coe_sSup' [SupSet α] {s : Set α} (hs : BddAbove s) :
99+ ↑(sSup s) = (sSup ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
100+ classical
101+ change _ = ite _ _ _
102+ rw [if_neg, preimage_image_eq, if_pos hs]
103+ · exact Option.some_injective _
104+ · rintro ⟨x, _, ⟨⟩⟩
105+
106+ @[simp]
107+ theorem WithBot.sSup_empty [SupSet α] : sSup (∅ : Set (WithBot α)) = ⊥ :=
108+ WithTop.sInf_empty (α := αᵒᵈ)
109+
110+ theorem WithBot.sInf_empty (α : Type *) [CompleteLattice α] : (sInf ∅ : WithBot α) = ⊤ := by
111+ rw [WithBot.sInf_eq (by simp) (OrderBot.bddBelow _), Set.preimage_empty, _root_.sInf_empty,
112+ WithBot.coe_top]
113+
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+
124+ end
125+
40126instance ConditionallyCompleteLinearOrder.toLinearOrder [h : ConditionallyCompleteLinearOrder α] :
41127 LinearOrder α where
42128 min_def a b := by
0 commit comments