Search in sources :

Example 11 with TupleSet

use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.

the class RelInverse method encodeApprox.

@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    TupleSet minSet = getMinTupleSet();
    for (Tuple tuple : encodeTupleSet) {
        BooleanFormula opt = minSet.contains(tuple) ? getExecPair(tuple, ctx) : r1.getSMTVar(tuple.getInverse(), ctx);
        enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), opt));
    }
    return enc;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 12 with TupleSet

use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.

the class RelRangeIdentity method getMinTupleSet.

@Override
public TupleSet getMinTupleSet() {
    if (minTupleSet == null) {
        ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
        minTupleSet = new TupleSet();
        r1.getMinTupleSet().stream().filter(t -> exec.isImplied(t.getSecond(), t.getFirst())).map(t -> new Tuple(t.getSecond(), t.getSecond())).forEach(minTupleSet::add);
    }
    return minTupleSet;
}
Also used : BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis) SolverContext(org.sosy_lab.java_smt.api.SolverContext) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Relation(com.dat3m.dartagnan.wmm.relation.Relation) Sets(com.google.common.collect.Sets) TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 13 with TupleSet

use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.

the class RelTrans method getFullEncodeTupleSet.

private TupleSet getFullEncodeTupleSet(TupleSet tuples) {
    TupleSet processNow = new TupleSet(Sets.intersection(tuples, getMaxTupleSet()));
    TupleSet result = new TupleSet();
    while (!processNow.isEmpty()) {
        TupleSet processNext = new TupleSet();
        result.addAll(processNow);
        for (Tuple tuple : processNow) {
            Event e1 = tuple.getFirst();
            Event e2 = tuple.getSecond();
            for (Tuple t : r1.getMaxTupleSet().getByFirst(e1)) {
                Event e3 = t.getSecond();
                if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
                    result.add(new Tuple(e1, e3));
                    processNext.add(new Tuple(e3, e2));
                }
            }
        }
        processNext.removeAll(result);
        processNow = processNext;
    }
    return result;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 14 with TupleSet

use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.

the class RelTrans method initializeRelationAnalysis.

@Override
public void initializeRelationAnalysis(VerificationTask task, Context context) {
    super.initializeRelationAnalysis(task, context);
    fullEncodeTupleSet = new TupleSet();
    transitiveReachabilityMap = null;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet)

Example 15 with TupleSet

use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.

the class RelTrans method addEncodeTupleSet.

@Override
public void addEncodeTupleSet(TupleSet tuples) {
    TupleSet activeSet = new TupleSet(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
    encodeTupleSet.addAll(activeSet);
    TupleSet fullActiveSet = getFullEncodeTupleSet(activeSet);
    if (fullEncodeTupleSet.addAll(fullActiveSet)) {
        fullActiveSet.removeAll(getMinTupleSet());
        r1.addEncodeTupleSet(fullActiveSet);
    }
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet)

Aggregations

TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)47 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)36 Event (com.dat3m.dartagnan.program.event.core.Event)27 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)16 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)16 ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)11 Thread (com.dat3m.dartagnan.program.Thread)10 Relation (com.dat3m.dartagnan.wmm.relation.Relation)8 SolverContext (org.sosy_lab.java_smt.api.SolverContext)8 Sets (com.google.common.collect.Sets)7 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)5 Set (java.util.Set)5 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)4 HashSet (java.util.HashSet)4 Collectors (java.util.stream.Collectors)4 Tag (com.dat3m.dartagnan.program.event.Tag)3 WmmAnalysis (com.dat3m.dartagnan.wmm.analysis.WmmAnalysis)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 GlobalSettings (com.dat3m.dartagnan.GlobalSettings)2