module Equality:sig
..end
Representation of an equality between a set of elements.
The signatures is roughly a subset of Ocaml's Set.S
.
An equality always contains at least two elements; operations that break
this invariant return Trivial.
include Datatype.S
val pair : Equality.elt -> Equality.elt -> t Equality.trivial
The equality between two elements.
val mem : Equality.elt -> t -> bool
mem x s
tests whether x
belongs to the equality s
.
val add : Equality.elt -> t -> t
add x s
returns the equality between all elements of s
and x
.
val remove : Equality.elt -> t -> t Equality.trivial
remove x s
returns the equality between all elements of s
, except x
.
val union : t -> t -> t
Union.
val inter : t -> t -> t Equality.trivial
Intersection.
val intersects : t -> t -> bool
intersect s s'
= true iff the two equalities both involve the same
element.
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : (Equality.elt -> unit) -> t -> unit
iter f s
applies f
in turn to all elements of s
.
val fold : (Equality.elt -> 'a -> 'a) -> t -> 'a -> 'a
fold f s a
computes (f xN ... (f x2 (f x1 a))...)
,
where x1 ... xN
are the elements of s
, in increasing order.
val for_all : (Equality.elt -> bool) -> t -> bool
for_all p s
checks if all elements of the equality
satisfy the predicate p
.
val exists : (Equality.elt -> bool) -> t -> bool
exists p s
checks if at least one element of the equality
satisfies the predicate p
.
val filter : (Equality.elt -> bool) -> t -> t Equality.trivial
filter p s
returns the equality between all elements in s
that satisfy predicate p
.
val cardinal : t -> int
Return the number of elements of the equality.
val choose : t -> Equality.elt
Return the representative of the equality.