Module Idds.Dd

Types

type t = private
| True
| False
| Branch of {
var : Var.t;

the variable on which to branch

hi : t;

subdiagram for case var = true

lo : t;

subdiagramm for case var = false

id : Base.int;

unique identifier for this diagram

}

The type of a decision diagram (DD).

Manager

type manager

A DD manager mgr : manager encapsulates all state required for DD construction. In particular, it is required by the branch function to allocate unique identifiers for each DD.

val manager : Base.unit -> manager

Initialize a fresh manager

Constructors

val cfalse : t

The constant false.

val ctrue : t

The constant true.

val branch : manager -> Var.t -> t -> t -> t

branch mgr var hi lo is the diagram that behaves like hi when var = true, and like lo when var = false.

Generic operations on DDs

val equal : t -> t -> Base.bool

O(1) structural equality.

PRECONDITION: The result of equal u v is only defined when u and v were built using the same manager. Otherwise, the result is arbitrary.

val to_string : ?⁠var_name:(Var.t -> Base.string) -> t -> Base.string
val render : ?⁠var_name:(Var.t -> Base.string) -> ?⁠format:Base.string -> ?⁠title:Base.string -> t -> Base.unit

Low-level API

val id : t -> Base.int

id u is an integer that is guranteed to be unique to the the diagram u. In particular, the following invariant holds whenever u and v were constructed using the same manager: id u = id v iff the trees u and v are structurally equal (ignoring IDs). Thus, one can use the IDs to test for equality in O(1). IDs are also useful for memoizing functions on DDs.

val index : t -> Base.int

The index of a diagram is the index of its top-most variable, or -1 if the diagram is a leaf.