(* Multiplication on Z, (Z, +, *, 0, 1) is a unitary commutative ring *)

(*Recursive Definition multZ : Z -> Z -> Z := 
        OZ      y  => OZ
 | (pos O)      y  => y
 | (pos (S n1)) y  => (addZ (multZ (pos n1) y) y)
 | (neg O)      y  => (oppZ y)
 | (neg (S n1)) y  => (addZ (multZ (neg n1) y) (oppZ y)).
*)


Fixpoint multpos (x2 : Z) (n : nat) {struct n} : Z :=
  match n with
  | O => x2
  | S n0 => addZ (multpos x2 n0) x2
  end.Fixpoint multneg (x2 : Z) (n : nat) {struct n} : Z :=
  match n with
  | O => oppZ x2
  | S n0 => addZ (multneg x2 n0) (oppZ x2)
  end.Definition multZ (x1 x2 : Z) :=
  match x1 with
  | OZ => OZ
  | pos n => multpos x2 n
  | neg n => multneg x2 n
  end.

Lemma mult_IZ : forall x : Z, multZ x IZ = x.