Extended GCD and divisibility over ℤ
Main definitions
- Given
x y : ℕ
,xgcd x y
computes the pair of integers(a, b)
such thatgcd x y = x * a + y * b
.gcd_a x y
andgcd_b x y
are defined to bea
andb
, 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
.
Extended Euclidean algorithm
Helper function for the extended GCD algorithm (nat.xgcd
).