Definition float := binary64.(**r the type of IEE754 double-precision FP numbers *)
Definition float32 := binary32.(**r the type of IEE754 single-precision FP numbers *)

(** Boolean-valued comparisons *)

Definition cmp_of_comparison (c: comparison) (x: option Datatypes.comparison) : bool :=
  match c with
  | Ceq =>
      match x with Some Eq => true | _ => false end
  | Cne =>
      match x with Some Eq => false | _ => true end
  | Clt =>
      match x with Some Lt => true | _ => false end
  | Cle =>
      match x with Some(Lt|Eq) => true | _ => false end
  | Cgt =>
      match x with Some Gt => true | _ => false end
  | Cge =>
      match x with Some(Gt|Eq) => true | _ => false end
  end.

(* Specifications: *)
Lemma cmp_of_comparison_swap: forall c x, cmp_of_comparison (swap_comparison c) x = cmp_of_comparison c (match x with None => None | Some x => Some (CompOpp x) end).
Lemma cmp_of_comparison_ne_eq: forall x, cmp_of_comparison Cne x = negb (cmp_of_comparison Ceq x).
Lemma cmp_of_comparison_lt_eq_false: forall x, cmp_of_comparison Clt x = true -> cmp_of_comparison Ceq x = true -> False.
Lemma cmp_of_comparison_le_lt_eq: forall x, cmp_of_comparison Cle x = cmp_of_comparison Clt x || cmp_of_comparison Ceq x.
Lemma cmp_of_comparison_gt_eq_false: forall x, cmp_of_comparison Cgt x = true -> cmp_of_comparison Ceq x = true -> False.
Lemma cmp_of_comparison_ge_gt_eq: forall x, cmp_of_comparison Cge x = cmp_of_comparison Cgt x || cmp_of_comparison Ceq x.
Lemma cmp_of_comparison_lt_gt_false: forall x, cmp_of_comparison Clt x = true -> cmp_of_comparison Cgt x = true -> False.
Lemma cmp_of_comparison_swap: forall c x, cmp_of_comparison (swap_comparison c) x = cmp_of_comparison c (match x with None => None | Some x => Some (CompOpp x) end).
Lemma cmp_of_comparison_ne_eq: forall x, cmp_of_comparison Cne x = negb (cmp_of_comparison Ceq x).
Lemma cmp_of_comparison_lt_eq_false: forall x, cmp_of_comparison Clt x = true -> cmp_of_comparison Ceq x = true -> False.
Lemma cmp_of_comparison_le_lt_eq: forall x, cmp_of_comparison Cle x = cmp_of_comparison Clt x || cmp_of_comparison Ceq x.
Lemma cmp_of_comparison_gt_eq_false: forall x, cmp_of_comparison Cgt x = true -> cmp_of_comparison Ceq x = true -> False.
Lemma cmp_of_comparison_ge_gt_eq: forall x, cmp_of_comparison Cge x = cmp_of_comparison Cgt x || cmp_of_comparison Ceq x.
Lemma cmp_of_comparison_lt_gt_false: forall x, cmp_of_comparison Clt x = true -> cmp_of_comparison Cgt x = true -> False.