module V : sig ... endA module for manipulating integer Values.
include Tset.S with type elem = V.t
include Tset.Tset_base
type elemThe type of the values in the set
The type of the set, with mandatory custom operations.
include Custom.T
type t
val dump : Stdlib.Format.formatter -> t -> unitval check : t -> unitval equal : t -> t -> boolval hash : t -> intval compare : t -> t -> int
val empty : tThe empty set
val any : tThe full set, containing all possible values for this kind.
val atom : elem -> tatom e creates a singleton set containing element e.
val cup : t -> t -> tcup t1 t2 returns the unions of t1 and t2.
val cap : t -> t -> tcap t1 t2 returns the intersection of t1 and t2.
val diff : t -> t -> tdiff t1 t2 returns the set of elements of t1 not in t2.
val neg : t -> tneg t returns the set diff any t.
module Infix : sig ... endType specific operations:
val bounded : V.t -> V.t -> tbounded i j returns the closed interval [ i, j ].
val left : V.t -> tleft j returns the left opened interval ( -∞, j ].
val right : V.t -> tright i returns the right opened interval [ i, +∞ ).
val add : t -> t -> tadd t1 t2 returns the intervals that are the sums of the individual intervals of t1 and t2. For instance :
(1--2 | 5--10) + (3--4 | 5--6) = 4--6 | 8--14 | 6--8 | 10--16
= 4--16
val negat : t -> tnegat t negates all the bounds of t
val sub : t -> t -> tsub t1 t2 subtract two intervals. sub t1 t2 is equivalent to add t1 (negat t2).
val mul : t -> t -> tmul t1 t2 returns the intervals that are the products of the individual intervals of t1 and t2.
val div : t -> t -> tdiv t1 t2 returns any (this is a convenience function).
val modulo : t -> t -> tmodulo t1 t2 returns any (this is a convenience function).
val int32 : tint32 represent the set of integers representable by an OCaml int32
val int64 : tint64 represent the set of integers representable by an OCaml int64
val is_bounded : t -> bool * boolis_bounded t returns a pair of boolean indicating whether the interval is left and right bounded.
val is_empty : t -> boolis_empty t checks wheter t is the empty set.
val contains : V.t -> t -> boolcontains i t checks whether the integer a belongs to t
val single : t -> V.tsingle t assumes t is a singleton and returns its unique element.
- raises [Not_found]
if t is the empty set
- raises [Exit]
if t contains more than one element
val disjoint : t -> t -> booldisjoint t1 t2 checks whether t1 and t2 have an empty intersection.
val sample : t -> V.tsample t returns an element of t.
- raises [Not_found]
if t is empty.
val print : t -> (Stdlib.Format.formatter -> unit) listprint t returns, for each interval in the set t, a function that prints the interval. Left (resp. right) opened intervals are printed as *--n (resp. n--*). Singleton intervals are juste printed as n. The intervals are always disjoints and printed in increasing order of their lower-bound, separated by "|". As a special case, any is printed as Int.