Definitions and properties of nat.gcd
, nat.lcm
, and nat.coprime
#
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Generalizations of these are provided in a later file as gcd_monoid.gcd
and
gcd_monoid.lcm
.
Note that the global is_coprime
is not a straightforward generalization of nat.coprime
, see
nat.is_coprime_iff_coprime
for the connection between the two.
gcd
#
lcm
#
coprime
#
See also nat.coprime_of_dvd
and nat.coprime_of_dvd'
to prove nat.coprime m n
.
@[protected, instance]
Equations
- nat.coprime.decidable m n = _.mpr (nat.decidable_eq (m.gcd n) 1)
Represent a divisor of m * n
as a product of a divisor of m
and a divisor of n
.
See exists_dvd_and_dvd_of_dvd_mul
for the more general but less constructive version for other
gcd_monoid
s.
Equations
- nat.prod_dvd_and_dvd_of_dvd_prod H = (λ (_x : ℕ) (h0 : k.gcd m = _x), _x.cases_on (λ (h0 : k.gcd m = 0), eq.rec (λ (H : 0 ∣ m * n) (h0 : 0.gcd m = 0), eq.rec (λ (H : 0 ∣ 0 * n) (h0 : 0.gcd 0 = 0), ⟨(⟨0, nat.prod_dvd_and_dvd_of_dvd_prod._proof_1⟩, ⟨n, _⟩), _⟩) _ H h0) _ H h0) (λ (n_1 : ℕ) (h0 : k.gcd m = n_1.succ), (λ (h0 : k.gcd m = n_1.succ), ⟨(⟨k.gcd m, _⟩, ⟨k / k.gcd m, _⟩), _⟩) h0) h0) (k.gcd m) nat.prod_dvd_and_dvd_of_dvd_prod._proof_7