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

Lemma foldl_rcons {T T0 : Type} : forall (f : T -> T0 -> T) x0 s t,
foldl f x0 (rcons s t) = f (foldl f x0 s) t.