Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions Mathlib/Data/ENat/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,15 @@ 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 eq_top_iff_forall_ne : n = ⊤ ↔ ∀ m : ℕ, ↑m ≠ n := WithTop.eq_top_iff_forall_ne
lemma eq_top_iff_forall_gt : n = ⊤ ↔ ∀ m : ℕ, m < n := WithTop.eq_top_iff_forall_gt
lemma eq_top_iff_forall_ge : n = ⊤ ↔ ∀ m : ℕ, m ≤ n := WithTop.eq_top_iff_forall_ge

lemma eq_top_iff_forall_lt : (∀ m : ℕ, m < n) ↔ n = ⊤ := WithTop.forall_gt_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 <| eq_top_iff_forall_ge.2.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
6 changes: 4 additions & 2 deletions Mathlib/Data/Option/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,10 @@ lemma isNone_eq_false_iff (a : Option α) : Option.isNone a = false ↔ Option.i
lemma eq_none_or_eq_some (a : Option α) : a = none ∨ ∃ x, a = some x :=
Option.exists.mp exists_eq'

lemma forall_some_ne_iff_eq_none {o : Option α} : (∀ (x : α), some x ≠ o) ↔ o = none := by
lemma eq_none_iff_forall_some_ne {o : Option α} : o = none ↔ ∀ a : α, some a ≠ o := by
apply not_iff_not.1
simpa only [not_forall, not_not] using Option.ne_none_iff_exists.symm
simpa only [not_forall, not_not] using Option.ne_none_iff_exists

@[deprecated (since := "2025-03-19")] alias forall_some_ne_iff_eq_none := eq_none_iff_forall_some_ne

end Option
2 changes: 1 addition & 1 deletion Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ lemma netMaxcard_infinite_iff (T : X → X) (F : Set X) (U : Set (X × X)) (n :
simp only [Nat.cast_lt, Subtype.exists, exists_prop] at h
rcases h with ⟨s, s_net, s_k⟩
exact ⟨s, ⟨s_net, s_k.le⟩⟩
· refine WithTop.forall_gt_iff_eq_top.1 fun k ↦ ?_
· refine WithTop.eq_top_iff_forall_gt.2 fun k ↦ ?_
specialize h (k + 1)
rcases h with ⟨s, s_net, s_card⟩
apply s_net.card_le_netMaxcard.trans_lt'
Expand Down
35 changes: 25 additions & 10 deletions Mathlib/Order/WithBot.lean
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ lemma map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f

lemma ne_bot_iff_exists {x : WithBot α} : x ≠ ⊥ ↔ ∃ a : α, ↑a = x := Option.ne_none_iff_exists

lemma forall_ne_iff_eq_bot {x : WithBot α} : (∀ a : α, ↑a ≠ x) ↔ x = ⊥ :=
Option.forall_some_ne_iff_eq_none
lemma eq_bot_iff_forall_ne {x : WithBot α} : x = ⊥ ↔ ∀ a : α, ↑a ≠ x :=
Option.eq_none_iff_forall_some_ne

@[deprecated (since := "2025-03-19")] alias forall_ne_iff_eq_bot := eq_bot_iff_forall_ne

/-- Deconstruct a `x : WithBot α` to the underlying value in `α`, given a proof that `x ≠ ⊥`. -/
def unbot : ∀ x : WithBot α, x ≠ ⊥ → α | (x : α), _ => x
Expand Down Expand Up @@ -325,14 +327,17 @@ alias le_coe_unbot' := le_coe_unbotD
@[simp]
theorem lt_coe_bot [OrderBot α] : x < (⊥ : α) ↔ x = ⊥ := by cases x <;> simp

lemma forall_lt_iff_eq_bot : (∀ b : α, x < b) ↔ x = ⊥ := by
lemma eq_bot_iff_forall_lt : x = ⊥ ↔ ∀ b : α, x < b := by
cases x <;> simp; simpa using ⟨_, lt_irrefl _⟩

lemma forall_le_iff_eq_bot [NoMinOrder α] : (∀ b : α, x ≤ b) ↔ x = ⊥ := by
refine ⟨fun h ↦ forall_lt_iff_eq_bot.1 fun y ↦ ?_, by simp +contextual
lemma eq_bot_iff_forall_le [NoMinOrder α] : x = ⊥ ↔ ∀ b : α, x ≤ b := by
refine ⟨by simp +contextual, fun h ↦ eq_bot_iff_forall_lt.2 fun y ↦ ?_⟩
obtain ⟨w, hw⟩ := exists_lt y
exact (h w).trans_lt (coe_lt_coe.2 hw)

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

end Preorder

instance semilatticeSup [SemilatticeSup α] : SemilatticeSup (WithBot α) where
Expand Down Expand Up @@ -638,8 +643,10 @@ theorem ofDual_map (f : αᵒᵈ → βᵒᵈ) (a : WithTop αᵒᵈ) :

lemma ne_top_iff_exists {x : WithTop α} : x ≠ ⊤ ↔ ∃ a : α, ↑a = x := Option.ne_none_iff_exists

lemma forall_ne_iff_eq_top {x : WithTop α} : (∀ a : α, ↑a ≠ x) ↔ x = ⊤ :=
Option.forall_some_ne_iff_eq_none
lemma eq_top_iff_forall_ne {x : WithTop α} : x = ⊤ ↔ ∀ a : α, ↑a ≠ x :=
Option.eq_none_iff_forall_some_ne

@[deprecated (since := "2025-03-19")] alias forall_ne_iff_eq_top := eq_top_iff_forall_ne

/-- Deconstruct a `x : WithTop α` to the underlying value in `α`, given a proof that `x ≠ ⊤`. -/
def untop : ∀ x : WithTop α, x ≠ ⊤ → α | (x : α), _ => x
Expand Down Expand Up @@ -806,11 +813,19 @@ alias coe_untop'_le := coe_untopD_le
@[simp]
theorem coe_top_lt [OrderTop α] : (⊤ : α) < x ↔ x = ⊤ := by cases x <;> simp

lemma forall_gt_iff_eq_top : (∀ a : α, a < y) ↔ y = ⊤ := by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on, why are these getting removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in #23101 (comment) you said you wanted y = ⊤ ↔ ∀ a : α, a < y to exist. Since (∀ a : α, a < y) ↔ y = ⊤ already existed then, I assumed you wanted me to replace it, so I have replaced it (and indeed I don't think we should have both).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehhh, okay

lemma eq_top_iff_forall_gt : y = ⊤ ↔ ∀ a : α, a < y := by
cases y <;> simp; simpa using ⟨_, lt_irrefl _⟩

lemma forall_ge_iff_eq_top [NoMaxOrder α] : (∀ a : α, a ≤ y) ↔ y = ⊤ :=
WithBot.forall_le_iff_eq_bot (α := αᵒᵈ)
lemma eq_top_iff_forall_ge [NoMaxOrder α] : y = ⊤ ↔ ∀ a : α, a ≤ y :=
WithBot.eq_bot_iff_forall_le (α := αᵒᵈ)

@[deprecated (since := "2025-03-19")] alias forall_lt_iff_eq_top := eq_top_iff_forall_gt
@[deprecated (since := "2025-03-19")] alias forall_le_iff_eq_top := eq_top_iff_forall_ge
Comment on lines +822 to +823
Copy link
Copy Markdown
Member

@erdOne erdOne Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have the wrong name. (Do we care?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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, eq_top_iff_forall_ge]
· exact ⟨fun h ↦ h _ le_rfl, fun hmn a ham ↦ ham.trans hmn⟩

end Preorder

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ instance (R : Type*) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R] :
obtain ⟨ϖ, hϖ⟩ := exists_irreducible R
simp only [← Ideal.one_eq_top, smul_eq_mul, mul_one, SModEq.zero, hϖ.maximalIdeal_eq,
Ideal.span_singleton_pow, Ideal.mem_span_singleton, ← addVal_le_iff_dvd, hϖ.addVal_pow] at hx
rwa [← addVal_eq_top_iff, WithTop.forall_ge_iff_eq_top]
rwa [← addVal_eq_top_iff, WithTop.eq_top_iff_forall_ge]

end IsDiscreteValuationRing

Expand Down