I'd like to prove Gauss' theorem for nat
.
In plain (non-precise) language it says: if a
divides b*c
and none of a
's factors are in b
then they must all be in c
.
Require Import NPeano.
Theorem Gauss_nat: forall (a b c:nat), gcd a b = 1 -> (a | (b*c)) -> (a | c).
The theorem is already defined for integers Z
, see here in the Coq manual. But I need it for nat
. The recommendations I have gotten so far is to use Bezout's lemma which states that
Lemma Bezout: forall (a b c:Z), Z.gcd a b = c -> exists u v, u*a+v*b=c.
However, I can't use it directly for nat
s since the coefficients u
and v
might be negative and thus it doesn't hold for nat
.
Is there another proof that does not use integers in the proof?
EDIT:
As was pointed out in a comment by Mark Dickinson, the theorem and lemma are already in Coq's library. They are in NPeano
, named Nat.gcd_bezout
and Nat.gauss
.
forall (a b:nat), exists u v, u*a = gcd a b + v*b
. – Mark Dickinsonbezout_nat
, I was able to prove Gauss_nat by using it....) – larsrgcd_bezout_pos_pos
,gcd_bezout
, andgauss
. – Mark Dickinson