Skip to content

Commit 392a24a

Browse files
committed
chore(Data/Int): Rename coe_nat to natCast (#11637)
Reduce the diff of #11499 ## Renames All in the `Int` namespace: * `ofNat_eq_cast` → `ofNat_eq_natCast` * `cast_eq_cast_iff_Nat` → `natCast_inj` * `natCast_eq_ofNat` → `ofNat_eq_natCast` * `coe_nat_sub` → `natCast_sub` * `coe_nat_nonneg` → `natCast_nonneg` * `sign_coe_add_one` → `sign_natCast_add_one` * `nat_succ_eq_int_succ` → `natCast_succ` * `succ_neg_nat_succ` → `succ_neg_natCast_succ` * `coe_pred_of_pos` → `natCast_pred_of_pos` * `coe_nat_div` → `natCast_div` * `coe_nat_ediv` → `natCast_ediv` * `sign_coe_nat_of_nonzero` → `sign_natCast_of_ne_zero` * `toNat_coe_nat` → `toNat_natCast` * `toNat_coe_nat_add_one` → `toNat_natCast_add_one` * `coe_nat_dvd` → `natCast_dvd_natCast` * `coe_nat_dvd_left` → `natCast_dvd` * `coe_nat_dvd_right` → `dvd_natCast` * `le_coe_nat_sub` → `le_natCast_sub` * `succ_coe_nat_pos` → `succ_natCast_pos` * `coe_nat_modEq_iff` → `natCast_modEq_iff` * `coe_natAbs` → `natCast_natAbs` * `coe_nat_eq_zero` → `natCast_eq_zero` * `coe_nat_ne_zero` → `natCast_ne_zero` * `coe_nat_ne_zero_iff_pos` → `natCast_ne_zero_iff_pos` * `abs_coe_nat` → `abs_natCast` * `coe_nat_nonpos_iff` → `natCast_nonpos_iff` Also rename `Nat.coe_nat_dvd` to `Nat.cast_dvd_cast`
1 parent e048fd6 commit 392a24a

File tree

88 files changed

+338
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+338
-307
lines changed

Archive/Imo/Imo1988Q6.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ theorem imo1988_q6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
207207
clear hk a b
208208
· -- We will now show that the fibers of the solution set are described by a quadratic equation.
209209
intro x y
210-
rw [← Int.coe_nat_inj', ← sub_eq_zero]
210+
rw [← Int.natCast_inj, ← sub_eq_zero]
211211
apply eq_iff_eq_cancel_right.2
212212
simp; ring
213213
· -- Show that the solution set is symmetric in a and b.
@@ -265,7 +265,7 @@ example {a b : ℕ} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^
265265
clear hk a b
266266
· -- We will now show that the fibers of the solution set are described by a quadratic equation.
267267
intro x y
268-
rw [← Int.coe_nat_inj', ← sub_eq_zero]
268+
rw [← Int.natCast_inj, ← sub_eq_zero]
269269
apply eq_iff_eq_cancel_right.2
270270
simp; ring
271271
· -- Show that the solution set is symmetric in a and b.

Archive/Imo/Imo2005Q4.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ theorem imo2005_q4 {k : ℕ} (hk : 0 < k) : (∀ n : ℕ, 1 ≤ n → IsCoprime
6666
have hp : Nat.Prime p := Nat.minFac_prime hk'
6767
replace h : ∀ n, 1 ≤ n → ¬(p : ℤ) ∣ a n := fun n hn ↦ by
6868
have : IsCoprime (a n) p :=
69-
.of_isCoprime_of_dvd_right (h n hn) (Int.coe_nat_dvd.mpr k.minFac_dvd)
69+
.of_isCoprime_of_dvd_right (h n hn) (Int.natCast_dvd_natCast.mpr k.minFac_dvd)
7070
rwa [isCoprime_comm,(Nat.prime_iff_prime_int.mp hp).coprime_iff_not_dvd] at this
7171
-- For `p = 2` and `p = 3`, take `n = 1` and `n = 2`, respectively
7272
by_cases hp2 : p = 2

Archive/Imo/Imo2008Q3.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ theorem p_lemma (p : ℕ) (hpp : Nat.Prime p) (hp_mod_4_eq_1 : p ≡ 1 [MOD 4])
4141
let m := ZMod.valMinAbs y
4242
let n := Int.natAbs m
4343
have hnat₁ : p ∣ n ^ 2 + 1 := by
44-
refine' Int.coe_nat_dvd.mp _
45-
simp only [n, Int.natAbs_sq, Int.coe_nat_pow, Int.ofNat_succ, Int.coe_nat_dvd.mp]
44+
refine' Int.natCast_dvd_natCast.mp _
45+
simp only [n, Int.natAbs_sq, Int.coe_nat_pow, Int.ofNat_succ, Int.natCast_dvd_natCast.mp]
4646
refine' (ZMod.int_cast_zmod_eq_zero_iff_dvd (m ^ 2 + 1) p).mp _
4747
simp only [m, Int.cast_pow, Int.cast_add, Int.cast_one, ZMod.coe_valMinAbs]
4848
rw [pow_two, ← hy]; exact add_left_neg 1

Archive/Wiedijk100Theorems/AbelRuffini.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,20 @@ theorem irreducible_Phi (p : ℕ) (hp : p.Prime) (hpa : p ∣ a) (hpb : p ∣ b)
8686
Irreducible (Φ ℚ a b) := by
8787
rw [← map_Phi a b (Int.castRingHom ℚ), ← IsPrimitive.Int.irreducible_iff_irreducible_map_cast]
8888
apply irreducible_of_eisenstein_criterion
89-
· rwa [span_singleton_prime (Int.coe_nat_ne_zero.mpr hp.ne_zero), Int.prime_iff_natAbs_prime]
89+
· rwa [span_singleton_prime (Int.natCast_ne_zero.mpr hp.ne_zero), Int.prime_iff_natAbs_prime]
9090
· rw [leadingCoeff_Phi, mem_span_singleton]
9191
exact mod_cast mt Nat.dvd_one.mp hp.ne_one
9292
· intro n hn
9393
rw [mem_span_singleton]
9494
rw [degree_Phi] at hn; norm_cast at hn
9595
interval_cases hn : n <;>
96-
simp (config := {decide := true}) only [Φ, coeff_X_pow, coeff_C, Int.coe_nat_dvd.mpr, hpb,
97-
if_true, coeff_C_mul, if_false, coeff_X_zero, hpa, coeff_add, zero_add, mul_zero, coeff_sub,
98-
add_zero, zero_sub, dvd_neg, neg_zero, dvd_mul_of_dvd_left]
96+
simp (config := {decide := true}) only [Φ, coeff_X_pow, coeff_C, Int.natCast_dvd_natCast.mpr,
97+
hpb, if_true, coeff_C_mul, if_false, coeff_X_zero, hpa, coeff_add, zero_add, mul_zero,
98+
coeff_sub, add_zero, zero_sub, dvd_neg, neg_zero, dvd_mul_of_dvd_left]
9999
· simp only [degree_Phi, ← WithBot.coe_zero, WithBot.coe_lt_coe, Nat.succ_pos']
100100
decide
101101
· rw [coeff_zero_Phi, span_singleton_pow, mem_span_singleton]
102-
exact mt Int.coe_nat_dvd.mp hp2b
102+
exact mt Int.natCast_dvd_natCast.mp hp2b
103103
all_goals exact Monic.isPrimitive (monic_Phi a b)
104104
#align abel_ruffini.irreducible_Phi AbelRuffini.irreducible_Phi
105105

Mathlib/Algebra/CharP/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ theorem CharP.int_cast_eq_zero_iff [AddGroupWithOne R] (p : ℕ) [CharP R p] (a
145145
rcases lt_trichotomy a 0 with (h | rfl | h)
146146
· rw [← neg_eq_zero, ← Int.cast_neg, ← dvd_neg]
147147
lift -a to ℕ using neg_nonneg.mpr (le_of_lt h) with b
148-
rw [Int.cast_ofNat, CharP.cast_eq_zero_iff R p, Int.coe_nat_dvd]
148+
rw [Int.cast_ofNat, CharP.cast_eq_zero_iff R p, Int.natCast_dvd_natCast]
149149
· simp only [Int.cast_zero, eq_self_iff_true, dvd_zero]
150150
· lift a to ℕ using le_of_lt h with b
151-
rw [Int.cast_ofNat, CharP.cast_eq_zero_iff R p, Int.coe_nat_dvd]
151+
rw [Int.cast_ofNat, CharP.cast_eq_zero_iff R p, Int.natCast_dvd_natCast]
152152
#align char_p.int_cast_eq_zero_iff CharP.int_cast_eq_zero_iff
153153

154154
theorem CharP.intCast_eq_intCast [AddGroupWithOne R] (p : ℕ) [CharP R p] {a b : ℤ} :

Mathlib/Algebra/CharP/CharAndCard.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ theorem prime_dvd_char_iff_dvd_card {R : Type*} [CommRing R] [Fintype R] (p :
6060
refine'
6161
fun h =>
6262
h.trans <|
63-
Int.coe_nat_dvd.mp <|
63+
Int.natCast_dvd_natCast.mp <|
6464
(CharP.int_cast_eq_zero_iff R (ringChar R) (Fintype.card R)).mp <|
6565
mod_cast CharP.cast_card_eq_zero R,
6666
fun h => _⟩

Mathlib/Algebra/CharZero/Quotient.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ theorem zsmul_mem_zmultiples_iff_exists_sub_div {r : R} {z : ℤ} (hz : z ≠ 0)
4242
theorem nsmul_mem_zmultiples_iff_exists_sub_div {r : R} {n : ℕ} (hn : n ≠ 0) :
4343
n • r ∈ AddSubgroup.zmultiples p ↔
4444
∃ k : Fin n, r - (k : ℕ) • (p / n : R) ∈ AddSubgroup.zmultiples p := by
45-
rw [← natCast_zsmul r, zsmul_mem_zmultiples_iff_exists_sub_div (Int.coe_nat_ne_zero.mpr hn),
45+
rw [← natCast_zsmul r, zsmul_mem_zmultiples_iff_exists_sub_div (Int.natCast_ne_zero.mpr hn),
4646
Int.cast_ofNat]
4747
rfl
4848
#align add_subgroup.nsmul_mem_zmultiples_iff_exists_sub_div AddSubgroup.nsmul_mem_zmultiples_iff_exists_sub_div
@@ -67,7 +67,7 @@ theorem zmultiples_zsmul_eq_zsmul_iff {ψ θ : R ⧸ AddSubgroup.zmultiples p} {
6767
theorem zmultiples_nsmul_eq_nsmul_iff {ψ θ : R ⧸ AddSubgroup.zmultiples p} {n : ℕ} (hz : n ≠ 0) :
6868
n • ψ = n • θ ↔ ∃ k : Fin n, ψ = θ + (k : ℕ) • (p / n : R) := by
6969
rw [← natCast_zsmul ψ, ← natCast_zsmul θ,
70-
zmultiples_zsmul_eq_zsmul_iff (Int.coe_nat_ne_zero.mpr hz), Int.cast_ofNat]
70+
zmultiples_zsmul_eq_zsmul_iff (Int.natCast_ne_zero.mpr hz), Int.cast_ofNat]
7171
rfl
7272
#align quotient_add_group.zmultiples_nsmul_eq_nsmul_iff QuotientAddGroup.zmultiples_nsmul_eq_nsmul_iff
7373

Mathlib/Algebra/ModEq.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ lemma intCast_modEq_intCast' {a b : ℤ} {n : ℕ} : a ≡ b [PMOD (n : α)] ↔
328328

329329
@[simp, norm_cast]
330330
theorem natCast_modEq_natCast {a b n : ℕ} : a ≡ b [PMOD (n : α)] ↔ a ≡ b [MOD n] := by
331-
simp_rw [← Int.coe_nat_modEq_iff, ← modEq_iff_int_modEq, ← @intCast_modEq_intCast α,
331+
simp_rw [← Int.natCast_modEq_iff, ← modEq_iff_int_modEq, ← @intCast_modEq_intCast α,
332332
Int.cast_ofNat]
333333
#align add_comm_group.nat_cast_modeq_nat_cast AddCommGroup.natCast_modEq_natCast
334334

Mathlib/Algebra/Order/Field/Power.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ theorem Nat.zpow_ne_zero_of_pos {a : ℕ} (h : 0 < a) (n : ℤ) : (a : α) ^ n
5656
#align nat.zpow_ne_zero_of_pos Nat.zpow_ne_zero_of_pos
5757

5858
theorem one_lt_zpow (ha : 1 < a) : ∀ n : ℤ, 0 < n → 1 < a ^ n
59-
| (n : ℕ), h => (zpow_natCast _ _).symm.subst (one_lt_pow ha <| Int.coe_nat_ne_zero.mp h.ne')
59+
| (n : ℕ), h => (zpow_natCast _ _).symm.subst (one_lt_pow ha <| Int.natCast_ne_zero.mp h.ne')
6060
| -[_+1], h => ((Int.negSucc_not_pos _).mp h).elim
6161
#align one_lt_zpow one_lt_zpow
6262

Mathlib/Algebra/Order/Floor.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,8 @@ theorem fract_div_intCast_eq_div_intCast_mod {m : ℤ} {n : ℕ} :
11511151
have : ∀ {l : ℤ}, 0 ≤ l → fract ((l : k) / n) = ↑(l % n) / n := by
11521152
intros l hl
11531153
obtain ⟨l₀, rfl | rfl⟩ := l.eq_nat_or_neg
1154-
· rw [cast_ofNat, ← coe_nat_mod, cast_ofNat, fract_div_natCast_eq_div_natCast_mod]
1155-
· rw [Right.nonneg_neg_iff, coe_nat_nonpos_iff] at hl
1154+
· rw [cast_ofNat, ← natCast_mod, cast_ofNat, fract_div_natCast_eq_div_natCast_mod]
1155+
· rw [Right.nonneg_neg_iff, natCast_nonpos_iff] at hl
11561156
simp [hl, zero_mod]
11571157
obtain ⟨m₀, rfl | rfl⟩ := m.eq_nat_or_neg
11581158
· exact this (ofNat_nonneg m₀)

0 commit comments

Comments
 (0)