use of com.dat3m.dartagnan.asserts.AssertTrue in project Dat3M by hernanponcedeleon.
the class TwoSolvers method run.
public static Result run(SolverContext ctx, ProverEnvironment prover1, ProverEnvironment prover2, VerificationTask task) throws InterruptedException, SolverException, InvalidConfigurationException {
Result res = Result.UNKNOWN;
task.preprocessProgram();
if (task.getProgram().getAss() instanceof AssertTrue) {
logger.info("Verification finished: assertion trivially holds");
return PASS;
}
task.performStaticProgramAnalyses();
task.performStaticWmmAnalyses();
task.initializeEncoders(ctx);
ProgramEncoder programEncoder = task.getProgramEncoder();
PropertyEncoder propertyEncoder = task.getPropertyEncoder();
WmmEncoder wmmEncoder = task.getWmmEncoder();
SymmetryEncoder symmEncoder = task.getSymmetryEncoder();
logger.info("Starting encoding using " + ctx.getVersion());
BooleanFormula encodeProg = programEncoder.encodeFullProgram(ctx);
prover1.addConstraint(encodeProg);
prover2.addConstraint(encodeProg);
BooleanFormula encodeWmm = wmmEncoder.encodeFullMemoryModel(ctx);
prover1.addConstraint(encodeWmm);
prover2.addConstraint(encodeWmm);
// For validation this contains information.
// For verification graph.encode() just returns ctx.mkTrue()
BooleanFormula encodeWitness = task.getWitness().encode(task.getProgram(), ctx);
prover1.addConstraint(encodeWitness);
prover2.addConstraint(encodeWitness);
BooleanFormula encodeSymm = symmEncoder.encodeFullSymmetry(ctx);
prover1.addConstraint(encodeSymm);
prover2.addConstraint(encodeSymm);
prover1.addConstraint(propertyEncoder.encodeSpecification(task.getProperty(), ctx));
logger.info("Starting first solver.check()");
if (prover1.isUnsat()) {
prover2.addConstraint(propertyEncoder.encodeBoundEventExec(ctx));
logger.info("Starting second solver.check()");
res = prover2.isUnsat() ? PASS : Result.UNKNOWN;
} else {
res = FAIL;
}
if (logger.isDebugEnabled()) {
String smtStatistics = "\n ===== SMT Statistics ===== \n";
for (String key : prover1.getStatistics().keySet()) {
smtStatistics += String.format("\t%s -> %s\n", key, prover1.getStatistics().get(key));
}
logger.debug(smtStatistics);
}
res = task.getProgram().getAss().getInvert() ? res.invert() : res;
logger.info("Verification finished with result " + res);
return res;
}
Aggregations