@@ -60,6 +60,9 @@ theorem is_coprime_zero_left : is_coprime 0 x ↔ is_unit x :=
60
60
theorem is_coprime_zero_right : is_coprime x 0 ↔ is_unit x :=
61
61
is_coprime_comm.trans is_coprime_zero_left
62
62
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
+
63
66
theorem is_coprime_one_left : is_coprime 1 x :=
64
67
⟨1 , 0 , by rw [one_mul, zero_mul, add_zero]⟩
65
68
@@ -166,10 +169,37 @@ by { rw [← finset.card_range n, ← finset.prod_const], exact is_coprime.prod_
166
169
theorem is_coprime.pow (H : is_coprime x y) : is_coprime (x ^ m) (y ^ n) :=
167
170
H.pow_left.pow_right
168
171
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
+
169
195
theorem is_coprime.is_unit_of_dvd (H : is_coprime x y) (d : x ∣ y) : is_unit x :=
170
196
let ⟨k, hk⟩ := d in is_coprime_self.1 $ is_coprime.of_mul_right_left $
171
197
show is_coprime x (x * k), from hk ▸ H
172
198
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
+
173
203
theorem is_coprime.map (H : is_coprime x y) {S : Type v} [comm_semiring S] (f : R →+* S) :
174
204
is_coprime (f x) (f y) :=
175
205
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
258
288
lemma mul_add_right_right_iff {x y z : R} : is_coprime x (z * x + y) ↔ is_coprime x y :=
259
289
⟨of_mul_add_right_right, λ h, h.mul_add_right_right z⟩
260
290
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
+
261
313
end comm_ring
262
314
263
315
end is_coprime
0 commit comments