use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class AbstractWorldDefinitions method AbOp_total.
/**
* Returns the AbOp_total assertion.
*
* @return AbOp_total assertion
*/
public Formula AbOp_total() {
final Variable a = Variable.unary("a");
final Variable a_in = Variable.unary("a_in");
final Formula f0 = Abstract(a).implies(AbIgnore(a, a, aNullOut).and(AbTransfer(a, a, a_in, aNullOut)));
final Formula f1 = f0.forAll(a.oneOf(AbWorld).and(a_in.oneOf(AIN)));
return f1;
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class DNACuts method declarations.
/**
* Returns declarations constraints.
*
* @return declarations constraints.
*/
public Formula declarations() {
final Variable l = Variable.unary("l");
final Formula f0 = l.join(base).one().forAll(l.oneOf(Link));
final Formula f1 = CutLink.union(JoinLink).eq(Link);
final Formula f2 = CutLink.intersection(JoinLink).no();
return f0.and(f1).and(f2);
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class DNACuts method cutChainLength.
/**
* Returns the cutChainLength constraint. (Similar to CutChainsAtMost6BasesLong
* fact, but with the cut chain length as specified during construction.)
*
* @return the cutChainLength constraint
*/
public Formula cutChainLength() {
Formula ret = Formula.FALSE;
final Variable c = Variable.unary("c");
for (int i = 0; i < neighbor.length; i++) {
ret = ret.or(c.join(neighbor[i]).in(JoinLink));
}
return ret.forAll(c.oneOf(CutLink));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class DNACuts method cutLinkUniqueness.
/**
* Returns the cutLinkUniqueness constraint.
*
* @return the cutLinkUniqueness constraint.
*/
public Formula cutLinkUniqueness() {
final Variable c1 = Variable.unary("c1");
final Variable c2 = Variable.unary("c2");
final Formula f0 = c1.eq(c2).not().and(next.join(c1).in(JoinLink)).and(next.join(c2).in(JoinLink));
Formula f = c1.join(base).in(c2.join(base).union(c2.join(base).join(partner))).not();
for (int i = 0; i < neighbor.length; i++) {
Expression c1n = c1.join(neighbor[i]), c2n = c2.join(neighbor[i]);
f = f.or(c1n.in(JoinLink)).or(c2n.in(JoinLink));
f = f.or(c1n.join(base).in(c2n.join(base).union(c2n.join(base).join(partner))).not());
}
return f0.implies(f).forAll(c1.oneOf(CutLink).and(c2.oneOf(CutLink)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Dijkstra method grabOrRelease.
/**
* Returns the GrabOrRelease predicate.
*
* @return
*
* <pre>
* pred GrabOrRelease () {
* Initial(so/first()) &&
* (
* all pre: State - so/last () | let post = so/next (pre) |
* (post.holds = pre.holds && post.waits = pre.waits)
* ||
* (some p: Process, m: Mutex | pre::GrabMutex (p, m, post))
* ||
* (some p: Process, m: Mutex | pre::ReleaseMutex (p, m, post))
*
* )
* }
* </pre>
*/
public Formula grabOrRelease() {
final Variable pre = Variable.unary("pre");
final Expression post = pre.join(sord);
final Formula f1 = post.join(holds).eq(pre.join(holds));
final Formula f2 = post.join(waits).eq(pre.join(waits));
final Variable p = Variable.unary("p");
final Variable m = Variable.unary("m");
final Decls d = p.oneOf(Process).and(m.oneOf(Mutex));
final Formula f3 = grabMutex(pre, post, p, m).forSome(d);
final Formula f4 = releaseMutex(pre, post, p, m).forSome(d);
return initial(sfirst).and(((f1.and(f2)).or(f3).or(f4)).forAll(pre.oneOf(State.difference(slast))));
}
Aggregations