use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant.
@Test
public void testIssue59JustInvariant() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x & #x.({x} \\/ {1,2} = {1,2})";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant2.
@Test
public void testIssue59JustInvariant2() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class Issue76Test method testOperatorPrecedence.
@Test
public void testOperatorPrecedence() {
String satFormula1 = "TRUE or (FALSE & FALSE)";
String satFormula2 = "TRUE or FALSE & FALSE";
Status check;
BoolExpr satExpr1 = translatePredicate(satFormula1, z3Context);
BoolExpr satExpr2 = translatePredicate(satFormula2, z3Context);
z3Solver.add(satExpr1);
check = z3Solver.check();
assertEquals(Status.SATISFIABLE, check);
z3Solver.add(satExpr2);
check = z3Solver.check();
assertEquals(Status.UNSATISFIABLE, check);
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class Z3InterpolationTest method testSimpleInterpolation.
@Test
public void testSimpleInterpolation() {
IntExpr x = ctx.mkIntConst("x");
BoolExpr xGtZero = ctx.mkGt(x, ctx.mkInt(0));
BoolExpr xLtZero = ctx.mkLt(x, ctx.mkInt(0));
BoolExpr xGtZeroInterpolant = ctx.MkInterpolant(xGtZero);
s.add(xGtZero);
s.add(xLtZero);
Status check = s.check();
assertEquals(Status.UNSATISFIABLE, check);
ComputeInterpolantResult ir = ctx.ComputeInterpolant(ctx.mkAnd(xGtZeroInterpolant, xLtZero), ctx.mkParams());
assertEquals(1, ir.interp.length);
assertEquals("(not (<= x 0))", ir.interp[0].toString());
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testFalseFormula.
@Test
public void testFalseFormula() throws Exception {
String formula = "x = 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");
assertEquals(SATISFIABLE, check);
assertEquals(z3Context.mkFalse(), z3Solver.getModel().eval(x, true));
}
Aggregations