@@ -201,6 +201,10 @@ class ConditionallyCompleteLinearOrder (α : Type*) extends ConditionallyComplet
201201 /-- In a `ConditionallyCompleteLinearOrder`, we assume the order relations are all decidable. -/
202202 decidableLT : DecidableRel (· < · : α → α → Prop ) :=
203203 @decidableLTOfDecidableLE _ _ decidableLE
204+ /-- If a set is not bounded above, its supremum is by convention `Sup univ`. -/
205+ csSup_of_not_bddAbove : ∀ s, ¬BddAbove s → sSup s = sSup (univ : Set α)
206+ /-- If a set is not bounded below, its infimum is by convention `Inf univ`. -/
207+ csInf_of_not_bddBelow : ∀ s, ¬BddBelow s → sInf s = sInf (univ : Set α)
204208#align conditionally_complete_linear_order ConditionallyCompleteLinearOrder
205209
206210instance (α : Type *) [ConditionallyCompleteLinearOrder α] : LinearOrder α :=
@@ -256,7 +260,10 @@ instance (priority := 100) CompleteLattice.toConditionallyCompleteLattice [Compl
256260-- see Note [lower instance priority]
257261instance (priority := 100 ) CompleteLinearOrder.toConditionallyCompleteLinearOrderBot {α : Type *}
258262 [h : CompleteLinearOrder α] : ConditionallyCompleteLinearOrderBot α :=
259- { CompleteLattice.toConditionallyCompleteLattice, h with csSup_empty := sSup_empty }
263+ { CompleteLattice.toConditionallyCompleteLattice, h with
264+ csSup_empty := sSup_empty
265+ csSup_of_not_bddAbove := fun s H ↦ (H (OrderTop.bddAbove s)).elim
266+ csInf_of_not_bddBelow := fun s H ↦ (H (OrderBot.bddBelow s)).elim }
260267#align complete_linear_order.to_conditionally_complete_linear_order_bot CompleteLinearOrder.toConditionallyCompleteLinearOrderBot
261268
262269section
@@ -285,7 +292,15 @@ noncomputable def IsWellOrder.conditionallyCompleteLinearOrderBot (α : Type*)
285292 have h's : (upperBounds s).Nonempty := ⟨a, has⟩
286293 simp only [h's, dif_pos]
287294 simpa using h.wf.not_lt_min _ h's has
288- csSup_empty := by simpa using eq_bot_iff.2 (not_lt.1 <| h.wf.not_lt_min _ _ <| mem_univ ⊥) }
295+ csSup_empty := by simpa using eq_bot_iff.2 (not_lt.1 <| h.wf.not_lt_min _ _ <| mem_univ ⊥)
296+ csSup_of_not_bddAbove := by
297+ intro s H
298+ have A : ¬(BddAbove (univ : Set α)) := by
299+ contrapose! H; exact H.mono (subset_univ _)
300+ have B : ¬((upperBounds s).Nonempty) := H
301+ have C : ¬((upperBounds (univ : Set α)).Nonempty) := A
302+ simp [sSup, B, C]
303+ csInf_of_not_bddBelow := fun s H ↦ (H (OrderBot.bddBelow s)).elim }
289304#align is_well_order.conditionally_complete_linear_order_bot IsWellOrder.conditionallyCompleteLinearOrderBot
290305
291306end
@@ -301,7 +316,9 @@ instance instConditionallyCompleteLatticeOrderDual (α : Type*) [ConditionallyCo
301316 csInf_le := @ConditionallyCompleteLattice.le_csSup α _ }
302317
303318instance (α : Type *) [ConditionallyCompleteLinearOrder α] : ConditionallyCompleteLinearOrder αᵒᵈ :=
304- { instConditionallyCompleteLatticeOrderDual α, OrderDual.instLinearOrder α with }
319+ { instConditionallyCompleteLatticeOrderDual α, OrderDual.instLinearOrder α with
320+ csSup_of_not_bddAbove := @ConditionallyCompleteLinearOrder.csInf_of_not_bddBelow α _
321+ csInf_of_not_bddBelow := @ConditionallyCompleteLinearOrder.csSup_of_not_bddAbove α _ }
305322
306323end OrderDual
307324
@@ -961,6 +978,52 @@ theorem exists_lt_of_ciInf_lt [Nonempty ι] {f : ι → α} (h : iInf f < a) :
961978 @exists_lt_of_lt_ciSup αᵒᵈ _ _ _ _ _ h
962979#align exists_lt_of_cinfi_lt exists_lt_of_ciInf_lt
963980
981+ theorem csSup_of_not_bddAbove {s : Set α} (hs : ¬BddAbove s) : sSup s = sSup univ :=
982+ ConditionallyCompleteLinearOrder.csSup_of_not_bddAbove s hs
983+
984+ theorem csInf_of_not_bddBelow {s : Set α} (hs : ¬BddBelow s) : sInf s = sInf univ :=
985+ ConditionallyCompleteLinearOrder.csInf_of_not_bddBelow s hs
986+
987+ /-- When every element of a set `s` is bounded by an element of a set `t`, and conversely, then
988+ `s` and `t` have the same supremum. This holds even when the sets may be empty or unbounded. -/
989+ theorem csSup_eq_csSup_of_forall_exists_le {s t : Set α}
990+ (hs : ∀ x ∈ s, ∃ y ∈ t, x ≤ y) (ht : ∀ y ∈ t, ∃ x ∈ s, y ≤ x) :
991+ sSup s = sSup t := by
992+ rcases eq_empty_or_nonempty s with rfl|s_ne
993+ · have : t = ∅ := eq_empty_of_forall_not_mem (fun y yt ↦ by simpa using ht y yt)
994+ rw [this]
995+ rcases eq_empty_or_nonempty t with rfl|t_ne
996+ · have : s = ∅ := eq_empty_of_forall_not_mem (fun x xs ↦ by simpa using hs x xs)
997+ rw [this]
998+ by_cases B : BddAbove s ∨ BddAbove t
999+ · have Bs : BddAbove s := by
1000+ rcases B with hB|⟨b, hb⟩
1001+ · exact hB
1002+ · refine ⟨b, fun x hx ↦ ?_⟩
1003+ rcases hs x hx with ⟨y, hy, hxy⟩
1004+ exact hxy.trans (hb hy)
1005+ have Bt : BddAbove t := by
1006+ rcases B with ⟨b, hb⟩|hB
1007+ · refine ⟨b, fun y hy ↦ ?_⟩
1008+ rcases ht y hy with ⟨x, hx, hyx⟩
1009+ exact hyx.trans (hb hx)
1010+ · exact hB
1011+ apply le_antisymm
1012+ · apply csSup_le s_ne (fun x hx ↦ ?_)
1013+ rcases hs x hx with ⟨y, yt, hxy⟩
1014+ exact hxy.trans (le_csSup Bt yt)
1015+ · apply csSup_le t_ne (fun y hy ↦ ?_)
1016+ rcases ht y hy with ⟨x, xs, hyx⟩
1017+ exact hyx.trans (le_csSup Bs xs)
1018+ · simp [csSup_of_not_bddAbove, (not_or.1 B).1 , (not_or.1 B).2 ]
1019+
1020+ /-- When every element of a set `s` is bounded by an element of a set `t`, and conversely, then
1021+ `s` and `t` have the same supremum. This holds even when the sets may be empty or unbounded. -/
1022+ theorem csInf_eq_csInf_of_forall_exists_le {s t : Set α}
1023+ (hs : ∀ x ∈ s, ∃ y ∈ t, y ≤ x) (ht : ∀ y ∈ t, ∃ x ∈ s, x ≤ y) :
1024+ sInf s = sInf t :=
1025+ @csSup_eq_csSup_of_forall_exists_le αᵒᵈ _ s t hs ht
1026+
9641027open Function
9651028
9661029variable [IsWellOrder α (· < ·)]
0 commit comments