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.

Step 1 If <strong>the</strong> false successor is 0 add <strong>the</strong> variable by which this node is labeled to <strong>the</strong> set<br />

and proceed to <strong>the</strong> true successor.<br />

Step 2 If <strong>the</strong> true successor is 0 proceed to <strong>the</strong> false successor.<br />

Step 3 If both successors are non-terminal nodes, start a new instance <strong>of</strong> <strong>the</strong> algorithm<br />

on both successors in order to obtain two new sets <strong>of</strong> variables: <strong>the</strong> resulting set<br />

is <strong>the</strong> union <strong>of</strong> <strong>the</strong> set that has already been computed by this instance with <strong>the</strong><br />

intersection between <strong>the</strong>se two new sets.<br />

Step 4 O<strong>the</strong>rwise, stop.<br />

The pro<strong>of</strong> that this algorithm finds all and only <strong>the</strong> entailed variables can be found in<br />

[BS98].<br />

Notice that we dont’t consider <strong>the</strong> case when <strong>the</strong> ROBDD is 0, as all variables in Vars<br />

are entailed and disentailed <strong>for</strong> ⊥ so we would have to return an infinite set. Pseudo-code<br />

<strong>for</strong> both algorithms is given in Algorithm 5 and Algorithm 6.<br />

Require: a ROBDD node n<br />

function entailed_vars(n)<br />

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

return <br />

nvar ∪entailed_vars(ntrue)<br />

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

return entailed_vars(nfalse)<br />

else if is_not_leaf(ntrue) and is_not_leaf(nfalse) <strong>the</strong>n<br />

return entailed_vars(ntrue) ∩ entailed_vars(nfalse)<br />

else<br />

return ∅<br />

Algorithm 5: The entailed_vars function<br />

Require: a ROBDD node n<br />

function disentailed_vars(n)<br />

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

return <br />

nvar ∪disentailed_vars(nfalse)<br />

else if nfalse = 0 <strong>the</strong>n<br />

return disentailed_vars(ntrue)<br />

else if is_not_leaf(ntrue) and is_not_leaf(nfalse) <strong>the</strong>n<br />

return disentailed_vars(ntrue) ∩ disentailed_vars(nfalse)<br />

else<br />

return ∅<br />

Algorithm 6: The disentailed_vars function<br />

3.2 ROBDD algorithms 18

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

Saved successfully!

Ooh no, something went wrong!