use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.Status 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);
}
use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.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 = FormulaToZ3Translator.translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.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 = FormulaToZ3Translator.translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testTrueFormula.
@Test
public void testTrueFormula() throws Exception {
String formula = "x = TRUE";
// 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.mkTrue(), z3Solver.getModel().eval(x, true));
}
use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.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