def test_get_implicant_sat(self): varA = Symbol("A", BOOL) varX = Symbol("X", REAL) f = And(varA, Equals(varX, Real(8))) for solver in get_env().factory.all_solvers(logic=QF_LRA): res = get_implicant(f, solver_name=solver) self.assertIsNotNone(res, "Formula was expected to be SAT") self.assertValid(Implies(res, f), logic=QF_LRA)
def test_examples_get_implicant(self): for (f, _, satisfiability, logic) in get_example_formulae(): if logic.quantifier_free: for sname in get_env().factory.all_solvers(logic=logic): f_i = get_implicant(f, logic=logic, solver_name=sname) if satisfiability: self.assertValid(Implies(f_i, f), logic=logic, msg=(f_i, f)) else: self.assertIsNone(f_i)
def test_get_implicant_unsat(self): varA = Symbol("A", BOOL) varB = Symbol("B", BOOL) f = And(varA, Not(varB)) g = f.substitute({varB: varA}) for solver in get_env().factory.all_solvers(logic=QF_BOOL): res = get_implicant(g, solver_name=solver) self.assertIsNone(res, "Formula was expected to be UNSAT")
def test_get_implicant_unsat(self): varA = Symbol("A", BOOL) varB = Symbol("B", BOOL) f = And(varA, Not(varB)) g = f.substitute({varB:varA}) for solver in get_env().factory.all_solvers(logic=QF_BOOL): res = get_implicant(g, solver_name=solver) self.assertIsNone(res, "Formula was expected to be UNSAT")
def test_examples_get_implicant(self): for (f, _, satisfiability, logic) in get_example_formulae(): if logic.quantifier_free: for sname in get_env().factory.all_solvers(logic=logic): try: f_i = get_implicant(f, logic=logic, solver_name=sname) if satisfiability: self.assertValid(Implies(f_i, f), logic=logic, msg=f) else: self.assertIsNone(f_i) except ConvertExpressionError as ex: # Some solvers do not support ARRAY_VALUE self.assertEqual(ex.expression.node_type(), op.ARRAY_VALUE) self.assertTrue(sname in ["cvc4", "btor"])
def test_examples_get_implicant(self): for (f, _, satisfiability, logic) in get_example_formulae(): if logic.quantifier_free: for sname in get_env().factory.all_solvers(logic=logic): try: f_i = get_implicant(f, logic=logic, solver_name=sname) if satisfiability: self.assertValid(Implies(f_i, f), logic=logic, msg=(f_i, f)) else: self.assertIsNone(f_i) except ConvertExpressionError as ex: # Some solvers do not support ARRAY_VALUE self.assertEqual(ex.expression.node_type(), op.ARRAY_VALUE) self.assertTrue(sname in ["cvc4", "btor"])