use of com.microsoft.z3.BoolExpr 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.BoolExpr 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.BoolExpr in project bmoth by hhu-stups.
the class Issue73Test method testSatPredicateWithoutModel.
@Test
public void testSatPredicateWithoutModel() throws IOException {
String formula = "1 < 2";
BoolExpr constraint = translatePredicate(formula, z3Context);
SolutionFinder finder = new SolutionFinder(z3Solver, z3Context);
Set<Model> solutions = finder.findSolutions(constraint, 20);
assertEquals(0, solutions.size());
}
use of com.microsoft.z3.BoolExpr 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.BoolExpr 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());
}
Aggregations