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.

3.2.18 Forcing some variables to be equivalent in a positive function<br />

The algorithm expand_equivalent_vars can be used to per<strong>for</strong>m efficiently <strong>the</strong> inverse<br />

operation <strong>for</strong> <strong>the</strong> one presented in 3.2.15, that is conjuncting a <strong>Boolean</strong> function with <strong>the</strong><br />

equivalence conditions given by an equivalence relation, <strong>for</strong> <strong>the</strong> case when f ∈ Pos.<br />

Given a ROBDD representing f and <strong>the</strong> equivalence relation L, we define <strong>the</strong> current<br />

variable xc and <strong>the</strong> set <strong>of</strong> true leaders T ; <strong>the</strong> first is initialized to <strong>the</strong> smallest variable in<br />

dom(L), while <strong>the</strong> second is initialized to ∅. Afterwards, we start from <strong>the</strong> root <strong>of</strong> <strong>the</strong><br />

ROBDD and follow <strong>the</strong>se steps:<br />

Step 1 If this node is 1 return <strong>the</strong> result <strong>of</strong> <strong>the</strong> application <strong>of</strong> <strong>the</strong> algorithm<br />

make_equivalent_vars (presented in 3.2.10) on <strong>the</strong> same relation L, using <strong>the</strong><br />

same values <strong>for</strong> xc and T .<br />

Step 2 If this node if 0 return 0.<br />

Step 3 If xc is undefined (which means that we have already processed all variables in<br />

dom(L)) return <strong>the</strong> current node.<br />

Step 4 Let x be <strong>the</strong> variable by which this node is labeled. If x ≺ xc return <strong>the</strong> node<br />

labeled with x and having <strong>the</strong> results <strong>of</strong> <strong>the</strong> recursive calls <strong>of</strong> this algorithm (with<br />

<strong>the</strong> same values <strong>for</strong> xc and T ) on <strong>the</strong> true and false successors <strong>of</strong> <strong>the</strong> current node<br />

as its true and false successors respectively.<br />

Step 5 Let xn be <strong>the</strong> smallest variable in dom(L) that is greater than xc. If x = xc <strong>the</strong>n<br />

xc must be a leader <strong>for</strong> L, so we return <strong>the</strong> node labeled with xc, having <strong>the</strong> result<br />

<strong>of</strong> <strong>the</strong> recursive application <strong>of</strong> this algorithm on <strong>the</strong> true successor <strong>of</strong> this node with<br />

xn as <strong>the</strong> current variable and with T = T ∪ {xc} as its true successor and <strong>the</strong> result<br />

<strong>of</strong> <strong>the</strong> recursive application <strong>of</strong> this algorithm on <strong>the</strong> false successor <strong>of</strong> this node with<br />

xn as <strong>the</strong> current variable and with <strong>the</strong> same old value <strong>of</strong> T as its false successor.<br />

Step 6 O<strong>the</strong>rwise, let xl = λL(xc). If xl = xc <strong>the</strong>n xc is a leader <strong>for</strong> L so we return <strong>the</strong><br />

node labeled with xc, having <strong>the</strong> result <strong>of</strong> <strong>the</strong> recursive application <strong>of</strong> this algorithm<br />

on this same node with xn as <strong>the</strong> current variable and with T = T ∪ {xc} as its<br />

true successor and <strong>the</strong> result <strong>of</strong> <strong>the</strong> recursive application <strong>of</strong> this algorithm on this<br />

same node with xn as <strong>the</strong> current variable and with <strong>the</strong> same old value <strong>of</strong> T as its<br />

false successor.<br />

Step 7 If xl ∈ T return <strong>the</strong> node labeled with xc, having <strong>the</strong> result <strong>of</strong> <strong>the</strong> recursive<br />

application <strong>of</strong> this algorithm on this same node with xn as <strong>the</strong> current variable and<br />

with <strong>the</strong> same value <strong>of</strong> T as its true successor and 0 as its false successor.<br />

Step 8 O<strong>the</strong>rwise, return <strong>the</strong> node labeled with xc, having <strong>the</strong> result <strong>of</strong> <strong>the</strong> recursive<br />

application <strong>of</strong> this algorithm on this same node with xn as <strong>the</strong> current variable and<br />

with <strong>the</strong> same value <strong>of</strong> T as its false successor and 0 as its true successor.<br />

3.2 ROBDD algorithms 29

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

Saved successfully!

Ooh no, something went wrong!