(* Extended gcd, which computes Bezout coefficients. *)

Fixpoint Bezout_rec km kn qs :=
  if qs is q :: qs' then Bezout_rec kn (NatTrec.add_mul q kn km) qs'
  else (km, kn).

Lemma Gauss_gcdr p m n : coprime p m -> gcdn p (m * n) = gcdn p n.