@@ -301,32 +301,18 @@ or.elim (eq_zero_or_pos (gcd k m))
301
301
dvd_of_mul_dvd_mul_left gpos $ by rw [←hd, ←gcd_mul_right]; exact
302
302
dvd_gcd (dvd_mul_right _ _) H⟩)
303
303
304
- lemma dvd_of_pow_dvd_pow : ∀ {a b n : ℕ}, 0 < n → a ^ n ∣ b ^ n → a ∣ b
305
- | a 0 := λ n hn h, dvd_zero _
306
- | a (b+1 ) := λ n hn h,
307
- let d := nat.gcd a (b + 1 ) in
308
- have hd : nat.gcd a (b + 1 ) = d := rfl,
309
- match d, hd with
310
- | 0 := λ hd, (eq_zero_of_gcd_eq_zero_right hd).symm ▸ dvd_zero _
311
- | 1 := λ hd,
312
- begin
313
- have h₁ : a ^ n = 1 := coprime.eq_one_of_dvd (coprime.pow n n hd) h,
314
- have := pow_dvd_pow a hn,
315
- rw [nat.pow_one, h₁] at this ,
316
- exact dvd.trans this (one_dvd _),
317
- end
318
- | (d+2 ) := λ hd,
319
- have (b+1 ) / (d+2 ) < (b+1 ) := div_lt_self dec_trivial dec_trivial,
320
- have ha : a = (d+2 ) * (a / (d+2 )) :=
321
- by rw [← hd, nat.mul_div_cancel' (gcd_dvd_left _ _)],
322
- have hb : (b+1 ) = (d+2 ) * ((b+1 ) / (d+2 )) :=
323
- by rw [← hd, nat.mul_div_cancel' (gcd_dvd_right _ _)],
324
- have a / (d+2 ) ∣ (b+1 ) / (d+2 ) := dvd_of_pow_dvd_pow hn $ dvd_of_mul_dvd_mul_left
325
- (show (d + 2 ) ^ n > 0 , from pos_pow_of_pos _ dec_trivial)
326
- (by rwa [← nat.mul_pow, ← nat.mul_pow, ← ha, ← hb]),
327
- by rw [ha, hb];
328
- exact mul_dvd_mul_left _ this
329
- end
330
- using_well_founded {rel_tac := λ _ _, `[exact ⟨_, measure_wf psigma.snd⟩]}
304
+ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b :=
305
+ begin
306
+ refine ⟨λ h, _, λ h, pow_dvd_pow_of_dvd h _⟩,
307
+ cases eq_zero_or_pos (gcd a b) with g0 g0,
308
+ { simp [eq_zero_of_gcd_eq_zero_right g0, dvd_zero] },
309
+ rcases exists_coprime g0 with ⟨a', b', co, h₁, h₂⟩,
310
+ generalize_hyp : gcd a b = g at g0 h₁ h₂, substs a b,
311
+ rw [mul_pow, mul_pow] at h,
312
+ replace h := dvd_of_mul_dvd_mul_right (pos_pow_of_pos _ g0) h,
313
+ have := pow_dvd_pow a' n0,
314
+ rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this ,
315
+ simp [eq_one_of_dvd_one this ]
316
+ end
331
317
332
318
end nat
0 commit comments