obdd-0.6.1: Ordered Reduced Binary Decision Diagrams

Safe HaskellNone
LanguageHaskell98

OBDD.Operation

Synopsis

Documentation

(&&) :: Ord v => OBDD v -> OBDD v -> OBDD v infixr 3 Source #

(||) :: Ord v => OBDD v -> OBDD v -> OBDD v infixr 2 Source #

not :: Ord v => OBDD v -> OBDD v Source #

FIXME this is a silly implementation. Negation should be done by switching values in Leaves (?)

and :: Ord v => [OBDD v] -> OBDD v Source #

or :: Ord v => [OBDD v] -> OBDD v Source #

ite :: Ord v => OBDD v -> OBDD v -> OBDD v -> OBDD v Source #

bool :: Ord v => OBDD v -> OBDD v -> OBDD v -> OBDD v Source #

implies :: Ord v => OBDD v -> OBDD v -> OBDD v Source #

equiv :: Ord v => OBDD v -> OBDD v -> OBDD v Source #

xor :: Ord v => OBDD v -> OBDD v -> OBDD v Source #

unary :: Ord v => (Bool -> Bool) -> OBDD v -> OBDD v Source #

binary :: Ord v => (Bool -> Bool -> Bool) -> OBDD v -> OBDD v -> OBDD v Source #

instantiate :: Ord v => v -> Bool -> OBDD v -> OBDD v Source #

replace variable by value

exists :: Ord v => v -> OBDD v -> OBDD v Source #

remove variable existentially TODO: needs better implementation

exists_many :: Ord v => Set v -> OBDD v -> OBDD v Source #

remove variables existentially TODO: needs better implementation

fold :: Ord v => (Bool -> a) -> (v -> a -> a -> a) -> OBDD v -> a Source #

Apply function in each node, bottom-up. return the value in the root node. Will cache intermediate results. You might think that count_models = fold (b -> if b then 1 else 0) (v l r -> l + r) but that's not true because a path might omit variables. Use full_fold to fold over interpolated nodes as well.

foldM :: (Monad m, Ord v) => (Bool -> m a) -> (v -> a -> a -> m a) -> OBDD v -> m a Source #

Run action in each node, bottum-up. return the value in the root node. Will cache intermediate results.

full_fold :: Ord v => Set v -> (Bool -> a) -> (v -> a -> a -> a) -> OBDD v -> a Source #

Apply function in each node, bottom-up. Also apply to interpolated nodes: when a link from a node to a child skips some variables: for each skipped variable, we run the branch function on an interpolated node that contains this missing variable, and identical children. With this function, number_of_models can be implemented as full_fold vars (bool 0 1) ( const (+) ). And it actually is, see the source.

full_foldM :: (Monad m, Ord v) => Set v -> (Bool -> m a) -> (v -> a -> a -> m a) -> OBDD v -> m a Source #