Search in sources :

Example 21 with Tuple

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

the class RelInt method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        for (Thread t : task.getProgram().getThreads()) {
            List<Event> events = t.getCache().getEvents(FilterBasic.get(Tag.VISIBLE));
            for (Event e1 : events) {
                for (Event e2 : events) {
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
        }
        removeMutuallyExclusiveTuples(maxTupleSet);
    }
    return maxTupleSet;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 22 with Tuple

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

the class RelPo method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        for (Thread t : task.getProgram().getThreads()) {
            List<Event> events = t.getCache().getEvents(filter);
            for (int i = 0; i < events.size(); i++) {
                Event e1 = events.get(i);
                for (int j = i + 1; j < events.size(); j++) {
                    Event e2 = events.get(j);
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
        }
        removeMutuallyExclusiveTuples(maxTupleSet);
    }
    return maxTupleSet;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 23 with Tuple

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

the class StaticRelation method encodeApprox.

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

Example 24 with Tuple

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

the class RelComposition method encodeApprox.

@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    TupleSet r1Set = r1.getEncodeTupleSet();
    TupleSet r2Set = r2.getEncodeTupleSet();
    TupleSet minSet = getMinTupleSet();
    for (Tuple tuple : encodeTupleSet) {
        BooleanFormula expr = bmgr.makeFalse();
        if (minSet.contains(tuple)) {
            expr = getExecPair(tuple, ctx);
        } else {
            for (Tuple t1 : r1Set.getByFirst(tuple.getFirst())) {
                Tuple t2 = new Tuple(t1.getSecond(), tuple.getSecond());
                if (r2Set.contains(t2)) {
                    expr = bmgr.or(expr, bmgr.and(r1.getSMTVar(t1, ctx), r2.getSMTVar(t2, ctx)));
                }
            }
        }
        enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), expr));
    }
    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 25 with Tuple

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

the class RelIntersection method encodeApprox.

@Override
public BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    TupleSet min = getMinTupleSet();
    for (Tuple tuple : encodeTupleSet) {
        if (min.contains(tuple)) {
            enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), getExecPair(tuple, ctx)));
            continue;
        }
        BooleanFormula opt1 = r1.getSMTVar(tuple, ctx);
        BooleanFormula opt2 = r2.getSMTVar(tuple, ctx);
        enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), bmgr.and(opt1, opt2)));
    }
    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)

Aggregations

Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)52 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)37 Event (com.dat3m.dartagnan.program.event.core.Event)36 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)23 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)23 Thread (com.dat3m.dartagnan.program.Thread)13 ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)11 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)10 Collectors (java.util.stream.Collectors)10 Tag (com.dat3m.dartagnan.program.event.Tag)9 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)9 Relation (com.dat3m.dartagnan.wmm.relation.Relation)9 SolverContext (org.sosy_lab.java_smt.api.SolverContext)9 LogManager (org.apache.logging.log4j.LogManager)8 Logger (org.apache.logging.log4j.Logger)8 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)6 WmmAnalysis (com.dat3m.dartagnan.wmm.analysis.WmmAnalysis)5 java.util (java.util)5 Store (com.dat3m.dartagnan.program.event.core.Store)4 List (java.util.List)4