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;
}
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);
}
}
Aggregations