Definition pos_div_2 (eps : posreal) := mkposreal _ (is_pos_div_2 eps).(** * The sign function *)

Definition sign (x : R) :=
  match total_order_T 0 x with
  | inleft (left _) => 1
  | inleft (right _) => 0
  | inright _ => -1
  end.

Lemma pairmap_map {T T0 T1 : Type} (f : T0 -> T0 -> T1) (g : T -> T0) (s : seq T) (x0 : T) : pairmap f (g x0) (map g s) = pairmap (fun x y => f (g x) (g y)) x0 s.