Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit a880ea4

Browse files
feat(ring_theory/coprime): add some lemmas (#7650)
1 parent c3dcb7d commit a880ea4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/ring_theory/coprime.lean

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ theorem is_coprime_zero_left : is_coprime 0 x ↔ is_unit x :=
6060
theorem is_coprime_zero_right : is_coprime x 0 ↔ is_unit x :=
6161
is_coprime_comm.trans is_coprime_zero_left
6262

63+
lemma not_coprime_zero_zero [nontrivial R] : ¬ is_coprime (0 : R) 0 :=
64+
mt is_coprime_zero_right.mp not_is_unit_zero
65+
6366
theorem is_coprime_one_left : is_coprime 1 x :=
6467
1, 0, by rw [one_mul, zero_mul, add_zero]⟩
6568

@@ -166,10 +169,37 @@ by { rw [← finset.card_range n, ← finset.prod_const], exact is_coprime.prod_
166169
theorem is_coprime.pow (H : is_coprime x y) : is_coprime (x ^ m) (y ^ n) :=
167170
H.pow_left.pow_right
168171

172+
theorem is_coprime.pow_left_iff (hm : 0 < m) : is_coprime (x ^ m) y ↔ is_coprime x y :=
173+
begin
174+
refine ⟨λ h, _, is_coprime.pow_left⟩,
175+
rw [← finset.card_range m, ← finset.prod_const] at h,
176+
exact h.of_prod_left 0 (finset.mem_range.mpr hm),
177+
end
178+
179+
theorem is_coprime.pow_right_iff (hm : 0 < m) : is_coprime x (y ^ m) ↔ is_coprime x y :=
180+
is_coprime_comm.trans $ (is_coprime.pow_left_iff hm).trans $ is_coprime_comm
181+
182+
theorem is_coprime.pow_iff (hm : 0 < m) (hn : 0 < n) :
183+
is_coprime (x ^ m) (y ^ n) ↔ is_coprime x y :=
184+
(is_coprime.pow_left_iff hm).trans $ is_coprime.pow_right_iff hn
185+
186+
theorem is_coprime.of_coprime_of_dvd_left (h : is_coprime y z) (hdvd : x ∣ y) : is_coprime x z :=
187+
begin
188+
obtain ⟨d, rfl⟩ := hdvd,
189+
exact is_coprime.of_mul_left_left h
190+
end
191+
192+
theorem is_coprime.of_coprime_of_dvd_right (h : is_coprime z y) (hdvd : x ∣ y) : is_coprime z x :=
193+
(h.symm.of_coprime_of_dvd_left hdvd).symm
194+
169195
theorem is_coprime.is_unit_of_dvd (H : is_coprime x y) (d : x ∣ y) : is_unit x :=
170196
let ⟨k, hk⟩ := d in is_coprime_self.1 $ is_coprime.of_mul_right_left $
171197
show is_coprime x (x * k), from hk ▸ H
172198

199+
theorem is_coprime.is_unit_of_dvd' {a b x : R} (h : is_coprime a b) (ha : x ∣ a) (hb : x ∣ b) :
200+
is_unit x :=
201+
(h.of_coprime_of_dvd_left ha).is_unit_of_dvd hb
202+
173203
theorem is_coprime.map (H : is_coprime x y) {S : Type v} [comm_semiring S] (f : R →+* S) :
174204
is_coprime (f x) (f y) :=
175205
let ⟨a, b, h⟩ := H in ⟨f a, f b, by rw [← f.map_mul, ← f.map_mul, ← f.map_add, h, f.map_one]⟩
@@ -258,6 +288,28 @@ lemma mul_add_left_right_iff {x y z : R} : is_coprime x (x * z + y) ↔ is_copri
258288
lemma mul_add_right_right_iff {x y z : R} : is_coprime x (z * x + y) ↔ is_coprime x y :=
259289
⟨of_mul_add_right_right, λ h, h.mul_add_right_right z⟩
260290

291+
lemma neg_left {x y : R} (h : is_coprime x y) : is_coprime (-x) y :=
292+
begin
293+
obtain ⟨a, b, h⟩ := h,
294+
use [-a, b],
295+
rwa neg_mul_neg,
296+
end
297+
298+
lemma neg_left_iff (x y : R) : is_coprime (-x) y ↔ is_coprime x y :=
299+
⟨λ h, neg_neg x ▸ h.neg_left, neg_left⟩
300+
301+
lemma neg_right {x y : R} (h : is_coprime x y) : is_coprime x (-y) :=
302+
h.symm.neg_left.symm
303+
304+
lemma neg_right_iff (x y : R) : is_coprime x (-y) ↔ is_coprime x y :=
305+
⟨λ h, neg_neg y ▸ h.neg_right, neg_right⟩
306+
307+
lemma neg_neg {x y : R} (h : is_coprime x y) : is_coprime (-x) (-y) :=
308+
h.neg_left.neg_right
309+
310+
lemma neg_neg_iff (x y : R) : is_coprime (-x) (-y) ↔ is_coprime x y :=
311+
(neg_left_iff _ _).trans (neg_right_iff _ _)
312+
261313
end comm_ring
262314

263315
end is_coprime

0 commit comments

Comments
 (0)