def test_image_rename_map_checks(): ordering = {'x': 0, 'xp': 1, 'y': 2, 'yp': 3, 'z': 4, 'zp': 5} bdd = BDD(ordering) # non-adjacent rename = {0: 2, 3: 4} qvars = set() r = _bdd.image(1, 1, rename, qvars, bdd) assert r == 1, r r = _bdd.preimage(1, 1, rename, qvars, bdd) assert r == 1, r # overlapping keys and values rename = {0: 1, 1: 2} with nt.assert_raises(AssertionError): _bdd.image(1, 1, rename, qvars, bdd) with nt.assert_raises(AssertionError): _bdd.preimage(1, 1, rename, qvars, bdd) # may be in support after quantification ? trans = bdd.add_expr('x => xp') source = bdd.add_expr('x /\ y') qvars = {0} rename = {1: 0, 3: 2} with nt.assert_raises(AssertionError): _bdd.image(trans, source, rename, qvars, bdd) # in support of `target` ? qvars = set() trans = bdd.add_expr('y') target = bdd.add_expr('x /\ y') rename = {0: 2} r = _bdd.preimage(trans, target, rename, qvars, bdd) assert r == bdd.var('y'), r
def image(trans, source, rename, qvars, forall=False): assert trans.bdd is source.bdd u = _bdd.image(trans.node, source.node, rename, qvars, trans.manager, forall) return trans.bdd._wrap(u)
def image(trans, source, rename, qvars, bdd, forall=False): assert trans.bdd == source.bdd assert trans.bdd == bdd._bdd u = _bdd.image(trans.node, source.node, rename, qvars, trans.bdd, forall) return bdd._wrap(u)