27.09.2013 Views

a modern C++ library for the manipulation of Boolean functions

a modern C++ library for the manipulation of Boolean functions

a modern C++ library for the manipulation of Boolean functions

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The implementation is quite simple: we visit <strong>the</strong> ROBDD as usual. When we encounter<br />

a node that is labeled with a leader <strong>for</strong> L <strong>the</strong> result is simply a node having <strong>the</strong> same label<br />

and <strong>the</strong> results <strong>of</strong> <strong>the</strong> recursive calls on <strong>the</strong> original node’s successors as its successors,<br />

o<strong>the</strong>rwise one <strong>of</strong> <strong>the</strong> successors <strong>of</strong> <strong>the</strong> node must be 0 and we return <strong>the</strong> result <strong>of</strong> <strong>the</strong><br />

recursive call <strong>of</strong> <strong>the</strong> algorithm on <strong>the</strong> o<strong>the</strong>r node (thus projecting away this node). You<br />

can find <strong>the</strong> pseudo-code in Algorithm 14.<br />

Require: a ROBDD node n and an equivalence relation L<br />

function squeeze_equivalent_vars(n, L)<br />

if is_leaf(n) or max(dom(L)) ≺ nvar <strong>the</strong>n<br />

return n<br />

else<br />

if nvar /∈ dom(L) or λL(nvar) = nvar <strong>the</strong>n<br />

return make_node nvar, squeeze_equivalent_vars(ntrue, L),<br />

squeeze_equivalent_vars(nfalse, L) <br />

else<br />

if ntrue = 0 <strong>the</strong>n<br />

return squeeze_equivalent_vars(nfalse, L)<br />

else<br />

return squeeze_equivalent_vars(ntrue, L)<br />

Algorithm 14: The squeeze_equivalent_vars function<br />

3.2.16 Combined search and elimination <strong>of</strong> entailed and disentailed<br />

variables<br />

Suppose that we have a ROBDD n <strong>for</strong> <strong>Boolean</strong> function f and we know some (but<br />

not necessarily all) entailed variables <strong>for</strong> f, i.e. we know E ⊂ true(f). The algorithm<br />

elim_search_true_vars can be used to eliminate all entailed variables in E from n<br />

while adding some o<strong>the</strong>r unknown entailed variables <strong>for</strong> f to E. Repeated application <strong>of</strong><br />

this algorithm on <strong>the</strong> same ROBDD is guaranteed to reach a fixpoint where E contains<br />

all and only <strong>the</strong> entailed variables <strong>for</strong> f and n does not have any entailed variable.<br />

Algorithm elim_search_false_vars is <strong>the</strong> analogous <strong>for</strong> disentailed variables. Pseudocodes<br />

<strong>for</strong> both can be found in Algorithm 15 and Algorithm 16 (notice that <strong>the</strong>y return a<br />

pair (n, S)).<br />

3.2.17 Forcing a set <strong>of</strong> variables to true or false<br />

Given a ROBDD n representing <strong>the</strong> <strong>Boolean</strong> function f and a finite set <strong>of</strong> variables<br />

S = x1, x2, . . . , xn, <strong>the</strong> algorithm and_vs_true computes <strong>the</strong> ROBDD representing <strong>the</strong><br />

<strong>Boolean</strong> function f ∧ x1 ∧ x2 ∧ . . . ∧ xn (<strong>the</strong> algorithm and_vs_false which computes<br />

f ∧ x1 ∧ x2 ∧ . . . ∧ xn is very similar to this one). We traverse <strong>the</strong> ROBDD starting from<br />

<strong>the</strong> root node , initialize <strong>the</strong> current variable xc = x1, and apply <strong>the</strong> following steps:<br />

3.2 ROBDD algorithms 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!