Skip to content

Commit da8db71

Browse files
committed
chore: fix some declarations using coprime (#20982)
Overwhelmingly `isCoprime` is used in names when it is also used in the theorem statement. Here we fix the last instances where `coprime` was used instead. Follow up to #20976. Co-authored-by: Moritz Firsching <firsching@google.com>
1 parent 5eb97b6 commit da8db71

9 files changed

Lines changed: 42 additions & 18 deletions

File tree

Mathlib/FieldTheory/SeparableDegree.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ theorem eq_X_pow_char_pow_sub_C_pow_of_natSepDegree_eq_one (q : ℕ) [ExpChar F
598598
refine ⟨_, n, y, hne, H, ?_⟩
599599
obtain ⟨c, hf, H⟩ := hF.exists_eq_pow_mul_and_not_dvd
600600
rw [hf, natSepDegree_mul_of_isCoprime _ c <| IsCoprime.pow_left <|
601-
(hI.coprime_or_dvd c).resolve_right H, natSepDegree_pow_of_ne_zero _ hne, hD,
601+
(hI.isCoprime_or_dvd c).resolve_right H, natSepDegree_pow_of_ne_zero _ hne, hD,
602602
add_right_eq_self, natSepDegree_eq_zero_iff] at h
603603
simpa only [eq_one_of_monic_natDegree_zero ((hM.pow _).of_mul_monic_left (hf ▸ hm)) h,
604604
mul_one, ← hp] using hf

Mathlib/NumberTheory/DiophantineApproximation/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ This version uses `Real.convergent`. -/
550550
theorem exists_rat_eq_convergent {q : ℚ} (h : |ξ - q| < 1 / (2 * (q.den : ℝ) ^ 2)) :
551551
∃ n, q = ξ.convergent n := by
552552
refine q.num_div_den ▸ exists_rat_eq_convergent' ⟨?_, fun hd => ?_, ?_⟩
553-
· exact coprime_iff_nat_coprime.mpr (natAbs_ofNat q.den ▸ q.reduced)
553+
· exact isCoprime_iff_nat_coprime.mpr (natAbs_ofNat q.den ▸ q.reduced)
554554
· rw [← q.den_eq_one_iff.mp (Nat.cast_eq_one.mp hd)] at h
555555
simpa only [Rat.den_intCast, Nat.cast_one, one_pow, mul_one] using (abs_lt.mp h).1
556556
· obtain ⟨hq₀, hq₁⟩ := aux₀ (Nat.cast_pos.mpr q.pos)

Mathlib/NumberTheory/FLT/Four.lean

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,18 @@ theorem exists_pos_odd_minimal {a b c : ℤ} (h : Fermat42 a b c) :
139139

140140
end Fermat42
141141

142-
theorem Int.coprime_of_sq_sum {r s : ℤ} (h2 : IsCoprime s r) : IsCoprime (r ^ 2 + s ^ 2) r := by
142+
theorem Int.isCoprime_of_sq_sum {r s : ℤ} (h2 : IsCoprime s r) : IsCoprime (r ^ 2 + s ^ 2) r := by
143143
rw [sq, sq]
144144
exact (IsCoprime.mul_left h2 h2).mul_add_left_left r
145145

146-
theorem Int.coprime_of_sq_sum' {r s : ℤ} (h : IsCoprime r s) :
146+
@[deprecated (since := "2025-01-23")] alias Int.coprime_of_sq_sum := Int.isCoprime_of_sq_sum
147+
148+
theorem Int.isCoprime_of_sq_sum' {r s : ℤ} (h : IsCoprime r s) :
147149
IsCoprime (r ^ 2 + s ^ 2) (r * s) := by
148-
apply IsCoprime.mul_right (Int.coprime_of_sq_sum (isCoprime_comm.mp h))
149-
rw [add_comm]; apply Int.coprime_of_sq_sum h
150+
apply IsCoprime.mul_right (Int.isCoprime_of_sq_sum (isCoprime_comm.mp h))
151+
rw [add_comm]; apply Int.isCoprime_of_sq_sum h
152+
153+
@[deprecated (since := "2025-01-23")] alias Int.coprime_of_sq_sum' := Int.isCoprime_of_sq_sum'
150154

151155
namespace Fermat42
152156

@@ -194,7 +198,7 @@ theorem not_minimal {a b c : ℤ} (h : Minimal a b c) (ha2 : a % 2 = 1) (hc : 0
194198
have hcp : Int.gcd m (r * s) = 1 := by
195199
rw [htt3]
196200
exact
197-
Int.gcd_eq_one_iff_coprime.mpr (Int.coprime_of_sq_sum' (Int.gcd_eq_one_iff_coprime.mp htt4))
201+
Int.gcd_eq_one_iff_coprime.mpr (Int.isCoprime_of_sq_sum' (Int.gcd_eq_one_iff_coprime.mp htt4))
198202
-- b is even because b ^ 2 = 2 * m * n.
199203
have hb2 : 2 ∣ b := by
200204
apply @Int.Prime.dvd_pow' _ 2 _ Nat.prime_two

Mathlib/NumberTheory/Zsqrtd/Basic.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ theorem gcd_eq_zero_iff (a : ℤ√d) : Int.gcd a.re a.im = 0 ↔ a = 0 := by
326326
theorem gcd_pos_iff (a : ℤ√d) : 0 < Int.gcd a.re a.im ↔ a ≠ 0 :=
327327
pos_iff_ne_zero.trans <| not_congr a.gcd_eq_zero_iff
328328

329-
theorem coprime_of_dvd_coprime {a b : ℤ√d} (hcoprime : IsCoprime a.re a.im) (hdvd : b ∣ a) :
329+
theorem isCoprime_of_dvd_isCoprime {a b : ℤ√d} (hcoprime : IsCoprime a.re a.im) (hdvd : b ∣ a) :
330330
IsCoprime b.re b.im := by
331331
apply isCoprime_of_dvd
332332
· rintro ⟨hre, him⟩
@@ -342,6 +342,8 @@ theorem coprime_of_dvd_coprime {a b : ℤ√d} (hcoprime : IsCoprime a.re a.im)
342342
exact ⟨hzdvdu, hzdvdv⟩
343343
exact hcoprime.isUnit_of_dvd' ha hb
344344

345+
@[deprecated (since := "2025-01-23")] alias coprime_of_dvd_coprime := isCoprime_of_dvd_isCoprime
346+
345347
theorem exists_coprime_of_gcd_pos {a : ℤ√d} (hgcd : 0 < Int.gcd a.re a.im) :
346348
∃ b : ℤ√d, a = ((Int.gcd a.re a.im : ℤ) : ℤ√d) * b ∧ IsCoprime b.re b.im := by
347349
obtain ⟨re, im, H1, Hre, Him⟩ := Int.exists_gcd_one hgcd

Mathlib/RingTheory/EuclideanDomain.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ theorem dvd_or_coprime (x y : α) (h : Irreducible x) :
9696
x ∣ y ∨ IsCoprime x y :=
9797
letI := Classical.decEq α
9898
letI := EuclideanDomain.gcdMonoid α
99-
_root_.dvd_or_coprime x y h
99+
_root_.dvd_or_isCoprime x y h
100100

101101
end EuclideanDomain
102102

Mathlib/RingTheory/Int/Basic.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ theorem gcd_eq_one_iff_coprime {a b : ℤ} : Int.gcd a b = 1 ↔ IsCoprime a b :
4545
rw [← natCast_dvd_natCast, Int.ofNat_one, ← h]
4646
exact dvd_add ((natCast_dvd.mpr ha).mul_left _) ((natCast_dvd.mpr hb).mul_left _)
4747

48-
theorem coprime_iff_nat_coprime {a b : ℤ} : IsCoprime a b ↔ Nat.Coprime a.natAbs b.natAbs := by
48+
theorem isCoprime_iff_nat_coprime {a b : ℤ} : IsCoprime a b ↔ Nat.Coprime a.natAbs b.natAbs := by
4949
rw [← gcd_eq_one_iff_coprime, Nat.coprime_iff_gcd_eq_one, gcd_eq_natAbs]
5050

51+
@[deprecated (since := "2025-01-23")] alias coprime_iff_nat_coprime := isCoprime_iff_nat_coprime
52+
5153
/-- If `gcd a (m * n) ≠ 1`, then `gcd a m ≠ 1` or `gcd a n ≠ 1`. -/
5254
theorem gcd_ne_one_iff_gcd_mul_right_ne_one {a : ℤ} {m n : ℕ} :
5355
a.gcd (m * n) ≠ 1 ↔ a.gcd m ≠ 1 ∨ a.gcd n ≠ 1 := by
@@ -65,10 +67,12 @@ theorem sq_of_gcd_eq_one {a b c : ℤ} (h : Int.gcd a b = 1) (heq : a * b = c ^
6567
· rw [hu']
6668
simp
6769

68-
theorem sq_of_coprime {a b c : ℤ} (h : IsCoprime a b) (heq : a * b = c ^ 2) :
70+
theorem sq_of_isCoprime {a b c : ℤ} (h : IsCoprime a b) (heq : a * b = c ^ 2) :
6971
∃ a0 : ℤ, a = a0 ^ 2 ∨ a = -a0 ^ 2 :=
7072
sq_of_gcd_eq_one (gcd_eq_one_iff_coprime.mpr h) heq
7173

74+
@[deprecated (since := "2025-01-23")] alias sq_of_coprime := sq_of_isCoprime
75+
7276
theorem natAbs_euclideanDomain_gcd (a b : ℤ) :
7377
Int.natAbs (EuclideanDomain.gcd a b) = Int.gcd a b := by
7478
apply Nat.dvd_antisymm <;> rw [← Int.natCast_dvd_natCast]

Mathlib/RingTheory/Polynomial/Basic.lean

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ theorem linearIndependent_powers_iff_aeval (f : M →ₗ[R] M) (v : M) :
945945
support, coeff, ofFinsupp_eq_zero]
946946
exact Iff.rfl
947947

948-
theorem disjoint_ker_aeval_of_coprime (f : M →ₗ[R] M) {p q : R[X]} (hpq : IsCoprime p q) :
948+
theorem disjoint_ker_aeval_of_isCoprime (f : M →ₗ[R] M) {p q : R[X]} (hpq : IsCoprime p q) :
949949
Disjoint (LinearMap.ker (aeval f p)) (LinearMap.ker (aeval f q)) := by
950950
rw [disjoint_iff_inf_le]
951951
intro v hv
@@ -954,7 +954,10 @@ theorem disjoint_ker_aeval_of_coprime (f : M →ₗ[R] M) {p q : R[X]} (hpq : Is
954954
LinearMap.mem_ker.1 (Submodule.mem_inf.1 hv).2] using
955955
congr_arg (fun p : R[X] => aeval f p v) hpq'.symm
956956

957-
theorem sup_aeval_range_eq_top_of_coprime (f : M →ₗ[R] M) {p q : R[X]} (hpq : IsCoprime p q) :
957+
@[deprecated (since := "2025-01-23")]
958+
alias disjoint_ker_aeval_of_coprime := disjoint_ker_aeval_of_isCoprime
959+
960+
theorem sup_aeval_range_eq_top_of_isCoprime (f : M →ₗ[R] M) {p q : R[X]} (hpq : IsCoprime p q) :
958961
LinearMap.range (aeval f p) ⊔ LinearMap.range (aeval f q) = ⊤ := by
959962
rw [eq_top_iff]
960963
intro v _
@@ -967,6 +970,9 @@ theorem sup_aeval_range_eq_top_of_coprime (f : M →ₗ[R] M) {p q : R[X]} (hpq
967970
simpa only [mul_comm p p', mul_comm q q', aeval_one, aeval_add] using
968971
congr_arg (fun p : R[X] => aeval f p v) hpq'
969972

973+
@[deprecated (since := "2025-01-23")]
974+
alias sup_aeval_range_eq_top_of_coprime := sup_aeval_range_eq_top_of_isCoprime
975+
970976
theorem sup_ker_aeval_le_ker_aeval_mul {f : M →ₗ[R] M} {p q : R[X]} :
971977
LinearMap.ker (aeval f p) ⊔ LinearMap.ker (aeval f q) ≤ LinearMap.ker (aeval f (p * q)) := by
972978
intro v hv

Mathlib/RingTheory/PrincipalIdealDomain.lean

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,23 +392,31 @@ theorem isCoprime_of_dvd (x y : R) (nonzero : ¬(x = 0 ∧ y = 0))
392392
(H : ∀ z ∈ nonunits R, z ≠ 0 → z ∣ x → ¬z ∣ y) : IsCoprime x y :=
393393
(isRelPrime_of_no_nonunits_factors nonzero H).isCoprime
394394

395-
theorem dvd_or_coprime (x y : R) (h : Irreducible x) : x ∣ y ∨ IsCoprime x y :=
395+
theorem dvd_or_isCoprime (x y : R) (h : Irreducible x) : x ∣ y ∨ IsCoprime x y :=
396396
h.dvd_or_isRelPrime.imp_right IsRelPrime.isCoprime
397397

398+
@[deprecated (since := "2025-01-23")] alias dvd_or_coprime := dvd_or_isCoprime
399+
398400
/-- See also `Irreducible.isRelPrime_iff_not_dvd`. -/
399401
theorem Irreducible.coprime_iff_not_dvd {p n : R} (hp : Irreducible p) :
400402
IsCoprime p n ↔ ¬p ∣ n := by rw [← isRelPrime_iff_isCoprime, hp.isRelPrime_iff_not_dvd]
401403

402404
/-- See also `Irreducible.coprime_iff_not_dvd'`. -/
403-
theorem Irreducible.dvd_iff_not_coprime {p n : R} (hp : Irreducible p) : p ∣ n ↔ ¬IsCoprime p n :=
405+
theorem Irreducible.dvd_iff_not_isCoprime {p n : R} (hp : Irreducible p) : p ∣ n ↔ ¬IsCoprime p n :=
404406
iff_not_comm.2 hp.coprime_iff_not_dvd
405407

408+
@[deprecated (since := "2025-01-23")]
409+
alias Irreducible.dvd_iff_not_coprime := Irreducible.dvd_iff_not_isCoprime
410+
406411
theorem Irreducible.coprime_pow_of_not_dvd {p a : R} (m : ℕ) (hp : Irreducible p) (h : ¬p ∣ a) :
407412
IsCoprime a (p ^ m) :=
408413
(hp.coprime_iff_not_dvd.2 h).symm.pow_right
409414

410-
theorem Irreducible.coprime_or_dvd {p : R} (hp : Irreducible p) (i : R) : IsCoprime p i ∨ p ∣ i :=
411-
(_root_.em _).imp_right hp.dvd_iff_not_coprime.2
415+
theorem Irreducible.isCoprime_or_dvd {p : R} (hp : Irreducible p) (i : R) : IsCoprime p i ∨ p ∣ i :=
416+
(_root_.em _).imp_right hp.dvd_iff_not_isCoprime.2
417+
418+
@[deprecated (since := "2025-01-23")]
419+
alias Irreducible.coprime_or_dvd := Irreducible.isCoprime_or_dvd
412420

413421
variable [IsDomain R]
414422

Mathlib/RingTheory/RootsOfUnity/Minpoly.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ theorem minpoly_eq_pow {p : ℕ} [hprime : Fact p.Prime] (hdiv : ¬p ∣ n) :
127127
Polynomial.map_mul]
128128
refine IsCoprime.mul_dvd ?_ ?_ ?_
129129
· have aux := IsPrimitive.Int.irreducible_iff_irreducible_map_cast Pmonic.isPrimitive
130-
refine (dvd_or_coprime _ _ (aux.1 Pirr)).resolve_left ?_
130+
refine (dvd_or_isCoprime _ _ (aux.1 Pirr)).resolve_left ?_
131131
rw [map_dvd_map (Int.castRingHom ℚ) Int.cast_injective Pmonic]
132132
intro hdiv
133133
refine hdiff (eq_of_monic_of_associated Pmonic Qmonic ?_)

0 commit comments

Comments
 (0)