Module Type TYPE_ALGEBRA.
(** Type expressions *)
Parameter t: Type.
Parameter eq: forall (x y: t), {x=y} + {x<>y}.
Parameter default: t.
(** Subtyping *)
Parameter sub: t -> t -> Prop.
Parameter sub_dec: forall x y, {sub x y} + {~sub x y}.
(** Least upper bounds. [lub x y] is specified only when [x] and [y] have a common supertype; it can be arbitrary otherwise. *)
Parameter lub: t -> t -> t.
(** Greater lower bounds. [glb x y] is specified only when [x] and [y] have a common subtype; it can be arbitrary otherwise.*)
Parameter glb: t -> t -> t.
(** Low and high bounds for a given type. *)
Parameter low_bound: t -> t.
Parameter high_bound: t -> t.
(** Measure over types *)
Parameter weight: t -> nat.
Parameter max_weight: nat.

Axiom weight_range: forall t, weight t <= max_weight.
Axiom weight_sub: forall x y, sub x y -> weight x <= weight y.
Axiom weight_sub_strict: forall x y, sub x y -> x <> y -> weight x < weight y.