Skip to content

Commit e2aa38b

Browse files
committed
chore(Algebra/Order/Ring): deprecate Int.cast_natAbs (#28384)
1 parent 19dd350 commit e2aa38b

File tree

7 files changed

+10
-15
lines changed

7 files changed

+10
-15
lines changed

Mathlib/Algebra/Order/Ring/Cast.lean

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,7 @@ lemma nneg_mul_add_sq_of_abs_le_one (n : ℤ) (hx : |x| ≤ 1) : (0 : R) ≤ n *
9999
· simp [le_total 0 x]
100100
· exact Or.inl ⟨mod_cast h.le, hnx h⟩
101101

102-
-- TODO: move to a better place
103-
omit [LinearOrder R] [IsStrictOrderedRing R] in
104-
lemma cast_natAbs : (n.natAbs : R) = |n| := by
105-
cases n
106-
· simp
107-
· rw [abs_eq_natAbs, natAbs_negSucc, cast_succ, cast_natCast, cast_succ]
102+
@[deprecated (since := "2025-11-07")] alias cast_natAbs := Nat.cast_natAbs
108103

109104
end LinearOrderedRing
110105
end Int

Mathlib/Data/NNReal/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ theorem coe_toNNReal_le (x : ℝ) : (toNNReal x : ℝ) ≤ |x| :=
902902

903903
theorem cast_natAbs_eq_nnabs_cast (n : ℤ) : (n.natAbs : ℝ≥0) = nnabs n := by
904904
ext
905-
rw [NNReal.coe_natCast, Int.cast_natAbs, Real.coe_nnabs, Int.cast_abs]
905+
rw [NNReal.coe_natCast, Nat.cast_natAbs, Real.coe_nnabs, Int.cast_abs]
906906

907907
/-- Every real number nonnegative or nonpositive, phrased using `ℝ≥0`. -/
908908
lemma nnreal_dichotomy (r : ℝ) : ∃ x : ℝ≥0, r = x ∨ r = -x := by

Mathlib/NumberTheory/ModularForms/EisensteinSeries/Summable.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ lemma div_max_sq_ge_one (x : Fin 2 → ℤ) (hx : x ≠ 0) :
118118
refine (max_choice (x 0).natAbs (x 1).natAbs).imp (fun H0 ↦ ?_) (fun H1 ↦ ?_)
119119
· have : x 00 := by
120120
rwa [← norm_ne_zero_iff, norm_eq_max_natAbs, H0, Nat.cast_ne_zero, Int.natAbs_ne_zero] at hx
121-
simp only [norm_eq_max_natAbs, H0, Int.cast_natAbs, Int.cast_abs, div_pow, sq_abs, ne_eq,
121+
simp only [norm_eq_max_natAbs, H0, Nat.cast_natAbs, Int.cast_abs, div_pow, sq_abs, ne_eq,
122122
OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, Int.cast_eq_zero, this, div_self,
123123
le_refl]
124124
· have : x 10 := by
125125
rwa [← norm_ne_zero_iff, norm_eq_max_natAbs, H1, Nat.cast_ne_zero, Int.natAbs_ne_zero] at hx
126-
simp only [norm_eq_max_natAbs, H1, Int.cast_natAbs, Int.cast_abs, div_pow, sq_abs, ne_eq,
126+
simp only [norm_eq_max_natAbs, H1, Nat.cast_natAbs, Int.cast_abs, div_pow, sq_abs, ne_eq,
127127
OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, Int.cast_eq_zero, this, div_self,
128128
le_refl]
129129

Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def intNorm (a : integerSet K) : ℕ := (Algebra.norm ℤ (preimageOfMemIntegerS
335335
@[simp]
336336
theorem intNorm_coe (a : integerSet K) :
337337
(intNorm a : ℝ) = mixedEmbedding.norm (a : mixedSpace K) := by
338-
rw [intNorm, Int.cast_natAbs, ← Rat.cast_intCast, Int.cast_abs, Algebra.coe_norm_int,
338+
rw [intNorm, Nat.cast_natAbs, ← Rat.cast_intCast, Int.cast_abs, Algebra.coe_norm_int,
339339
← norm_eq_norm, mixedEmbedding_preimageOfMemIntegerSet]
340340

341341
/-- The norm `intNorm` lifts to a function on `integerSet K` modulo `torsion K`. -/

Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ theorem seq_norm_le (n : ℕ) :
276276
simp only [Nat.lt_one_iff.mp hB, CharP.cast_eq_zero, mul_zero, zero_le]
277277
simp only [ne_eq, seq, map_one, Int.natAbs_one, this]
278278
| succ n =>
279-
rw [← Nat.cast_le (α := ℚ), Int.cast_natAbs, Int.cast_abs, Algebra.coe_norm_int]
279+
rw [← Nat.cast_le (α := ℚ), Nat.cast_natAbs, Int.cast_abs, Algebra.coe_norm_int]
280280
exact (seq_next K w₁ hB (seq K w₁ hB n).prop).choose_spec.2.2
281281

282282
/-- Construct a unit associated to the place `w₁`. The family, for `w₁ ≠ w₀`, formed by the

Mathlib/RingTheory/FractionalIdeal/Norm.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ theorem absNorm_div_norm_eq_absNorm_div_norm {I : FractionalIdeal R⁰ K} (a : R
4646
rw [h, Submonoid.smul_def, Submonoid.smul_def, ← Submodule.ideal_span_singleton_smul,
4747
← Submodule.ideal_span_singleton_smul, ← Submodule.map_smul'', ← Submodule.map_smul'',
4848
(LinearMap.map_injective ?_).eq_iff, smul_eq_mul, smul_eq_mul] at h'
49-
· simp_rw [← Int.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton]
49+
· simp_rw [← Nat.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton]
5050
rw [← map_mul, ← map_mul, mul_comm, ← h', mul_comm]
5151
· exact LinearMap.ker_eq_bot.mpr (IsFractionRing.injective R K)
5252
all_goals simp [Algebra.norm_eq_zero_iff]
@@ -109,7 +109,7 @@ theorem abs_det_basis_change [NoZeroDivisors K] {ι : Type*} [Fintype ι]
109109
let b₀ : Basis ι ℚ K := b.localizationLocalization ℚ ℤ⁰ K
110110
let bI.num : Basis ι ℤ I.num := bI.map
111111
((equivNum (nonZeroDivisors.coe_ne_zero _)).restrictScalars ℤ)
112-
rw [absNorm_eq, ← Ideal.natAbs_det_basis_change b I.num bI.num, Int.cast_natAbs, Int.cast_abs,
112+
rw [absNorm_eq, ← Ideal.natAbs_det_basis_change b I.num bI.num, Nat.cast_natAbs, Int.cast_abs,
113113
Int.cast_abs, Basis.det_apply, Basis.det_apply]
114114
change _ = |algebraMap ℤ ℚ _| / _
115115
rw [RingHom.map_det, show RingHom.mapMatrix (algebraMap ℤ ℚ) (b.toMatrix ((↑) ∘ bI.num)) =
@@ -134,7 +134,7 @@ theorem absNorm_span_singleton [Module.Finite ℚ K] (x : K) :
134134
obtain ⟨d, ⟨r, hr⟩⟩ := IsLocalization.exists_integer_multiple R⁰ x
135135
rw [absNorm_eq' d (Ideal.span {r})]
136136
· rw [Ideal.absNorm_span_singleton]
137-
simp_rw [Int.cast_natAbs, Int.cast_abs, show ((Algebra.norm ℤ _) : ℚ) = algebraMap ℤ ℚ
137+
simp_rw [Nat.cast_natAbs, Int.cast_abs, show ((Algebra.norm ℤ _) : ℚ) = algebraMap ℤ ℚ
138138
(Algebra.norm ℤ _) by rfl, ← Algebra.norm_localization ℤ ℤ⁰ (Sₘ := K) _]
139139
rw [hr, Algebra.smul_def, map_mul, abs_mul, mul_div_assoc, mul_div_cancel₀ _ (by
140140
rw [ne_eq, abs_eq_zero, Algebra.norm_eq_zero_iff, IsFractionRing.to_map_eq_zero_iff]

Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ theorem sub_one_pow_totient_lt_natAbs_cyclotomic_eval {n : ℕ} {q : ℕ} (hn' :
292292
· rw [zero_tsub, zero_pow (Nat.totient_pos.2 (pos_of_gt hn')).ne', pos_iff_ne_zero,
293293
Int.natAbs_ne_zero, Nat.cast_zero, ← coeff_zero_eq_eval_zero, cyclotomic_coeff_zero _ hn']
294294
exact one_ne_zero
295-
rw [← @Nat.cast_lt ℝ, Nat.cast_pow, Nat.cast_sub hq'.le, Nat.cast_one, Int.cast_natAbs]
295+
rw [← @Nat.cast_lt ℝ, Nat.cast_pow, Nat.cast_sub hq'.le, Nat.cast_one, Nat.cast_natAbs]
296296
refine (sub_one_pow_totient_lt_cyclotomic_eval hn' (Nat.one_lt_cast.2 hq')).trans_le ?_
297297
convert (cyclotomic.eval_apply (q : ℤ) n (algebraMap ℤ ℝ)).trans_le (le_abs_self _)
298298
simp

0 commit comments

Comments
 (0)