Module Intervals.Atom

Possibly unbounded integer interval.

type t

t represents a non-empty integer interval. The interval can be unbounded to the left and to the right. Bounds are arbitrary-precision integers provided by the zarith library.

val mk : Z.t option -> Z.t option -> t

mk b1 b2 creates an interval from bound b1 (inclusive, -\infty if None) to bound b2 (inclusive, +\infty if None).

  • raises Invalid_argument

    if the interval is empty.

val mk_bounded : Z.t -> Z.t -> t

mk_bounded i1 i2 creates an interval from bound i1 (inclusive) to bound i2 (inclusive).

  • raises Invalid_argument

    if the interval is empty.

val mk_singl : Z.t -> t

mk_singl i creates an interval containing exactly i.

val get : t -> Z.t option * Z.t option

get t returns the boundaries (inclusive) of the interval t.

val compare : t -> t -> int

Comparison working on the internal representation of t.

val equal : t -> t -> bool

Equality, equal a b is equivalent to compare a b = 0.

val pp : Stdlib.Format.formatter -> t -> unit

Prints the interval to the given formatter. An interval is printed as (b1..b2) where bi is the bound if it is finite, and the empty string if it is infinite.