Пример #1
0
def test_ee_image_only_sys():
    g = TransitionSystem()
    g.add_path([0, 1, 2])
    aut = logicizer.graph_to_logic(g, 'pc', True)
    u = aut.add_expr('pc = 0')
    v = fx.ee_image(u, aut)
    v_ = aut.add_expr('pc = 1')
    assert v == v_, _to_expr(v, aut)
    v = fx.ee_image(v, aut)
    v_ = aut.add_expr('pc = 2')
    assert v == v_, _to_expr(v, aut)
Пример #2
0
def test_ee_image_only_sys():
    g = TransitionSystem()
    g.add_path([0, 1, 2])
    aut = logicizer.graph_to_logic(g, 'pc', True)
    u = aut.add_expr('pc = 0')
    v = fx.ee_image(u, aut)
    v_ = aut.add_expr('pc = 1')
    assert v == v_, _to_expr(v, aut)
    v = fx.ee_image(v, aut)
    v_ = aut.add_expr('pc = 2')
    assert v == v_, _to_expr(v, aut)
Пример #3
0
def test_ue_image_no_constrain():
    g = TransitionSystem()
    g.vars = dict(x='bool')
    g.env_vars = {'x'}
    g.add_edge(0, 1, formula='x')
    g.add_edge(0, 2, formula=' ~ x')
    aut = logicizer.graph_to_logic(g, 'pc', True)
    # source constrained to x
    source = aut.add_expr('x /\ (pc = 0)')
    u = fx.ee_image(source, aut)
    assert u == aut.add_expr('pc = 1')
    # source contains both x and ~ x
    source = aut.add_expr('pc = 0')
    u = fx.ee_image(source, aut)
    assert u == aut.add_expr('(pc = 1) \/ (pc = 2)')
Пример #4
0
def test_ue_image_no_constrain():
    g = TransitionSystem()
    g.vars = dict(x='bool')
    g.env_vars = {'x'}
    g.add_edge(0, 1, formula='x')
    g.add_edge(0, 2, formula=' ~ x')
    aut = logicizer.graph_to_logic(g, 'pc', True)
    # source constrained to x
    source = aut.add_expr('x /\ (pc = 0)')
    u = fx.ee_image(source, aut)
    assert u == aut.add_expr('pc = 1')
    # source contains both x and ~ x
    source = aut.add_expr('pc = 0')
    u = fx.ee_image(source, aut)
    assert u == aut.add_expr('(pc = 1) \/ (pc = 2)')
Пример #5
0
def test_ee_image():
    g = TransitionSystem()
    g.vars = dict(x='bool')
    g.env_vars = {'x'}
    g.add_edge(0, 1, formula='x')
    g.add_edge(0, 1, formula=' ~ x')
    g.add_edge(0, 2, formula='x')
    aut = logicizer.graph_to_logic(g, 'pc', True)
    source = aut.add_expr('pc = 0')
    u = fx.ee_image(source, aut)
    u_ = aut.add_expr('(pc = 1) \/ (pc = 2)')
    assert u == u_, _to_expr(u, aut)
Пример #6
0
def test_ee_image():
    g = TransitionSystem()
    g.vars = dict(x='bool')
    g.env_vars = {'x'}
    g.add_edge(0, 1, formula='x')
    g.add_edge(0, 1, formula=' ~ x')
    g.add_edge(0, 2, formula='x')
    aut = logicizer.graph_to_logic(g, 'pc', True)
    source = aut.add_expr('pc = 0')
    u = fx.ee_image(source, aut)
    u_ = aut.add_expr('(pc = 1) \/ (pc = 2)')
    assert u == u_, _to_expr(u, aut)