(** Basic facts about boolean comparisons *)
Module Type BoolOrderFacts
(Import E:EqLtLe')
(Import C:HasCmp E)
(Import F:HasBoolOrdFuns' E)
(Import O:CompareBasedOrder E C)
(Import S:BoolOrdSpecs E F).
Include CompareBasedOrderFacts E C O.
(** Nota : apart from [eqb_compare] below, facts about [eqb] are in BoolEqualityFacts *)
(** Alternate specifications based on [BoolSpec] and [reflect] *)

(* Specifications: *)
Lemma leb_spec0 x y : reflect (x<=y) (x<=?y).
Lemma ltb_spec0 x y : reflect (x<y) (x<?y).
(** Negated variants of the specifications *)
Lemma leb_nle x y : x <=? y = false <-> ~ (x <= y).
Lemma leb_gt x y : x <=? y = false <-> y < x.
Lemma ltb_nlt x y : x <? y = false <-> ~ (x < y).
Lemma ltb_ge x y : x <? y = false <-> y <= x.
(** Basic equality laws for boolean tests *)
Lemma leb_refl x : x <=? x = true.
Lemma leb_antisym x y : y <=? x = negb (x <? y).
Lemma ltb_irrefl x : x <? x = false.
Lemma ltb_antisym x y : y <? x = negb (x <=? y).
(** Relation between [compare] and the boolean comparisons *)
Lemma eqb_compare x y :
(x =? y) = match compare x y with Eq => true | _ => false end.
Lemma ltb_compare x y :
(x <? y) = match compare x y with Lt => true | _ => false end.
Lemma leb_compare x y :
(x <=? y) = match compare x y with Gt => false | _ => true end.