data.nat.gcd.basic
⟷
Mathlib.Data.Nat.GCD.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
A few convenience shortcuts for dvd
along with some simple nat
lemmas. Also
neg_dvd_of_dvd
/dvd_of_neg_dvd
/dvd_neg_of_dvd
/dvd_of_dvd_neg
in favor of the aforementioned shortcuts.dvd_neg
/neg_dvd
.int.of_nat_dvd_of_dvd_nat_abs
/int.dvd_nat_abs_of_of_nat_dvd
because they are the two directions of int.coe_nat_dvd_left
.group_with_zero.to_cancel_monoid_with_zero
from algebra.group_with_zero.units.basic
back to algebra.group_with_zero.basic
. It was erroneously moved during the Great Splits.@@ -266,6 +266,9 @@ dvd_antisymm
theorem lcm_ne_zero {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) : lcm m n ≠ 0 :=
by { intro h, simpa [h, hm, hn] using gcd_mul_lcm m n, }
+lemma lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n :=
+by { simp_rw pos_iff_ne_zero, exact lcm_ne_zero }
+
/-!
### `coprime`
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
@@ -104,9 +104,9 @@ end
theorem gcd_div {m n k : ℕ} (H1 : k ∣ m) (H2 : k ∣ n) :
gcd (m / k) (n / k) = gcd m n / k :=
-or.elim (nat.eq_zero_or_pos k)
+(decidable.eq_or_ne k 0).elim
(λk0, by rw [k0, nat.div_zero, nat.div_zero, nat.div_zero, gcd_zero_right])
- (λH3, nat.eq_of_mul_eq_mul_right H3 $ by rw [
+ (λH3, mul_right_cancel₀ H3 $ by rw [
nat.div_mul_cancel (dvd_gcd H1 H2), ←gcd_mul_right,
nat.div_mul_cancel H1, nat.div_mul_cancel H2])
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -828,7 +828,7 @@ theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b :=
by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
- rw [pow_succ, Nat.coprime_mul_iff_left]
+ rw [pow_succ', Nat.coprime_mul_iff_left]
exact ⟨And.left, fun hab => ⟨hab, hab.pow_leftₓ _⟩⟩
#align nat.coprime_pow_left_iff Nat.coprime_pow_left_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -119,7 +119,7 @@ theorem gcd_mul_left (m n k : ℕ) : gcd (m * n) (m * k) = m * gcd n k :=
first
| rw [MulZeroClass.mul_zero]
| rw [gcd_zero_left])
- fun k n H IH => by rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
+ fun k n H IH => by rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
#align nat.gcd_mul_left Nat.gcd_mul_left
-/
@@ -150,7 +150,7 @@ theorem eq_zero_of_gcd_eq_zero_left {m n : ℕ} (H : gcd m n = 0) : m = 0 :=
#print Nat.eq_zero_of_gcd_eq_zero_right /-
theorem eq_zero_of_gcd_eq_zero_right {m n : ℕ} (H : gcd m n = 0) : n = 0 := by
- rw [gcd_comm] at H <;> exact eq_zero_of_gcd_eq_zero_left H
+ rw [gcd_comm] at H <;> exact eq_zero_of_gcd_eq_zero_left H
#align nat.eq_zero_of_gcd_eq_zero_right Nat.eq_zero_of_gcd_eq_zero_right
-/
@@ -522,13 +522,13 @@ theorem Coprime.symmetric : Symmetric Coprime := fun m n => Coprime.symm
theorem Coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
by
let t := dvd_gcd (dvd_mul_left k m) H2
- rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
+ rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
#align nat.coprime.dvd_of_dvd_mul_right Nat.Coprime.dvd_of_dvd_mul_right
-/
#print Nat.Coprime.dvd_of_dvd_mul_left /-
theorem Coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
- rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
+ rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
#align nat.coprime.dvd_of_dvd_mul_left Nat.Coprime.dvd_of_dvd_mul_left
-/
@@ -699,7 +699,7 @@ theorem Coprime.mul_right {k m n : ℕ} (H1 : Coprime k m) (H2 : Coprime k n) :
#print Nat.Coprime.coprime_dvd_left /-
theorem Coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n :=
- eq_one_of_dvd_one (by delta coprime at H2 <;> rw [← H2] <;> exact gcd_dvd_gcd_of_dvd_left _ H1)
+ eq_one_of_dvd_one (by delta coprime at H2 <;> rw [← H2] <;> exact gcd_dvd_gcd_of_dvd_left _ H1)
#align nat.coprime.coprime_dvd_left Nat.Coprime.coprime_dvd_left
-/
@@ -738,7 +738,7 @@ theorem Coprime.coprime_div_left {m n a : ℕ} (cmn : Coprime m n) (dvd : a ∣
Coprime (m / a) n := by
by_cases a_split : a = 0
· subst a_split
- rw [zero_dvd_iff] at dvd
+ rw [zero_dvd_iff] at dvd
simpa [dvd] using cmn
· rcases dvd with ⟨k, rfl⟩
rw [Nat.mul_div_cancel_left _ (Nat.pos_of_ne_zero a_split)]
@@ -967,10 +967,10 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
cases' Nat.eq_zero_or_pos (gcd a b) with g0 g0
· simp [eq_zero_of_gcd_eq_zero_right g0]
rcases exists_coprime' g0 with ⟨g, a', b', g0', co, rfl, rfl⟩
- rw [mul_pow, mul_pow] at h
+ rw [mul_pow, mul_pow] at h
replace h := dvd_of_mul_dvd_mul_right (pow_pos g0' _) h
have := pow_dvd_pow a' n0
- rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this
+ rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this
simp [eq_one_of_dvd_one this]
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
-/
@@ -994,9 +994,9 @@ theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.Coprime d)
theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 :=
by
- rw [coprime_iff_gcd_eq_one] at h_ab_coprime
+ rw [coprime_iff_gcd_eq_one] at h_ab_coprime
have h1 := dvd_gcd hka hkb
- rw [h_ab_coprime] at h1
+ rw [h_ab_coprime] at h1
exact nat.dvd_one.mp h1
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-/
@@ -1012,7 +1012,7 @@ theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a
cop.dvd_of_dvd_mul_right
((Nat.dvd_add_iff_right (dvd_mul_left m (n * x))).mpr
((congr_arg _ h).mpr (dvd_mul_right m n)))
- rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
+ rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2014 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
-/
-import Mathbin.Algebra.GroupPower.Basic
-import Mathbin.Algebra.GroupWithZero.Divisibility
-import Mathbin.Data.Nat.Order.Lemmas
+import Algebra.GroupPower.Basic
+import Algebra.GroupWithZero.Divisibility
+import Data.Nat.Order.Lemmas
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -481,113 +481,113 @@ See also `nat.coprime_of_dvd` and `nat.coprime_of_dvd'` to prove `nat.coprime m
-/
-instance (m n : ℕ) : Decidable (coprime m n) := by unfold coprime <;> infer_instance
+instance (m n : ℕ) : Decidable (Coprime m n) := by unfold coprime <;> infer_instance
#print Nat.coprime_iff_gcd_eq_one /-
-theorem coprime_iff_gcd_eq_one {m n : ℕ} : coprime m n ↔ gcd m n = 1 :=
+theorem coprime_iff_gcd_eq_one {m n : ℕ} : Coprime m n ↔ gcd m n = 1 :=
Iff.rfl
#align nat.coprime_iff_gcd_eq_one Nat.coprime_iff_gcd_eq_one
-/
-#print Nat.coprime.gcd_eq_one /-
-theorem coprime.gcd_eq_one {m n : ℕ} (h : coprime m n) : gcd m n = 1 :=
+#print Nat.Coprime.gcd_eq_one /-
+theorem Coprime.gcd_eq_one {m n : ℕ} (h : Coprime m n) : gcd m n = 1 :=
h
-#align nat.coprime.gcd_eq_one Nat.coprime.gcd_eq_one
+#align nat.coprime.gcd_eq_one Nat.Coprime.gcd_eq_one
-/
-#print Nat.coprime.lcm_eq_mul /-
-theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
+#print Nat.Coprime.lcm_eq_mul /-
+theorem Coprime.lcm_eq_mul {m n : ℕ} (h : Coprime m n) : lcm m n = m * n := by
rw [← one_mul (lcm m n), ← h.gcd_eq_one, gcd_mul_lcm]
-#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
+#align nat.coprime.lcm_eq_mul Nat.Coprime.lcm_eq_mul
-/
-#print Nat.coprime.symm /-
-theorem coprime.symm {m n : ℕ} : coprime n m → coprime m n :=
+#print Nat.Coprime.symm /-
+theorem Coprime.symm {m n : ℕ} : Coprime n m → Coprime m n :=
(gcd_comm m n).trans
-#align nat.coprime.symm Nat.coprime.symm
+#align nat.coprime.symm Nat.Coprime.symm
-/
#print Nat.coprime_comm /-
-theorem coprime_comm {m n : ℕ} : coprime n m ↔ coprime m n :=
- ⟨coprime.symm, coprime.symm⟩
+theorem coprime_comm {m n : ℕ} : Coprime n m ↔ Coprime m n :=
+ ⟨Coprime.symm, Coprime.symm⟩
#align nat.coprime_comm Nat.coprime_comm
-/
-#print Nat.coprime.symmetric /-
-theorem coprime.symmetric : Symmetric coprime := fun m n => coprime.symm
-#align nat.coprime.symmetric Nat.coprime.symmetric
+#print Nat.Coprime.symmetric /-
+theorem Coprime.symmetric : Symmetric Coprime := fun m n => Coprime.symm
+#align nat.coprime.symmetric Nat.Coprime.symmetric
-/
-#print Nat.coprime.dvd_of_dvd_mul_right /-
-theorem coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
+#print Nat.Coprime.dvd_of_dvd_mul_right /-
+theorem Coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
by
let t := dvd_gcd (dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
-#align nat.coprime.dvd_of_dvd_mul_right Nat.coprime.dvd_of_dvd_mul_right
+#align nat.coprime.dvd_of_dvd_mul_right Nat.Coprime.dvd_of_dvd_mul_right
-/
-#print Nat.coprime.dvd_of_dvd_mul_left /-
-theorem coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
+#print Nat.Coprime.dvd_of_dvd_mul_left /-
+theorem Coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
-#align nat.coprime.dvd_of_dvd_mul_left Nat.coprime.dvd_of_dvd_mul_left
+#align nat.coprime.dvd_of_dvd_mul_left Nat.Coprime.dvd_of_dvd_mul_left
-/
-#print Nat.coprime.dvd_mul_right /-
-theorem coprime.dvd_mul_right {m n k : ℕ} (H : coprime k n) : k ∣ m * n ↔ k ∣ m :=
+#print Nat.Coprime.dvd_mul_right /-
+theorem Coprime.dvd_mul_right {m n k : ℕ} (H : Coprime k n) : k ∣ m * n ↔ k ∣ m :=
⟨H.dvd_of_dvd_mul_right, fun h => dvd_mul_of_dvd_left h n⟩
-#align nat.coprime.dvd_mul_right Nat.coprime.dvd_mul_right
+#align nat.coprime.dvd_mul_right Nat.Coprime.dvd_mul_right
-/
-#print Nat.coprime.dvd_mul_left /-
-theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k ∣ n :=
+#print Nat.Coprime.dvd_mul_left /-
+theorem Coprime.dvd_mul_left {m n k : ℕ} (H : Coprime k m) : k ∣ m * n ↔ k ∣ n :=
⟨H.dvd_of_dvd_mul_left, fun h => dvd_mul_of_dvd_right h m⟩
-#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
+#align nat.coprime.dvd_mul_left Nat.Coprime.dvd_mul_left
-/
-#print Nat.coprime.gcd_mul_left_cancel /-
-theorem coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : coprime k n) :
+#print Nat.Coprime.gcd_mul_left_cancel /-
+theorem Coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : Coprime k n) :
gcd (k * m) n = gcd m n :=
- have H1 : coprime (gcd (k * m) n) k := by
+ have H1 : Coprime (gcd (k * m) n) k := by
rw [coprime, gcd_assoc, H.symm.gcd_eq_one, gcd_one_right]
dvd_antisymm (dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _))
(gcd_dvd_gcd_mul_left _ _ _)
-#align nat.coprime.gcd_mul_left_cancel Nat.coprime.gcd_mul_left_cancel
+#align nat.coprime.gcd_mul_left_cancel Nat.Coprime.gcd_mul_left_cancel
-/
-#print Nat.coprime.gcd_mul_right_cancel /-
-theorem coprime.gcd_mul_right_cancel (m : ℕ) {k n : ℕ} (H : coprime k n) :
+#print Nat.Coprime.gcd_mul_right_cancel /-
+theorem Coprime.gcd_mul_right_cancel (m : ℕ) {k n : ℕ} (H : Coprime k n) :
gcd (m * k) n = gcd m n := by rw [mul_comm m k, H.gcd_mul_left_cancel m]
-#align nat.coprime.gcd_mul_right_cancel Nat.coprime.gcd_mul_right_cancel
+#align nat.coprime.gcd_mul_right_cancel Nat.Coprime.gcd_mul_right_cancel
-/
-#print Nat.coprime.gcd_mul_left_cancel_right /-
-theorem coprime.gcd_mul_left_cancel_right {k m : ℕ} (n : ℕ) (H : coprime k m) :
+#print Nat.Coprime.gcd_mul_left_cancel_right /-
+theorem Coprime.gcd_mul_left_cancel_right {k m : ℕ} (n : ℕ) (H : Coprime k m) :
gcd m (k * n) = gcd m n := by rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n]
-#align nat.coprime.gcd_mul_left_cancel_right Nat.coprime.gcd_mul_left_cancel_right
+#align nat.coprime.gcd_mul_left_cancel_right Nat.Coprime.gcd_mul_left_cancel_right
-/
-#print Nat.coprime.gcd_mul_right_cancel_right /-
-theorem coprime.gcd_mul_right_cancel_right {k m : ℕ} (n : ℕ) (H : coprime k m) :
+#print Nat.Coprime.gcd_mul_right_cancel_right /-
+theorem Coprime.gcd_mul_right_cancel_right {k m : ℕ} (n : ℕ) (H : Coprime k m) :
gcd m (n * k) = gcd m n := by rw [mul_comm n k, H.gcd_mul_left_cancel_right n]
-#align nat.coprime.gcd_mul_right_cancel_right Nat.coprime.gcd_mul_right_cancel_right
+#align nat.coprime.gcd_mul_right_cancel_right Nat.Coprime.gcd_mul_right_cancel_right
-/
#print Nat.coprime_div_gcd_div_gcd /-
-theorem coprime_div_gcd_div_gcd {m n : ℕ} (H : 0 < gcd m n) : coprime (m / gcd m n) (n / gcd m n) :=
+theorem coprime_div_gcd_div_gcd {m n : ℕ} (H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) :=
by rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H]
#align nat.coprime_div_gcd_div_gcd Nat.coprime_div_gcd_div_gcd
-/
#print Nat.not_coprime_of_dvd_of_dvd /-
theorem not_coprime_of_dvd_of_dvd {m n d : ℕ} (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) :
- ¬coprime m n := fun co =>
+ ¬Coprime m n := fun co =>
not_lt_of_ge (le_of_dvd zero_lt_one <| by rw [← co.gcd_eq_one] <;> exact dvd_gcd Hm Hn) dgt1
#align nat.not_coprime_of_dvd_of_dvd Nat.not_coprime_of_dvd_of_dvd
-/
#print Nat.exists_coprime /-
theorem exists_coprime {m n : ℕ} (H : 0 < gcd m n) :
- ∃ m' n', coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n :=
+ ∃ m' n', Coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n :=
⟨_, _, coprime_div_gcd_div_gcd H, (Nat.div_mul_cancel (gcd_dvd_left m n)).symm,
(Nat.div_mul_cancel (gcd_dvd_right m n)).symm⟩
#align nat.exists_coprime Nat.exists_coprime
@@ -595,7 +595,7 @@ theorem exists_coprime {m n : ℕ} (H : 0 < gcd m n) :
#print Nat.exists_coprime' /-
theorem exists_coprime' {m n : ℕ} (H : 0 < gcd m n) :
- ∃ g m' n', 0 < g ∧ coprime m' n' ∧ m = m' * g ∧ n = n' * g :=
+ ∃ g m' n', 0 < g ∧ Coprime m' n' ∧ m = m' * g ∧ n = n' * g :=
let ⟨m', n', h⟩ := exists_coprime H
⟨_, m', n', H, h⟩
#align nat.exists_coprime' Nat.exists_coprime'
@@ -603,139 +603,139 @@ theorem exists_coprime' {m n : ℕ} (H : 0 < gcd m n) :
#print Nat.coprime_add_self_right /-
@[simp]
-theorem coprime_add_self_right {m n : ℕ} : coprime m (n + m) ↔ coprime m n := by
+theorem coprime_add_self_right {m n : ℕ} : Coprime m (n + m) ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_self_right]
#align nat.coprime_add_self_right Nat.coprime_add_self_right
-/
#print Nat.coprime_self_add_right /-
@[simp]
-theorem coprime_self_add_right {m n : ℕ} : coprime m (m + n) ↔ coprime m n := by
+theorem coprime_self_add_right {m n : ℕ} : Coprime m (m + n) ↔ Coprime m n := by
rw [add_comm, coprime_add_self_right]
#align nat.coprime_self_add_right Nat.coprime_self_add_right
-/
#print Nat.coprime_add_self_left /-
@[simp]
-theorem coprime_add_self_left {m n : ℕ} : coprime (m + n) n ↔ coprime m n := by
+theorem coprime_add_self_left {m n : ℕ} : Coprime (m + n) n ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_self_left]
#align nat.coprime_add_self_left Nat.coprime_add_self_left
-/
#print Nat.coprime_self_add_left /-
@[simp]
-theorem coprime_self_add_left {m n : ℕ} : coprime (m + n) m ↔ coprime n m := by
+theorem coprime_self_add_left {m n : ℕ} : Coprime (m + n) m ↔ Coprime n m := by
rw [coprime, coprime, gcd_self_add_left]
#align nat.coprime_self_add_left Nat.coprime_self_add_left
-/
#print Nat.coprime_add_mul_right_right /-
@[simp]
-theorem coprime_add_mul_right_right (m n k : ℕ) : coprime m (n + k * m) ↔ coprime m n := by
+theorem coprime_add_mul_right_right (m n k : ℕ) : Coprime m (n + k * m) ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_mul_right_right]
#align nat.coprime_add_mul_right_right Nat.coprime_add_mul_right_right
-/
#print Nat.coprime_add_mul_left_right /-
@[simp]
-theorem coprime_add_mul_left_right (m n k : ℕ) : coprime m (n + m * k) ↔ coprime m n := by
+theorem coprime_add_mul_left_right (m n k : ℕ) : Coprime m (n + m * k) ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_mul_left_right]
#align nat.coprime_add_mul_left_right Nat.coprime_add_mul_left_right
-/
#print Nat.coprime_mul_right_add_right /-
@[simp]
-theorem coprime_mul_right_add_right (m n k : ℕ) : coprime m (k * m + n) ↔ coprime m n := by
+theorem coprime_mul_right_add_right (m n k : ℕ) : Coprime m (k * m + n) ↔ Coprime m n := by
rw [coprime, coprime, gcd_mul_right_add_right]
#align nat.coprime_mul_right_add_right Nat.coprime_mul_right_add_right
-/
#print Nat.coprime_mul_left_add_right /-
@[simp]
-theorem coprime_mul_left_add_right (m n k : ℕ) : coprime m (m * k + n) ↔ coprime m n := by
+theorem coprime_mul_left_add_right (m n k : ℕ) : Coprime m (m * k + n) ↔ Coprime m n := by
rw [coprime, coprime, gcd_mul_left_add_right]
#align nat.coprime_mul_left_add_right Nat.coprime_mul_left_add_right
-/
#print Nat.coprime_add_mul_right_left /-
@[simp]
-theorem coprime_add_mul_right_left (m n k : ℕ) : coprime (m + k * n) n ↔ coprime m n := by
+theorem coprime_add_mul_right_left (m n k : ℕ) : Coprime (m + k * n) n ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_mul_right_left]
#align nat.coprime_add_mul_right_left Nat.coprime_add_mul_right_left
-/
#print Nat.coprime_add_mul_left_left /-
@[simp]
-theorem coprime_add_mul_left_left (m n k : ℕ) : coprime (m + n * k) n ↔ coprime m n := by
+theorem coprime_add_mul_left_left (m n k : ℕ) : Coprime (m + n * k) n ↔ Coprime m n := by
rw [coprime, coprime, gcd_add_mul_left_left]
#align nat.coprime_add_mul_left_left Nat.coprime_add_mul_left_left
-/
#print Nat.coprime_mul_right_add_left /-
@[simp]
-theorem coprime_mul_right_add_left (m n k : ℕ) : coprime (k * n + m) n ↔ coprime m n := by
+theorem coprime_mul_right_add_left (m n k : ℕ) : Coprime (k * n + m) n ↔ Coprime m n := by
rw [coprime, coprime, gcd_mul_right_add_left]
#align nat.coprime_mul_right_add_left Nat.coprime_mul_right_add_left
-/
#print Nat.coprime_mul_left_add_left /-
@[simp]
-theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ coprime m n := by
+theorem coprime_mul_left_add_left (m n k : ℕ) : Coprime (n * k + m) n ↔ Coprime m n := by
rw [coprime, coprime, gcd_mul_left_add_left]
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
-/
-#print Nat.coprime.mul /-
-theorem coprime.mul {m n k : ℕ} (H1 : coprime m k) (H2 : coprime n k) : coprime (m * n) k :=
+#print Nat.Coprime.mul /-
+theorem Coprime.mul {m n k : ℕ} (H1 : Coprime m k) (H2 : Coprime n k) : Coprime (m * n) k :=
(H1.gcd_mul_left_cancel n).trans H2
-#align nat.coprime.mul Nat.coprime.mul
+#align nat.coprime.mul Nat.Coprime.mul
-/
-#print Nat.coprime.mul_right /-
-theorem coprime.mul_right {k m n : ℕ} (H1 : coprime k m) (H2 : coprime k n) : coprime k (m * n) :=
+#print Nat.Coprime.mul_right /-
+theorem Coprime.mul_right {k m n : ℕ} (H1 : Coprime k m) (H2 : Coprime k n) : Coprime k (m * n) :=
(H1.symm.mul H2.symm).symm
-#align nat.coprime.mul_right Nat.coprime.mul_right
+#align nat.coprime.mul_right Nat.Coprime.mul_right
-/
-#print Nat.coprime.coprime_dvd_left /-
-theorem coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : coprime k n) : coprime m n :=
+#print Nat.Coprime.coprime_dvd_left /-
+theorem Coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n :=
eq_one_of_dvd_one (by delta coprime at H2 <;> rw [← H2] <;> exact gcd_dvd_gcd_of_dvd_left _ H1)
-#align nat.coprime.coprime_dvd_left Nat.coprime.coprime_dvd_left
+#align nat.coprime.coprime_dvd_left Nat.Coprime.coprime_dvd_left
-/
-#print Nat.coprime.coprime_dvd_right /-
-theorem coprime.coprime_dvd_right {m k n : ℕ} (H1 : n ∣ m) (H2 : coprime k m) : coprime k n :=
+#print Nat.Coprime.coprime_dvd_right /-
+theorem Coprime.coprime_dvd_right {m k n : ℕ} (H1 : n ∣ m) (H2 : Coprime k m) : Coprime k n :=
(H2.symm.coprime_dvd_left H1).symm
-#align nat.coprime.coprime_dvd_right Nat.coprime.coprime_dvd_right
+#align nat.coprime.coprime_dvd_right Nat.Coprime.coprime_dvd_right
-/
-#print Nat.coprime.coprime_mul_left /-
-theorem coprime.coprime_mul_left {k m n : ℕ} (H : coprime (k * m) n) : coprime m n :=
+#print Nat.Coprime.coprime_mul_left /-
+theorem Coprime.coprime_mul_left {k m n : ℕ} (H : Coprime (k * m) n) : Coprime m n :=
H.coprime_dvd_left (dvd_mul_left _ _)
-#align nat.coprime.coprime_mul_left Nat.coprime.coprime_mul_left
+#align nat.coprime.coprime_mul_left Nat.Coprime.coprime_mul_left
-/
-#print Nat.coprime.coprime_mul_right /-
-theorem coprime.coprime_mul_right {k m n : ℕ} (H : coprime (m * k) n) : coprime m n :=
+#print Nat.Coprime.coprime_mul_right /-
+theorem Coprime.coprime_mul_right {k m n : ℕ} (H : Coprime (m * k) n) : Coprime m n :=
H.coprime_dvd_left (dvd_mul_right _ _)
-#align nat.coprime.coprime_mul_right Nat.coprime.coprime_mul_right
+#align nat.coprime.coprime_mul_right Nat.Coprime.coprime_mul_right
-/
-#print Nat.coprime.coprime_mul_left_right /-
-theorem coprime.coprime_mul_left_right {k m n : ℕ} (H : coprime m (k * n)) : coprime m n :=
+#print Nat.Coprime.coprime_mul_left_right /-
+theorem Coprime.coprime_mul_left_right {k m n : ℕ} (H : Coprime m (k * n)) : Coprime m n :=
H.coprime_dvd_right (dvd_mul_left _ _)
-#align nat.coprime.coprime_mul_left_right Nat.coprime.coprime_mul_left_right
+#align nat.coprime.coprime_mul_left_right Nat.Coprime.coprime_mul_left_right
-/
-#print Nat.coprime.coprime_mul_right_right /-
-theorem coprime.coprime_mul_right_right {k m n : ℕ} (H : coprime m (n * k)) : coprime m n :=
+#print Nat.Coprime.coprime_mul_right_right /-
+theorem Coprime.coprime_mul_right_right {k m n : ℕ} (H : Coprime m (n * k)) : Coprime m n :=
H.coprime_dvd_right (dvd_mul_right _ _)
-#align nat.coprime.coprime_mul_right_right Nat.coprime.coprime_mul_right_right
+#align nat.coprime.coprime_mul_right_right Nat.Coprime.coprime_mul_right_right
-/
-#print Nat.coprime.coprime_div_left /-
-theorem coprime.coprime_div_left {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣ m) :
- coprime (m / a) n := by
+#print Nat.Coprime.coprime_div_left /-
+theorem Coprime.coprime_div_left {m n a : ℕ} (cmn : Coprime m n) (dvd : a ∣ m) :
+ Coprime (m / a) n := by
by_cases a_split : a = 0
· subst a_split
rw [zero_dvd_iff] at dvd
@@ -743,89 +743,89 @@ theorem coprime.coprime_div_left {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣
· rcases dvd with ⟨k, rfl⟩
rw [Nat.mul_div_cancel_left _ (Nat.pos_of_ne_zero a_split)]
exact coprime.coprime_mul_left cmn
-#align nat.coprime.coprime_div_left Nat.coprime.coprime_div_left
+#align nat.coprime.coprime_div_left Nat.Coprime.coprime_div_left
-/
-#print Nat.coprime.coprime_div_right /-
-theorem coprime.coprime_div_right {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣ n) :
- coprime m (n / a) :=
- (coprime.coprime_div_left cmn.symm dvd).symm
-#align nat.coprime.coprime_div_right Nat.coprime.coprime_div_right
+#print Nat.Coprime.coprime_div_right /-
+theorem Coprime.coprime_div_right {m n a : ℕ} (cmn : Coprime m n) (dvd : a ∣ n) :
+ Coprime m (n / a) :=
+ (Coprime.coprime_div_left cmn.symm dvd).symm
+#align nat.coprime.coprime_div_right Nat.Coprime.coprime_div_right
-/
#print Nat.coprime_mul_iff_left /-
-theorem coprime_mul_iff_left {k m n : ℕ} : coprime (m * n) k ↔ coprime m k ∧ coprime n k :=
- ⟨fun h => ⟨coprime.coprime_mul_right h, coprime.coprime_mul_left h⟩, fun ⟨h, _⟩ => by
+theorem coprime_mul_iff_left {k m n : ℕ} : Coprime (m * n) k ↔ Coprime m k ∧ Coprime n k :=
+ ⟨fun h => ⟨Coprime.coprime_mul_right h, Coprime.coprime_mul_left h⟩, fun ⟨h, _⟩ => by
rwa [coprime_iff_gcd_eq_one, coprime.gcd_mul_left_cancel n h]⟩
#align nat.coprime_mul_iff_left Nat.coprime_mul_iff_left
-/
#print Nat.coprime_mul_iff_right /-
-theorem coprime_mul_iff_right {k m n : ℕ} : coprime k (m * n) ↔ coprime k m ∧ coprime k n := by
+theorem coprime_mul_iff_right {k m n : ℕ} : Coprime k (m * n) ↔ Coprime k m ∧ Coprime k n := by
simpa only [coprime_comm] using coprime_mul_iff_left
#align nat.coprime_mul_iff_right Nat.coprime_mul_iff_right
-/
-#print Nat.coprime.gcd_left /-
-theorem coprime.gcd_left (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) n :=
+#print Nat.Coprime.gcd_left /-
+theorem Coprime.gcd_left (k : ℕ) {m n : ℕ} (hmn : Coprime m n) : Coprime (gcd k m) n :=
hmn.coprime_dvd_left <| gcd_dvd_right k m
-#align nat.coprime.gcd_left Nat.coprime.gcd_left
+#align nat.coprime.gcd_left Nat.Coprime.gcd_left
-/
-#print Nat.coprime.gcd_right /-
-theorem coprime.gcd_right (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime m (gcd k n) :=
+#print Nat.Coprime.gcd_right /-
+theorem Coprime.gcd_right (k : ℕ) {m n : ℕ} (hmn : Coprime m n) : Coprime m (gcd k n) :=
hmn.coprime_dvd_right <| gcd_dvd_right k n
-#align nat.coprime.gcd_right Nat.coprime.gcd_right
+#align nat.coprime.gcd_right Nat.Coprime.gcd_right
-/
-#print Nat.coprime.gcd_both /-
-theorem coprime.gcd_both (k l : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) (gcd l n) :=
+#print Nat.Coprime.gcd_both /-
+theorem Coprime.gcd_both (k l : ℕ) {m n : ℕ} (hmn : Coprime m n) : Coprime (gcd k m) (gcd l n) :=
(hmn.gcd_left k).gcd_right l
-#align nat.coprime.gcd_both Nat.coprime.gcd_both
+#align nat.coprime.gcd_both Nat.Coprime.gcd_both
-/
-#print Nat.coprime.mul_dvd_of_dvd_of_dvd /-
-theorem coprime.mul_dvd_of_dvd_of_dvd {a n m : ℕ} (hmn : coprime m n) (hm : m ∣ a) (hn : n ∣ a) :
+#print Nat.Coprime.mul_dvd_of_dvd_of_dvd /-
+theorem Coprime.mul_dvd_of_dvd_of_dvd {a n m : ℕ} (hmn : Coprime m n) (hm : m ∣ a) (hn : n ∣ a) :
m * n ∣ a :=
let ⟨k, hk⟩ := hm
hk.symm ▸ mul_dvd_mul_left _ (hmn.symm.dvd_of_dvd_mul_left (hk ▸ hn))
-#align nat.coprime.mul_dvd_of_dvd_of_dvd Nat.coprime.mul_dvd_of_dvd_of_dvd
+#align nat.coprime.mul_dvd_of_dvd_of_dvd Nat.Coprime.mul_dvd_of_dvd_of_dvd
-/
#print Nat.coprime_one_left /-
-theorem coprime_one_left : ∀ n, coprime 1 n :=
+theorem coprime_one_left : ∀ n, Coprime 1 n :=
gcd_one_left
#align nat.coprime_one_left Nat.coprime_one_left
-/
#print Nat.coprime_one_right /-
-theorem coprime_one_right : ∀ n, coprime n 1 :=
+theorem coprime_one_right : ∀ n, Coprime n 1 :=
gcd_one_right
#align nat.coprime_one_right Nat.coprime_one_right
-/
-#print Nat.coprime.pow_left /-
-theorem coprime.pow_left {m k : ℕ} (n : ℕ) (H1 : coprime m k) : coprime (m ^ n) k :=
+#print Nat.Coprime.pow_left /-
+theorem Coprime.pow_left {m k : ℕ} (n : ℕ) (H1 : Coprime m k) : Coprime (m ^ n) k :=
Nat.recOn n (coprime_one_left _) fun n IH => H1.mul IH
-#align nat.coprime.pow_left Nat.coprime.pow_left
+#align nat.coprime.pow_left Nat.Coprime.pow_left
-/
-#print Nat.coprime.pow_right /-
-theorem coprime.pow_right {m k : ℕ} (n : ℕ) (H1 : coprime k m) : coprime k (m ^ n) :=
+#print Nat.Coprime.pow_right /-
+theorem Coprime.pow_right {m k : ℕ} (n : ℕ) (H1 : Coprime k m) : Coprime k (m ^ n) :=
(H1.symm.pow_leftₓ n).symm
-#align nat.coprime.pow_right Nat.coprime.pow_right
+#align nat.coprime.pow_right Nat.Coprime.pow_right
-/
-#print Nat.coprime.pow /-
-theorem coprime.pow {k l : ℕ} (m n : ℕ) (H1 : coprime k l) : coprime (k ^ m) (l ^ n) :=
+#print Nat.Coprime.pow /-
+theorem Coprime.pow {k l : ℕ} (m n : ℕ) (H1 : Coprime k l) : Coprime (k ^ m) (l ^ n) :=
(H1.pow_leftₓ _).pow_right _
-#align nat.coprime.pow Nat.coprime.pow
+#align nat.coprime.pow Nat.Coprime.pow
-/
#print Nat.coprime_pow_left_iff /-
@[simp]
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime (a ^ n) b ↔ Nat.coprime a b :=
+ Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b :=
by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
rw [pow_succ, Nat.coprime_mul_iff_left]
@@ -836,54 +836,54 @@ theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
#print Nat.coprime_pow_right_iff /-
@[simp]
theorem coprime_pow_right_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime a (b ^ n) ↔ Nat.coprime a b := by
+ Nat.Coprime a (b ^ n) ↔ Nat.Coprime a b := by
rw [Nat.coprime_comm, coprime_pow_left_iff hn, Nat.coprime_comm]
#align nat.coprime_pow_right_iff Nat.coprime_pow_right_iff
-/
-#print Nat.coprime.eq_one_of_dvd /-
-theorem coprime.eq_one_of_dvd {k m : ℕ} (H : coprime k m) (d : k ∣ m) : k = 1 := by
+#print Nat.Coprime.eq_one_of_dvd /-
+theorem Coprime.eq_one_of_dvd {k m : ℕ} (H : Coprime k m) (d : k ∣ m) : k = 1 := by
rw [← H.gcd_eq_one, gcd_eq_left d]
-#align nat.coprime.eq_one_of_dvd Nat.coprime.eq_one_of_dvd
+#align nat.coprime.eq_one_of_dvd Nat.Coprime.eq_one_of_dvd
-/
#print Nat.coprime_zero_left /-
@[simp]
-theorem coprime_zero_left (n : ℕ) : coprime 0 n ↔ n = 1 := by simp [coprime]
+theorem coprime_zero_left (n : ℕ) : Coprime 0 n ↔ n = 1 := by simp [coprime]
#align nat.coprime_zero_left Nat.coprime_zero_left
-/
#print Nat.coprime_zero_right /-
@[simp]
-theorem coprime_zero_right (n : ℕ) : coprime n 0 ↔ n = 1 := by simp [coprime]
+theorem coprime_zero_right (n : ℕ) : Coprime n 0 ↔ n = 1 := by simp [coprime]
#align nat.coprime_zero_right Nat.coprime_zero_right
-/
#print Nat.not_coprime_zero_zero /-
-theorem not_coprime_zero_zero : ¬coprime 0 0 := by simp
+theorem not_coprime_zero_zero : ¬Coprime 0 0 := by simp
#align nat.not_coprime_zero_zero Nat.not_coprime_zero_zero
-/
#print Nat.coprime_one_left_iff /-
@[simp]
-theorem coprime_one_left_iff (n : ℕ) : coprime 1 n ↔ True := by simp [coprime]
+theorem coprime_one_left_iff (n : ℕ) : Coprime 1 n ↔ True := by simp [coprime]
#align nat.coprime_one_left_iff Nat.coprime_one_left_iff
-/
#print Nat.coprime_one_right_iff /-
@[simp]
-theorem coprime_one_right_iff (n : ℕ) : coprime n 1 ↔ True := by simp [coprime]
+theorem coprime_one_right_iff (n : ℕ) : Coprime n 1 ↔ True := by simp [coprime]
#align nat.coprime_one_right_iff Nat.coprime_one_right_iff
-/
#print Nat.coprime_self /-
@[simp]
-theorem coprime_self (n : ℕ) : coprime n n ↔ n = 1 := by simp [coprime]
+theorem coprime_self (n : ℕ) : Coprime n n ↔ n = 1 := by simp [coprime]
#align nat.coprime_self Nat.coprime_self
-/
#print Nat.gcd_mul_of_coprime_of_dvd /-
-theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : coprime a c) (b_dvd_c : b ∣ c) :
+theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : Coprime a c) (b_dvd_c : b ∣ c) :
gcd (a * b) c = b :=
by
rcases exists_eq_mul_left_of_dvd b_dvd_c with ⟨d, rfl⟩
@@ -893,12 +893,12 @@ theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : coprime a c) (b_dvd_c : b
#align nat.gcd_mul_of_coprime_of_dvd Nat.gcd_mul_of_coprime_of_dvd
-/
-#print Nat.coprime.eq_of_mul_eq_zero /-
-theorem coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.coprime n) (hmn : m * n = 0) :
+#print Nat.Coprime.eq_of_mul_eq_zero /-
+theorem Coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.Coprime n) (hmn : m * n = 0) :
m = 0 ∧ n = 1 ∨ m = 1 ∧ n = 0 :=
(Nat.eq_zero_of_mul_eq_zero hmn).imp (fun hm => ⟨hm, n.coprime_zero_left.mp <| hm ▸ h⟩) fun hn =>
⟨m.coprime_zero_left.mp <| hn ▸ h.symm, hn⟩
-#align nat.coprime.eq_of_mul_eq_zero Nat.coprime.eq_of_mul_eq_zero
+#align nat.coprime.eq_of_mul_eq_zero Nat.Coprime.eq_of_mul_eq_zero
-/
#print Nat.prodDvdAndDvdOfDvdProd /-
@@ -952,12 +952,12 @@ theorem gcd_mul_dvd_mul_gcd (k m n : ℕ) : gcd k (m * n) ∣ gcd k m * gcd k n
#align nat.gcd_mul_dvd_mul_gcd Nat.gcd_mul_dvd_mul_gcd
-/
-#print Nat.coprime.gcd_mul /-
-theorem coprime.gcd_mul (k : ℕ) {m n : ℕ} (h : coprime m n) : gcd k (m * n) = gcd k m * gcd k n :=
+#print Nat.Coprime.gcd_mul /-
+theorem Coprime.gcd_mul (k : ℕ) {m n : ℕ} (h : Coprime m n) : gcd k (m * n) = gcd k m * gcd k n :=
dvd_antisymm (gcd_mul_dvd_mul_gcd k m n)
((h.gcd_both k k).mul_dvd_of_dvd_of_dvd (gcd_dvd_gcd_mul_right_right _ _ _)
(gcd_dvd_gcd_mul_left_right _ _ _))
-#align nat.coprime.gcd_mul Nat.coprime.gcd_mul
+#align nat.coprime.gcd_mul Nat.Coprime.gcd_mul
-/
#print Nat.pow_dvd_pow_iff /-
@@ -976,10 +976,10 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
-/
#print Nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul /-
-theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d) (h : a * b = c * d) :
+theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.Coprime d) (h : a * b = c * d) :
a.gcd c * b.gcd c = c := by
apply dvd_antisymm
- · apply Nat.coprime.dvd_of_dvd_mul_right (Nat.coprime.mul (cop.gcd_left _) (cop.gcd_left _))
+ · apply Nat.Coprime.dvd_of_dvd_mul_right (Nat.Coprime.mul (cop.gcd_left _) (cop.gcd_left _))
rw [← h]
apply mul_dvd_mul (gcd_dvd _ _).1 (gcd_dvd _ _).1
· rw [gcd_comm a _, gcd_comm b _]
@@ -991,7 +991,7 @@ theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d)
#print Nat.eq_one_of_dvd_coprimes /-
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
-theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka : k ∣ a)
+theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 :=
by
rw [coprime_iff_gcd_eq_one] at h_ab_coprime
@@ -1001,8 +1001,8 @@ theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka :
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-/
-#print Nat.coprime.mul_add_mul_ne_mul /-
-theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
+#print Nat.Coprime.mul_add_mul_ne_mul /-
+theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
a * m + b * n ≠ m * n := by
intro h
obtain ⟨x, rfl⟩ : n ∣ a :=
@@ -1015,7 +1015,7 @@ theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a
rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
-#align nat.coprime.mul_add_mul_ne_mul Nat.coprime.mul_add_mul_ne_mul
+#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
-/
end Nat
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2014 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
-
-! This file was ported from Lean 3 source module data.nat.gcd.basic
-! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.GroupPower.Basic
import Mathbin.Algebra.GroupWithZero.Divisibility
import Mathbin.Data.Nat.Order.Lemmas
+#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
+
/-!
# Definitions and properties of `nat.gcd`, `nat.lcm`, and `nat.coprime`
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -63,15 +63,19 @@ theorem gcd_le_right (m) {n} (h : 0 < n) : gcd m n ≤ n :=
#align nat.gcd_le_right Nat.gcd_le_right
-/
+#print Nat.dvd_gcd /-
theorem dvd_gcd {m n k : ℕ} : k ∣ m → k ∣ n → k ∣ gcd m n :=
gcd.induction m n (fun n _ kn => by rw [gcd_zero_left] <;> exact kn) fun n m mpos IH H1 H2 => by
rw [gcd_rec] <;> exact IH ((dvd_mod_iff H1).2 H2) H1
#align nat.dvd_gcd Nat.dvd_gcd
+-/
+#print Nat.dvd_gcd_iff /-
theorem dvd_gcd_iff {m n k : ℕ} : k ∣ gcd m n ↔ k ∣ m ∧ k ∣ n :=
Iff.intro (fun h => ⟨h.trans (gcd_dvd m n).left, h.trans (gcd_dvd m n).right⟩) fun h =>
dvd_gcd h.left h.right
#align nat.dvd_gcd_iff Nat.dvd_gcd_iff
+-/
#print Nat.gcd_comm /-
theorem gcd_comm (m n : ℕ) : gcd m n = gcd n m :=
@@ -500,28 +504,36 @@ theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
-/
+#print Nat.coprime.symm /-
theorem coprime.symm {m n : ℕ} : coprime n m → coprime m n :=
(gcd_comm m n).trans
#align nat.coprime.symm Nat.coprime.symm
+-/
+#print Nat.coprime_comm /-
theorem coprime_comm {m n : ℕ} : coprime n m ↔ coprime m n :=
⟨coprime.symm, coprime.symm⟩
#align nat.coprime_comm Nat.coprime_comm
+-/
#print Nat.coprime.symmetric /-
theorem coprime.symmetric : Symmetric coprime := fun m n => coprime.symm
#align nat.coprime.symmetric Nat.coprime.symmetric
-/
+#print Nat.coprime.dvd_of_dvd_mul_right /-
theorem coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
by
let t := dvd_gcd (dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
#align nat.coprime.dvd_of_dvd_mul_right Nat.coprime.dvd_of_dvd_mul_right
+-/
+#print Nat.coprime.dvd_of_dvd_mul_left /-
theorem coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
#align nat.coprime.dvd_of_dvd_mul_left Nat.coprime.dvd_of_dvd_mul_left
+-/
#print Nat.coprime.dvd_mul_right /-
theorem coprime.dvd_mul_right {m n k : ℕ} (H : coprime k n) : k ∣ m * n ↔ k ∣ m :=
@@ -535,6 +547,7 @@ theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k
#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
-/
+#print Nat.coprime.gcd_mul_left_cancel /-
theorem coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : coprime k n) :
gcd (k * m) n = gcd m n :=
have H1 : coprime (gcd (k * m) n) k := by
@@ -542,10 +555,13 @@ theorem coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : coprime k
dvd_antisymm (dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _))
(gcd_dvd_gcd_mul_left _ _ _)
#align nat.coprime.gcd_mul_left_cancel Nat.coprime.gcd_mul_left_cancel
+-/
+#print Nat.coprime.gcd_mul_right_cancel /-
theorem coprime.gcd_mul_right_cancel (m : ℕ) {k n : ℕ} (H : coprime k n) :
gcd (m * k) n = gcd m n := by rw [mul_comm m k, H.gcd_mul_left_cancel m]
#align nat.coprime.gcd_mul_right_cancel Nat.coprime.gcd_mul_right_cancel
+-/
#print Nat.coprime.gcd_mul_left_cancel_right /-
theorem coprime.gcd_mul_left_cancel_right {k m : ℕ} (n : ℕ) (H : coprime k m) :
@@ -565,10 +581,12 @@ theorem coprime_div_gcd_div_gcd {m n : ℕ} (H : 0 < gcd m n) : coprime (m / gcd
#align nat.coprime_div_gcd_div_gcd Nat.coprime_div_gcd_div_gcd
-/
+#print Nat.not_coprime_of_dvd_of_dvd /-
theorem not_coprime_of_dvd_of_dvd {m n d : ℕ} (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) :
¬coprime m n := fun co =>
not_lt_of_ge (le_of_dvd zero_lt_one <| by rw [← co.gcd_eq_one] <;> exact dvd_gcd Hm Hn) dgt1
#align nat.not_coprime_of_dvd_of_dvd Nat.not_coprime_of_dvd_of_dvd
+-/
#print Nat.exists_coprime /-
theorem exists_coprime {m n : ℕ} (H : 0 < gcd m n) :
@@ -670,9 +688,11 @@ theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ copr
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
-/
+#print Nat.coprime.mul /-
theorem coprime.mul {m n k : ℕ} (H1 : coprime m k) (H2 : coprime n k) : coprime (m * n) k :=
(H1.gcd_mul_left_cancel n).trans H2
#align nat.coprime.mul Nat.coprime.mul
+-/
#print Nat.coprime.mul_right /-
theorem coprime.mul_right {k m n : ℕ} (H1 : coprime k m) (H2 : coprime k n) : coprime k (m * n) :=
@@ -686,9 +706,11 @@ theorem coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : coprime k n)
#align nat.coprime.coprime_dvd_left Nat.coprime.coprime_dvd_left
-/
+#print Nat.coprime.coprime_dvd_right /-
theorem coprime.coprime_dvd_right {m k n : ℕ} (H1 : n ∣ m) (H2 : coprime k m) : coprime k n :=
(H2.symm.coprime_dvd_left H1).symm
#align nat.coprime.coprime_dvd_right Nat.coprime.coprime_dvd_right
+-/
#print Nat.coprime.coprime_mul_left /-
theorem coprime.coprime_mul_left {k m n : ℕ} (H : coprime (k * m) n) : coprime m n :=
@@ -696,17 +718,23 @@ theorem coprime.coprime_mul_left {k m n : ℕ} (H : coprime (k * m) n) : coprime
#align nat.coprime.coprime_mul_left Nat.coprime.coprime_mul_left
-/
+#print Nat.coprime.coprime_mul_right /-
theorem coprime.coprime_mul_right {k m n : ℕ} (H : coprime (m * k) n) : coprime m n :=
H.coprime_dvd_left (dvd_mul_right _ _)
#align nat.coprime.coprime_mul_right Nat.coprime.coprime_mul_right
+-/
+#print Nat.coprime.coprime_mul_left_right /-
theorem coprime.coprime_mul_left_right {k m n : ℕ} (H : coprime m (k * n)) : coprime m n :=
H.coprime_dvd_right (dvd_mul_left _ _)
#align nat.coprime.coprime_mul_left_right Nat.coprime.coprime_mul_left_right
+-/
+#print Nat.coprime.coprime_mul_right_right /-
theorem coprime.coprime_mul_right_right {k m n : ℕ} (H : coprime m (n * k)) : coprime m n :=
H.coprime_dvd_right (dvd_mul_right _ _)
#align nat.coprime.coprime_mul_right_right Nat.coprime.coprime_mul_right_right
+-/
#print Nat.coprime.coprime_div_left /-
theorem coprime.coprime_div_left {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣ m) :
@@ -728,10 +756,12 @@ theorem coprime.coprime_div_right {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣
#align nat.coprime.coprime_div_right Nat.coprime.coprime_div_right
-/
+#print Nat.coprime_mul_iff_left /-
theorem coprime_mul_iff_left {k m n : ℕ} : coprime (m * n) k ↔ coprime m k ∧ coprime n k :=
⟨fun h => ⟨coprime.coprime_mul_right h, coprime.coprime_mul_left h⟩, fun ⟨h, _⟩ => by
rwa [coprime_iff_gcd_eq_one, coprime.gcd_mul_left_cancel n h]⟩
#align nat.coprime_mul_iff_left Nat.coprime_mul_iff_left
+-/
#print Nat.coprime_mul_iff_right /-
theorem coprime_mul_iff_right {k m n : ℕ} : coprime k (m * n) ↔ coprime k m ∧ coprime k n := by
@@ -739,23 +769,31 @@ theorem coprime_mul_iff_right {k m n : ℕ} : coprime k (m * n) ↔ coprime k m
#align nat.coprime_mul_iff_right Nat.coprime_mul_iff_right
-/
+#print Nat.coprime.gcd_left /-
theorem coprime.gcd_left (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) n :=
hmn.coprime_dvd_left <| gcd_dvd_right k m
#align nat.coprime.gcd_left Nat.coprime.gcd_left
+-/
+#print Nat.coprime.gcd_right /-
theorem coprime.gcd_right (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime m (gcd k n) :=
hmn.coprime_dvd_right <| gcd_dvd_right k n
#align nat.coprime.gcd_right Nat.coprime.gcd_right
+-/
+#print Nat.coprime.gcd_both /-
theorem coprime.gcd_both (k l : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) (gcd l n) :=
(hmn.gcd_left k).gcd_right l
#align nat.coprime.gcd_both Nat.coprime.gcd_both
+-/
+#print Nat.coprime.mul_dvd_of_dvd_of_dvd /-
theorem coprime.mul_dvd_of_dvd_of_dvd {a n m : ℕ} (hmn : coprime m n) (hm : m ∣ a) (hn : n ∣ a) :
m * n ∣ a :=
let ⟨k, hk⟩ := hm
hk.symm ▸ mul_dvd_mul_left _ (hmn.symm.dvd_of_dvd_mul_left (hk ▸ hn))
#align nat.coprime.mul_dvd_of_dvd_of_dvd Nat.coprime.mul_dvd_of_dvd_of_dvd
+-/
#print Nat.coprime_one_left /-
theorem coprime_one_left : ∀ n, coprime 1 n :=
@@ -775,9 +813,11 @@ theorem coprime.pow_left {m k : ℕ} (n : ℕ) (H1 : coprime m k) : coprime (m ^
#align nat.coprime.pow_left Nat.coprime.pow_left
-/
+#print Nat.coprime.pow_right /-
theorem coprime.pow_right {m k : ℕ} (n : ℕ) (H1 : coprime k m) : coprime k (m ^ n) :=
(H1.symm.pow_leftₓ n).symm
#align nat.coprime.pow_right Nat.coprime.pow_right
+-/
#print Nat.coprime.pow /-
theorem coprime.pow {k l : ℕ} (m n : ℕ) (H1 : coprime k l) : coprime (k ^ m) (l ^ n) :=
@@ -915,11 +955,13 @@ theorem gcd_mul_dvd_mul_gcd (k m n : ℕ) : gcd k (m * n) ∣ gcd k m * gcd k n
#align nat.gcd_mul_dvd_mul_gcd Nat.gcd_mul_dvd_mul_gcd
-/
+#print Nat.coprime.gcd_mul /-
theorem coprime.gcd_mul (k : ℕ) {m n : ℕ} (h : coprime m n) : gcd k (m * n) = gcd k m * gcd k n :=
dvd_antisymm (gcd_mul_dvd_mul_gcd k m n)
((h.gcd_both k k).mul_dvd_of_dvd_of_dvd (gcd_dvd_gcd_mul_right_right _ _ _)
(gcd_dvd_gcd_mul_left_right _ _ _))
#align nat.coprime.gcd_mul Nat.coprime.gcd_mul
+-/
#print Nat.pow_dvd_pow_iff /-
theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b :=
@@ -936,6 +978,7 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
-/
+#print Nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul /-
theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d) (h : a * b = c * d) :
a.gcd c * b.gcd c = c := by
apply dvd_antisymm
@@ -947,6 +990,7 @@ theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d)
rw [h, gcd_mul_right_right d c]
apply gcd_mul_dvd_mul_gcd
#align nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul Nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul
+-/
#print Nat.eq_one_of_dvd_coprimes /-
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -112,8 +112,13 @@ theorem gcd_one_right (n : ℕ) : gcd n 1 = 1 :=
#print Nat.gcd_mul_left /-
theorem gcd_mul_left (m n k : ℕ) : gcd (m * n) (m * k) = m * gcd n k :=
- gcd.induction n k (fun k => by repeat' first |rw [MulZeroClass.mul_zero]|rw [gcd_zero_left])
- fun k n H IH => by rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
+ gcd.induction n k
+ (fun k => by
+ repeat'
+ first
+ | rw [MulZeroClass.mul_zero]
+ | rw [gcd_zero_left])
+ fun k n H IH => by rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
#align nat.gcd_mul_left Nat.gcd_mul_left
-/
@@ -144,7 +149,7 @@ theorem eq_zero_of_gcd_eq_zero_left {m n : ℕ} (H : gcd m n = 0) : m = 0 :=
#print Nat.eq_zero_of_gcd_eq_zero_right /-
theorem eq_zero_of_gcd_eq_zero_right {m n : ℕ} (H : gcd m n = 0) : n = 0 := by
- rw [gcd_comm] at H <;> exact eq_zero_of_gcd_eq_zero_left H
+ rw [gcd_comm] at H <;> exact eq_zero_of_gcd_eq_zero_left H
#align nat.eq_zero_of_gcd_eq_zero_right Nat.eq_zero_of_gcd_eq_zero_right
-/
@@ -511,11 +516,11 @@ theorem coprime.symmetric : Symmetric coprime := fun m n => coprime.symm
theorem coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
by
let t := dvd_gcd (dvd_mul_left k m) H2
- rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
+ rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
#align nat.coprime.dvd_of_dvd_mul_right Nat.coprime.dvd_of_dvd_mul_right
theorem coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
- rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
+ rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
#align nat.coprime.dvd_of_dvd_mul_left Nat.coprime.dvd_of_dvd_mul_left
#print Nat.coprime.dvd_mul_right /-
@@ -677,7 +682,7 @@ theorem coprime.mul_right {k m n : ℕ} (H1 : coprime k m) (H2 : coprime k n) :
#print Nat.coprime.coprime_dvd_left /-
theorem coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : coprime k n) : coprime m n :=
- eq_one_of_dvd_one (by delta coprime at H2 <;> rw [← H2] <;> exact gcd_dvd_gcd_of_dvd_left _ H1)
+ eq_one_of_dvd_one (by delta coprime at H2 <;> rw [← H2] <;> exact gcd_dvd_gcd_of_dvd_left _ H1)
#align nat.coprime.coprime_dvd_left Nat.coprime.coprime_dvd_left
-/
@@ -708,7 +713,7 @@ theorem coprime.coprime_div_left {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣
coprime (m / a) n := by
by_cases a_split : a = 0
· subst a_split
- rw [zero_dvd_iff] at dvd
+ rw [zero_dvd_iff] at dvd
simpa [dvd] using cmn
· rcases dvd with ⟨k, rfl⟩
rw [Nat.mul_div_cancel_left _ (Nat.pos_of_ne_zero a_split)]
@@ -872,8 +877,8 @@ def prodDvdAndDvdOfDvdProd {m n k : ℕ} (H : k ∣ m * n) :
obtain rfl : k = 0 := eq_zero_of_gcd_eq_zero_left h0
obtain rfl : m = 0 := eq_zero_of_gcd_eq_zero_right h0
exact ⟨⟨⟨0, dvd_refl 0⟩, ⟨n, dvd_refl n⟩⟩, (MulZeroClass.zero_mul n).symm⟩
- case
- succ tmp =>
+ case succ
+ tmp =>
have hpos : 0 < gcd k m := h0.symm ▸ Nat.zero_lt_succ _ <;> clear h0 tmp
have hd : gcd k m * (k / gcd k m) = k := Nat.mul_div_cancel' (gcd_dvd_left k m)
refine' ⟨⟨⟨gcd k m, gcd_dvd_right k m⟩, ⟨k / gcd k m, _⟩⟩, hd.symm⟩
@@ -923,10 +928,10 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
cases' Nat.eq_zero_or_pos (gcd a b) with g0 g0
· simp [eq_zero_of_gcd_eq_zero_right g0]
rcases exists_coprime' g0 with ⟨g, a', b', g0', co, rfl, rfl⟩
- rw [mul_pow, mul_pow] at h
+ rw [mul_pow, mul_pow] at h
replace h := dvd_of_mul_dvd_mul_right (pow_pos g0' _) h
have := pow_dvd_pow a' n0
- rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this
+ rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this
simp [eq_one_of_dvd_one this]
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
-/
@@ -948,9 +953,9 @@ theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d)
theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 :=
by
- rw [coprime_iff_gcd_eq_one] at h_ab_coprime
+ rw [coprime_iff_gcd_eq_one] at h_ab_coprime
have h1 := dvd_gcd hka hkb
- rw [h_ab_coprime] at h1
+ rw [h_ab_coprime] at h1
exact nat.dvd_one.mp h1
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-/
@@ -966,7 +971,7 @@ theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a
cop.dvd_of_dvd_mul_right
((Nat.dvd_add_iff_right (dvd_mul_left m (n * x))).mpr
((congr_arg _ h).mpr (dvd_mul_right m n)))
- rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
+ rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
#align nat.coprime.mul_add_mul_ne_mul Nat.coprime.mul_add_mul_ne_mul
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -63,23 +63,11 @@ theorem gcd_le_right (m) {n} (h : 0 < n) : gcd m n ≤ n :=
#align nat.gcd_le_right Nat.gcd_le_right
-/
-/- warning: nat.dvd_gcd -> Nat.dvd_gcd is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {k : Nat}, (Dvd.Dvd.{0} Nat Nat.hasDvd k m) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k n) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k (Nat.gcd m n))
-but is expected to have type
- forall {m : Nat} {n : Nat} {k : Nat}, (Dvd.dvd.{0} Nat Nat.instDvdNat m n) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m k) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m (Nat.gcd n k))
-Case conversion may be inaccurate. Consider using '#align nat.dvd_gcd Nat.dvd_gcdₓ'. -/
theorem dvd_gcd {m n k : ℕ} : k ∣ m → k ∣ n → k ∣ gcd m n :=
gcd.induction m n (fun n _ kn => by rw [gcd_zero_left] <;> exact kn) fun n m mpos IH H1 H2 => by
rw [gcd_rec] <;> exact IH ((dvd_mod_iff H1).2 H2) H1
#align nat.dvd_gcd Nat.dvd_gcd
-/- warning: nat.dvd_gcd_iff -> Nat.dvd_gcd_iff is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {k : Nat}, Iff (Dvd.Dvd.{0} Nat Nat.hasDvd k (Nat.gcd m n)) (And (Dvd.Dvd.{0} Nat Nat.hasDvd k m) (Dvd.Dvd.{0} Nat Nat.hasDvd k n))
-but is expected to have type
- forall {m : Nat} {n : [mdata borrowed:1 Nat]} {k : [mdata borrowed:1 Nat]}, Iff (Dvd.dvd.{0} Nat Nat.instDvdNat m (Nat.gcd n k)) (And (Dvd.dvd.{0} Nat Nat.instDvdNat m n) (Dvd.dvd.{0} Nat Nat.instDvdNat m k))
-Case conversion may be inaccurate. Consider using '#align nat.dvd_gcd_iff Nat.dvd_gcd_iffₓ'. -/
theorem dvd_gcd_iff {m n k : ℕ} : k ∣ gcd m n ↔ k ∣ m ∧ k ∣ n :=
Iff.intro (fun h => ⟨h.trans (gcd_dvd m n).left, h.trans (gcd_dvd m n).right⟩) fun h =>
dvd_gcd h.left h.right
@@ -507,22 +495,10 @@ theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
-/
-/- warning: nat.coprime.symm -> Nat.coprime.symm is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat}, (Nat.coprime n m) -> (Nat.coprime m n)
-but is expected to have type
- forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (Nat.coprime n m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.symm Nat.coprime.symmₓ'. -/
theorem coprime.symm {m n : ℕ} : coprime n m → coprime m n :=
(gcd_comm m n).trans
#align nat.coprime.symm Nat.coprime.symm
-/- warning: nat.coprime_comm -> Nat.coprime_comm is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat}, Iff (Nat.coprime n m) (Nat.coprime m n)
-but is expected to have type
- forall {m : Nat} {n : Nat}, Iff (Nat.coprime m n) (Nat.coprime n m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime_comm Nat.coprime_commₓ'. -/
theorem coprime_comm {m n : ℕ} : coprime n m ↔ coprime m n :=
⟨coprime.symm, coprime.symm⟩
#align nat.coprime_comm Nat.coprime_comm
@@ -532,24 +508,12 @@ theorem coprime.symmetric : Symmetric coprime := fun m n => coprime.symm
#align nat.coprime.symmetric Nat.coprime.symmetric
-/
-/- warning: nat.coprime.dvd_of_dvd_mul_right -> Nat.coprime.dvd_of_dvd_mul_right is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime k n) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n)) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k m)
-but is expected to have type
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime m n) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) k n)) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m k)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.dvd_of_dvd_mul_right Nat.coprime.dvd_of_dvd_mul_rightₓ'. -/
theorem coprime.dvd_of_dvd_mul_right {m n k : ℕ} (H1 : coprime k n) (H2 : k ∣ m * n) : k ∣ m :=
by
let t := dvd_gcd (dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, mul_one] at t
#align nat.coprime.dvd_of_dvd_mul_right Nat.coprime.dvd_of_dvd_mul_right
-/- warning: nat.coprime.dvd_of_dvd_mul_left -> Nat.coprime.dvd_of_dvd_mul_left is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime k m) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n)) -> (Dvd.Dvd.{0} Nat Nat.hasDvd k n)
-but is expected to have type
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime m n) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) n k)) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m k)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.dvd_of_dvd_mul_left Nat.coprime.dvd_of_dvd_mul_leftₓ'. -/
theorem coprime.dvd_of_dvd_mul_left {m n k : ℕ} (H1 : coprime k m) (H2 : k ∣ m * n) : k ∣ n := by
rw [mul_comm] at H2 <;> exact H1.dvd_of_dvd_mul_right H2
#align nat.coprime.dvd_of_dvd_mul_left Nat.coprime.dvd_of_dvd_mul_left
@@ -566,12 +530,6 @@ theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k
#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
-/
-/- warning: nat.coprime.gcd_mul_left_cancel -> Nat.coprime.gcd_mul_left_cancel is a dubious translation:
-lean 3 declaration is
- forall {k : Nat} (m : Nat) {n : Nat}, (Nat.coprime k n) -> (Eq.{1} Nat (Nat.gcd (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) k m) n) (Nat.gcd m n))
-but is expected to have type
- forall {k : Nat} {m : Nat} (n : Nat), (Nat.coprime k m) -> (Eq.{1} Nat (Nat.gcd (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) k n) m) (Nat.gcd n m))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_mul_left_cancel Nat.coprime.gcd_mul_left_cancelₓ'. -/
theorem coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : coprime k n) :
gcd (k * m) n = gcd m n :=
have H1 : coprime (gcd (k * m) n) k := by
@@ -580,12 +538,6 @@ theorem coprime.gcd_mul_left_cancel {k : ℕ} (m : ℕ) {n : ℕ} (H : coprime k
(gcd_dvd_gcd_mul_left _ _ _)
#align nat.coprime.gcd_mul_left_cancel Nat.coprime.gcd_mul_left_cancel
-/- warning: nat.coprime.gcd_mul_right_cancel -> Nat.coprime.gcd_mul_right_cancel is a dubious translation:
-lean 3 declaration is
- forall (m : Nat) {k : Nat} {n : Nat}, (Nat.coprime k n) -> (Eq.{1} Nat (Nat.gcd (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m k) n) (Nat.gcd m n))
-but is expected to have type
- forall {m : Nat} {k : Nat} (n : Nat), (Nat.coprime m k) -> (Eq.{1} Nat (Nat.gcd (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) n m) k) (Nat.gcd n k))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_mul_right_cancel Nat.coprime.gcd_mul_right_cancelₓ'. -/
theorem coprime.gcd_mul_right_cancel (m : ℕ) {k n : ℕ} (H : coprime k n) :
gcd (m * k) n = gcd m n := by rw [mul_comm m k, H.gcd_mul_left_cancel m]
#align nat.coprime.gcd_mul_right_cancel Nat.coprime.gcd_mul_right_cancel
@@ -608,12 +560,6 @@ theorem coprime_div_gcd_div_gcd {m n : ℕ} (H : 0 < gcd m n) : coprime (m / gcd
#align nat.coprime_div_gcd_div_gcd Nat.coprime_div_gcd_div_gcd
-/
-/- warning: nat.not_coprime_of_dvd_of_dvd -> Nat.not_coprime_of_dvd_of_dvd is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {d : Nat}, (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) d) -> (Dvd.Dvd.{0} Nat Nat.hasDvd d m) -> (Dvd.Dvd.{0} Nat Nat.hasDvd d n) -> (Not (Nat.coprime m n))
-but is expected to have type
- forall {m : Nat} {n : Nat} {d : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) m) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m n) -> (Dvd.dvd.{0} Nat Nat.instDvdNat m d) -> (Not (Nat.coprime n d))
-Case conversion may be inaccurate. Consider using '#align nat.not_coprime_of_dvd_of_dvd Nat.not_coprime_of_dvd_of_dvdₓ'. -/
theorem not_coprime_of_dvd_of_dvd {m n d : ℕ} (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) :
¬coprime m n := fun co =>
not_lt_of_ge (le_of_dvd zero_lt_one <| by rw [← co.gcd_eq_one] <;> exact dvd_gcd Hm Hn) dgt1
@@ -719,12 +665,6 @@ theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ copr
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
-/
-/- warning: nat.coprime.mul -> Nat.coprime.mul is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime m k) -> (Nat.coprime n k) -> (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n) k)
-but is expected to have type
- forall {m : Nat} {n : Nat} {k : Nat}, (Nat.coprime m n) -> (Nat.coprime k n) -> (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) m k) n)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.mul Nat.coprime.mulₓ'. -/
theorem coprime.mul {m n k : ℕ} (H1 : coprime m k) (H2 : coprime n k) : coprime (m * n) k :=
(H1.gcd_mul_left_cancel n).trans H2
#align nat.coprime.mul Nat.coprime.mul
@@ -741,12 +681,6 @@ theorem coprime.coprime_dvd_left {m k n : ℕ} (H1 : m ∣ k) (H2 : coprime k n)
#align nat.coprime.coprime_dvd_left Nat.coprime.coprime_dvd_left
-/
-/- warning: nat.coprime.coprime_dvd_right -> Nat.coprime.coprime_dvd_right is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {k : Nat} {n : Nat}, (Dvd.Dvd.{0} Nat Nat.hasDvd n m) -> (Nat.coprime k m) -> (Nat.coprime k n)
-but is expected to have type
- forall {m : Nat} {k : Nat} {n : Nat}, (Dvd.dvd.{0} Nat Nat.instDvdNat m k) -> (Nat.coprime n k) -> (Nat.coprime n m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.coprime_dvd_right Nat.coprime.coprime_dvd_rightₓ'. -/
theorem coprime.coprime_dvd_right {m k n : ℕ} (H1 : n ∣ m) (H2 : coprime k m) : coprime k n :=
(H2.symm.coprime_dvd_left H1).symm
#align nat.coprime.coprime_dvd_right Nat.coprime.coprime_dvd_right
@@ -757,32 +691,14 @@ theorem coprime.coprime_mul_left {k m n : ℕ} (H : coprime (k * m) n) : coprime
#align nat.coprime.coprime_mul_left Nat.coprime.coprime_mul_left
-/
-/- warning: nat.coprime.coprime_mul_right -> Nat.coprime.coprime_mul_right is a dubious translation:
-lean 3 declaration is
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m k) n) -> (Nat.coprime m n)
-but is expected to have type
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) k m) n) -> (Nat.coprime k n)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.coprime_mul_right Nat.coprime.coprime_mul_rightₓ'. -/
theorem coprime.coprime_mul_right {k m n : ℕ} (H : coprime (m * k) n) : coprime m n :=
H.coprime_dvd_left (dvd_mul_right _ _)
#align nat.coprime.coprime_mul_right Nat.coprime.coprime_mul_right
-/- warning: nat.coprime.coprime_mul_left_right -> Nat.coprime.coprime_mul_left_right is a dubious translation:
-lean 3 declaration is
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime m (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) k n)) -> (Nat.coprime m n)
-but is expected to have type
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime k (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) m n)) -> (Nat.coprime k n)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.coprime_mul_left_right Nat.coprime.coprime_mul_left_rightₓ'. -/
theorem coprime.coprime_mul_left_right {k m n : ℕ} (H : coprime m (k * n)) : coprime m n :=
H.coprime_dvd_right (dvd_mul_left _ _)
#align nat.coprime.coprime_mul_left_right Nat.coprime.coprime_mul_left_right
-/- warning: nat.coprime.coprime_mul_right_right -> Nat.coprime.coprime_mul_right_right is a dubious translation:
-lean 3 declaration is
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime m (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) n k)) -> (Nat.coprime m n)
-but is expected to have type
- forall {k : Nat} {m : Nat} {n : Nat}, (Nat.coprime k (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) m n)) -> (Nat.coprime k m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.coprime_mul_right_right Nat.coprime.coprime_mul_right_rightₓ'. -/
theorem coprime.coprime_mul_right_right {k m n : ℕ} (H : coprime m (n * k)) : coprime m n :=
H.coprime_dvd_right (dvd_mul_right _ _)
#align nat.coprime.coprime_mul_right_right Nat.coprime.coprime_mul_right_right
@@ -807,12 +723,6 @@ theorem coprime.coprime_div_right {m n a : ℕ} (cmn : coprime m n) (dvd : a ∣
#align nat.coprime.coprime_div_right Nat.coprime.coprime_div_right
-/
-/- warning: nat.coprime_mul_iff_left -> Nat.coprime_mul_iff_left is a dubious translation:
-lean 3 declaration is
- forall {k : Nat} {m : Nat} {n : Nat}, Iff (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n) k) (And (Nat.coprime m k) (Nat.coprime n k))
-but is expected to have type
- forall {k : Nat} {m : Nat} {n : Nat}, Iff (Nat.coprime (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) k m) n) (And (Nat.coprime k n) (Nat.coprime m n))
-Case conversion may be inaccurate. Consider using '#align nat.coprime_mul_iff_left Nat.coprime_mul_iff_leftₓ'. -/
theorem coprime_mul_iff_left {k m n : ℕ} : coprime (m * n) k ↔ coprime m k ∧ coprime n k :=
⟨fun h => ⟨coprime.coprime_mul_right h, coprime.coprime_mul_left h⟩, fun ⟨h, _⟩ => by
rwa [coprime_iff_gcd_eq_one, coprime.gcd_mul_left_cancel n h]⟩
@@ -824,42 +734,18 @@ theorem coprime_mul_iff_right {k m n : ℕ} : coprime k (m * n) ↔ coprime k m
#align nat.coprime_mul_iff_right Nat.coprime_mul_iff_right
-/
-/- warning: nat.coprime.gcd_left -> Nat.coprime.gcd_left is a dubious translation:
-lean 3 declaration is
- forall (k : Nat) {m : Nat} {n : Nat}, (Nat.coprime m n) -> (Nat.coprime (Nat.gcd k m) n)
-but is expected to have type
- forall {k : Nat} {m : Nat} (n : Nat), (Nat.coprime k m) -> (Nat.coprime (Nat.gcd n k) m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_left Nat.coprime.gcd_leftₓ'. -/
theorem coprime.gcd_left (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) n :=
hmn.coprime_dvd_left <| gcd_dvd_right k m
#align nat.coprime.gcd_left Nat.coprime.gcd_left
-/- warning: nat.coprime.gcd_right -> Nat.coprime.gcd_right is a dubious translation:
-lean 3 declaration is
- forall (k : Nat) {m : Nat} {n : Nat}, (Nat.coprime m n) -> (Nat.coprime m (Nat.gcd k n))
-but is expected to have type
- forall {k : Nat} {m : Nat} (n : Nat), (Nat.coprime k m) -> (Nat.coprime k (Nat.gcd n m))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_right Nat.coprime.gcd_rightₓ'. -/
theorem coprime.gcd_right (k : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime m (gcd k n) :=
hmn.coprime_dvd_right <| gcd_dvd_right k n
#align nat.coprime.gcd_right Nat.coprime.gcd_right
-/- warning: nat.coprime.gcd_both -> Nat.coprime.gcd_both is a dubious translation:
-lean 3 declaration is
- forall (k : Nat) (l : Nat) {m : Nat} {n : Nat}, (Nat.coprime m n) -> (Nat.coprime (Nat.gcd k m) (Nat.gcd l n))
-but is expected to have type
- forall {k : Nat} {l : Nat} (m : Nat) (n : Nat), (Nat.coprime k l) -> (Nat.coprime (Nat.gcd m k) (Nat.gcd n l))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_both Nat.coprime.gcd_bothₓ'. -/
theorem coprime.gcd_both (k l : ℕ) {m n : ℕ} (hmn : coprime m n) : coprime (gcd k m) (gcd l n) :=
(hmn.gcd_left k).gcd_right l
#align nat.coprime.gcd_both Nat.coprime.gcd_both
-/- warning: nat.coprime.mul_dvd_of_dvd_of_dvd -> Nat.coprime.mul_dvd_of_dvd_of_dvd is a dubious translation:
-lean 3 declaration is
- forall {a : Nat} {n : Nat} {m : Nat}, (Nat.coprime m n) -> (Dvd.Dvd.{0} Nat Nat.hasDvd m a) -> (Dvd.Dvd.{0} Nat Nat.hasDvd n a) -> (Dvd.Dvd.{0} Nat Nat.hasDvd (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n) a)
-but is expected to have type
- forall {a : Nat} {n : Nat} {m : Nat}, (Nat.coprime a n) -> (Dvd.dvd.{0} Nat Nat.instDvdNat a m) -> (Dvd.dvd.{0} Nat Nat.instDvdNat n m) -> (Dvd.dvd.{0} Nat Nat.instDvdNat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) a n) m)
-Case conversion may be inaccurate. Consider using '#align nat.coprime.mul_dvd_of_dvd_of_dvd Nat.coprime.mul_dvd_of_dvd_of_dvdₓ'. -/
theorem coprime.mul_dvd_of_dvd_of_dvd {a n m : ℕ} (hmn : coprime m n) (hm : m ∣ a) (hn : n ∣ a) :
m * n ∣ a :=
let ⟨k, hk⟩ := hm
@@ -884,12 +770,6 @@ theorem coprime.pow_left {m k : ℕ} (n : ℕ) (H1 : coprime m k) : coprime (m ^
#align nat.coprime.pow_left Nat.coprime.pow_left
-/
-/- warning: nat.coprime.pow_right -> Nat.coprime.pow_right is a dubious translation:
-lean 3 declaration is
- forall {m : Nat} {k : Nat} (n : Nat), (Nat.coprime k m) -> (Nat.coprime k (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) m n))
-but is expected to have type
- forall {m : Nat} {k : Nat} (n : Nat), (Nat.coprime m k) -> (Nat.coprime m (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) k n))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.pow_right Nat.coprime.pow_rightₓ'. -/
theorem coprime.pow_right {m k : ℕ} (n : ℕ) (H1 : coprime k m) : coprime k (m ^ n) :=
(H1.symm.pow_leftₓ n).symm
#align nat.coprime.pow_right Nat.coprime.pow_right
@@ -1030,12 +910,6 @@ theorem gcd_mul_dvd_mul_gcd (k m n : ℕ) : gcd k (m * n) ∣ gcd k m * gcd k n
#align nat.gcd_mul_dvd_mul_gcd Nat.gcd_mul_dvd_mul_gcd
-/
-/- warning: nat.coprime.gcd_mul -> Nat.coprime.gcd_mul is a dubious translation:
-lean 3 declaration is
- forall (k : Nat) {m : Nat} {n : Nat}, (Nat.coprime m n) -> (Eq.{1} Nat (Nat.gcd k (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Nat.gcd k m) (Nat.gcd k n)))
-but is expected to have type
- forall {k : Nat} {m : Nat} (n : Nat), (Nat.coprime k m) -> (Eq.{1} Nat (Nat.gcd n (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) k m)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Nat.gcd n k) (Nat.gcd n m)))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.gcd_mul Nat.coprime.gcd_mulₓ'. -/
theorem coprime.gcd_mul (k : ℕ) {m n : ℕ} (h : coprime m n) : gcd k (m * n) = gcd k m * gcd k n :=
dvd_antisymm (gcd_mul_dvd_mul_gcd k m n)
((h.gcd_both k k).mul_dvd_of_dvd_of_dvd (gcd_dvd_gcd_mul_right_right _ _ _)
@@ -1057,12 +931,6 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
-/
-/- warning: nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul -> Nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul is a dubious translation:
-lean 3 declaration is
- forall {a : Nat} {b : Nat} {c : Nat} {d : Nat}, (Nat.coprime c d) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) a b) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) c d)) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Nat.gcd a c) (Nat.gcd b c)) c)
-but is expected to have type
- forall {a : Nat} {b : Nat} {c : Nat} {d : Nat}, (Nat.coprime a b) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) c d) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) a b)) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Nat.gcd c a) (Nat.gcd d a)) a)
-Case conversion may be inaccurate. Consider using '#align nat.gcd_mul_gcd_of_coprime_of_mul_eq_mul Nat.gcd_mul_gcd_of_coprime_of_mul_eq_mulₓ'. -/
theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul {a b c d : ℕ} (cop : c.coprime d) (h : a * b = c * d) :
a.gcd c * b.gcd c = c := by
apply dvd_antisymm
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -469,17 +469,13 @@ theorem lcm_assoc (m n k : ℕ) : lcm (lcm m n) k = lcm m (lcm n k) :=
-/
#print Nat.lcm_ne_zero /-
-theorem lcm_ne_zero {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) : lcm m n ≠ 0 :=
- by
- intro h
+theorem lcm_ne_zero {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) : lcm m n ≠ 0 := by intro h;
simpa [h, hm, hn] using gcd_mul_lcm m n
#align nat.lcm_ne_zero Nat.lcm_ne_zero
-/
#print Nat.lcm_pos /-
-theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n :=
- by
- simp_rw [pos_iff_ne_zero]
+theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by simp_rw [pos_iff_ne_zero];
exact lcm_ne_zero
#align nat.lcm_pos Nat.lcm_pos
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/c9236f47f5b9df573443aa499c0d3968769628b7
@@ -476,11 +476,13 @@ theorem lcm_ne_zero {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) : lcm m n ≠ 0 :=
#align nat.lcm_ne_zero Nat.lcm_ne_zero
-/
+#print Nat.lcm_pos /-
theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n :=
by
simp_rw [pos_iff_ne_zero]
exact lcm_ne_zero
#align nat.lcm_pos Nat.lcm_pos
+-/
/-!
### `coprime`
mathlib commit https://github.com/leanprover-community/mathlib/commit/06a655b5fcfbda03502f9158bbf6c0f1400886f9
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
! This file was ported from Lean 3 source module data.nat.gcd.basic
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
+! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -476,6 +476,12 @@ theorem lcm_ne_zero {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) : lcm m n ≠ 0 :=
#align nat.lcm_ne_zero Nat.lcm_ne_zero
-/
+theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n :=
+ by
+ simp_rw [pos_iff_ne_zero]
+ exact lcm_ne_zero
+#align nat.lcm_pos Nat.lcm_pos
+
/-!
### `coprime`
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -124,8 +124,8 @@ theorem gcd_one_right (n : ℕ) : gcd n 1 = 1 :=
#print Nat.gcd_mul_left /-
theorem gcd_mul_left (m n k : ℕ) : gcd (m * n) (m * k) = m * gcd n k :=
- gcd.induction n k (fun k => by repeat' first |rw [mul_zero]|rw [gcd_zero_left]) fun k n H IH => by
- rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
+ gcd.induction n k (fun k => by repeat' first |rw [MulZeroClass.mul_zero]|rw [gcd_zero_left])
+ fun k n H IH => by rwa [← mul_mod_mul_left, ← gcd_rec, ← gcd_rec] at IH
#align nat.gcd_mul_left Nat.gcd_mul_left
-/
@@ -384,7 +384,8 @@ theorem lcm_comm (m n : ℕ) : lcm m n = lcm n m := by delta lcm <;> rw [mul_com
#print Nat.lcm_zero_left /-
@[simp]
-theorem lcm_zero_left (m : ℕ) : lcm 0 m = 0 := by delta lcm <;> rw [zero_mul, Nat.zero_div]
+theorem lcm_zero_left (m : ℕ) : lcm 0 m = 0 := by
+ delta lcm <;> rw [MulZeroClass.zero_mul, Nat.zero_div]
#align nat.lcm_zero_left Nat.lcm_zero_left
-/
@@ -986,7 +987,7 @@ def prodDvdAndDvdOfDvdProd {m n k : ℕ} (H : k ∣ m * n) :
case zero =>
obtain rfl : k = 0 := eq_zero_of_gcd_eq_zero_left h0
obtain rfl : m = 0 := eq_zero_of_gcd_eq_zero_right h0
- exact ⟨⟨⟨0, dvd_refl 0⟩, ⟨n, dvd_refl n⟩⟩, (zero_mul n).symm⟩
+ exact ⟨⟨⟨0, dvd_refl 0⟩, ⟨n, dvd_refl n⟩⟩, (MulZeroClass.zero_mul n).symm⟩
case
succ tmp =>
have hpos : 0 < gcd k m := h0.symm ▸ Nat.zero_lt_succ _ <;> clear h0 tmp
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -345,4 +345,23 @@ theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
+variable {x n m : ℕ}
+
+theorem dvd_gcd_mul_iff_dvd_mul : x ∣ gcd x n * m ↔ x ∣ n * m := by
+ refine ⟨(·.trans <| mul_dvd_mul_right (x.gcd_dvd_right n) m), fun ⟨y, hy⟩ ↦ ?_⟩
+ rw [← gcd_mul_right, hy, gcd_mul_left]
+ exact dvd_mul_right x (gcd m y)
+
+theorem dvd_mul_gcd_iff_dvd_mul : x ∣ n * gcd x m ↔ x ∣ n * m := by
+ rw [mul_comm, dvd_gcd_mul_iff_dvd_mul, mul_comm]
+
+theorem dvd_gcd_mul_gcd_iff_dvd_mul : x ∣ gcd x n * gcd x m ↔ x ∣ n * m := by
+ rw [dvd_gcd_mul_iff_dvd_mul, dvd_mul_gcd_iff_dvd_mul]
+
+theorem gcd_mul_gcd_eq_iff_dvd_mul_of_coprime (hcop : Coprime n m) :
+ gcd x n * gcd x m = x ↔ x ∣ n * m := by
+ refine ⟨fun h ↦ ?_, (dvd_antisymm ?_ <| dvd_gcd_mul_gcd_iff_dvd_mul.mpr ·)⟩
+ refine h ▸ Nat.mul_dvd_mul ?_ ?_ <;> exact x.gcd_dvd_right _
+ refine (hcop.gcd_both x x).mul_dvd_of_dvd_of_dvd ?_ ?_ <;> exact x.gcd_dvd_left _
+
end Nat
We add fermatLastTheoremThree_of_three_dvd_only_c
: To prove FermatLastTheoremFor 3
, we may assume that ¬ 3 ∣ a
, ¬ 3 ∣ b
, a
and b
are coprime and 3 ∣ c
.
From the flt3 project in LFTCM2024.
Co-authored-by: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com>
@@ -307,14 +307,14 @@ theorem dvd_mul {x m n : ℕ} : x ∣ m * n ↔ ∃ y z, y ∣ m ∧ z ∣ n ∧
exact mul_dvd_mul hy hz
#align nat.dvd_mul Nat.dvd_mul
-theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b := by
+theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : n ≠ 0) : a ^ n ∣ b ^ n ↔ a ∣ b := by
refine' ⟨fun h => _, fun h => pow_dvd_pow_of_dvd h _⟩
rcases Nat.eq_zero_or_pos (gcd a b) with g0 | g0
· simp [eq_zero_of_gcd_eq_zero_right g0]
rcases exists_coprime' g0 with ⟨g, a', b', g0', co, rfl, rfl⟩
rw [mul_pow, mul_pow] at h
replace h := Nat.dvd_of_mul_dvd_mul_right (pow_pos g0' _) h
- have := pow_dvd_pow a' n0
+ have := pow_dvd_pow a' <| Nat.pos_of_ne_zero n0
rw [pow_one, (co.pow n n).eq_one_of_dvd h] at this
simp [eq_one_of_dvd_one this]
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
Data.{Nat,Int}{.Order}.Basic
in group vs ring instances (#11924)
Scatter the content of Data.Nat.Basic
across:
Data.Nat.Defs
for the lemmas having no dependenciesAlgebra.Group.Nat
for the monoid instances and the few miscellaneous lemmas needing them.Algebra.Ring.Nat
for the semiring instance and the few miscellaneous lemmas following it.Similarly, scatter
Data.Int.Basic
across Data.Int.Defs
, Algebra.Group.Int
, Algebra.Ring.Int
Data.Nat.Order.Basic
across Data.Nat.Defs
, Algebra.Order.Group.Nat
, Algebra.Order.Ring.Nat
Data.Int.Order.Basic
across Data.Int.Defs
, Algebra.Order.Group.Int
, Algebra.Order.Ring.Int
Also move a few lemmas from Data.Nat.Order.Lemmas
to Data.Nat.Defs
.
Before
After
@@ -5,7 +5,8 @@ Authors: Jeremy Avigad, Leonardo de Moura
-/
import Mathlib.Algebra.GroupPower.Basic
import Mathlib.Algebra.GroupWithZero.Divisibility
-import Mathlib.Data.Nat.Order.Lemmas
+import Mathlib.Algebra.Order.Ring.Nat
+import Mathlib.Data.Nat.Units
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -243,7 +243,7 @@ theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : Coprime n (n - m) ↔
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b := by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
- rw [pow_succ, Nat.coprime_mul_iff_left]
+ rw [Nat.pow_succ, Nat.coprime_mul_iff_left]
exact ⟨And.right, fun hab => ⟨hab.pow_left _, hab⟩⟩
#align nat.coprime_pow_left_iff Nat.coprime_pow_left_iff
IsRelPrime
and DecompositionMonoid
and refactor (#10327)
Introduce typeclass DecompositionMonoid
, which says every element in the monoid is primal, i.e., whenever an element divides a product b * c
, it can be factored into a product such that the factors divides b
and c
respectively. A domain is called pre-Schreier if its multiplicative monoid is a decomposition monoid, and these are more general than GCD domains.
Show that any GCDMonoid
is a DecompositionMonoid
. In order for lemmas about DecompositionMonoid
s to automatically apply to UniqueFactorizationMonoid
s, we add instances from UniqueFactorizationMonoid α
to Nonempty (NormalizedGCDMonoid α)
to Nonempty (GCDMonoid α)
to DecompositionMonoid α
. (Zulip) See the bottom of message for an updated diagram of classes and instances.
Introduce binary predicate IsRelPrime
which says that the only common divisors of the two elements are units. Replace previous occurrences in mathlib by this predicate.
Duplicate all lemmas about IsCoprime
in Coprime/Basic (except three lemmas about smul) to IsRelPrime
. Due to import constraints, they are spread into three files Algebra/Divisibility/Units (including key lemmas assuming DecompositionMonoid), GroupWithZero/Divisibility, and Coprime/Basic.
Show IsCoprime
always imply IsRelPrime
and is equivalent to it in Bezout rings. To reduce duplication, the definition of Bezout rings and the GCDMonoid instance are moved from RingTheory/Bezout to RingTheory/PrincipalIdealDomain, and some results in PrincipalIdealDomain are generalized to Bezout rings.
Remove the recently added file Squarefree/UniqueFactorizationMonoid and place the results appropriately within Squarefree/Basic. All results are generalized to DecompositionMonoid or weaker except the last one.
With this PR, all the following instances (indicated by arrows) now work; this PR fills the central part.
EuclideanDomain (bundled)
↙ ↖
IsPrincipalIdealRing ← Field (bundled)
↓ ↓
NormalizationMonoid ← NormalizedGCDMonoid → GCDMonoid IsBezout ← ValuationRing ← DiscreteValuationRing
↓ ↓ ↘ ↙
Nonempty NormalizationMonoid ← Nonempty NormalizedGCDMonoid → Nonempty GCDMonoid → IsIntegrallyClosed
↑ ↓
WfDvdMonoid ← UniqueFactorizationMonoid → DecompositionMonoid
↑
IsPrincipalIdealRing
Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: Oliver Nash <github@olivernash.org>
@@ -318,13 +318,14 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
simp [eq_one_of_dvd_one this]
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
+theorem coprime_iff_isRelPrime {m n : ℕ} : m.Coprime n ↔ IsRelPrime m n := by
+ simp_rw [coprime_iff_gcd_eq_one, IsRelPrime, ← and_imp, ← dvd_gcd_iff, isUnit_iff_dvd_one]
+ exact ⟨fun h _ ↦ (h ▸ ·), (dvd_one.mp <| · dvd_rfl)⟩
+
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
- (hkb : k ∣ b) : k = 1 := by
- rw [coprime_iff_gcd_eq_one] at h_ab_coprime
- have h1 := dvd_gcd hka hkb
- rw [h_ab_coprime] at h1
- exact Nat.dvd_one.mp h1
+ (hkb : k ∣ b) : k = 1 :=
+ dvd_one.mp (isUnit_iff_dvd_one.mp <| coprime_iff_isRelPrime.mp h_ab_coprime hka hkb)
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
cases x with | ...
instead of cases x; case => ...
(#9321)
This converts usages of the pattern
cases h
case inl h' => ...
case inr h' => ...
which derive from mathported code, to the "structured cases
" syntax:
cases h with
| inl h' => ...
| inr h' => ...
The case where the subgoals are handled with ·
instead of case
is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases'
, induction
, induction'
, and rcases
. Furthermore, there is a similar transformation for by_cases
:
by_cases h : cond
case pos => ...
case neg => ...
is replaced by:
if h : cond then
...
else
...
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -283,12 +283,12 @@ See `exists_dvd_and_dvd_of_dvd_mul` for the more general but less constructive v
`GCDMonoid`s. -/
def prodDvdAndDvdOfDvdProd {m n k : ℕ} (H : k ∣ m * n) :
{ d : { m' // m' ∣ m } × { n' // n' ∣ n } // k = d.1 * d.2 } := by
- cases h0 : gcd k m
- case zero =>
+ cases h0 : gcd k m with
+ | zero =>
obtain rfl : k = 0 := eq_zero_of_gcd_eq_zero_left h0
obtain rfl : m = 0 := eq_zero_of_gcd_eq_zero_right h0
exact ⟨⟨⟨0, dvd_refl 0⟩, ⟨n, dvd_refl n⟩⟩, (zero_mul n).symm⟩
- case succ tmp =>
+ | succ tmp =>
have hpos : 0 < gcd k m := h0.symm ▸ Nat.zero_lt_succ _; clear h0 tmp
have hd : gcd k m * (k / gcd k m) = k := Nat.mul_div_cancel' (gcd_dvd_left k m)
refine' ⟨⟨⟨gcd k m, gcd_dvd_right k m⟩, ⟨k / gcd k m, _⟩⟩, hd.symm⟩
cases'
(#9171)
I literally went through and regex'd some uses of cases'
, replacing them with rcases
; this is meant to be a low effort PR as I hope that tools can do this in the future.
rcases
is an easier replacement than cases
, though with better tools we could in future do a second pass converting simple rcases
added here (and existing ones) to cases
.
@@ -308,7 +308,7 @@ theorem dvd_mul {x m n : ℕ} : x ∣ m * n ↔ ∃ y z, y ∣ m ∧ z ∣ n ∧
theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b := by
refine' ⟨fun h => _, fun h => pow_dvd_pow_of_dvd h _⟩
- cases' Nat.eq_zero_or_pos (gcd a b) with g0 g0
+ rcases Nat.eq_zero_or_pos (gcd a b) with g0 | g0
· simp [eq_zero_of_gcd_eq_zero_right g0]
rcases exists_coprime' g0 with ⟨g, a', b', g0', co, rfl, rfl⟩
rw [mul_pow, mul_pow] at h
@@ -135,7 +135,7 @@ theorem lcm_mul_left {m n k : ℕ} : (m * n).lcm (m * k) = m * n.lcm k := by
apply dvd_antisymm
· exact lcm_dvd (mul_dvd_mul_left m (dvd_lcm_left n k)) (mul_dvd_mul_left m (dvd_lcm_right n k))
· have h : m ∣ lcm (m * n) (m * k) := (dvd_mul_right m n).trans (dvd_lcm_left (m * n) (m * k))
- rw [←dvd_div_iff h, lcm_dvd_iff, dvd_div_iff h, dvd_div_iff h, ←lcm_dvd_iff]
+ rw [← dvd_div_iff h, lcm_dvd_iff, dvd_div_iff h, dvd_div_iff h, ← lcm_dvd_iff]
theorem lcm_mul_right {m n k : ℕ} : (m * n).lcm (k * n) = m.lcm k * n := by
rw [mul_comm, mul_comm k n, lcm_mul_left, mul_comm]
@@ -30,7 +30,8 @@ theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e :
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
--- Lemmas where one argument consists of addition of a multiple of the other
+/-! Lemmas where one argument consists of addition of a multiple of the other -/
+
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
@@ -69,7 +70,8 @@ theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
#align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left
--- Lemmas where one argument consists of an addition of the other
+/-! Lemmas where one argument consists of an addition of the other -/
+
@[simp]
theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n :=
Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1)
@@ -89,7 +91,8 @@ theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
rw [add_comm, gcd_add_self_right]
#align nat.gcd_self_add_right Nat.gcd_self_add_right
--- Lemmas where one argument consists of a subtraction of the other
+/-! Lemmas where one argument consists of a subtraction of the other -/
+
@[simp]
theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
calc
@@ -225,7 +225,7 @@ theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) m ↔
rw [Coprime, Coprime, gcd_sub_self_left h]
@[simp]
-theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : Coprime m (n - m) ↔ Coprime m n:= by
+theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : Coprime m (n - m) ↔ Coprime m n := by
rw [Coprime, Coprime, gcd_sub_self_right h]
@[simp]
@@ -93,7 +93,7 @@ theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
@[simp]
theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
calc
- gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
+ gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
_ = gcd n m := by rw [Nat.sub_add_cancel h]
@[simp]
Nat.lcm_mul_left
and Nat.lcm_mul_right
(#6990)
Add two lemmas about Nat.lcm
. These results mirror Nat.gcd_mul_left present in Std.
Co-authored-by: Arend Mellendijk <FLDutchmann@users.noreply.github.com>
@@ -128,6 +128,15 @@ theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by
exact lcm_ne_zero
#align nat.lcm_pos Nat.lcm_pos
+theorem lcm_mul_left {m n k : ℕ} : (m * n).lcm (m * k) = m * n.lcm k := by
+ apply dvd_antisymm
+ · exact lcm_dvd (mul_dvd_mul_left m (dvd_lcm_left n k)) (mul_dvd_mul_left m (dvd_lcm_right n k))
+ · have h : m ∣ lcm (m * n) (m * k) := (dvd_mul_right m n).trans (dvd_lcm_left (m * n) (m * k))
+ rw [←dvd_div_iff h, lcm_dvd_iff, dvd_div_iff h, dvd_div_iff h, ←lcm_dvd_iff]
+
+theorem lcm_mul_right {m n k : ℕ} : (m * n).lcm (k * n) = m.lcm k * n := by
+ rw [mul_comm, mul_comm k n, lcm_mul_left, mul_comm]
+
/-!
### `Coprime`
@@ -129,107 +129,107 @@ theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by
#align nat.lcm_pos Nat.lcm_pos
/-!
-### `coprime`
+### `Coprime`
-See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.coprime m n`.
+See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.Coprime m n`.
-/
-instance (m n : ℕ) : Decidable (coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
+instance (m n : ℕ) : Decidable (Coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
-theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
+theorem Coprime.lcm_eq_mul {m n : ℕ} (h : Coprime m n) : lcm m n = m * n := by
rw [← one_mul (lcm m n), ← h.gcd_eq_one, gcd_mul_lcm]
-#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
+#align nat.coprime.lcm_eq_mul Nat.Coprime.lcm_eq_mul
-theorem coprime.symmetric : Symmetric coprime := fun _ _ => coprime.symm
-#align nat.coprime.symmetric Nat.coprime.symmetric
+theorem Coprime.symmetric : Symmetric Coprime := fun _ _ => Coprime.symm
+#align nat.coprime.symmetric Nat.Coprime.symmetric
-theorem coprime.dvd_mul_right {m n k : ℕ} (H : coprime k n) : k ∣ m * n ↔ k ∣ m :=
+theorem Coprime.dvd_mul_right {m n k : ℕ} (H : Coprime k n) : k ∣ m * n ↔ k ∣ m :=
⟨H.dvd_of_dvd_mul_right, fun h => dvd_mul_of_dvd_left h n⟩
-#align nat.coprime.dvd_mul_right Nat.coprime.dvd_mul_right
+#align nat.coprime.dvd_mul_right Nat.Coprime.dvd_mul_right
-theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k ∣ n :=
+theorem Coprime.dvd_mul_left {m n k : ℕ} (H : Coprime k m) : k ∣ m * n ↔ k ∣ n :=
⟨H.dvd_of_dvd_mul_left, fun h => dvd_mul_of_dvd_right h m⟩
-#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
+#align nat.coprime.dvd_mul_left Nat.Coprime.dvd_mul_left
@[simp]
-theorem coprime_add_self_right {m n : ℕ} : coprime m (n + m) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_self_right]
+theorem coprime_add_self_right {m n : ℕ} : Coprime m (n + m) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_self_right]
#align nat.coprime_add_self_right Nat.coprime_add_self_right
@[simp]
-theorem coprime_self_add_right {m n : ℕ} : coprime m (m + n) ↔ coprime m n := by
+theorem coprime_self_add_right {m n : ℕ} : Coprime m (m + n) ↔ Coprime m n := by
rw [add_comm, coprime_add_self_right]
#align nat.coprime_self_add_right Nat.coprime_self_add_right
@[simp]
-theorem coprime_add_self_left {m n : ℕ} : coprime (m + n) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_self_left]
+theorem coprime_add_self_left {m n : ℕ} : Coprime (m + n) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_self_left]
#align nat.coprime_add_self_left Nat.coprime_add_self_left
@[simp]
-theorem coprime_self_add_left {m n : ℕ} : coprime (m + n) m ↔ coprime n m := by
- rw [coprime, coprime, gcd_self_add_left]
+theorem coprime_self_add_left {m n : ℕ} : Coprime (m + n) m ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_self_add_left]
#align nat.coprime_self_add_left Nat.coprime_self_add_left
@[simp]
-theorem coprime_add_mul_right_right (m n k : ℕ) : coprime m (n + k * m) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_right_right]
+theorem coprime_add_mul_right_right (m n k : ℕ) : Coprime m (n + k * m) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_right_right]
#align nat.coprime_add_mul_right_right Nat.coprime_add_mul_right_right
@[simp]
-theorem coprime_add_mul_left_right (m n k : ℕ) : coprime m (n + m * k) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_left_right]
+theorem coprime_add_mul_left_right (m n k : ℕ) : Coprime m (n + m * k) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_left_right]
#align nat.coprime_add_mul_left_right Nat.coprime_add_mul_left_right
@[simp]
-theorem coprime_mul_right_add_right (m n k : ℕ) : coprime m (k * m + n) ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_right_add_right]
+theorem coprime_mul_right_add_right (m n k : ℕ) : Coprime m (k * m + n) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_right_add_right]
#align nat.coprime_mul_right_add_right Nat.coprime_mul_right_add_right
@[simp]
-theorem coprime_mul_left_add_right (m n k : ℕ) : coprime m (m * k + n) ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_left_add_right]
+theorem coprime_mul_left_add_right (m n k : ℕ) : Coprime m (m * k + n) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_left_add_right]
#align nat.coprime_mul_left_add_right Nat.coprime_mul_left_add_right
@[simp]
-theorem coprime_add_mul_right_left (m n k : ℕ) : coprime (m + k * n) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_right_left]
+theorem coprime_add_mul_right_left (m n k : ℕ) : Coprime (m + k * n) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_right_left]
#align nat.coprime_add_mul_right_left Nat.coprime_add_mul_right_left
@[simp]
-theorem coprime_add_mul_left_left (m n k : ℕ) : coprime (m + n * k) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_left_left]
+theorem coprime_add_mul_left_left (m n k : ℕ) : Coprime (m + n * k) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_left_left]
#align nat.coprime_add_mul_left_left Nat.coprime_add_mul_left_left
@[simp]
-theorem coprime_mul_right_add_left (m n k : ℕ) : coprime (k * n + m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_right_add_left]
+theorem coprime_mul_right_add_left (m n k : ℕ) : Coprime (k * n + m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_right_add_left]
#align nat.coprime_mul_right_add_left Nat.coprime_mul_right_add_left
@[simp]
-theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_left_add_left]
+theorem coprime_mul_left_add_left (m n k : ℕ) : Coprime (n * k + m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_left_add_left]
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
@[simp]
-theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) m ↔ coprime n m := by
- rw [coprime, coprime, gcd_sub_self_left h]
+theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) m ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_sub_self_left h]
@[simp]
-theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : coprime m (n - m) ↔ coprime m n:= by
- rw [coprime, coprime, gcd_sub_self_right h]
+theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : Coprime m (n - m) ↔ Coprime m n:= by
+ rw [Coprime, Coprime, gcd_sub_self_right h]
@[simp]
-theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_self_sub_left h]
+theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_self_sub_left h]
@[simp]
-theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : coprime n (n - m) ↔ coprime n m := by
- rw [coprime, coprime, gcd_self_sub_right h]
+theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : Coprime n (n - m) ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_self_sub_right h]
@[simp]
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime (a ^ n) b ↔ Nat.coprime a b := by
+ Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b := by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
rw [pow_succ, Nat.coprime_mul_iff_left]
exact ⟨And.right, fun hab => ⟨hab.pow_left _, hab⟩⟩
@@ -237,33 +237,33 @@ theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
@[simp]
theorem coprime_pow_right_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime a (b ^ n) ↔ Nat.coprime a b := by
+ Nat.Coprime a (b ^ n) ↔ Nat.Coprime a b := by
rw [Nat.coprime_comm, coprime_pow_left_iff hn, Nat.coprime_comm]
#align nat.coprime_pow_right_iff Nat.coprime_pow_right_iff
-theorem not_coprime_zero_zero : ¬coprime 0 0 := by simp
+theorem not_coprime_zero_zero : ¬Coprime 0 0 := by simp
#align nat.not_coprime_zero_zero Nat.not_coprime_zero_zero
-theorem coprime_one_left_iff (n : ℕ) : coprime 1 n ↔ True := by simp [coprime]
+theorem coprime_one_left_iff (n : ℕ) : Coprime 1 n ↔ True := by simp [Coprime]
#align nat.coprime_one_left_iff Nat.coprime_one_left_iff
-theorem coprime_one_right_iff (n : ℕ) : coprime n 1 ↔ True := by simp [coprime]
+theorem coprime_one_right_iff (n : ℕ) : Coprime n 1 ↔ True := by simp [Coprime]
#align nat.coprime_one_right_iff Nat.coprime_one_right_iff
-theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : coprime a c) (b_dvd_c : b ∣ c) :
+theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : Coprime a c) (b_dvd_c : b ∣ c) :
gcd (a * b) c = b := by
rcases exists_eq_mul_left_of_dvd b_dvd_c with ⟨d, rfl⟩
rw [gcd_mul_right]
convert one_mul b
- exact coprime.coprime_mul_right_right hac
+ exact Coprime.coprime_mul_right_right hac
#align nat.gcd_mul_of_coprime_of_dvd Nat.gcd_mul_of_coprime_of_dvd
-theorem coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.coprime n) (hmn : m * n = 0) :
+theorem Coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.Coprime n) (hmn : m * n = 0) :
m = 0 ∧ n = 1 ∨ m = 1 ∧ n = 0 :=
(Nat.eq_zero_of_mul_eq_zero hmn).imp (fun hm => ⟨hm, n.coprime_zero_left.mp <| hm ▸ h⟩) fun hn =>
let eq := hn ▸ h.symm
⟨m.coprime_zero_left.mp <| eq, hn⟩
-#align nat.coprime.eq_of_mul_eq_zero Nat.coprime.eq_of_mul_eq_zero
+#align nat.coprime.eq_of_mul_eq_zero Nat.Coprime.eq_of_mul_eq_zero
/-- Represent a divisor of `m * n` as a product of a divisor of `m` and a divisor of `n`.
@@ -307,7 +307,7 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
-theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka : k ∣ a)
+theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 := by
rw [coprime_iff_gcd_eq_one] at h_ab_coprime
have h1 := dvd_gcd hka hkb
@@ -315,7 +315,7 @@ theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka :
exact Nat.dvd_one.mp h1
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
+theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
a * m + b * n ≠ m * n := by
intro h
obtain ⟨x, rfl⟩ : n ∣ a :=
@@ -329,6 +329,6 @@ theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a
rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
-#align nat.coprime.mul_add_mul_ne_mul Nat.coprime.mul_add_mul_ne_mul
+#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
end Nat
@@ -129,107 +129,107 @@ theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by
#align nat.lcm_pos Nat.lcm_pos
/-!
-### `Coprime`
+### `coprime`
-See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.Coprime m n`.
+See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.coprime m n`.
-/
-instance (m n : ℕ) : Decidable (Coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
+instance (m n : ℕ) : Decidable (coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
-theorem Coprime.lcm_eq_mul {m n : ℕ} (h : Coprime m n) : lcm m n = m * n := by
+theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
rw [← one_mul (lcm m n), ← h.gcd_eq_one, gcd_mul_lcm]
-#align nat.coprime.lcm_eq_mul Nat.Coprime.lcm_eq_mul
+#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
-theorem Coprime.symmetric : Symmetric Coprime := fun _ _ => Coprime.symm
-#align nat.coprime.symmetric Nat.Coprime.symmetric
+theorem coprime.symmetric : Symmetric coprime := fun _ _ => coprime.symm
+#align nat.coprime.symmetric Nat.coprime.symmetric
-theorem Coprime.dvd_mul_right {m n k : ℕ} (H : Coprime k n) : k ∣ m * n ↔ k ∣ m :=
+theorem coprime.dvd_mul_right {m n k : ℕ} (H : coprime k n) : k ∣ m * n ↔ k ∣ m :=
⟨H.dvd_of_dvd_mul_right, fun h => dvd_mul_of_dvd_left h n⟩
-#align nat.coprime.dvd_mul_right Nat.Coprime.dvd_mul_right
+#align nat.coprime.dvd_mul_right Nat.coprime.dvd_mul_right
-theorem Coprime.dvd_mul_left {m n k : ℕ} (H : Coprime k m) : k ∣ m * n ↔ k ∣ n :=
+theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k ∣ n :=
⟨H.dvd_of_dvd_mul_left, fun h => dvd_mul_of_dvd_right h m⟩
-#align nat.coprime.dvd_mul_left Nat.Coprime.dvd_mul_left
+#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
@[simp]
-theorem coprime_add_self_right {m n : ℕ} : Coprime m (n + m) ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_self_right]
+theorem coprime_add_self_right {m n : ℕ} : coprime m (n + m) ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_self_right]
#align nat.coprime_add_self_right Nat.coprime_add_self_right
@[simp]
-theorem coprime_self_add_right {m n : ℕ} : Coprime m (m + n) ↔ Coprime m n := by
+theorem coprime_self_add_right {m n : ℕ} : coprime m (m + n) ↔ coprime m n := by
rw [add_comm, coprime_add_self_right]
#align nat.coprime_self_add_right Nat.coprime_self_add_right
@[simp]
-theorem coprime_add_self_left {m n : ℕ} : Coprime (m + n) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_self_left]
+theorem coprime_add_self_left {m n : ℕ} : coprime (m + n) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_self_left]
#align nat.coprime_add_self_left Nat.coprime_add_self_left
@[simp]
-theorem coprime_self_add_left {m n : ℕ} : Coprime (m + n) m ↔ Coprime n m := by
- rw [Coprime, Coprime, gcd_self_add_left]
+theorem coprime_self_add_left {m n : ℕ} : coprime (m + n) m ↔ coprime n m := by
+ rw [coprime, coprime, gcd_self_add_left]
#align nat.coprime_self_add_left Nat.coprime_self_add_left
@[simp]
-theorem coprime_add_mul_right_right (m n k : ℕ) : Coprime m (n + k * m) ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_mul_right_right]
+theorem coprime_add_mul_right_right (m n k : ℕ) : coprime m (n + k * m) ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_mul_right_right]
#align nat.coprime_add_mul_right_right Nat.coprime_add_mul_right_right
@[simp]
-theorem coprime_add_mul_left_right (m n k : ℕ) : Coprime m (n + m * k) ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_mul_left_right]
+theorem coprime_add_mul_left_right (m n k : ℕ) : coprime m (n + m * k) ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_mul_left_right]
#align nat.coprime_add_mul_left_right Nat.coprime_add_mul_left_right
@[simp]
-theorem coprime_mul_right_add_right (m n k : ℕ) : Coprime m (k * m + n) ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_mul_right_add_right]
+theorem coprime_mul_right_add_right (m n k : ℕ) : coprime m (k * m + n) ↔ coprime m n := by
+ rw [coprime, coprime, gcd_mul_right_add_right]
#align nat.coprime_mul_right_add_right Nat.coprime_mul_right_add_right
@[simp]
-theorem coprime_mul_left_add_right (m n k : ℕ) : Coprime m (m * k + n) ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_mul_left_add_right]
+theorem coprime_mul_left_add_right (m n k : ℕ) : coprime m (m * k + n) ↔ coprime m n := by
+ rw [coprime, coprime, gcd_mul_left_add_right]
#align nat.coprime_mul_left_add_right Nat.coprime_mul_left_add_right
@[simp]
-theorem coprime_add_mul_right_left (m n k : ℕ) : Coprime (m + k * n) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_mul_right_left]
+theorem coprime_add_mul_right_left (m n k : ℕ) : coprime (m + k * n) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_mul_right_left]
#align nat.coprime_add_mul_right_left Nat.coprime_add_mul_right_left
@[simp]
-theorem coprime_add_mul_left_left (m n k : ℕ) : Coprime (m + n * k) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_add_mul_left_left]
+theorem coprime_add_mul_left_left (m n k : ℕ) : coprime (m + n * k) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_add_mul_left_left]
#align nat.coprime_add_mul_left_left Nat.coprime_add_mul_left_left
@[simp]
-theorem coprime_mul_right_add_left (m n k : ℕ) : Coprime (k * n + m) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_mul_right_add_left]
+theorem coprime_mul_right_add_left (m n k : ℕ) : coprime (k * n + m) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_mul_right_add_left]
#align nat.coprime_mul_right_add_left Nat.coprime_mul_right_add_left
@[simp]
-theorem coprime_mul_left_add_left (m n k : ℕ) : Coprime (n * k + m) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_mul_left_add_left]
+theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_mul_left_add_left]
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
@[simp]
-theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) m ↔ Coprime n m := by
- rw [Coprime, Coprime, gcd_sub_self_left h]
+theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) m ↔ coprime n m := by
+ rw [coprime, coprime, gcd_sub_self_left h]
@[simp]
-theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : Coprime m (n - m) ↔ Coprime m n:= by
- rw [Coprime, Coprime, gcd_sub_self_right h]
+theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : coprime m (n - m) ↔ coprime m n:= by
+ rw [coprime, coprime, gcd_sub_self_right h]
@[simp]
-theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) n ↔ Coprime m n := by
- rw [Coprime, Coprime, gcd_self_sub_left h]
+theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_self_sub_left h]
@[simp]
-theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : Coprime n (n - m) ↔ Coprime n m := by
- rw [Coprime, Coprime, gcd_self_sub_right h]
+theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : coprime n (n - m) ↔ coprime n m := by
+ rw [coprime, coprime, gcd_self_sub_right h]
@[simp]
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b := by
+ Nat.coprime (a ^ n) b ↔ Nat.coprime a b := by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
rw [pow_succ, Nat.coprime_mul_iff_left]
exact ⟨And.right, fun hab => ⟨hab.pow_left _, hab⟩⟩
@@ -237,33 +237,33 @@ theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
@[simp]
theorem coprime_pow_right_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.Coprime a (b ^ n) ↔ Nat.Coprime a b := by
+ Nat.coprime a (b ^ n) ↔ Nat.coprime a b := by
rw [Nat.coprime_comm, coprime_pow_left_iff hn, Nat.coprime_comm]
#align nat.coprime_pow_right_iff Nat.coprime_pow_right_iff
-theorem not_coprime_zero_zero : ¬Coprime 0 0 := by simp
+theorem not_coprime_zero_zero : ¬coprime 0 0 := by simp
#align nat.not_coprime_zero_zero Nat.not_coprime_zero_zero
-theorem coprime_one_left_iff (n : ℕ) : Coprime 1 n ↔ True := by simp [Coprime]
+theorem coprime_one_left_iff (n : ℕ) : coprime 1 n ↔ True := by simp [coprime]
#align nat.coprime_one_left_iff Nat.coprime_one_left_iff
-theorem coprime_one_right_iff (n : ℕ) : Coprime n 1 ↔ True := by simp [Coprime]
+theorem coprime_one_right_iff (n : ℕ) : coprime n 1 ↔ True := by simp [coprime]
#align nat.coprime_one_right_iff Nat.coprime_one_right_iff
-theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : Coprime a c) (b_dvd_c : b ∣ c) :
+theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : coprime a c) (b_dvd_c : b ∣ c) :
gcd (a * b) c = b := by
rcases exists_eq_mul_left_of_dvd b_dvd_c with ⟨d, rfl⟩
rw [gcd_mul_right]
convert one_mul b
- exact Coprime.coprime_mul_right_right hac
+ exact coprime.coprime_mul_right_right hac
#align nat.gcd_mul_of_coprime_of_dvd Nat.gcd_mul_of_coprime_of_dvd
-theorem Coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.Coprime n) (hmn : m * n = 0) :
+theorem coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.coprime n) (hmn : m * n = 0) :
m = 0 ∧ n = 1 ∨ m = 1 ∧ n = 0 :=
(Nat.eq_zero_of_mul_eq_zero hmn).imp (fun hm => ⟨hm, n.coprime_zero_left.mp <| hm ▸ h⟩) fun hn =>
let eq := hn ▸ h.symm
⟨m.coprime_zero_left.mp <| eq, hn⟩
-#align nat.coprime.eq_of_mul_eq_zero Nat.Coprime.eq_of_mul_eq_zero
+#align nat.coprime.eq_of_mul_eq_zero Nat.coprime.eq_of_mul_eq_zero
/-- Represent a divisor of `m * n` as a product of a divisor of `m` and a divisor of `n`.
@@ -307,7 +307,7 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
-theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
+theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 := by
rw [coprime_iff_gcd_eq_one] at h_ab_coprime
have h1 := dvd_gcd hka hkb
@@ -315,7 +315,7 @@ theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka :
exact Nat.dvd_one.mp h1
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
+theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
a * m + b * n ≠ m * n := by
intro h
obtain ⟨x, rfl⟩ : n ∣ a :=
@@ -329,6 +329,6 @@ theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a
rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
-#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
+#align nat.coprime.mul_add_mul_ne_mul Nat.coprime.mul_add_mul_ne_mul
end Nat
Some changes have already been review and delegated in #6910 and #7148.
The diff that needs looking at is https://github.com/leanprover-community/mathlib4/pull/7174/commits/64d6d07ee18163627c8f517eb31455411921c5ac
The std bump PR was insta-merged already!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -129,107 +129,107 @@ theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by
#align nat.lcm_pos Nat.lcm_pos
/-!
-### `coprime`
+### `Coprime`
-See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.coprime m n`.
+See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.Coprime m n`.
-/
-instance (m n : ℕ) : Decidable (coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
+instance (m n : ℕ) : Decidable (Coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
-theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
+theorem Coprime.lcm_eq_mul {m n : ℕ} (h : Coprime m n) : lcm m n = m * n := by
rw [← one_mul (lcm m n), ← h.gcd_eq_one, gcd_mul_lcm]
-#align nat.coprime.lcm_eq_mul Nat.coprime.lcm_eq_mul
+#align nat.coprime.lcm_eq_mul Nat.Coprime.lcm_eq_mul
-theorem coprime.symmetric : Symmetric coprime := fun _ _ => coprime.symm
-#align nat.coprime.symmetric Nat.coprime.symmetric
+theorem Coprime.symmetric : Symmetric Coprime := fun _ _ => Coprime.symm
+#align nat.coprime.symmetric Nat.Coprime.symmetric
-theorem coprime.dvd_mul_right {m n k : ℕ} (H : coprime k n) : k ∣ m * n ↔ k ∣ m :=
+theorem Coprime.dvd_mul_right {m n k : ℕ} (H : Coprime k n) : k ∣ m * n ↔ k ∣ m :=
⟨H.dvd_of_dvd_mul_right, fun h => dvd_mul_of_dvd_left h n⟩
-#align nat.coprime.dvd_mul_right Nat.coprime.dvd_mul_right
+#align nat.coprime.dvd_mul_right Nat.Coprime.dvd_mul_right
-theorem coprime.dvd_mul_left {m n k : ℕ} (H : coprime k m) : k ∣ m * n ↔ k ∣ n :=
+theorem Coprime.dvd_mul_left {m n k : ℕ} (H : Coprime k m) : k ∣ m * n ↔ k ∣ n :=
⟨H.dvd_of_dvd_mul_left, fun h => dvd_mul_of_dvd_right h m⟩
-#align nat.coprime.dvd_mul_left Nat.coprime.dvd_mul_left
+#align nat.coprime.dvd_mul_left Nat.Coprime.dvd_mul_left
@[simp]
-theorem coprime_add_self_right {m n : ℕ} : coprime m (n + m) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_self_right]
+theorem coprime_add_self_right {m n : ℕ} : Coprime m (n + m) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_self_right]
#align nat.coprime_add_self_right Nat.coprime_add_self_right
@[simp]
-theorem coprime_self_add_right {m n : ℕ} : coprime m (m + n) ↔ coprime m n := by
+theorem coprime_self_add_right {m n : ℕ} : Coprime m (m + n) ↔ Coprime m n := by
rw [add_comm, coprime_add_self_right]
#align nat.coprime_self_add_right Nat.coprime_self_add_right
@[simp]
-theorem coprime_add_self_left {m n : ℕ} : coprime (m + n) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_self_left]
+theorem coprime_add_self_left {m n : ℕ} : Coprime (m + n) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_self_left]
#align nat.coprime_add_self_left Nat.coprime_add_self_left
@[simp]
-theorem coprime_self_add_left {m n : ℕ} : coprime (m + n) m ↔ coprime n m := by
- rw [coprime, coprime, gcd_self_add_left]
+theorem coprime_self_add_left {m n : ℕ} : Coprime (m + n) m ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_self_add_left]
#align nat.coprime_self_add_left Nat.coprime_self_add_left
@[simp]
-theorem coprime_add_mul_right_right (m n k : ℕ) : coprime m (n + k * m) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_right_right]
+theorem coprime_add_mul_right_right (m n k : ℕ) : Coprime m (n + k * m) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_right_right]
#align nat.coprime_add_mul_right_right Nat.coprime_add_mul_right_right
@[simp]
-theorem coprime_add_mul_left_right (m n k : ℕ) : coprime m (n + m * k) ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_left_right]
+theorem coprime_add_mul_left_right (m n k : ℕ) : Coprime m (n + m * k) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_left_right]
#align nat.coprime_add_mul_left_right Nat.coprime_add_mul_left_right
@[simp]
-theorem coprime_mul_right_add_right (m n k : ℕ) : coprime m (k * m + n) ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_right_add_right]
+theorem coprime_mul_right_add_right (m n k : ℕ) : Coprime m (k * m + n) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_right_add_right]
#align nat.coprime_mul_right_add_right Nat.coprime_mul_right_add_right
@[simp]
-theorem coprime_mul_left_add_right (m n k : ℕ) : coprime m (m * k + n) ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_left_add_right]
+theorem coprime_mul_left_add_right (m n k : ℕ) : Coprime m (m * k + n) ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_left_add_right]
#align nat.coprime_mul_left_add_right Nat.coprime_mul_left_add_right
@[simp]
-theorem coprime_add_mul_right_left (m n k : ℕ) : coprime (m + k * n) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_right_left]
+theorem coprime_add_mul_right_left (m n k : ℕ) : Coprime (m + k * n) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_right_left]
#align nat.coprime_add_mul_right_left Nat.coprime_add_mul_right_left
@[simp]
-theorem coprime_add_mul_left_left (m n k : ℕ) : coprime (m + n * k) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_add_mul_left_left]
+theorem coprime_add_mul_left_left (m n k : ℕ) : Coprime (m + n * k) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_add_mul_left_left]
#align nat.coprime_add_mul_left_left Nat.coprime_add_mul_left_left
@[simp]
-theorem coprime_mul_right_add_left (m n k : ℕ) : coprime (k * n + m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_right_add_left]
+theorem coprime_mul_right_add_left (m n k : ℕ) : Coprime (k * n + m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_right_add_left]
#align nat.coprime_mul_right_add_left Nat.coprime_mul_right_add_left
@[simp]
-theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_mul_left_add_left]
+theorem coprime_mul_left_add_left (m n k : ℕ) : Coprime (n * k + m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_mul_left_add_left]
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
@[simp]
-theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) m ↔ coprime n m := by
- rw [coprime, coprime, gcd_sub_self_left h]
+theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) m ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_sub_self_left h]
@[simp]
-theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : coprime m (n - m) ↔ coprime m n:= by
- rw [coprime, coprime, gcd_sub_self_right h]
+theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : Coprime m (n - m) ↔ Coprime m n:= by
+ rw [Coprime, Coprime, gcd_sub_self_right h]
@[simp]
-theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) n ↔ coprime m n := by
- rw [coprime, coprime, gcd_self_sub_left h]
+theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : Coprime (n - m) n ↔ Coprime m n := by
+ rw [Coprime, Coprime, gcd_self_sub_left h]
@[simp]
-theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : coprime n (n - m) ↔ coprime n m := by
- rw [coprime, coprime, gcd_self_sub_right h]
+theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : Coprime n (n - m) ↔ Coprime n m := by
+ rw [Coprime, Coprime, gcd_self_sub_right h]
@[simp]
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime (a ^ n) b ↔ Nat.coprime a b := by
+ Nat.Coprime (a ^ n) b ↔ Nat.Coprime a b := by
obtain ⟨n, rfl⟩ := exists_eq_succ_of_ne_zero hn.ne'
rw [pow_succ, Nat.coprime_mul_iff_left]
exact ⟨And.right, fun hab => ⟨hab.pow_left _, hab⟩⟩
@@ -237,33 +237,33 @@ theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
@[simp]
theorem coprime_pow_right_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
- Nat.coprime a (b ^ n) ↔ Nat.coprime a b := by
+ Nat.Coprime a (b ^ n) ↔ Nat.Coprime a b := by
rw [Nat.coprime_comm, coprime_pow_left_iff hn, Nat.coprime_comm]
#align nat.coprime_pow_right_iff Nat.coprime_pow_right_iff
-theorem not_coprime_zero_zero : ¬coprime 0 0 := by simp
+theorem not_coprime_zero_zero : ¬Coprime 0 0 := by simp
#align nat.not_coprime_zero_zero Nat.not_coprime_zero_zero
-theorem coprime_one_left_iff (n : ℕ) : coprime 1 n ↔ True := by simp [coprime]
+theorem coprime_one_left_iff (n : ℕ) : Coprime 1 n ↔ True := by simp [Coprime]
#align nat.coprime_one_left_iff Nat.coprime_one_left_iff
-theorem coprime_one_right_iff (n : ℕ) : coprime n 1 ↔ True := by simp [coprime]
+theorem coprime_one_right_iff (n : ℕ) : Coprime n 1 ↔ True := by simp [Coprime]
#align nat.coprime_one_right_iff Nat.coprime_one_right_iff
-theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : coprime a c) (b_dvd_c : b ∣ c) :
+theorem gcd_mul_of_coprime_of_dvd {a b c : ℕ} (hac : Coprime a c) (b_dvd_c : b ∣ c) :
gcd (a * b) c = b := by
rcases exists_eq_mul_left_of_dvd b_dvd_c with ⟨d, rfl⟩
rw [gcd_mul_right]
convert one_mul b
- exact coprime.coprime_mul_right_right hac
+ exact Coprime.coprime_mul_right_right hac
#align nat.gcd_mul_of_coprime_of_dvd Nat.gcd_mul_of_coprime_of_dvd
-theorem coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.coprime n) (hmn : m * n = 0) :
+theorem Coprime.eq_of_mul_eq_zero {m n : ℕ} (h : m.Coprime n) (hmn : m * n = 0) :
m = 0 ∧ n = 1 ∨ m = 1 ∧ n = 0 :=
(Nat.eq_zero_of_mul_eq_zero hmn).imp (fun hm => ⟨hm, n.coprime_zero_left.mp <| hm ▸ h⟩) fun hn =>
let eq := hn ▸ h.symm
⟨m.coprime_zero_left.mp <| eq, hn⟩
-#align nat.coprime.eq_of_mul_eq_zero Nat.coprime.eq_of_mul_eq_zero
+#align nat.coprime.eq_of_mul_eq_zero Nat.Coprime.eq_of_mul_eq_zero
/-- Represent a divisor of `m * n` as a product of a divisor of `m` and a divisor of `n`.
@@ -307,7 +307,7 @@ theorem pow_dvd_pow_iff {a b n : ℕ} (n0 : 0 < n) : a ^ n ∣ b ^ n ↔ a ∣ b
#align nat.pow_dvd_pow_iff Nat.pow_dvd_pow_iff
/-- If `k:ℕ` divides coprime `a` and `b` then `k = 1` -/
-theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka : k ∣ a)
+theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : Coprime a b) (hka : k ∣ a)
(hkb : k ∣ b) : k = 1 := by
rw [coprime_iff_gcd_eq_one] at h_ab_coprime
have h1 := dvd_gcd hka hkb
@@ -315,7 +315,7 @@ theorem eq_one_of_dvd_coprimes {a b k : ℕ} (h_ab_coprime : coprime a b) (hka :
exact Nat.dvd_one.mp h1
#align nat.eq_one_of_dvd_coprimes Nat.eq_one_of_dvd_coprimes
-theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
+theorem Coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : Coprime m n) (ha : a ≠ 0) (hb : b ≠ 0) :
a * m + b * n ≠ m * n := by
intro h
obtain ⟨x, rfl⟩ : n ∣ a :=
@@ -329,6 +329,6 @@ theorem coprime.mul_add_mul_ne_mul {m n a b : ℕ} (cop : coprime m n) (ha : a
rw [mul_comm, mul_ne_zero_iff, ← one_le_iff_ne_zero] at ha hb
refine' mul_ne_zero hb.2 ha.2 (eq_zero_of_mul_eq_self_left (ne_of_gt (add_le_add ha.1 hb.1)) _)
rw [← mul_assoc, ← h, add_mul, add_mul, mul_comm _ n, ← mul_assoc, mul_comm y]
-#align nat.coprime.mul_add_mul_ne_mul Nat.coprime.mul_add_mul_ne_mul
+#align nat.coprime.mul_add_mul_ne_mul Nat.Coprime.mul_add_mul_ne_mul
end Nat
@@ -6,6 +6,7 @@ Authors: Jeremy Avigad, Leonardo de Moura
import Mathlib.Algebra.GroupPower.Basic
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Nat.Order.Lemmas
+import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
@@ -88,6 +89,30 @@ theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
rw [add_comm, gcd_add_self_right]
#align nat.gcd_self_add_right Nat.gcd_self_add_right
+-- Lemmas where one argument consists of a subtraction of the other
+@[simp]
+theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
+ calc
+ gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
+ _ = gcd n m := by rw [Nat.sub_add_cancel h]
+
+@[simp]
+theorem gcd_sub_self_right {m n : ℕ} (h : m ≤ n) : gcd m (n - m) = gcd m n := by
+ rw [gcd_comm, gcd_sub_self_left h, gcd_comm]
+
+@[simp]
+theorem gcd_self_sub_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) n = gcd m n := by
+ have := Nat.sub_add_cancel h
+ rw [gcd_comm m n, ← this, gcd_add_self_left (n - m) m]
+ have : gcd (n - m) n = gcd (n - m) m := by
+ nth_rw 2 [← Nat.add_sub_cancel' h]
+ rw [gcd_add_self_right, gcd_comm]
+ convert this
+
+@[simp]
+theorem gcd_self_sub_right {m n : ℕ} (h : m ≤ n) : gcd n (n - m) = gcd n m := by
+ rw [gcd_comm, gcd_self_sub_left h, gcd_comm]
+
/-! ### `lcm` -/
theorem lcm_dvd_mul (m n : ℕ) : lcm m n ∣ m * n :=
@@ -186,6 +211,22 @@ theorem coprime_mul_left_add_left (m n k : ℕ) : coprime (n * k + m) n ↔ copr
rw [coprime, coprime, gcd_mul_left_add_left]
#align nat.coprime_mul_left_add_left Nat.coprime_mul_left_add_left
+@[simp]
+theorem coprime_sub_self_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) m ↔ coprime n m := by
+ rw [coprime, coprime, gcd_sub_self_left h]
+
+@[simp]
+theorem coprime_sub_self_right {m n : ℕ} (h : m ≤ n) : coprime m (n - m) ↔ coprime m n:= by
+ rw [coprime, coprime, gcd_sub_self_right h]
+
+@[simp]
+theorem coprime_self_sub_left {m n : ℕ} (h : m ≤ n) : coprime (n - m) n ↔ coprime m n := by
+ rw [coprime, coprime, gcd_self_sub_left h]
+
+@[simp]
+theorem coprime_self_sub_right {m n : ℕ} (h : m ≤ n) : coprime n (n - m) ↔ coprime n m := by
+ rw [coprime, coprime, gcd_self_sub_right h]
+
@[simp]
theorem coprime_pow_left_iff {n : ℕ} (hn : 0 < n) (a b : ℕ) :
Nat.coprime (a ^ n) b ↔ Nat.coprime a b := by
@@ -2,16 +2,13 @@
Copyright (c) 2014 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
-
-! This file was ported from Lean 3 source module data.nat.gcd.basic
-! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.GroupPower.Basic
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Nat.Order.Lemmas
+#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
+
/-!
# Definitions and properties of `Nat.gcd`, `Nat.lcm`, and `Nat.coprime`
This is the second half of the changes originally in #5699, removing all occurrences of ;
after a space and implementing a linter rule to enforce it.
In most cases this 2-character substring has a space after it, so the following command was run first:
find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;
The remaining cases were few enough in number that they were done manually.
@@ -239,7 +239,7 @@ def prodDvdAndDvdOfDvdProd {m n k : ℕ} (H : k ∣ m * n) :
obtain rfl : m = 0 := eq_zero_of_gcd_eq_zero_right h0
exact ⟨⟨⟨0, dvd_refl 0⟩, ⟨n, dvd_refl n⟩⟩, (zero_mul n).symm⟩
case succ tmp =>
- have hpos : 0 < gcd k m := h0.symm ▸ Nat.zero_lt_succ _ ; clear h0 tmp
+ have hpos : 0 < gcd k m := h0.symm ▸ Nat.zero_lt_succ _; clear h0 tmp
have hd : gcd k m * (k / gcd k m) = k := Nat.mul_div_cancel' (gcd_dvd_left k m)
refine' ⟨⟨⟨gcd k m, gcd_dvd_right k m⟩, ⟨k / gcd k m, _⟩⟩, hd.symm⟩
apply Nat.dvd_of_mul_dvd_mul_left hpos
Match https://github.com/leanprover-community/mathlib/pull/18698 and a bit of https://github.com/leanprover-community/mathlib/pull/18785.
algebra.divisibility.basic
@70d50ecfd4900dd6d328da39ab7ebd516abe4025
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.euclidean_domain.basic
@655994e298904d7e5bbd1e18c95defd7b543eb94
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.group.units
@369525b73f229ccd76a6ec0e0e0bf2be57599768
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.group_with_zero.basic
@2196ab363eb097c008d4497125e0dde23fb36db2
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.group_with_zero.divisibility
@f1a2caaf51ef593799107fe9a8d5e411599f3996
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.group_with_zero.units.basic
@70d50ecfd4900dd6d328da39ab7ebd516abe4025
..df5e9937a06fdd349fc60106f54b84d47b1434f0
algebra.order.monoid.canonical.defs
@de87d5053a9fe5cbde723172c0fb7e27e7436473
..e8638a0fcaf73e4500469f368ef9494e495099b3
algebra.ring.divisibility
@f1a2caaf51ef593799107fe9a8d5e411599f3996
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.int.dvd.basic
@e1bccd6e40ae78370f01659715d3c948716e3b7e
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.int.dvd.pow
@b3f25363ae62cb169e72cd6b8b1ac97bacf21ca7
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.int.order.basic
@728baa2f54e6062c5879a3e397ac6bac323e506f
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.nat.gcd.basic
@a47cda9662ff3925c6df271090b5808adbca5b46
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.nat.order.basic
@26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2
..e8638a0fcaf73e4500469f368ef9494e495099b3
data.nat.order.lemmas
@2258b40dacd2942571c8ce136215350c702dc78f
..e8638a0fcaf73e4500469f368ef9494e495099b3
group_theory.perm.cycle.basic
@92ca63f0fb391a9ca5f22d2409a6080e786d99f7
..e8638a0fcaf73e4500469f368ef9494e495099b3
number_theory.divisors
@f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c
..e8638a0fcaf73e4500469f368ef9494e495099b3
number_theory.pythagorean_triples
@70fd9563a21e7b963887c9360bd29b2393e6225a
..e8638a0fcaf73e4500469f368ef9494e495099b3
number_theory.zsqrtd.basic
@7ec294687917cbc5c73620b4414ae9b5dd9ae1b4
..e8638a0fcaf73e4500469f368ef9494e495099b3
ring_theory.multiplicity
@ceb887ddf3344dab425292e497fa2af91498437c
..e8638a0fcaf73e4500469f368ef9494e495099b3
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
! This file was ported from Lean 3 source module data.nat.gcd.basic
-! leanprover-community/mathlib commit a47cda9662ff3925c6df271090b5808adbca5b46
+! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -101,6 +101,11 @@ theorem lcm_dvd_iff {m n k : ℕ} : lcm m n ∣ k ↔ m ∣ k ∧ n ∣ k :=
⟨fun h => ⟨(dvd_lcm_left _ _).trans h, (dvd_lcm_right _ _).trans h⟩, and_imp.2 lcm_dvd⟩
#align nat.lcm_dvd_iff Nat.lcm_dvd_iff
+theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by
+ simp_rw [pos_iff_ne_zero]
+ exact lcm_ne_zero
+#align nat.lcm_pos Nat.lcm_pos
+
/-!
### `coprime`
This PR resyncs the first 28 entries of https://leanprover-community.github.io/mathlib-port-status/out-of-sync.html after sorting by diff size.
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
! This file was ported from Lean 3 source module data.nat.gcd.basic
-! leanprover-community/mathlib commit cf9386b56953fb40904843af98b7a80757bbe7f9
+! leanprover-community/mathlib commit a47cda9662ff3925c6df271090b5808adbca5b46
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Drop
by delta mydef; infer_instance
. This generates id _
in the proof.
show _, by infer_instance
. This generates let
in let
; not sure if it's bad for defeq but a reducible inferInstanceAs
should not be worse.
@@ -107,7 +107,7 @@ theorem lcm_dvd_iff {m n k : ℕ} : lcm m n ∣ k ↔ m ∣ k ∧ n ∣ k :=
See also `Nat.coprime_of_dvd` and `Nat.coprime_of_dvd'` to prove `Nat.coprime m n`.
-/
-instance (m n : ℕ) : Decidable (coprime m n) := by unfold coprime ;infer_instance
+instance (m n : ℕ) : Decidable (coprime m n) := inferInstanceAs (Decidable (gcd m n = 1))
theorem coprime.lcm_eq_mul {m n : ℕ} (h : coprime m n) : lcm m n = m * n := by
rw [← one_mul (lcm m n), ← h.gcd_eq_one, gcd_mul_lcm]
@@ -19,7 +19,7 @@ Generalizations of these are provided in a later file as `GCDMonoid.gcd` and
`GCDMonoid.lcm`.
Note that the global `IsCoprime` is not a straightforward generalization of `Nat.coprime`, see
-`Nat.is_coprime_iff_coprime` for the connection between the two.
+`Nat.isCoprime_iff_coprime` for the connection between the two.
-/
The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md
@@ -2,6 +2,11 @@
Copyright (c) 2014 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
+
+! This file was ported from Lean 3 source module data.nat.gcd.basic
+! leanprover-community/mathlib commit cf9386b56953fb40904843af98b7a80757bbe7f9
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Algebra.GroupPower.Basic
import Mathlib.Algebra.GroupWithZero.Divisibility