Ltac simpl_compare := autorewrite with compare.Ltac simpl_compare_in H := autorewrite with compare in H.(** Relation between [compare] and [sub_mask] *)

Definition mask2cmp (p:mask) : comparison :=
 match p with
  | IsNul => Eq
  | IsPos _ => Gt
  | IsNeg => Lt
 end.

(* Specifications: *)
Lemma compare_sub_mask p q : (p ?= q) = mask2cmp (sub_mask p q).
Lemma lt_iff_add p q : p < q <-> exists r, p + r = q.
Lemma gt_iff_add p q : p > q <-> exists r, q + r = p.
Theorem compare_cont_refl p c : compare_cont c p p = c.
Lemma compare_cont_antisym p q c : CompOpp (compare_cont c p q) = compare_cont (CompOpp c) q p.
Lemma compare_eq_iff p q : (p ?= q) = Eq <-> p = q.
Lemma compare_antisym p q : (q ?= p) = CompOpp (p ?= q).
Lemma compare_lt_iff p q : (p ?= q) = Lt <-> p < q.
Lemma compare_le_iff p q : (p ?= q) <> Gt <-> p <= q.