Extended GCD and divisibility over ℤ #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Main definitions #
- Given
x y : ℕ,xgcd x ycomputes the pair of integers(a, b)such thatgcd x y = x * a + y * b.gcd_a x yandgcd_b x yare defined to beaandb, respectively.
Main statements #
gcd_eq_gcd_ab: Bézout's lemma, givenx y : ℕ,gcd x y = x * gcd_a x y + y * gcd_b x y.
Tags #
Bézout's lemma, Bezout's lemma
Extended Euclidean algorithm #
Divisibility over ℤ #
theorem
int.dvd_of_dvd_mul_left_of_gcd_one
{a b c : ℤ}
(habc : a ∣ b * c)
(hab : a.gcd c = 1) :
a ∣ b
Euclid's lemma: if a ∣ b * c and gcd a c = 1 then a ∣ b.
Compare with is_coprime.dvd_of_dvd_mul_left and
unique_factorization_monoid.dvd_of_dvd_mul_left_of_no_prime_factors
theorem
int.dvd_of_dvd_mul_right_of_gcd_one
{a b c : ℤ}
(habc : a ∣ b * c)
(hab : a.gcd b = 1) :
a ∣ c
Euclid's lemma: if a ∣ b * c and gcd a b = 1 then a ∣ c.
Compare with is_coprime.dvd_of_dvd_mul_right and
unique_factorization_monoid.dvd_of_dvd_mul_right_of_no_prime_factors