Search in sources :

Example 51 with Tuple

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

the class RelFencerel method encodeApprox.

@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    List<Event> fences = task.getProgram().getCache().getEvents(FilterBasic.get(fenceName));
    for (Tuple tuple : encodeTupleSet) {
        Event e1 = tuple.getFirst();
        Event e2 = tuple.getSecond();
        BooleanFormula orClause;
        if (minTupleSet.contains(tuple)) {
            orClause = bmgr.makeTrue();
        } else {
            orClause = fences.stream().filter(f -> e1.getCId() < f.getCId() && f.getCId() < e2.getCId()).map(Event::exec).reduce(bmgr.makeFalse(), bmgr::or);
        }
        BooleanFormula rel = this.getSMTVar(tuple, ctx);
        enc = bmgr.and(enc, bmgr.equivalence(rel, bmgr.and(getExecPair(tuple, ctx), orClause)));
    }
    return enc;
}
Also used : Tag(com.dat3m.dartagnan.program.event.Tag) BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) List(java.util.List) 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) Thread(com.dat3m.dartagnan.program.Thread) FilterBasic(com.dat3m.dartagnan.program.filter.FilterBasic) BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) Event(com.dat3m.dartagnan.program.event.core.Event) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 52 with Tuple

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

the class RelComposition method addEncodeTupleSet.

@Override
public void addEncodeTupleSet(TupleSet tuples) {
    Set<Tuple> activeSet = new HashSet<>(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
    encodeTupleSet.addAll(activeSet);
    activeSet.removeAll(getMinTupleSet());
    if (!activeSet.isEmpty()) {
        TupleSet r1Set = new TupleSet();
        TupleSet r2Set = new TupleSet();
        TupleSet r1Max = r1.getMaxTupleSet();
        TupleSet r2Max = r2.getMaxTupleSet();
        for (Tuple t : activeSet) {
            Event e1 = t.getFirst();
            Event e3 = t.getSecond();
            for (Tuple t1 : r1Max.getByFirst(e1)) {
                Event e2 = t1.getSecond();
                Tuple t2 = new Tuple(e2, e3);
                if (r2Max.contains(t2)) {
                    r1Set.add(t1);
                    r2Set.add(t2);
                }
            }
        }
        r1.addEncodeTupleSet(r1Set);
        r2.addEncodeTupleSet(r2Set);
    }
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) HashSet(java.util.HashSet)

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