1 (***********************************************************************)
5 (* Kim Nguyen, LRI UMR8623 *)
6 (* Université Paris-Sud & CNRS *)
8 (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (* Recherche Scientifique. All rights reserved. This file is *)
10 (* distributed under the terms of the GNU Lesser General Public *)
11 (* License, with the special exception on linking described in file *)
14 (***********************************************************************)
17 Time-stamp: <Last modified on 2013-03-04 23:01:55 CET by Kim Nguyen>
20 (** Type equipped with an equality and hash function.
21 If [equal a b] then [(hash a) = (hash b)]
23 module type HashedType =
27 (** [hash v] returns an integer in the range [ 0 - 2^30-1 ]
32 val equal : t -> t -> bool
36 (** Type equiped with a total ordering *)
37 module type OrderedType =
41 (** Total ordering on values of type [t]. [compare a b] returns a
42 negative number if [a] is strictly smaller than [b], a positive
43 number if [a] is strictly greater than [b] and 0 if [a] is equal
45 val compare : t -> t -> int
51 include HashedType with type t := t
52 include OrderedType with type t := t
55 (** Type equiped with a pretty-printer *)
56 module type Printable =
59 val print : Format.formatter -> t -> unit
62 (** Signature of a simple HashSet module *)
68 val add : t -> data -> unit
69 val remove : t -> data -> unit
70 val find : t -> data -> data
71 val find_all : t -> data -> data list
73 val mem : t -> data -> bool
76 (** Signature of simple Set module *)
82 val is_empty : t -> bool
83 val mem : elt -> t -> bool
84 val add : elt -> t -> t
85 val singleton : elt -> t
86 val remove : elt -> t -> t
87 val union : t -> t -> t
88 val inter : t -> t -> t
89 val diff : t -> t -> t
90 val compare : t -> t -> int
91 val equal : t -> t -> bool
92 val subset : t -> t -> bool
93 val iter : (elt -> unit) -> t -> unit
94 val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
95 val for_all : (elt -> bool) -> t -> bool
96 val exists : (elt -> bool) -> t -> bool
97 val filter : (elt -> bool) -> t -> t
98 val partition : (elt -> bool) -> t -> t * t
99 val cardinal : t -> int
100 val elements : t -> elt list
101 val min_elt : t -> elt
102 val max_elt : t -> elt
103 val choose : t -> elt
104 val split : elt -> t -> t * bool * t
105 val intersect : t -> t -> bool
106 val is_singleton : t -> bool
107 val from_list : elt list -> t