Search in sources :

Example 6 with AssertTrue

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;
}
Also used : PropertyEncoder(com.dat3m.dartagnan.encoding.PropertyEncoder) AssertTrue(com.dat3m.dartagnan.asserts.AssertTrue) ProgramEncoder(com.dat3m.dartagnan.encoding.ProgramEncoder) WmmEncoder(com.dat3m.dartagnan.encoding.WmmEncoder) SymmetryEncoder(com.dat3m.dartagnan.encoding.SymmetryEncoder) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Result(com.dat3m.dartagnan.utils.Result)

Aggregations

AssertTrue (com.dat3m.dartagnan.asserts.AssertTrue)6 ProgramEncoder (com.dat3m.dartagnan.encoding.ProgramEncoder)4 PropertyEncoder (com.dat3m.dartagnan.encoding.PropertyEncoder)4 SymmetryEncoder (com.dat3m.dartagnan.encoding.SymmetryEncoder)4 WmmEncoder (com.dat3m.dartagnan.encoding.WmmEncoder)4 Result (com.dat3m.dartagnan.utils.Result)4 AbstractAssert (com.dat3m.dartagnan.asserts.AbstractAssert)2 AssertCompositeOr (com.dat3m.dartagnan.asserts.AssertCompositeOr)2 AssertInline (com.dat3m.dartagnan.asserts.AssertInline)2 Event (com.dat3m.dartagnan.program.event.core.Event)2 Local (com.dat3m.dartagnan.program.event.core.Local)2 ArrayList (java.util.ArrayList)2 Program (com.dat3m.dartagnan.program.Program)1 Thread (com.dat3m.dartagnan.program.Thread)1 CAATSolver (com.dat3m.dartagnan.solver.caat.CAATSolver)1 Refiner (com.dat3m.dartagnan.solver.caat4wmm.Refiner)1 WMMSolver (com.dat3m.dartagnan.solver.caat4wmm.WMMSolver)1 CoreLiteral (com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.CoreLiteral)1 DNF (com.dat3m.dartagnan.utils.logic.DNF)1 ExecutionModel (com.dat3m.dartagnan.verification.model.ExecutionModel)1