Search in sources :

Example 1 with ExecLiteral

use of com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.ExecLiteral in project Dat3M by hernanponcedeleon.

the class Refiner method permuteAndConvert.

// Changes a reasoning <literal> based on a given permutation <perm> and translates the result
// into a BooleanFormula for Refinement.
private BooleanFormula permuteAndConvert(CoreLiteral literal, Function<Event, Event> perm, SolverContext context) {
    BooleanFormulaManager bmgr = context.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc;
    if (literal instanceof ExecLiteral) {
        ExecLiteral lit = (ExecLiteral) literal;
        enc = perm.apply(lit.getData()).exec();
    } else if (literal instanceof AddressLiteral) {
        AddressLiteral loc = (AddressLiteral) literal;
        MemEvent e1 = (MemEvent) perm.apply(loc.getFirst());
        MemEvent e2 = (MemEvent) perm.apply(loc.getSecond());
        enc = generalEqual(e1.getMemAddressExpr(), e2.getMemAddressExpr(), context);
    } else if (literal instanceof RelLiteral) {
        RelLiteral lit = (RelLiteral) literal;
        Relation rel = task.getMemoryModel().getRelationRepository().getRelation(lit.getName());
        enc = rel.getSMTVar(perm.apply(lit.getData().getFirst()), perm.apply(lit.getData().getSecond()), context);
    } else {
        throw new IllegalArgumentException("CoreLiteral " + literal.toString() + " is not supported");
    }
    return literal.isNegative() ? bmgr.not(enc) : enc;
}
Also used : ExecLiteral(com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.ExecLiteral) Relation(com.dat3m.dartagnan.wmm.relation.Relation) BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) MemEvent(com.dat3m.dartagnan.program.event.core.MemEvent) AddressLiteral(com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.AddressLiteral) RelLiteral(com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.RelLiteral) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula)

Aggregations

MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)1 AddressLiteral (com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.AddressLiteral)1 ExecLiteral (com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.ExecLiteral)1 RelLiteral (com.dat3m.dartagnan.solver.caat4wmm.coreReasoning.RelLiteral)1 Relation (com.dat3m.dartagnan.wmm.relation.Relation)1 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)1 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)1