def test_imply_noloop(self): with tests.Configure(self, __file__, "/example.smv"): expr = ast.Imply(ast.Proposition("a"), ast.Proposition("b")) self.assertEqual( (ast.Proposition("a").semantic_no_loop(self.enc, 2, 3).imply( ast.Proposition("b").semantic_no_loop(self.enc, 2, 3))), expr.semantic_no_loop(self.enc, 2, 3)) expr = ast.Imply(ast.Globally(ast.Proposition("a")), ast.Eventually(ast.Proposition("b"))) self.assertEqual( (-ast.Globally(ast.Proposition("a")).semantic_no_loop( self.enc, 2, 3) | ast.Eventually(ast.Proposition("b")).semantic_no_loop( self.enc, 2, 3)), expr.semantic_no_loop(self.enc, 2, 3))
def test_eventually_with_loop(self): with tests.Configure(self, __file__, "/example.smv"): i, k, l = 0, 2, 0 enc = self.enc a = ast.Proposition("a") formula = ast.Eventually(a) tool = formula.semantic_with_loop(enc, i, k, l) manual = a.semantic_with_loop(enc, i+1, k, l) |\ a.semantic_with_loop(enc, i , k, l) nusmv = ltlspec.bounded_semantics(self.befsm, Node.from_ptr( parse_ltl_spec("F a")), bound=k, loop=l) # normalized string representation of the BE's (make them comparable) loop_cond = bmcutils.loop_condition(enc, k, l) s_tool = tests.canonical_cnf(tool & loop_cond) s_manual = tests.canonical_cnf(manual & loop_cond) s_nusmv = tests.canonical_cnf(nusmv) self.assertEqual(s_nusmv, s_tool) self.assertEqual(s_manual, s_tool)
def test_xor_with_loop(self): with tests.Configure(self, __file__, "/example.smv"): expr = ast.Xor(ast.Proposition("a"), ast.Proposition("b")) self.assertEqual( (ast.Proposition("a").semantic_with_loop(self.enc, 2, 3, 1) ^ ast.Proposition("b").semantic_with_loop(self.enc, 2, 3, 1)), expr.semantic_with_loop(self.enc, 2, 3, 1)) expr = ast.Xor(ast.Globally(ast.Proposition("a")), ast.Eventually(ast.Proposition("b"))) self.assertEqual( (ast.Globally(ast.Proposition("a")).semantic_with_loop( self.enc, 2, 3, 1) ^ ast.Eventually(ast.Proposition("b")).semantic_with_loop( self.enc, 2, 3, 1)), expr.semantic_with_loop(self.enc, 2, 3, 1))