Module Bigraph.IntSet

Finite sets of non negative integers.

type t

The type of non negative integer sets.

val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
val to_yojson : t -> Yojson.Safe.t
val of_yojson : Yojson.Safe.t -> t Ppx_deriving_yojson_runtime.error_or

Standard set operations

val empty : t
val add : int -> t -> t
val singleton : int -> t
val remove : int -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> int list
val iter : (int -> unit) -> t -> unit
val fold : (int -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val filter : (int -> bool) -> t -> t
val is_empty : t -> bool
val mem : int -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (int -> bool) -> t -> bool
val exists : (int -> bool) -> t -> bool
val to_list : t -> int list
val of_list : int list -> t

Additional operations

val choose : t -> int

Return an arbitrary element of the set. Raises Failure if the set is empty.

val is_singleton : t -> bool

Test whether a set is a singleton or not.

val of_int : int -> t

of_int n returns set {0, 1, ...., n - 1}, with n non negative.

val off : int -> t -> t

off i s adds offset i to all the elements of set s. Offset i must be non negative.

val fix : t -> Iso.t

Compute an isomorphism to fix the numbering of a set. For example, the isomorphism for set {2, 5, 6, 7} is {(2,0), (5,1), (6,2), (7,3)}.

val apply : Iso.t -> t -> t

apply iso s applies iso to each element of s. Elements not mapped by iso are ignored.

val union_list : t list -> t

Compute the union of all the sets in a list.

val merge : t list -> t list

Merge sets with common elements.

val iso_dom : Iso.t -> t

Return the domain of an isomorphism.

val iso_codom : Iso.t -> t

Return the co-domain of an isomorphism.