use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelRangeIdentity method addEncodeTupleSet.
@Override
public void addEncodeTupleSet(TupleSet tuples) {
TupleSet activeSet = new TupleSet(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
encodeTupleSet.addAll(activeSet);
activeSet.removeAll(getMinTupleSet());
// TODO: Optimize using minSets (but no CAT uses this anyway)
if (!activeSet.isEmpty()) {
TupleSet r1Set = new TupleSet();
for (Tuple tuple : activeSet) {
r1Set.addAll(r1.getMaxTupleSet().getBySecond(tuple.getFirst()));
}
r1.addEncodeTupleSet(r1Set);
}
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelTrans method getMinTupleSet.
@Override
public TupleSet getMinTupleSet() {
if (minTupleSet == null) {
// TODO: Make sure this is correct and efficient
ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
minTupleSet = new TupleSet(r1.getMinTupleSet());
boolean changed;
int size = minTupleSet.size();
do {
minTupleSet.addAll(minTupleSet.postComposition(r1.getMinTupleSet(), (t1, t2) -> exec.isImplied(t1.getFirst(), t1.getSecond()) || exec.isImplied(t2.getSecond(), t1.getSecond())));
changed = minTupleSet.size() != size;
size = minTupleSet.size();
} while (changed);
removeMutuallyExclusiveTuples(minTupleSet);
}
return minTupleSet;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelTrans method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
transitiveReachabilityMap = r1.getMaxTupleSet().transMap();
maxTupleSet = new TupleSet();
for (Event e1 : transitiveReachabilityMap.keySet()) {
for (Event e2 : transitiveReachabilityMap.get(e1)) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelTrans method encodeApprox.
@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
BooleanFormula enc = bmgr.makeTrue();
TupleSet minSet = getMinTupleSet();
TupleSet r1Max = r1.getMaxTupleSet();
for (Tuple tuple : fullEncodeTupleSet) {
if (minSet.contains(tuple)) {
if (Relation.PostFixApprox) {
enc = bmgr.and(enc, bmgr.implication(getExecPair(tuple, ctx), this.getSMTVar(tuple, ctx)));
} else {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), getExecPair(tuple, ctx)));
}
continue;
}
BooleanFormula orClause = bmgr.makeFalse();
Event e1 = tuple.getFirst();
Event e2 = tuple.getSecond();
if (r1Max.contains(tuple)) {
orClause = bmgr.or(orClause, r1.getSMTVar(tuple, ctx));
}
for (Tuple t : r1Max.getByFirst(e1)) {
Event e3 = t.getSecond();
if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
BooleanFormula tVar = minSet.contains(t) ? this.getSMTVar(t, ctx) : r1.getSMTVar(t, ctx);
orClause = bmgr.or(orClause, bmgr.and(tVar, this.getSMTVar(e3, e2, ctx)));
}
}
if (Relation.PostFixApprox) {
enc = bmgr.and(enc, bmgr.implication(orClause, this.getSMTVar(tuple, ctx)));
} else {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), orClause));
}
}
return enc;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelTransRef method initializeRelationAnalysis.
@Override
public void initializeRelationAnalysis(VerificationTask task, Context context) {
super.initializeRelationAnalysis(task, context);
identityEncodeTupleSet = new TupleSet();
transEncodeTupleSet = new TupleSet();
}
Aggregations