use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class AbstractWorldDefinitions method XiAbPurse.
/**
* Returns the application of the XiAbPurse predicate.
*
* @return application of the XiAbPurse predicate.
*/
public Formula XiAbPurse(Expression s, Expression sprime, Expression a) {
final Expression aRestrict = a.product(Expression.UNIV);
final Formula f0 = aRestrict.intersection(abBalance.join(s)).eq(aRestrict.intersection(abBalance.join(sprime)));
final Formula f1 = aRestrict.intersection(abLost.join(s)).eq(aRestrict.intersection(abLost.join(sprime)));
return f0.and(f1);
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class AbstractWorldDefinitions method AbTransferLost.
/**
* Returns the application of the AbTransferLost predicate.
*
* @return application of the AbTransferOkay predicate.
*/
public Formula AbTransferLost(Expression s, Expression sprime, Expression a_in, Expression a_out) {
final Expression e0 = a_in.join(from);
final Expression e1 = a_in.join(to);
final Formula f0 = AbWorldSecureOp(s, sprime, a_in, a_out);
final Formula f1 = Authentic(s, e0);
final Formula f2 = Authentic(s, e1);
final Formula f3 = SufficientFundsProperty(s, a_in);
final Formula f4 = e0.intersection(e1).no();
final Formula f5 = e0.join(abBalance).join(sprime).eq(e0.join(abBalance).join(s).difference(a_in.join(value)));
final Formula f6 = e0.join(abLost).join(sprime).eq(e0.join(abLost).join(s).union(a_in.join(value)));
final Formula f7 = XiAbPurse(s, sprime, e1);
final Formula f8 = Authentic(sprime, e0);
final Formula f9 = Authentic(sprime, e1);
return Formula.and(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
}
use of kodkod.ast.Expression 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.Expression 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))));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class Dijkstra method grabbedInOrder.
/**
* Returns the GrabbedInOrder predicate.
*
* @return
*
* <pre>
* pred GrabbedInOrder ( ) {
* all pre: State - so/last() |
* let post = so/next(pre) |
* let had = Process.(pre.holds), have = Process.(post.holds) |
* let grabbed = have - had |
* some grabbed => grabbed in mo/nexts(had)
* }
* </pre>
*/
public Formula grabbedInOrder() {
final Variable pre = Variable.unary("pre");
final Expression post = pre.join(sord);
final Expression had = Process.join(pre.join(holds));
final Expression have = Process.join(post.join(holds));
final Expression grabbed = have.difference(had);
return grabbed.some().implies(grabbed.in(had.join(mord.closure()))).forAll(pre.oneOf(State.difference(slast)));
}
Aggregations