Module Lattices.Bitfield

include Datatype_sig.S with type t = Z.t
type t = Z.t
val top : size:int -> t

Top requires the size as it is a union of all the cases from 0 to size-1.

val singleton : int -> t
val is_singleton : t -> int option
val fold_on_cases : t -> 'a -> (int -> 'a -> 'a) -> 'a

Fold on all the set indices in the bitfield, in ascending order.

include Sig.WITH_BOTTOM with type t := t
val bottom : unit -> t
val is_bottom : t -> bool
include Datatype_sig.S with type t := t
val equal : t -> t -> bool

Any notion of equality is allowed, as long as it is an equivalence relation, and that if a == b, then equal a b.

val compare : t -> t -> int

compare is a total order, and should be compatible with equal.

val hash : t -> int

hash requires that equal values have the same hash.

val pretty : Stdlib.Format.formatter -> t -> unit
val join : t -> t -> t

Computes the least upper bound of two elements.

val includes_or_widen : previous:t -> t -> bool * t

In a fixpoint iteration of a function \mathcal{F}, previous is the previous element of the fixpoint iteration sequence. The other element is the newly computed (tentative) element, i.e. \mathcal{F}(previous). If the new element is included in previous, true is returned, together with new (the smaller element): the post-fixpoint of \mathcal{F} has been found (further calls to \mathcal{F} can decrease the sequence). Else, the returned element should be used as the next element of the fixpoint iteration sequence; the operator guarantees its convergence. For lattices of finite height, the widening part can just perform an over-approximation of the join; however note that it is not required that the sequence is monotonic.

val includes : t -> t -> bool

includes a b holds if b \sqsubseteq a, i.e., b is at least as precise as a.

val widen : previous:t -> t -> t

Widening operator used in fixpoint iteration to enforce convergence.

val inter : t -> t -> t