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)
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)
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)')
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)')