Search in sources :

Example 26 with BoolExpr

use of com.microsoft.z3.BoolExpr in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testBelonging.

@Test
public void testBelonging() {
    String formula = "1 : {1}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 27 with BoolExpr

use of com.microsoft.z3.BoolExpr in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testBelonging2.

@Test
public void testBelonging2() {
    String formula = "x: {1}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 28 with BoolExpr

use of com.microsoft.z3.BoolExpr in project bmoth by hhu-stups.

the class InitialStateExistsChecker method doInitialStateExistsCheck.

static InitialStateExistsCheckingResult doInitialStateExistsCheck(MachineNode machine) {
    Context ctx = new Context();
    Solver solver = Z3SolverFactory.getZ3Solver(ctx);
    MachineToZ3Translator machineTranslator = new MachineToZ3Translator(machine, ctx);
    final BoolExpr invariant = machineTranslator.getInitialValueConstraint();
    solver.add(invariant);
    Status check = solver.check();
    return new InitialStateExistsCheckingResult(check);
}
Also used : Context(com.microsoft.z3.Context) Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) MachineToZ3Translator(de.bmoth.backend.z3.MachineToZ3Translator)

Example 29 with BoolExpr

use of com.microsoft.z3.BoolExpr in project bmoth by hhu-stups.

the class InvariantSatisfiabilityChecker method doInvariantSatisfiabilityCheck.

static InvariantSatisfiabilityCheckingResult doInvariantSatisfiabilityCheck(MachineNode machine) {
    Context ctx = new Context();
    Solver solver = Z3SolverFactory.getZ3Solver(ctx);
    MachineToZ3Translator machineTranslator = new MachineToZ3Translator(machine, ctx);
    final BoolExpr invariant = machineTranslator.getInvariantConstraint();
    solver.add(invariant);
    Status check = solver.check();
    return new InvariantSatisfiabilityCheckingResult(check);
}
Also used : Context(com.microsoft.z3.Context) Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) MachineToZ3Translator(de.bmoth.backend.z3.MachineToZ3Translator)

Example 30 with BoolExpr

use of com.microsoft.z3.BoolExpr in project bmoth by hhu-stups.

the class TestUsingZ3 method check.

public void check(Status satisfiable, String formula) {
    BoolExpr constraint = translatePredicate(formula, z3Context);
    // create scope just for current constraint
    z3Solver.push();
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    // clean solver stack
    z3Solver.pop();
    assertEquals(satisfiable, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr)

Aggregations

BoolExpr (com.microsoft.z3.BoolExpr)141 Status (com.microsoft.z3.Status)55 Test (org.junit.Test)51 ArithExpr (com.microsoft.z3.ArithExpr)27 GraphEdge (org.batfish.symbolic.GraphEdge)25 Context (com.microsoft.z3.Context)24 HashMap (java.util.HashMap)22 Expr (com.microsoft.z3.Expr)21 Set (java.util.Set)20 Collectors (java.util.stream.Collectors)18 BitVecExpr (com.microsoft.z3.BitVecExpr)17 Event (dartagnan.program.Event)17 MemEvent (dartagnan.program.MemEvent)17 Program (dartagnan.program.Program)16 Map (java.util.Map)16 Local (dartagnan.program.Local)15 ArrayList (java.util.ArrayList)15 BatfishException (org.batfish.common.BatfishException)14 Graph (org.batfish.symbolic.Graph)14 com.microsoft.z3 (com.microsoft.z3)12