Search in sources :

Example 1 with MachineToZ3Translator

use of de.bmoth.backend.z3.MachineToZ3Translator 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 2 with MachineToZ3Translator

use of de.bmoth.backend.z3.MachineToZ3Translator 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 3 with MachineToZ3Translator

use of de.bmoth.backend.z3.MachineToZ3Translator in project bmoth by hhu-stups.

the class MachineTranslatorTest method init.

@Before
public void init() {
    String machine = "MACHINE SimpleMachine\n";
    machine += "VARIABLES x\n";
    machine += "INVARIANT x : INTEGER &\n";
    machine += "\tx**2 = x*x \n";
    machine += "INITIALISATION x := -3\n";
    machine += "OPERATIONS\n";
    machine += "\tIncX = SELECT x < 50 THEN x := x+1 END\n";
    machine += "END";
    translator = new MachineToZ3Translator(parseMachine(machine), new Context());
}
Also used : Context(com.microsoft.z3.Context) MachineToZ3Translator(de.bmoth.backend.z3.MachineToZ3Translator) Before(org.junit.Before)

Aggregations

Context (com.microsoft.z3.Context)3 MachineToZ3Translator (de.bmoth.backend.z3.MachineToZ3Translator)3 BoolExpr (com.microsoft.z3.BoolExpr)2 Solver (com.microsoft.z3.Solver)2 Status (com.microsoft.z3.Status)2 Before (org.junit.Before)1