(** Z2R function (Z -> R) *)
Fixpoint P2R (p : positive) :=
  match p with
  | xH => 1%R
  | xO xH => 2%R
  | xO t => (2 * P2R t)%R
  | xI xH => 3%R
  | xI t => (1 + 2 * P2R t)%R
  end.Definition Z2R n :=
  match n with
  | Zpos p => P2R p
  | Zneg p => Ropp (P2R p)
  | Z0 => 0%R
  end.

(* Specifications: *)
Theorem P2R_INR : forall n, P2R n = INR (nat_of_P n).
Theorem Z2R_IZR : forall n, Z2R n = IZR n.
Theorem Z2R_opp : forall n, Z2R (-n) = (- Z2R n)%R.
Theorem Z2R_plus : forall m n, (Z2R (m + n) = Z2R m + Z2R n)%R.
Theorem minus_IZR : forall n m : Z, IZR (n - m) = (IZR n - IZR m)%R.
Theorem Z2R_minus : forall m n, (Z2R (m - n) = Z2R m - Z2R n)%R.
Theorem Z2R_mult : forall m n, (Z2R (m * n) = Z2R m * Z2R n)%R.
Theorem le_Z2R : forall m n, (Z2R m <= Z2R n)%R -> (m <= n)%Z.
Theorem Z2R_le : forall m n, (m <= n)%Z -> (Z2R m <= Z2R n)%R.
Theorem lt_Z2R : forall m n, (Z2R m < Z2R n)%R -> (m < n)%Z.
Theorem Z2R_lt : forall m n, (m < n)%Z -> (Z2R m < Z2R n)%R.
Theorem Z2R_le_lt : forall m n p, (m <= n < p)%Z -> (Z2R m <= Z2R n < Z2R p)%R.
Theorem le_lt_Z2R : forall m n p, (Z2R m <= Z2R n < Z2R p)%R -> (m <= n < p)%Z.
Theorem eq_Z2R : forall m n, (Z2R m = Z2R n)%R -> (m = n)%Z.
Theorem neq_Z2R : forall m n, (Z2R m <> Z2R n)%R -> (m <> n)%Z.
Theorem Z2R_neq : forall m n, (m <> n)%Z -> (Z2R m <> Z2R n)%R.
Theorem Z2R_abs : forall z, Z2R (Zabs z) = Rabs (Z2R z).