Module Type GenericSgn (Import Z : ZDecAxiomsSig')
(Import ZP : ZMulOrderProp Z) <: HasSgn Z.
Definition sgn n :=
match compare 0 n with Eq => 0 | Lt => 1 | Gt => -1 end.
(** Triangular inequality *)
(** Absolute value and multiplication *)
(** Some results about the sign function. *)
Ltac destruct_sgn n :=
let LT := fresh "LT" in
let EQ := fresh "EQ" in
let GT := fresh "GT" in
destruct (lt_trichotomy 0 n) as [LT|[EQ|GT]];
[rewrite (sgn_pos n) by auto|
rewrite (sgn_null n) by auto with relations|
rewrite (sgn_neg n) by auto].
Instance sgn_wd : Proper (eq==>eq) sgn.

Lemma sgn_spec : forall n,
0 < n /\ sgn n == 1 \/
0 == n /\ sgn n == 0 \/
0 > n /\ sgn n == -1.