Skip to content

Commit 6225383

Browse files
committed
feat: generalize NoMaxOrder to NoTopOrder (#24203)
Generalizes `NoMaxOrder` to `NoTopOrder` and `NoMinOrder` to `NoBotOrder` in some lemmas.
1 parent a6a1efc commit 6225383

File tree

6 files changed

+54
-44
lines changed

6 files changed

+54
-44
lines changed

Mathlib/Order/Bounds/Basic.lean

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -649,20 +649,25 @@ theorem isGLB_univ [OrderBot α] : IsGLB (univ : Set α) ⊥ :=
649649
isLeast_univ.isGLB
650650

651651
@[simp]
652-
theorem NoMaxOrder.upperBounds_univ [NoMaxOrder α] : upperBounds (univ : Set α) = ∅ :=
652+
theorem NoTopOrder.upperBounds_univ [NoTopOrder α] : upperBounds (univ : Set α) = ∅ :=
653653
eq_empty_of_subset_empty fun b hb =>
654-
let ⟨_, hx⟩ := exists_gt b
655-
not_le_of_lt hx (hb trivial)
654+
not_isTop b fun x => hb (mem_univ x)
655+
656+
@[deprecated (since := "2025-04-18")]
657+
alias NoMaxOrder.upperBounds_univ := NoTopOrder.upperBounds_univ
656658

657659
@[simp]
658-
theorem NoMinOrder.lowerBounds_univ [NoMinOrder α] : lowerBounds (univ : Set α) = ∅ :=
659-
@NoMaxOrder.upperBounds_univ αᵒᵈ _ _
660+
theorem NoBotOrder.lowerBounds_univ [NoBotOrder α] : lowerBounds (univ : Set α) = ∅ :=
661+
@NoTopOrder.upperBounds_univ αᵒᵈ _ _
662+
663+
@[deprecated (since := "2025-04-18")]
664+
alias NoMinOrder.lowerBounds_univ := NoBotOrder.lowerBounds_univ
660665

661666
@[simp]
662-
theorem not_bddAbove_univ [NoMaxOrder α] : ¬BddAbove (univ : Set α) := by simp [BddAbove]
667+
theorem not_bddAbove_univ [NoTopOrder α] : ¬BddAbove (univ : Set α) := by simp [BddAbove]
663668

664669
@[simp]
665-
theorem not_bddBelow_univ [NoMinOrder α] : ¬BddBelow (univ : Set α) :=
670+
theorem not_bddBelow_univ [NoBotOrder α] : ¬BddBelow (univ : Set α) :=
666671
@not_bddAbove_univ αᵒᵈ _ _
667672

668673
/-!
@@ -698,12 +703,11 @@ theorem isGLB_empty [OrderTop α] : IsGLB ∅ (⊤ : α) :=
698703
theorem isLUB_empty [OrderBot α] : IsLUB ∅ (⊥ : α) :=
699704
@isGLB_empty αᵒᵈ _ _
700705

701-
theorem IsLUB.nonempty [NoMinOrder α] (hs : IsLUB s a) : s.Nonempty :=
702-
let ⟨a', ha'⟩ := exists_lt a
706+
theorem IsLUB.nonempty [NoBotOrder α] (hs : IsLUB s a) : s.Nonempty :=
703707
nonempty_iff_ne_empty.2 fun h =>
704-
not_le_of_lt ha' <| hs.right <| by rw [h, upperBounds_empty]; exact mem_univ _
708+
not_isBot a fun _ => hs.right <| by rw [h, upperBounds_empty]; exact mem_univ _
705709

706-
theorem IsGLB.nonempty [NoMaxOrder α] (hs : IsGLB s a) : s.Nonempty :=
710+
theorem IsGLB.nonempty [NoTopOrder α] (hs : IsGLB s a) : s.Nonempty :=
707711
hs.dual.nonempty
708712

709713
theorem nonempty_of_not_bddAbove [ha : Nonempty α] (h : ¬BddAbove s) : s.Nonempty :=

Mathlib/Order/Filter/AtTopBot/Defs.lean

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,38 @@ theorem mem_atTop [Preorder α] (a : α) : { b : α | a ≤ b } ∈ @atTop α _
4343
theorem Ici_mem_atTop [Preorder α] (a : α) : Ici a ∈ (atTop : Filter α) :=
4444
mem_atTop a
4545

46-
theorem Ioi_mem_atTop [Preorder α] [NoMaxOrder α] (x : α) : Ioi x ∈ (atTop : Filter α) :=
47-
let ⟨z, hz⟩ := exists_gt x
48-
mem_of_superset (mem_atTop z) fun _ h => lt_of_lt_of_le hz h
46+
theorem Ioi_mem_atTop [Preorder α] [NoTopOrder α] (x : α) : Ioi x ∈ (atTop : Filter α) :=
47+
let ⟨z, hz⟩ := exists_not_le x
48+
mem_of_superset (inter_mem (mem_atTop x) (mem_atTop z))
49+
fun _ ⟨hxy, hzy⟩ => lt_of_le_not_le hxy fun hyx => hz (hzy.trans hyx)
4950

5051
theorem mem_atBot [Preorder α] (a : α) : { b : α | b ≤ a } ∈ @atBot α _ :=
5152
mem_iInf_of_mem a <| Subset.refl _
5253

5354
theorem Iic_mem_atBot [Preorder α] (a : α) : Iic a ∈ (atBot : Filter α) :=
5455
mem_atBot a
5556

56-
theorem Iio_mem_atBot [Preorder α] [NoMinOrder α] (x : α) : Iio x ∈ (atBot : Filter α) :=
57-
let ⟨z, hz⟩ := exists_lt x
58-
mem_of_superset (mem_atBot z) fun _ h => lt_of_le_of_lt h hz
57+
theorem Iio_mem_atBot [Preorder α] [NoBotOrder α] (x : α) : Iio x ∈ (atBot : Filter α) :=
58+
let ⟨z, hz⟩ := exists_not_ge x
59+
mem_of_superset (inter_mem (mem_atBot x) (mem_atBot z))
60+
fun _ ⟨hyx, hyz⟩ => lt_of_le_not_le hyx fun hxy => hz (hxy.trans hyz)
5961

6062
theorem eventually_ge_atTop [Preorder α] (a : α) : ∀ᶠ x in atTop, a ≤ x :=
6163
mem_atTop a
6264

6365
theorem eventually_le_atBot [Preorder α] (a : α) : ∀ᶠ x in atBot, x ≤ a :=
6466
mem_atBot a
6567

66-
theorem eventually_gt_atTop [Preorder α] [NoMaxOrder α] (a : α) : ∀ᶠ x in atTop, a < x :=
68+
theorem eventually_gt_atTop [Preorder α] [NoTopOrder α] (a : α) : ∀ᶠ x in atTop, a < x :=
6769
Ioi_mem_atTop a
6870

69-
theorem eventually_ne_atTop [Preorder α] [NoMaxOrder α] (a : α) : ∀ᶠ x in atTop, x ≠ a :=
71+
theorem eventually_ne_atTop [Preorder α] [NoTopOrder α] (a : α) : ∀ᶠ x in atTop, x ≠ a :=
7072
(eventually_gt_atTop a).mono fun _ => ne_of_gt
7173

72-
theorem eventually_lt_atBot [Preorder α] [NoMinOrder α] (a : α) : ∀ᶠ x in atBot, x < a :=
74+
theorem eventually_lt_atBot [Preorder α] [NoBotOrder α] (a : α) : ∀ᶠ x in atBot, x < a :=
7375
Iio_mem_atBot a
7476

75-
theorem eventually_ne_atBot [Preorder α] [NoMinOrder α] (a : α) : ∀ᶠ x in atBot, x ≠ a :=
77+
theorem eventually_ne_atBot [Preorder α] [NoBotOrder α] (a : α) : ∀ᶠ x in atBot, x ≠ a :=
7678
(eventually_lt_atBot a).mono fun _ => ne_of_lt
7779

7880
theorem _root_.IsTop.atTop_eq [Preorder α] {a : α} (ha : IsTop a) : atTop = 𝓟 (Ici a) :=

Mathlib/Order/Filter/AtTopBot/Disjoint.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ theorem disjoint_atBot_principal_Ioi [Preorder α] (x : α) : Disjoint atBot (
2424
theorem disjoint_atTop_principal_Iio [Preorder α] (x : α) : Disjoint atTop (𝓟 (Iio x)) :=
2525
@disjoint_atBot_principal_Ioi αᵒᵈ _ _
2626

27-
theorem disjoint_atTop_principal_Iic [Preorder α] [NoMaxOrder α] (x : α) :
27+
theorem disjoint_atTop_principal_Iic [Preorder α] [NoTopOrder α] (x : α) :
2828
Disjoint atTop (𝓟 (Iic x)) :=
2929
disjoint_of_disjoint_of_mem (Iic_disjoint_Ioi le_rfl).symm (Ioi_mem_atTop x)
3030
(mem_principal_self _)
3131

32-
theorem disjoint_atBot_principal_Ici [Preorder α] [NoMinOrder α] (x : α) :
32+
theorem disjoint_atBot_principal_Ici [Preorder α] [NoBotOrder α] (x : α) :
3333
Disjoint atBot (𝓟 (Ici x)) :=
3434
@disjoint_atTop_principal_Iic αᵒᵈ _ _ _
3535

36-
theorem disjoint_pure_atTop [Preorder α] [NoMaxOrder α] (x : α) : Disjoint (pure x) atTop :=
36+
theorem disjoint_pure_atTop [Preorder α] [NoTopOrder α] (x : α) : Disjoint (pure x) atTop :=
3737
Disjoint.symm <| (disjoint_atTop_principal_Iic x).mono_right <| le_principal_iff.2 <|
3838
mem_pure.2 right_mem_Iic
3939

40-
theorem disjoint_pure_atBot [Preorder α] [NoMinOrder α] (x : α) : Disjoint (pure x) atBot :=
40+
theorem disjoint_pure_atBot [Preorder α] [NoBotOrder α] (x : α) : Disjoint (pure x) atBot :=
4141
@disjoint_pure_atTop αᵒᵈ _ _ _
4242

4343
theorem disjoint_atBot_atTop [PartialOrder α] [Nontrivial α] :

Mathlib/Order/Filter/AtTopBot/Tendsto.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,39 @@ open Set
2121

2222
namespace Filter
2323

24-
theorem not_tendsto_const_atTop [Preorder α] [NoMaxOrder α] (x : α) (l : Filter β) [l.NeBot] :
24+
theorem not_tendsto_const_atTop [Preorder α] [NoTopOrder α] (x : α) (l : Filter β) [l.NeBot] :
2525
¬Tendsto (fun _ => x) l atTop :=
2626
tendsto_const_pure.not_tendsto (disjoint_pure_atTop x)
2727

28-
theorem not_tendsto_const_atBot [Preorder α] [NoMinOrder α] (x : α) (l : Filter β) [l.NeBot] :
28+
theorem not_tendsto_const_atBot [Preorder α] [NoBotOrder α] (x : α) (l : Filter β) [l.NeBot] :
2929
¬Tendsto (fun _ => x) l atBot :=
3030
tendsto_const_pure.not_tendsto (disjoint_pure_atBot x)
3131

32-
protected theorem Tendsto.eventually_gt_atTop [Preorder β] [NoMaxOrder β] {f : α → β} {l : Filter α}
32+
protected theorem Tendsto.eventually_gt_atTop [Preorder β] [NoTopOrder β] {f : α → β} {l : Filter α}
3333
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, c < f x :=
3434
hf.eventually (eventually_gt_atTop c)
3535

3636
protected theorem Tendsto.eventually_ge_atTop [Preorder β] {f : α → β} {l : Filter α}
3737
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, c ≤ f x :=
3838
hf.eventually (eventually_ge_atTop c)
3939

40-
protected theorem Tendsto.eventually_ne_atTop [Preorder β] [NoMaxOrder β] {f : α → β} {l : Filter α}
40+
protected theorem Tendsto.eventually_ne_atTop [Preorder β] [NoTopOrder β] {f : α → β} {l : Filter α}
4141
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, f x ≠ c :=
4242
hf.eventually (eventually_ne_atTop c)
4343

44-
protected theorem Tendsto.eventually_ne_atTop' [Preorder β] [NoMaxOrder β] {f : α → β}
44+
protected theorem Tendsto.eventually_ne_atTop' [Preorder β] [NoTopOrder β] {f : α → β}
4545
{l : Filter α} (hf : Tendsto f l atTop) (c : α) : ∀ᶠ x in l, x ≠ c :=
4646
(hf.eventually_ne_atTop (f c)).mono fun _ => ne_of_apply_ne f
4747

48-
protected theorem Tendsto.eventually_lt_atBot [Preorder β] [NoMinOrder β] {f : α → β} {l : Filter α}
48+
protected theorem Tendsto.eventually_lt_atBot [Preorder β] [NoBotOrder β] {f : α → β} {l : Filter α}
4949
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x < c :=
5050
hf.eventually (eventually_lt_atBot c)
5151

5252
protected theorem Tendsto.eventually_le_atBot [Preorder β] {f : α → β} {l : Filter α}
5353
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x ≤ c :=
5454
hf.eventually (eventually_le_atBot c)
5555

56-
protected theorem Tendsto.eventually_ne_atBot [Preorder β] [NoMinOrder β] {f : α → β} {l : Filter α}
56+
protected theorem Tendsto.eventually_ne_atBot [Preorder β] [NoBotOrder β] {f : α → β} {l : Filter α}
5757
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x ≠ c :=
5858
hf.eventually (eventually_ne_atBot c)
5959

Mathlib/Order/Filter/Cofinite.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ theorem le_cofinite_iff_compl_singleton_mem : l ≤ cofinite ↔ ∀ x, {x}ᶜ
100100
theorem le_cofinite_iff_eventually_ne : l ≤ cofinite ↔ ∀ x, ∀ᶠ y in l, y ≠ x :=
101101
le_cofinite_iff_compl_singleton_mem
102102

103-
/-- If `α` is a preorder with no maximal element, then `atTop ≤ cofinite`. -/
104-
theorem atTop_le_cofinite [Preorder α] [NoMaxOrder α] : (atTop : Filter α) ≤ cofinite :=
103+
/-- If `α` is a preorder with no top element, then `atTop ≤ cofinite`. -/
104+
theorem atTop_le_cofinite [Preorder α] [NoTopOrder α] : (atTop : Filter α) ≤ cofinite :=
105105
le_cofinite_iff_eventually_ne.mpr eventually_ne_atTop
106106

107+
/-- If `α` is a preorder with no bottom element, then `atBot ≤ cofinite`. -/
108+
theorem atBot_le_cofinite [Preorder α] [NoBotOrder α] : (atBot : Filter α) ≤ cofinite :=
109+
le_cofinite_iff_eventually_ne.mpr eventually_ne_atBot
110+
107111
theorem comap_cofinite_le (f : α → β) : comap f cofinite ≤ cofinite :=
108112
le_cofinite_iff_eventually_ne.mpr fun x =>
109113
mem_comap.2 ⟨{f x}ᶜ, (finite_singleton _).compl_mem_cofinite, fun _ => ne_of_apply_ne f⟩

Mathlib/Order/WithBot.lean

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,23 +330,23 @@ theorem lt_coe_bot [OrderBot α] : x < (⊥ : α) ↔ x = ⊥ := by cases x <;>
330330
lemma eq_bot_iff_forall_lt : x = ⊥ ↔ ∀ b : α, x < b := by
331331
cases x <;> simp; simpa using ⟨_, lt_irrefl _⟩
332332

333-
lemma eq_bot_iff_forall_le [NoMinOrder α] : x = ⊥ ↔ ∀ b : α, x ≤ b := by
334-
refine ⟨by simp +contextual, fun h ↦ eq_bot_iff_forall_lt.2 fun y ?_⟩
335-
obtain ⟨w, hw⟩ := exists_lt y
336-
exact (h w).trans_lt (coe_lt_coe.2 hw)
333+
lemma eq_bot_iff_forall_le [NoBotOrder α] : x = ⊥ ↔ ∀ b : α, x ≤ b := by
334+
refine ⟨by simp +contextual, fun h ↦ (x.eq_bot_iff_forall_ne).2 fun y => ?_⟩
335+
rintro rfl
336+
exact not_isBot y fun z => coe_le_coe.1 (h z)
337337

338338
@[deprecated (since := "2025-03-19")] alias forall_lt_iff_eq_bot := eq_bot_iff_forall_lt
339339
@[deprecated (since := "2025-03-19")] alias forall_le_iff_eq_bot := eq_bot_iff_forall_le
340340

341-
lemma forall_le_coe_iff_le [NoMinOrder α] : (∀ a : α, y ≤ a → x ≤ a) ↔ x ≤ y := by
341+
lemma forall_le_coe_iff_le [NoBotOrder α] : (∀ a : α, y ≤ a → x ≤ a) ↔ x ≤ y := by
342342
obtain _ | y := y
343343
· simp [WithBot.none_eq_bot, eq_bot_iff_forall_le]
344344
· exact ⟨fun h ↦ h _ le_rfl, fun hmn a ham ↦ hmn.trans ham⟩
345345

346346
end Preorder
347347

348348
section PartialOrder
349-
variable [PartialOrder α] [NoMinOrder α] {x y : WithBot α}
349+
variable [PartialOrder α] [NoBotOrder α] {x y : WithBot α}
350350

351351
lemma eq_of_forall_le_coe_iff (h : ∀ a : α, x ≤ a ↔ y ≤ a) : x = y :=
352352
le_antisymm (forall_le_coe_iff_le.mp fun a ↦ (h a).2) (forall_le_coe_iff_le.mp fun a ↦ (h a).1)
@@ -829,19 +829,19 @@ theorem coe_top_lt [OrderTop α] : (⊤ : α) < x ↔ x = ⊤ := by cases x <;>
829829
lemma eq_top_iff_forall_gt : y = ⊤ ↔ ∀ a : α, a < y := by
830830
cases y <;> simp; simpa using ⟨_, lt_irrefl _⟩
831831

832-
lemma eq_top_iff_forall_ge [NoMaxOrder α] : y = ⊤ ↔ ∀ a : α, a ≤ y :=
832+
lemma eq_top_iff_forall_ge [NoTopOrder α] : y = ⊤ ↔ ∀ a : α, a ≤ y :=
833833
WithBot.eq_bot_iff_forall_le (α := αᵒᵈ)
834834

835835
@[deprecated (since := "2025-03-19")] alias forall_gt_iff_eq_top := eq_top_iff_forall_gt
836836
@[deprecated (since := "2025-03-19")] alias forall_ge_iff_eq_top := eq_top_iff_forall_ge
837837

838-
lemma forall_coe_le_iff_le [NoMaxOrder α] : (∀ a : α, a ≤ x → a ≤ y) ↔ x ≤ y :=
838+
lemma forall_coe_le_iff_le [NoTopOrder α] : (∀ a : α, a ≤ x → a ≤ y) ↔ x ≤ y :=
839839
WithBot.forall_le_coe_iff_le (α := αᵒᵈ)
840840

841841
end Preorder
842842

843843
section PartialOrder
844-
variable [PartialOrder α] [NoMaxOrder α] {x y : WithTop α}
844+
variable [PartialOrder α] [NoTopOrder α] {x y : WithTop α}
845845

846846
lemma eq_of_forall_coe_le_iff (h : ∀ a : α, a ≤ x ↔ a ≤ y) : x = y :=
847847
WithBot.eq_of_forall_le_coe_iff (α := αᵒᵈ) h
@@ -973,7 +973,7 @@ end WithTop
973973

974974
section WithBotWithTop
975975

976-
lemma WithBot.eq_top_iff_forall_ge [Preorder α] [Nonempty α] [NoMaxOrder α]
976+
lemma WithBot.eq_top_iff_forall_ge [Preorder α] [Nonempty α] [NoTopOrder α]
977977
{x : WithBot (WithTop α)} : x = ⊤ ↔ ∀ a : α, a ≤ x := by
978978
refine ⟨by aesop, fun H ↦ ?_⟩
979979
induction x

0 commit comments

Comments
 (0)