Skip to content

Commit 6ab5985

Browse files
committed
feat(ENat): (∀ a : ℕ, a ≤ m → a ≤ n) ↔ m ≤ n (#23101)
From my PhD (MiscYD)
1 parent 8aef1f5 commit 6ab5985

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

Mathlib/Data/ENat/Basic.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,15 @@ lemma add_lt_add_iff_left {k : ℕ∞} (h : k ≠ ⊤) : k + n < k + m ↔ n < m
313313

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

316-
lemma eq_top_iff_forall_ne : (∀ m : ℕ, ↑m ≠ n) ↔ n = ⊤ := WithTop.forall_ne_iff_eq_top
316+
lemma eq_top_iff_forall_ne : n = ⊤ ↔ ∀ m : ℕ, ↑m ≠ n := WithTop.eq_top_iff_forall_ne
317+
lemma eq_top_iff_forall_gt : n = ⊤ ↔ ∀ m : ℕ, m < n := WithTop.eq_top_iff_forall_gt
318+
lemma eq_top_iff_forall_ge : n = ⊤ ↔ ∀ m : ℕ, m ≤ n := WithTop.eq_top_iff_forall_ge
317319

318-
lemma eq_top_iff_forall_lt : (∀ m : ℕ, m < n) ↔ n = ⊤ := WithTop.forall_gt_iff_eq_top
319-
320-
lemma eq_top_iff_forall_le : (∀ m : ℕ, m ≤ n) ↔ n = ⊤ := WithTop.forall_ge_iff_eq_top
320+
lemma forall_natCast_le_iff_le : (∀ a : ℕ, a ≤ m → a ≤ n) ↔ m ≤ n := WithTop.forall_coe_le_iff_le
321321

322322
protected lemma exists_nat_gt (hn : n ≠ ⊤) : ∃ m : ℕ, n < m := by
323323
simp_rw [lt_iff_not_ge n]
324-
exact not_forall.mp <| eq_top_iff_forall_le.mp.mt hn
324+
exact not_forall.mp <| eq_top_iff_forall_ge.2.mt hn
325325

326326
@[simp] lemma sub_eq_top_iff : a - b = ⊤ ↔ a = ⊤ ∧ b ≠ ⊤ := WithTop.sub_eq_top_iff
327327
lemma sub_ne_top_iff : a - b ≠ ⊤ ↔ a ≠ ⊤ ∨ b = ⊤ := WithTop.sub_ne_top_iff

Mathlib/Data/Option/Basic.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,10 @@ lemma isNone_eq_false_iff (a : Option α) : Option.isNone a = false ↔ Option.i
318318
lemma eq_none_or_eq_some (a : Option α) : a = none ∨ ∃ x, a = some x :=
319319
Option.exists.mp exists_eq'
320320

321-
lemma forall_some_ne_iff_eq_none {o : Option α} : (∀ (x : α), some x ≠ o) ↔ o = none := by
321+
lemma eq_none_iff_forall_some_ne {o : Option α} : o = none ↔ ∀ a : α, some a ≠ o := by
322322
apply not_iff_not.1
323-
simpa only [not_forall, not_not] using Option.ne_none_iff_exists.symm
323+
simpa only [not_forall, not_not] using Option.ne_none_iff_exists
324+
325+
@[deprecated (since := "2025-03-19")] alias forall_some_ne_iff_eq_none := eq_none_iff_forall_some_ne
324326

325327
end Option

Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ lemma netMaxcard_infinite_iff (T : X → X) (F : Set X) (U : Set (X × X)) (n :
202202
simp only [Nat.cast_lt, Subtype.exists, exists_prop] at h
203203
rcases h with ⟨s, s_net, s_k⟩
204204
exact ⟨s, ⟨s_net, s_k.le⟩⟩
205-
· refine WithTop.forall_gt_iff_eq_top.1 fun k ↦ ?_
205+
· refine WithTop.eq_top_iff_forall_gt.2 fun k ↦ ?_
206206
specialize h (k + 1)
207207
rcases h with ⟨s, s_net, s_card⟩
208208
apply s_net.card_le_netMaxcard.trans_lt'

Mathlib/Order/WithBot.lean

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ lemma map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f
151151

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

154-
lemma forall_ne_iff_eq_bot {x : WithBot α} : (∀ a : α, ↑a ≠ x) ↔ x = ⊥ :=
155-
Option.forall_some_ne_iff_eq_none
154+
lemma eq_bot_iff_forall_ne {x : WithBot α} : x = ⊥ ↔ ∀ a : α, ↑a ≠ x :=
155+
Option.eq_none_iff_forall_some_ne
156+
157+
@[deprecated (since := "2025-03-19")] alias forall_ne_iff_eq_bot := eq_bot_iff_forall_ne
156158

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

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

331-
lemma forall_le_iff_eq_bot [NoMinOrder α] : (∀ b : α, x ≤ b) ↔ x = ⊥ := by
332-
refine ⟨fun h ↦ forall_lt_iff_eq_bot.1 fun y ↦ ?_, by simp +contextual
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 ↦ ?_⟩
333335
obtain ⟨w, hw⟩ := exists_lt y
334336
exact (h w).trans_lt (coe_lt_coe.2 hw)
335337

338+
@[deprecated (since := "2025-03-19")] alias forall_lt_iff_eq_bot := eq_bot_iff_forall_lt
339+
@[deprecated (since := "2025-03-19")] alias forall_le_iff_eq_bot := eq_bot_iff_forall_le
340+
336341
end Preorder
337342

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

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

641-
lemma forall_ne_iff_eq_top {x : WithTop α} : (∀ a : α, ↑a ≠ x) ↔ x = ⊤ :=
642-
Option.forall_some_ne_iff_eq_none
646+
lemma eq_top_iff_forall_ne {x : WithTop α} : x = ⊤ ↔ ∀ a : α, ↑a ≠ x :=
647+
Option.eq_none_iff_forall_some_ne
648+
649+
@[deprecated (since := "2025-03-19")] alias forall_ne_iff_eq_top := eq_top_iff_forall_ne
643650

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

809-
lemma forall_gt_iff_eq_top : (∀ a : α, a < y) ↔ y = ⊤ := by
816+
lemma eq_top_iff_forall_gt : y = ⊤ ↔ ∀ a : α, a < y := by
810817
cases y <;> simp; simpa using ⟨_, lt_irrefl _⟩
811818

812-
lemma forall_ge_iff_eq_top [NoMaxOrder α] : (∀ a : α, a ≤ y) ↔ y = ⊤ :=
813-
WithBot.forall_le_iff_eq_bot (α := αᵒᵈ)
819+
lemma eq_top_iff_forall_ge [NoMaxOrder α] : y = ⊤ ↔ ∀ a : α, a ≤ y :=
820+
WithBot.eq_bot_iff_forall_le (α := αᵒᵈ)
821+
822+
@[deprecated (since := "2025-03-19")] alias forall_lt_iff_eq_top := eq_top_iff_forall_gt
823+
@[deprecated (since := "2025-03-19")] alias forall_le_iff_eq_top := eq_top_iff_forall_ge
824+
825+
lemma forall_coe_le_iff_le [NoMaxOrder α] {x y : WithTop α} : (∀ a : α, a ≤ x → a ≤ y) ↔ x ≤ y := by
826+
obtain _ | x := x
827+
· simp [WithTop.none_eq_top, eq_top_iff_forall_ge]
828+
· exact ⟨fun h ↦ h _ le_rfl, fun hmn a ham ↦ ham.trans hmn⟩
814829

815830
end Preorder
816831

Mathlib/RingTheory/DiscreteValuationRing/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ instance (R : Type*) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R] :
474474
obtain ⟨ϖ, hϖ⟩ := exists_irreducible R
475475
simp only [← Ideal.one_eq_top, smul_eq_mul, mul_one, SModEq.zero, hϖ.maximalIdeal_eq,
476476
Ideal.span_singleton_pow, Ideal.mem_span_singleton, ← addVal_le_iff_dvd, hϖ.addVal_pow] at hx
477-
rwa [← addVal_eq_top_iff, WithTop.forall_ge_iff_eq_top]
477+
rwa [← addVal_eq_top_iff, WithTop.eq_top_iff_forall_ge]
478478

479479
end IsDiscreteValuationRing
480480

0 commit comments

Comments
 (0)