Notation "0" := rO.Notation "1" := rI.Notation "x + y" := (radd x y).Notation "x * y " := (rmul x y).Notation "x - y " := (rsub x y).Notation "- x" := (ropp x).Notation "x == y" := (req x y).Add Parametric Relation : R req
       reflexivity  proved by (@Equivalence_Reflexive _ _ Rsth)
       symmetry     proved by (@Equivalence_Symmetric _ _ Rsth)
       transitivity proved by (@Equivalence_Transitive _ _ Rsth)
      as R_setoid3.Ltac rrefl := gen_reflexivity Rsth.Add Morphism radd with signature (req ==> req ==> req) as radd_ext3.Add Morphism rmul with signature (req ==> req ==> req) as rmul_ext3.Add Morphism ropp with signature (req ==> req) as ropp_ext3.Fixpoint gen_phiPOS1 (p:positive) : R :=
  match p with
  | xH => 1
  | xO p => (1 + 1) * (gen_phiPOS1 p)
  | xI p => 1 + ((1 + 1) * (gen_phiPOS1 p))
  end.Fixpoint gen_phiPOS (p:positive) : R :=
  match p with
  | xH => 1
  | xO xH => (1 + 1)
  | xO p => (1 + 1) * (gen_phiPOS p)
  | xI xH => 1 + (1 +1)
  | xI p => 1 + ((1 + 1) * (gen_phiPOS p))
  end.Definition gen_phiZ1 z :=
  match z with
  | Zpos p => gen_phiPOS1 p
  | Z0 => 0
  | Zneg p => -(gen_phiPOS1 p)
  end.Definition gen_phiZ z :=
  match z with
  | Zpos p => gen_phiPOS p
  | Z0 => 0
  | Zneg p => -(gen_phiPOS p)
  end.Notation "[ x ]" := (gen_phiN x).Definition get_signZ z :=
  match z with
  | Zneg p => Some (Zpos p)
  | _ => None
  end.

(* Specifications: *)
Lemma get_signZ_th : sign_theory Z.opp Zeq_bool get_signZ.