2

I am trying to understand how the composition of two ROBDDs works.

F1 = (d? false: (c? (a? false: true): false))
F2 = (d? (b? true: (a? false: true)): (c? (b? true: (a? false: true)): true))

I need to find a formula F3 that is obtained by replacing all occurrences of d by formula F1 in formula F2.

How do I proceed solving this?

0 _
  • 10,524
  • 11
  • 77
  • 109
nirvair
  • 4,001
  • 10
  • 51
  • 85
  • The title says *'Composition of ROBDD'*, but the description seems to imply you want a substitution of one node **(?)** into another ROBDD. Could you please clarify? – Patrick Trentin Jun 12 '17 at 11:35
  • Seems that [section 5.3.2 of this paper](http://www.ecs.umass.edu/ece/labs/vlsicad/ece667/reading/somenzi99bdd.pdf) is covering this scenario. – Patrick Trentin Jun 12 '17 at 11:55

1 Answers1

1

Substitution, composition of BDDs, variable renaming, cofactors, and evaluation are all the same mathematical operation: substitution. You can do the substitution you are interested in using the Python package dd as follows:

import dd.autoref as _bdd


f1_formula = 'ite(d, FALSE, ite(c, ite(a, FALSE, TRUE), FALSE))'
f2_formula = (
    'ite(d, ite(b, TRUE, ite(a, FALSE, TRUE)), '
    'ite(c, ite(b, TRUE, ite(a, FALSE, TRUE)), TRUE))')
# create a BDD manager and BDDs for the above formulas
bdd = _bdd.BDD()
bdd.declare('a', 'b', 'c', 'd')
f1 = bdd.add_expr(f1_formula)
f2 = bdd.add_expr(f2_formula)
# substitute `f1` for `d` in `f2`
sub = dict(d=f1)
r = bdd.let(sub, f2)
# dump the BDDs to a PNG file
bdd.dump('foo.png', [f1, f2, r])
print(f'f1: {f1}, f2: {f2}, r: {r}')

The above creates the output:

f1: @-7, f2: @14, r: @11

and the file foo.png shown below. For assignments of Boolean values to the variables:

  • f1_formula corresponds to the negated BDD at node 7
  • f2_formula corresponds to the BDD at node 14
  • r (the composition) corresponds to the BDD at node 11.

enter image description here

The "let" method is named after the LET... IN construct in TLA+.

0 _
  • 10,524
  • 11
  • 77
  • 109