Definition logGI p x :=
if primeGI p then logGI_rec p x ('N x) else 0%N.

Lemma pfactor_dvdGI p (n : nat) (x : GI) : primeGI p -> x != 0 -> (p ^+ n %| x) = (n <= logGI p x)%N.
Definition coprimeGI (x y : GI) := 'N(gcdGI x y) == 1%N.