use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class Z3ConnectionTest method testQuantifiedFormula.
@Test
public void testQuantifiedFormula() {
Expr a = z3Context.mkIntConst("a");
Expr b = z3Context.mkIntConst("b");
BoolExpr constraint = z3Context.mkAnd(z3Context.mkEq(a, b), z3Context.mkEq(a, z3Context.mkInt(5)), z3Context.mkEq(b, z3Context.mkInt(7)));
constraint = z3Context.mkExists(new Expr[] { a, b }, constraint, 1, null, null, null, null);
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.UNSATISFIABLE, check);
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class Z3ConnectionTest method testSimpleCallToZ3.
@Test
public void testSimpleCallToZ3() {
// a = b & a = 5
Expr a = z3Context.mkIntConst("a");
Expr b = z3Context.mkIntConst("b");
BoolExpr constraint = z3Context.mkAnd(z3Context.mkEq(a, b), z3Context.mkEq(a, z3Context.mkInt(5)));
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.SATISFIABLE, check);
assertEquals(z3Context.mkInt(5), z3Solver.getModel().eval(a, true));
assertEquals(z3Context.mkInt(5), z3Solver.getModel().eval(b, true));
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testSimpleBooleanFormula.
@Test
public void testSimpleBooleanFormula() throws Exception {
String formula = "x = TRUE & y = FALSE";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
Expr x = z3Context.mkBoolConst("x");
Expr y = z3Context.mkBoolConst("y");
assertEquals(Status.SATISFIABLE, check);
assertEquals(z3Context.mkBool(true), z3Solver.getModel().eval(x, true));
assertEquals(z3Context.mkBool(false), z3Solver.getModel().eval(y, false));
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class QuantifiedFormulaEvaluationTest method testFailExistentialFormula.
@Test
public void testFailExistentialFormula() {
String formula = "#(x).(x=2 & x=5)";
// getting the translated z3 representation of the formula
BoolExpr constraint = translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.UNSATISFIABLE, check);
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class QuantifiedFormulaEvaluationTest method testUniversalExistentialFormula.
@Test
public void testUniversalExistentialFormula() {
String formula = "#(y).(y:NATURAL & !(x).(x*y=y))";
// getting the translated z3 representation of the formula
BoolExpr constraint = translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.SATISFIABLE, check);
}
Aggregations