Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Mathlib/Data/ENat/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,19 @@ lemma add_lt_add_iff_left {k : ℕ∞} (h : k ≠ ⊤) : k + n < k + m ↔ n < m

lemma ne_top_iff_exists : n ≠ ⊤ ↔ ∃ m : ℕ, ↑m = n := WithTop.ne_top_iff_exists

lemma eq_top_iff_forall_ne : (∀ m : ℕ, ↑m ≠ n) ↔ n = ⊤ := WithTop.forall_ne_iff_eq_top
Comment thread
YaelDillies marked this conversation as resolved.
lemma forall_ne_iff_eq_top : (∀ m : ℕ, ↑m ≠ n) ↔ n = ⊤ := WithTop.forall_ne_iff_eq_top
lemma forall_gt_iff_eq_top : (∀ m : ℕ, m < n) ↔ n = ⊤ := WithTop.forall_gt_iff_eq_top
lemma forall_ge_iff_eq_top : (∀ m : ℕ, m ≤ n) ↔ n = ⊤ := WithTop.forall_ge_iff_eq_top

lemma eq_top_iff_forall_lt : (∀ m : ℕ, m < n) ↔ n = ⊤ := WithTop.forall_gt_iff_eq_top
@[deprecated (since := "2025-03-19")] alias eq_top_iff_forall_ne := forall_ne_iff_eq_top
@[deprecated (since := "2025-03-19")] alias eq_top_iff_forall_lt := forall_gt_iff_eq_top
@[deprecated (since := "2025-03-19")] alias eq_top_iff_forall_le := forall_ge_iff_eq_top

lemma eq_top_iff_forall_le : (∀ m : ℕ, m ≤ n) ↔ n = ⊤ := WithTop.forall_ge_iff_eq_top
lemma forall_natCast_le_iff_le : (∀ a : ℕ, a ≤ m → a ≤ n) ↔ m ≤ n := WithTop.forall_coe_le_iff_le

protected lemma exists_nat_gt (hn : n ≠ ⊤) : ∃ m : ℕ, n < m := by
simp_rw [lt_iff_not_ge n]
exact not_forall.mp <| eq_top_iff_forall_le.mp.mt hn
exact not_forall.mp <| forall_ge_iff_eq_top.mp.mt hn

@[simp] lemma sub_eq_top_iff : a - b = ⊤ ↔ a = ⊤ ∧ b ≠ ⊤ := WithTop.sub_eq_top_iff
lemma sub_ne_top_iff : a - b ≠ ⊤ ↔ a ≠ ⊤ ∨ b = ⊤ := WithTop.sub_ne_top_iff
Expand Down
5 changes: 5 additions & 0 deletions Mathlib/Order/WithBot.lean
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,11 @@ lemma forall_gt_iff_eq_top : (∀ a : α, a < y) ↔ y = ⊤ := by
lemma forall_ge_iff_eq_top [NoMaxOrder α] : (∀ a : α, a ≤ y) ↔ y = ⊤ :=
WithBot.forall_le_iff_eq_bot (α := αᵒᵈ)

lemma forall_coe_le_iff_le [NoMaxOrder α] {x y : WithTop α} : (∀ a : α, a ≤ x → a ≤ y) ↔ x ≤ y := by
obtain _ | x := x
· simp [WithTop.none_eq_top, forall_ge_iff_eq_top]
· exact ⟨fun h ↦ h _ le_rfl, fun hmn a ham ↦ ham.trans hmn⟩

end Preorder

instance semilatticeInf [SemilatticeInf α] : SemilatticeInf (WithTop α) where
Expand Down
Loading