Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Open Scope ring_scope.
(** Starting from cyril exercise *)
Section PreliminaryLemmas.

(* Specifications: *)
(** * Preliminaries  Let's extend the library on rings and algebraic numbers with some easy lemmas first.  ** Question -2: prove that if a product of natural numbers is 1 then each factor is 1.  Note that we do not consider nat but the copy of nat which is embeded in the algebraic numbers algC. The theorem already exists for nat, and we suggest you use a compatibility lemma numbers between nat and Cnat *)
Lemma Cnat_mul_eq1 : {in Cnat &, forall x y, (x * y == 1) = (x == 1) && (y == 1)}.
Lemma Cnat_add_eq1 : {in Cnat &, forall x y,
(x + y == 1) = ((x == 1) && (y == 0)) || ((x == 0) && (y == 1))}.
(** ** Question -1: The real part of product *)
Lemma algReM (x y : algC) :
'Re (x * y) = 'Re x * 'Re y - 'Im x * 'Im y.
(** ** Question 0: The imaginary part of product *)
Lemma algImM (x y : algC) : 'Im (x * y) = 'Re x * 'Im y + 'Re y * 'Im x.
Lemma algReV (x : algC) :
'Re (x^-1) = 'Re x / `|x| ^+ 2.
Lemma algImV (x : algC) :
'Im (x^-1) = - ('Im x / `|x| ^+ 2).
Lemma algRe_div (x y : algC) :
'Re (x/y) = ('Re x * 'Re y + 'Im x * 'Im y) / `|y| ^+ 2.
Lemma algIm_div (x y : algC) :
'Im (x/y) = ('Re y * 'Im x - 'Re x * 'Im y) / `|y| ^+ 2.