open Ident type const = | Integer of Intervals.v | Atom of Atoms.v | Char of Chars.v val compare_const: const -> const -> int val hash_const: const -> int val equal_const: const -> const -> bool (** Algebra **) type node type descr val make: unit -> node val define: node -> descr -> unit val cons: descr -> node val internalize: node -> node val id: node -> int val descr: node -> descr val equal_descr: descr -> descr -> bool val hash_descr: descr -> int val compare_descr: descr -> descr -> int module DescrHash: Hashtbl.S with type key = descr module DescrSList: SortedList.S with type 'a elem = descr module DescrMap: Map.S with type key = descr (** Boolean connectives **) val cup : descr -> descr -> descr val cap : descr -> descr -> descr val diff : descr -> descr -> descr val neg : descr -> descr val empty : descr val any : descr val any_node : node (** Constructors **) type pair_kind = [ `Normal | `XML ] val interval : Intervals.t -> descr val atom : Atoms.t -> descr val times : node -> node -> descr val xml : node -> node -> descr val arrow : node -> node -> descr val record : label -> node -> descr val record' : bool * node label_map -> descr val char : Chars.t -> descr val constant : const -> descr (** Positive systems and least solutions **) module Positive : sig type v val forward: unit -> v val define: v -> v -> unit val ty: descr -> v val cup: v list -> v val times: v -> v -> v val xml: v -> v -> v val solve: v -> node end (** Normalization **) module Product : sig val any : descr val any_xml : descr val other : ?kind:pair_kind -> descr -> descr val is_product : ?kind:pair_kind -> descr -> bool (* List of non-empty rectangles *) type t = (descr * descr) list val is_empty: t -> bool val get: ?kind:pair_kind -> descr -> t val pi1: t -> descr val pi2: t -> descr val pi2_restricted: descr -> t -> descr (* Intersection with (pi1,Any) *) val restrict_1: t -> descr -> t (* List of non-empty rectangles whose first projection are pair-wise disjunct *) type normal = t val normal: ?kind:pair_kind -> descr -> normal val constraint_on_2: normal -> descr -> descr (* constraint_on_2 n t1: maximal t2 such that (t1,t2) <= n *) (* Assumption: t1 <= pi1(n) *) val need_second: t -> bool (* Is there more than a single rectangle ? *) end module Record : sig val any : descr val or_absent: descr -> descr val any_or_absent: descr val has_absent: descr -> bool val has_record: descr -> bool val split : descr -> label -> Product.t val split_normal : descr -> label -> Product.normal val project : descr -> label -> descr (* Raise Not_found if label is not necessarily present *) val condition : descr -> label -> descr -> descr (* condition t1 l t2 : What must follow if field l hash type t2 *) val project_opt : descr -> label -> descr val has_empty_record: descr -> bool val first_label: descr -> label val empty_cases: descr -> bool * bool val merge: descr -> descr -> descr val remove_field: descr -> label -> descr val get: descr -> (descr label_map * bool * bool) list end module Arrow : sig val any : descr val check_strenghten: descr -> descr -> descr (* [check_strenghten t s] Assume that [t] is an intersection of arrow types representing the interface of an abstraction; check that this abstraction has type [s] (otherwise raise Not_found) and returns a refined type for this abstraction. *) val check_iface: (descr * descr) list -> descr -> bool type t val is_empty: t -> bool val get: descr -> t (* Always succeed; no check <= Arrow.any *) val domain: t -> descr val apply: t -> descr -> descr (* Always succeed; no check on the domain *) val need_arg : t -> bool (* True if the type of the argument is needed to obtain the type of the result (must use [apply]; otherwise, [apply_noarg] is enough *) val apply_noarg : t -> descr end module Int : sig val has_int : descr -> Intervals.v -> bool val get: descr -> Intervals.t val any : descr end module Atom : sig val has_atom : descr -> Atoms.v -> bool val get: descr -> Atoms.t end module Char : sig val has_char : descr -> Chars.v -> bool val get: descr -> Chars.t val any : descr end val normalize : descr -> descr (** Subtyping and sample values **) val is_empty : descr -> bool val non_empty: descr -> bool val subtype : descr -> descr -> bool module Sample : sig type t val get : descr -> t (** Extract a sample value from a non empty type; raise Not_found for an empty type **) val print : Format.formatter -> t -> unit end module Print : sig val register_global : string -> descr -> unit val print_const : Format.formatter -> const -> unit val print: Format.formatter -> descr -> unit end