Fact unitGI_out : {in [predC unitGI], invGI =1 id}.
Definition GI_comUnitRingMixin :=
ComUnitRingMixin mulGIr unitGIP unitGI_out.
Canonical GI_unitRingType := UnitRingType GI GI_comUnitRingMixin.
Canonical GI_comUnitRingType := [comUnitRingType of GI].

(* Specifications: *)
(**  ** Question 4: Show that gauss integers are stable by conjugation.  *)
Lemma conjGIE x : (x^* \is a gaussInteger) = (x \is a gaussInteger).
Lemma gaussNorm_eq0 (x : GI) : (gaussNorm (algGI x) == 0) = (x == 0).
Lemma normGI_gt0 (x : GI) : ('N x > 0)%N = (x != 0).
Lemma normGI_nat n : 'N n%:R = (n ^ 2)%N.
Lemma normGIE (x : GI) : ('N(x) = truncC (`|'Re (val x)|) ^ 2 + truncC (`|'Im (val x)|) ^ 2)%N.
Lemma truncC_Cint (x : algC) :
x \in Cint -> x = (-1) ^+ (x < 0)%R * (truncC `|x|)%:R.
Lemma normGI_eq1 (x : GI) : ('N(x) == 1)%N = (val x \in [::1;-1;'i;-'i]).
(**  ** Question 7: Find the invertible elements of GI  - This is question 1 of the CPGE exercice  - Suggested strategy: sketch the proof on a paper first, don't let Coq divert you from your proofsketch  *)
Lemma unitGIE (x : GI) : (x \in GRing.unit) =
(val x \in 4.-unity_root).
Lemma algC_eqE (x y : algC) : (x == y) = (('Re x == 'Re y) && ('Im x == 'Im y)).
Lemma normGI_unit (x : GI) : ('N(x) == 1)%N = (x \in GRing.unit).
Fact GI_idomainAxiom (x y : GI) : x * y = 0 -> (x == 0) || (y == 0).