예제 #1
0
파일: bdd_test.py 프로젝트: swipswaps/dd
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
예제 #2
0
파일: bdd_test.py 프로젝트: johnyf/dd
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
예제 #3
0
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)
예제 #4
0
파일: autoref.py 프로젝트: johnyf/dd
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)
예제 #5
0
파일: autoref.py 프로젝트: lummax/dd
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)
예제 #6
0
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)