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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.2.19 Exotic operators<br />

CORAL also provides a few more specific ROBDD algorithms <strong>for</strong> <strong>the</strong> purpose <strong>of</strong> building<br />

(efficiently) some ROBDDs representing particular classes <strong>of</strong> <strong>Boolean</strong> <strong>functions</strong> that are<br />

<strong>of</strong>ten encountered in groundness analysis.<br />

Functions <strong>of</strong> type v =⇒ v1 ∧ v2 ∧ . . . ∧ vn<br />

ROBDDs <strong>for</strong> this class <strong>of</strong> <strong>functions</strong> are built by <strong>the</strong> if_conj algorithm, which takes v<br />

and <strong>the</strong> set <strong>of</strong> variables V = <br />

v1, v2, . . . vn , v /∈ V as its arguments. If all variables in V<br />

are greater than v in <strong>the</strong> ordering <strong>the</strong> task is trivial, as <strong>the</strong> result is simply a ROBDD<br />

whose root is labeled by v, has 1 as its false successor and has <strong>the</strong> ROBDD representing<br />

v1 ∧ v2 ∧ . . . ∧ vn as its true successor: that’s why we start by considering only <strong>the</strong> grater<br />

variables and building <strong>the</strong> ROBDD <strong>for</strong> <strong>the</strong>m. The smaller variables are handled later, as<br />

you can see in Algorithm 19.<br />

Require: a variable v and a set <strong>of</strong> variables V<br />

function if_conj(v, V )<br />

nv = and_vs_true 1, x ∈ V . v ≺ x <br />

nv = make_node v, nv, 1 <br />

S = x ∈ V . x ≺ v <br />

if S = ∅ <strong>the</strong>n<br />

return nv<br />

else<br />

fv = make_node v, 0, 1 <br />

curr = prev = nv<br />

while S = ∅ do<br />

m = max(S)<br />

<br />

curr = make_node m, prev, fv<br />

prev = curr<br />

S = S \ m <br />

return curr<br />

Functions <strong>of</strong> type v ⇐⇒ v1 ∧ v2 ∧ . . . ∧ vn<br />

Algorithm 19: The if_conj function.<br />

ROBDDs <strong>for</strong> this class <strong>of</strong> <strong>functions</strong> are built by <strong>the</strong> iff_conj algorithm, which takes<br />

v and <strong>the</strong> set <strong>of</strong> variables V = <br />

v1, v2, . . . vn , v /∈ V as its arguments. As <strong>for</strong> if_conj,<br />

<strong>the</strong> construction is trivial if all variables in V are greater than v in <strong>the</strong> ordering, as <strong>the</strong><br />

result is simply a ROBDD whose root is labeled by v, has <strong>the</strong> ROBDD representing<br />

¬v1∨¬v2∨. . .∨¬nn as its false successor and has <strong>the</strong> ROBDD representing v1∧v2∧. . .∧vn<br />

as its true successor: that’s why, as <strong>for</strong> if_conj, we start by considering only <strong>the</strong> greater<br />

variables and handle <strong>the</strong> smaller ones later. Pseudo-code is given in Algorithm 20.<br />

3.2 ROBDD algorithms 30

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

Saved successfully!

Ooh no, something went wrong!