|
| 1 | +/- |
| 2 | +Copyright (c) 2020 Bryan Gin-ge Chen. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Kevin Lacker, Bryan Gin-ge Chen |
| 5 | +
|
| 6 | +! This file was ported from Lean 3 source module data.int.nat_prime |
| 7 | +! leanprover-community/mathlib commit 422e70f7ce183d2900c586a8cda8381e788a0c62 |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.Data.Nat.Prime |
| 12 | + |
| 13 | +/-! |
| 14 | +# Lemmas about `Nat.Prime` using `Int`s |
| 15 | +-/ |
| 16 | + |
| 17 | + |
| 18 | +open Nat |
| 19 | + |
| 20 | +namespace Int |
| 21 | + |
| 22 | +theorem not_prime_of_int_mul {a b : ℤ} {c : ℕ} (ha : 1 < a.natAbs) (hb : 1 < b.natAbs) |
| 23 | + (hc : a * b = (c : ℤ)) : ¬Nat.Prime c := |
| 24 | + not_prime_mul' (natAbs_mul_natAbs_eq hc) ha hb |
| 25 | +#align int.not_prime_of_int_mul Int.not_prime_of_int_mul |
| 26 | + |
| 27 | +theorem succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : Nat.Prime p) {m n : ℤ} |
| 28 | + {k l : ℕ} (hpm : ↑(p ^ k) ∣ m) (hpn : ↑(p ^ l) ∣ n) (hpmn : ↑(p ^ (k + l + 1)) ∣ m * n) : |
| 29 | + ↑(p ^ (k + 1)) ∣ m ∨ ↑(p ^ (l + 1)) ∣ n := |
| 30 | + have hpm' : p ^ k ∣ m.natAbs := Int.coe_nat_dvd.1 <| Int.dvd_natAbs.2 hpm |
| 31 | + have hpn' : p ^ l ∣ n.natAbs := Int.coe_nat_dvd.1 <| Int.dvd_natAbs.2 hpn |
| 32 | + have hpmn' : p ^ (k + l + 1) ∣ m.natAbs * n.natAbs := by |
| 33 | + rw [← Int.natAbs_mul]; apply Int.coe_nat_dvd.1 <| Int.dvd_natAbs.2 hpmn |
| 34 | + let hsd := Nat.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul p_prime hpm' hpn' hpmn' |
| 35 | + hsd.elim (fun hsd1 => Or.inl (by apply Int.dvd_natAbs.1; apply Int.coe_nat_dvd.2 hsd1)) |
| 36 | + fun hsd2 => Or.inr (by apply Int.dvd_natAbs.1; apply Int.coe_nat_dvd.2 hsd2) |
| 37 | +#align int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul Int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul |
| 38 | + |
| 39 | +theorem Prime.dvd_natAbs_of_coe_dvd_sq {p : ℕ} (hp : p.Prime) (k : ℤ) (h : (p : ℤ) ∣ k ^ 2) : |
| 40 | + p ∣ k.natAbs := by |
| 41 | + apply @Nat.Prime.dvd_of_dvd_pow _ _ 2 hp |
| 42 | + rwa [sq, ← natAbs_mul, ← coe_nat_dvd_left, ← sq] |
| 43 | +#align int.prime.dvd_nat_abs_of_coe_dvd_sq Int.Prime.dvd_natAbs_of_coe_dvd_sq |
0 commit comments