Skip to content

Commit ba3d564

Browse files
vihdzpBergschaf
authored andcommitted
chore: deprecate WithZero.zero_le (leanprover-community#39016)
This is a duplicate of `zero_le` in the root namespace.
1 parent 1f159d5 commit ba3d564

4 files changed

Lines changed: 14 additions & 24 deletions

File tree

Mathlib/Algebra/Order/Archimedean/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ instance WithZero.instMulArchimedean (M) [CommMonoid M] [PartialOrder M] [MulArc
510510
constructor
511511
intro x y hxy
512512
cases y with
513-
| zero => exact absurd hxy (zero_le _).not_gt
513+
| zero => cases hxy.pos.false
514514
| coe y =>
515515
cases x with
516-
| zero => refine ⟨0, zero_le _
516+
| zero => refine ⟨0, zero_le⟩
517517
| coe x => simpa [← WithZero.coe_pow] using (MulArchimedean.arch x (by simpa using hxy))

Mathlib/Algebra/Order/GroupWithZero/Canonical.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ instance instBoundedOrder [OrderTop α] : BoundedOrder (WithZero α) :=
244244
instance : IsBotZeroClass (WithZero α) where
245245
isBot_zero _ := bot_le
246246

247-
-- TODO: deprecate
248-
lemma zero_le (a : WithZero α) : 0 ≤ a := by simp
247+
@[deprecated _root_.zero_le (since := "2026-05-06")]
248+
protected lemma zero_le (a : WithZero α) : 0 ≤ a := by simp
249249

250250
/-- There is a general version `le_zero_iff`, but this lemma does not require a `PartialOrder`. -/
251251
@[simp]
@@ -308,8 +308,8 @@ instance instPreorder : Preorder (WithZero α) := inferInstanceAs <| Preorder (W
308308
instance instMulLeftMono [Mul α] [MulLeftMono α] :
309309
MulLeftMono (WithZero α) := by
310310
refine ⟨fun a b c hbc => ?_⟩
311-
induction a; · exact zero_le _
312-
induction b; · exact zero_le _
311+
induction a; · exact zero_le
312+
induction b; · exact zero_le
313313
rcases WithZero.coe_le_iff.1 hbc with ⟨c, rfl, hbc'⟩
314314
rw [← coe_mul _ c, ← coe_mul, coe_le_coe]
315315
exact mul_le_mul_right hbc' _
@@ -398,7 +398,7 @@ instance instPartialOrder : PartialOrder (WithZero α) :=
398398
instance instMulLeftReflectLT [Mul α] [MulLeftReflectLT α] :
399399
MulLeftReflectLT (WithZero α) := by
400400
refine ⟨fun a b c h => ?_⟩
401-
have := ((zero_le _).trans_lt h).ne'
401+
have := h.ne_zero
402402
induction a
403403
· simp at this
404404
induction c
@@ -511,7 +511,7 @@ instance instCanonicallyOrderedAdd [AddZeroClass α] [Preorder α] [CanonicallyO
511511

512512
instance instLinearOrderedCommMonoidWithZero [CommMonoid α] [LinearOrder α]
513513
[IsOrderedCancelMonoid α] : LinearOrderedCommMonoidWithZero (WithZero α) where
514-
isBot_zero := WithZero.zero_le
514+
isBot_zero _ := zero_le
515515
mul_lt_mul_of_pos_left
516516
| (a : α), _, 0, (c : α), _ => by simp [← WithZero.coe_mul]
517517
| (a : α), _, (b : α), (c : α), hbc => by norm_cast at *; exact mul_lt_mul_right hbc _

Mathlib/FieldTheory/RatFunc/Valuation.lean

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,9 @@ theorem InftyValuation.map_mul' (x y : RatFunc F) :
6868

6969
theorem InftyValuation.map_add_le_max' (x y : RatFunc F) :
7070
inftyValuationDef F (x + y) ≤ max (inftyValuationDef F x) (inftyValuationDef F y) := by
71-
by_cases hx : x = 0
72-
· rw [hx, zero_add]
73-
conv_rhs => rw [inftyValuationDef, if_pos (Eq.refl _)]
74-
rw [max_eq_right (WithZero.zero_le (inftyValuationDef F y))]
75-
· by_cases hy : y = 0
76-
· rw [hy, add_zero]
77-
conv_rhs => rw [max_comm, inftyValuationDef, if_pos (Eq.refl _)]
78-
rw [max_eq_right (WithZero.zero_le (inftyValuationDef F x))]
79-
· by_cases hxy : x + y = 0
80-
· rw [inftyValuationDef, if_pos hxy]; exact zero_le'
81-
· rw [inftyValuationDef, inftyValuationDef, inftyValuationDef, if_neg hx, if_neg hy,
82-
if_neg hxy]
83-
simpa using RatFunc.intDegree_add_le hy hxy
71+
unfold inftyValuationDef
72+
have := @RatFunc.intDegree_add_le F
73+
aesop
8474

8575
@[simp]
8676
theorem inftyValuation_of_nonzero {x : RatFunc F} (hx : x ≠ 0) :

Mathlib/RingTheory/DedekindDomain/AdicValuation.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ theorem intValuation_zero_lt (x : nonZeroDivisors R) : 0 < v.intValuation x := b
204204

205205
/-- The `v`-adic valuation on `R` is bounded above by 1. -/
206206
theorem intValuation_le_one (x : R) : v.intValuation x ≤ 1 := by
207-
by_cases hx : x = 0
208-
· rw [hx, Valuation.map_zero]; exact WithZero.zero_le 1
207+
obtain rfl | hx := eq_or_ne x 0
208+
· simp
209209
· rw [v.intValuation_if_neg hx, ← exp_zero, exp_le_exp, Right.neg_nonpos_iff]
210210
exact Int.natCast_nonneg _
211211

@@ -711,7 +711,7 @@ lemma adicCompletion.mul_nonZeroDivisor_mem_adicCompletionIntegers (v : HeightOn
711711
-- now manually translate the goal (an inequality in ℤᵐ⁰) to an inequality of "log" of ℤ
712712
simp only [map_pow, mem_adicCompletionIntegers, map_mul, this, inv_pow, ← exp_nsmul, nsmul_one,
713713
Int.natCast_natAbs]
714-
exact mul_inv_le_one_of_le₀ (le_exp_log.trans (by simp [le_abs_self])) (zero_le _)
714+
exact mul_inv_le_one_of_le₀ (le_exp_log.trans (by simp [le_abs_self])) zero_le
715715

716716
instance : FaithfulSMul (v.adicCompletionIntegers K) (v.adicCompletion K) :=
717717
Subsemiring.faithfulSMul _

0 commit comments

Comments
 (0)