(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************************)
(*                 The Calculus of Inductive Constructions                  *)
(*                                                                          *)
(*                                Projet Coq                                *)
(*                                                                          *)
(*                     INRIA                        ENS-CNRS                *)
(*              Rocquencourt                        Lyon                    *)
(*                                                                          *)
(*                                Coq V5.10                                 *)
(*                              Nov 25th 1994                               *)
(*                                                                          *)
(****************************************************************************)
(*                                 Zmult.v                                  *)
(****************************************************************************)
Require Export Lci.
Require Export misc.
Require Export Arith.
Require Export Nat_complements.
Require Export groups.
Require Export rings.
Require Export Zbase.
Require Export Z_succ_pred.
Require Export Zadd.
(* 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.

(* Specifications: *)
Lemma multZ_eq1 : forall n : Z, multZ OZ n = OZ.
Lemma multZ_eq2 : forall n : Z, multZ (pos 0) n = n.
Lemma multZ_eq3 :
forall (n1 : nat) (n : Z), multZ (pos (S n1)) n = addZ (multZ (pos n1) n) n.
Lemma multZ_eq4 : forall n : Z, multZ (neg 0) n = oppZ n.
Lemma multZ_eq5 :
forall (n1 : nat) (n : Z),
multZ (neg (S n1)) n = addZ (multZ (neg n1) n) (oppZ n).
(*******************)
Lemma tech_mult_posZ :
forall (x : nat) (y : Z), multZ (pos (S x)) y = addZ (multZ (pos x) y) y.