Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit a8a211f

Browse files
committed
feat(order/lattice): add left_lt_inf etc (#14152)
* add `left_lt_sup`, `right_lt_sup`, `left_or_right_lt_sup`, and their `inf` counterparts; * generalize `is_top_or_exists_gt` and `is_bot_or_exists_lt` to directed orders, replacing `forall_le_or_exists_lt_inf` and `forall_le_or_exists_lt_sup`; * generalize `exists_lt_of_sup` and `exists_lt_of_inf` to directed orders, rename them to `exists_lt_of_directed_le` and `exists_lt_of_directed_ge`.
1 parent d8b6f76 commit a8a211f

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

src/order/directed.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,29 @@ protected lemma is_min.is_bot [is_directed α (swap (≤))] (h : is_min a) : is_
137137
protected lemma is_max.is_top [is_directed α (≤)] (h : is_max a) : is_top a :=
138138
λ b, let ⟨c, hac, hbc⟩ := exists_ge_ge a b in hbc.trans $ h hac
139139

140+
lemma is_top_or_exists_gt [is_directed α (≤)] (a : α) : is_top a ∨ (∃ b, a < b) :=
141+
(em (is_max a)).imp is_max.is_top not_is_max_iff.mp
142+
143+
lemma is_bot_or_exists_lt [is_directed α (swap (≤))] (a : α) : is_bot a ∨ (∃ b, b < a) :=
144+
@is_top_or_exists_gt αᵒᵈ _ _ a
145+
140146
lemma is_bot_iff_is_min [is_directed α (swap (≤))] : is_bot a ↔ is_min a :=
141147
⟨is_bot.is_min, is_min.is_bot⟩
142148

143149
lemma is_top_iff_is_max [is_directed α (≤)] : is_top a ↔ is_max a := ⟨is_top.is_max, is_max.is_top⟩
144150

151+
variables (β) [partial_order β]
152+
153+
theorem exists_lt_of_directed_ge [is_directed β (swap (≤))] [nontrivial β] : ∃ a b : β, a < b :=
154+
begin
155+
rcases exists_pair_ne β with ⟨a, b, hne⟩,
156+
rcases is_bot_or_exists_lt a with ha|⟨c, hc⟩,
157+
exacts [⟨a, b, (ha b).lt_of_ne hne⟩, ⟨_, _, hc⟩]
158+
end
159+
160+
theorem exists_lt_of_directed_le [is_directed β (≤)] [nontrivial β] : ∃ a b : β, a < b :=
161+
let ⟨a, b, h⟩ := exists_lt_of_directed_ge βᵒᵈ in ⟨b, a, h⟩
162+
145163
end preorder
146164

147165
@[priority 100] -- see Note [lower instance priority]

src/order/lattice.lean

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ sup_eq_left.2 h
165165
@[simp] theorem left_eq_sup : a = a ⊔ b ↔ b ≤ a :=
166166
eq_comm.trans sup_eq_left
167167

168+
@[simp] theorem left_lt_sup : a < a ⊔ b ↔ ¬b ≤ a :=
169+
le_sup_left.lt_iff_ne.trans $ not_congr left_eq_sup
170+
168171
@[simp] theorem sup_eq_right : a ⊔ b = b ↔ a ≤ b :=
169172
le_antisymm_iff.trans $ by simp [le_refl]
170173

@@ -174,6 +177,12 @@ sup_eq_right.2 h
174177
@[simp] theorem right_eq_sup : b = a ⊔ b ↔ a ≤ b :=
175178
eq_comm.trans sup_eq_right
176179

180+
@[simp] theorem right_lt_sup : b < a ⊔ b ↔ ¬a ≤ b :=
181+
le_sup_right.lt_iff_ne.trans $ not_congr right_eq_sup
182+
183+
lemma left_or_right_lt_sup (h : a ≠ b) : (a < a ⊔ b ∨ b < a ⊔ b) :=
184+
h.not_le_or_not_le.symm.imp left_lt_sup.2 right_lt_sup.2
185+
177186
theorem sup_le_sup (h₁ : a ≤ b) (h₂ : c ≤ d) : a ⊔ c ≤ b ⊔ d :=
178187
sup_le (le_sup_of_le_left h₁) (le_sup_of_le_right h₂)
179188

@@ -225,12 +234,6 @@ by rw [sup_sup_sup_comm, sup_idem]
225234
lemma sup_sup_distrib_right (a b c : α) : (a ⊔ b) ⊔ c = (a ⊔ c) ⊔ (b ⊔ c) :=
226235
by rw [sup_sup_sup_comm, sup_idem]
227236

228-
lemma forall_le_or_exists_lt_sup (a : α) : (∀b, b ≤ a) ∨ (∃b, a < b) :=
229-
suffices (∃b, ¬b ≤ a) → (∃b, a < b),
230-
by rwa [or_iff_not_imp_left, not_forall],
231-
assume ⟨b, hb⟩,
232-
⟨a ⊔ b, lt_of_le_of_ne le_sup_left $ mt left_eq_sup.1 hb⟩
233-
234237
/-- If `f` is monotone, `g` is antitone, and `f ≤ g`, then for all `a`, `b` we have `f a ≤ g b`. -/
235238
theorem monotone.forall_le_of_antitone {β : Type*} [preorder β] {f g : α → β}
236239
(hf : monotone f) (hg : antitone g) (h : f ≤ g) (m n : α) :
@@ -254,13 +257,6 @@ begin
254257
injection this; congr'
255258
end
256259

257-
theorem exists_lt_of_sup (α : Type*) [semilattice_sup α] [nontrivial α] : ∃ a b : α, a < b :=
258-
begin
259-
rcases exists_pair_ne α with ⟨a, b, hne⟩,
260-
rcases forall_le_or_exists_lt_sup b with (hb|H),
261-
exacts [⟨a, b, (hb a).lt_of_ne hne⟩, ⟨b, H⟩]
262-
end
263-
264260
lemma ite_le_sup (s s' : α) (P : Prop) [decidable P] : ite P s s' ≤ s ⊔ s' :=
265261
if h : P then (if_pos h).trans_le le_sup_left else (if_neg h).trans_le le_sup_right
266262

@@ -329,6 +325,8 @@ lt_of_le_of_lt inf_le_right h
329325
@[simp] theorem inf_eq_left : a ⊓ b = a ↔ a ≤ b :=
330326
le_antisymm_iff.trans $ by simp [le_refl]
331327

328+
@[simp] theorem inf_lt_left : a ⊓ b < a ↔ ¬a ≤ b := @left_lt_sup αᵒᵈ _ _ _
329+
332330
theorem inf_of_le_left (h : a ≤ b) : a ⊓ b = a :=
333331
inf_eq_left.2 h
334332

@@ -338,6 +336,11 @@ eq_comm.trans inf_eq_left
338336
@[simp] theorem inf_eq_right : a ⊓ b = b ↔ b ≤ a :=
339337
le_antisymm_iff.trans $ by simp [le_refl]
340338

339+
@[simp] theorem inf_lt_right : a ⊓ b < b ↔ ¬b ≤ a := @right_lt_sup αᵒᵈ _ _ _
340+
341+
theorem inf_lt_left_or_right (h : a ≠ b) : a ⊓ b < a ∨ a ⊓ b < b :=
342+
@left_or_right_lt_sup αᵒᵈ _ _ _ h
343+
341344
theorem inf_of_le_right (h : b ≤ a) : a ⊓ b = b :=
342345
inf_eq_right.2 h
343346

@@ -384,9 +387,6 @@ lemma inf_inf_distrib_left (a b c : α) : a ⊓ (b ⊓ c) = (a ⊓ b) ⊓ (a ⊓
384387
lemma inf_inf_distrib_right (a b c : α) : (a ⊓ b) ⊓ c = (a ⊓ c) ⊓ (b ⊓ c) :=
385388
@sup_sup_distrib_right αᵒᵈ _ _ _ _
386389

387-
lemma forall_le_or_exists_lt_inf (a : α) : (∀b, a ≤ b) ∨ (∃b, b < a) :=
388-
@forall_le_or_exists_lt_sup αᵒᵈ _ a
389-
390390
theorem semilattice_inf.ext_inf {α} {A B : semilattice_inf α}
391391
(H : ∀ x y : α, (by haveI := A; exact x ≤ y) ↔ x ≤ y)
392392
(x y : α) : (by haveI := A; exact (x ⊓ y)) = x ⊓ y :=
@@ -406,10 +406,6 @@ theorem semilattice_inf.dual_dual (α : Type*) [H : semilattice_inf α] :
406406
order_dual.semilattice_inf αᵒᵈ = H :=
407407
semilattice_inf.ext $ λ _ _, iff.rfl
408408

409-
theorem exists_lt_of_inf (α : Type*) [semilattice_inf α] [nontrivial α] :
410-
∃ a b : α, a < b :=
411-
let ⟨a, b, h⟩ := exists_lt_of_sup αᵒᵈ in ⟨b, a, h⟩
412-
413409
lemma inf_le_ite (s s' : α) (P : Prop) [decidable P] : s ⊓ s' ≤ ite P s s' :=
414410
@ite_le_sup αᵒᵈ _ _ _ _ _
415411

src/order/max.lean

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,3 @@ protected lemma is_max.eq_of_le (ha : is_max a) (h : a ≤ b) : a = b := h.antis
184184
protected lemma is_max.eq_of_ge (ha : is_max a) (h : a ≤ b) : b = a := h.antisymm' $ ha h
185185

186186
end partial_order
187-
188-
section linear_order
189-
variables [linear_order α]
190-
191-
--TODO: Delete in favor of the directed version
192-
lemma is_top_or_exists_gt (a : α) : is_top a ∨ ∃ b, a < b :=
193-
by simpa only [or_iff_not_imp_left, is_top, not_forall, not_le] using id
194-
195-
lemma is_bot_or_exists_lt (a : α) : is_bot a ∨ ∃ b, b < a := @is_top_or_exists_gt αᵒᵈ _ a
196-
197-
end linear_order

src/topology/algebra/order/liminf_limsup.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ section order_closed_topology
2222
variables [semilattice_sup α] [topological_space α] [order_topology α]
2323

2424
lemma is_bounded_le_nhds (a : α) : (𝓝 a).is_bounded (≤) :=
25-
match forall_le_or_exists_lt_sup a with
26-
| or.inl h := ⟨a, eventually_of_forall h⟩
27-
| or.inr ⟨b, hb⟩ := ⟨b, ge_mem_nhds hb⟩
28-
end
25+
(is_top_or_exists_gt a).elim (λ h, ⟨a, eventually_of_forall h⟩) (λ ⟨b, hb⟩, ⟨b, ge_mem_nhds hb⟩)
2926

3027
lemma filter.tendsto.is_bounded_under_le {f : filter β} {u : β → α} {a : α}
3128
(h : tendsto u f (𝓝 a)) : f.is_bounded_under (≤) u :=

0 commit comments

Comments
 (0)