(** ** Constants and usual functions *)

(** 0 and 1 for complex are defined as [RtoC 0] and [RtoC 1] *)
Definition Ci : C := (0,1).(** *** Arithmetic operations *)

Definition Cplus (x y : C) : C := (fst x + fst y, snd x + snd y).Definition Copp (x : C) : C := (-fst x, -snd x).Definition Cminus (x y : C) : C := Cplus x (Copp y).Definition Cmult (x y : C) : C := (fst x * fst y - snd x * snd y, fst x * snd y + snd x * fst y).Definition Cinv (x : C) : C := (fst x / (fst x ^ 2 + snd x ^ 2), - snd x / (fst x ^ 2 + snd x ^ 2)).Definition Cdiv (x y : C) : C := Cmult x (Cinv y).Infix "+" := Cplus : C_scope.Notation "- x" := (Copp x) : C_scope.Infix "-" := Cminus : C_scope.Infix "*" := Cmult : C_scope.Notation "/ x" := (Cinv x) : C_scope.Infix "/" := Cdiv : C_scope.(** *** Other usual functions *)

Definition Re (z : C) : R := fst z.Definition Im (z : C) : R := snd z.Definition Cmod (x : C) : R := sqrt (fst x ^ 2 + snd x ^ 2).Definition Cconj (x : C) : C := (fst x, (- snd x)%R).

Lemma RtoC_mult (x y : R) : RtoC (x * y) = RtoC x * RtoC y.