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.

Case 4 If fvar = hvar < gvar,<br />

return make_node <br />

fvar, g, hfalse .<br />

Case 5 If gvar < fvar < hvar,<br />

return make_node gvar, gen_var_ite_h(f, gtrue, h), gen_var_ite_h(f, gfalse, h) .<br />

Case 6 If gvar < fvar = hvar or gvar < hvar < fvar,<br />

return make_node gvar, gen_var_ite(f, gtrue, h), gen_var_ite(f, gfalse, h) .<br />

Case 7 If gvar = hvar < fvar,<br />

return make_node gvar, gen_var_ite(f, gtrue, htrue), gen_var_ite(f, gfalse, hfalse) .<br />

Case 8 If hvar < fvar < gvar,<br />

return make_node hvar, gen_var_ite_g(f, g, htrue), gen_var_ite_g(f, g, hfalse) .<br />

Case 9 If hvar < fvar = gvar or hvar < gvar < fvar,<br />

return make_node hvar, gen_var_ite(f, g, htrue), gen_var_ite(f, g, hfalse) .<br />

The set <strong>of</strong> cases <strong>for</strong> var_ite is a strict subset <strong>of</strong> <strong>the</strong>se cases, obtained by removing<br />

<strong>the</strong> ones where fvar = gvar or fvar = hvar and replacing all calls to gen_var_ite,<br />

gen_var_ite_h and gen_var_ite_g with calls to var_ite, var_ite_h and var_ite_g<br />

respectively.<br />

3.2.7 Variables on which a <strong>Boolean</strong> function depends<br />

The algorithm vars which takes a ROBDD representing <strong>the</strong> <strong>Boolean</strong> function f and<br />

returns vars(f) can be easily implemented by visiting <strong>the</strong> ROBDD and collecting <strong>the</strong><br />

variables that label <strong>the</strong> nodes. This algorithm is one <strong>of</strong> <strong>the</strong> few ROBDD algorithms in<br />

CORAL <strong>for</strong> which no caching is provided. Pseudo-code is given in Algorithm 4.<br />

Require: a ROBDD node n<br />

function vars(n)<br />

if n = 0 or n = 1 <strong>the</strong>n<br />

return ∅<br />

else<br />

return <br />

nvar ∪vars(ntrue) ∪ vars(nfalse)<br />

Algorithm 4: The vars function<br />

3.2.8 Entailed and disentailed variables<br />

The algorithms entailed_vars and disentailed_vars (and <strong>the</strong>ir counterparts<br />

entailed_vars_no_cache and disentailed_vars_no_cache, which don’t use caching)<br />

are used to compute true(f) and false(f). In order to compute <strong>the</strong> set <strong>of</strong> all entailed<br />

variables in a ROBDD, we start from its root node and follow <strong>the</strong>se steps (<strong>the</strong> algorithm<br />

that looks <strong>for</strong> disentailed variables is very similar):<br />

3.2 ROBDD algorithms 17

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

Saved successfully!

Ooh no, something went wrong!