use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GEO158 method innerPointDefn.
/**
* Returns the inner_point_defn axiom.
*
* @return inner_point_defn
*/
public final Formula innerPointDefn() {
// all P: Point, C: Curve | P->C in innerPoint iff
// (P->C in incident && no P->C & endPoint)
final Variable c = Variable.unary("C");
final Variable p = Variable.unary("P");
final Expression e0 = p.product(c);
final Formula f0 = e0.in(innerPoint);
final Formula f1 = e0.in(incident).and(e0.intersection(endPoint).no());
return f0.iff(f1).forAll(p.oneOf(point).and(c.oneOf(curve)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class AbstractWorldDefinitions method Abstract.
/**
* Returns the application of the Abstract predicate.
*
* @return application of the Abstract predicate.
*/
public Formula Abstract(Expression s) {
final Expression e0 = s.join(abAuthPurse).join(abBalance).join(s).intersection(s.join(abAuthPurse).join(abLost).join(s));
final Formula f0 = e0.no();
final Expression e1 = s.join(abAuthPurse).product(Expression.UNIV);
final Expression e2 = e1.intersection((abBalance.union(abLost)).join(s));
final Formula f1 = e2.in(AbPurse.product(Coin));
final Variable c = Variable.unary("c");
final Formula f2 = e2.join(c).lone().forAll(c.oneOf(Coin));
return Formula.and(f0, f1, f2);
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class Dijkstra method releaseMutex.
/**
* Returns the GrabMutex predicate for states s1, s2, process p and mutex m.
*
* @return
*
* <pre>
* pred State.ReleaseMutex (p: Process, m: Mutex, s': State) {
* !this::IsStalled(p)
* m in p.(this.holds)
* p.(s'.holds) = p.(this.holds) - m
* no p.(s'.waits)
* no m.~(this.waits) => {
* no m.~(s'.holds)
* no m.~(s'.waits)
* } else {
* some lucky: m.~(this.waits) | {
* m.~(s'.waits) = m.~(this.waits) - lucky
* m.~(s'.holds) = lucky
* }
* }
* all mu: Mutex - m {
* mu.~(s'.waits) = mu.~(this.waits)
* mu.~(s'.holds)= mu.~(this.holds)
* }
* }
* </pre>
*/
public Formula releaseMutex(Expression s1, Expression s2, Expression p, Expression m) {
final Formula f1 = isStalled(s1, p).not().and(m.in(p.join(s1.join(holds))));
final Formula f2 = p.join(s2.join(holds)).eq(p.join(s1.join(holds)).difference(m));
final Formula f3 = p.join(s2.join(waits)).no();
final Expression cexpr = m.join((s1.join(waits)).transpose());
final Formula f4 = m.join(s2.join(holds).transpose()).no();
final Formula f5 = m.join(s2.join(waits).transpose()).no();
final Formula f6 = cexpr.no().implies(f4.and(f5));
final Variable lucky = Variable.unary("lucky");
final Formula f7 = m.join(s2.join(waits).transpose()).eq(m.join(s1.join(waits).transpose()).difference(lucky));
final Formula f8 = m.join(s2.join(holds).transpose()).eq(lucky);
final Formula f9 = f7.and(f8).forSome(lucky.oneOf(m.join(s1.join(waits).transpose())));
final Formula f10 = cexpr.some().implies(f9);
final Variable mu = Variable.unary("mu");
final Formula f11 = mu.join(s2.join(waits).transpose()).eq(mu.join(s1.join(waits).transpose()));
final Formula f12 = mu.join(s2.join(holds).transpose()).eq(mu.join(s1.join(holds).transpose()));
final Formula f13 = f11.and(f12).forAll(mu.oneOf(Mutex.difference(m)));
return Formula.and(f1, f2, f3, f6, f10, f13);
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class MED001 method bg_completion.
/**
* Returns the bg_completion axiom.
*
* @return bg_completion
*/
public final Formula bg_completion() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
final Formula f0 = x1.in(releaselg).not();
return f0.implies(x1.in(drugbg)).forAll(x0.oneOf(UNIV));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class MED001 method liver_glucose.
/**
* Returns the liver_glucose axiom.
*
* @return liver_glucose
*/
public final Formula liver_glucose() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
return x1.in(uptakelg).implies(x1.in(releaselg).not()).forAll(x0.oneOf(UNIV));
}
Aggregations