(** Conversion from [Z] to [nat]. *)

Definition nat_of_Z: Z -> nat := Z.to_nat.

(* Specifications: *)
Lemma nat_of_Z_of_nat: forall n, nat_of_Z (Z.of_nat n) = n.
Lemma nat_of_Z_max: forall z, Z.of_nat (nat_of_Z z) = Z.max z 0.
Lemma nat_of_Z_eq: forall z, z >= 0 -> Z.of_nat (nat_of_Z z) = z.
Lemma nat_of_Z_neg: forall n, n <= 0 -> nat_of_Z n = O.
Lemma nat_of_Z_plus: forall p q, p >= 0 -> q >= 0 -> nat_of_Z (p + q) = (nat_of_Z p + nat_of_Z q)%nat.
Lemma nat_of_Z_of_nat: forall n, nat_of_Z (Z.of_nat n) = n.
Lemma nat_of_Z_max: forall z, Z.of_nat (nat_of_Z z) = Z.max z 0.
Lemma nat_of_Z_eq: forall z, z >= 0 -> Z.of_nat (nat_of_Z z) = z.
Lemma nat_of_Z_neg: forall n, n <= 0 -> nat_of_Z n = O.
Lemma nat_of_Z_plus: forall p q, p >= 0 -> q >= 0 -> nat_of_Z (p + q) = (nat_of_Z p + nat_of_Z q)%nat.