(** [String] is an ordered type with respect to the usual lexical order. *)
Module String_as_OT <: UsualOrderedType.
Definition t := string.
Include HasUsualEq <+ UsualIsEq.
Definition eqb := String.eqb.
Definition eqb_eq := String.eqb_eq.
Include HasEqBool2Dec.
Fixpoint compare (a b : string)
:= match a, b with
| EmptyString, EmptyString => Eq
| EmptyString, _ => Lt
| String _ _, EmptyString => Gt
| String a_head a_tail, String b_head b_tail =>
match Ascii_as_OT.compare a_head b_head with
| Lt => Lt
| Gt => Gt
| Eq => compare a_tail b_tail
end
end.
Definition lt (a b : string) := compare a b = Lt.
#[global]
Instance lt_compat : Proper (eq==>eq==>iff) lt.

(* Specifications: *)
Lemma compare_spec : forall x y, CompSpec eq lt x y (compare x y).
#[global]
Instance lt_strorder : StrictOrder lt.