use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class RingElection method progress.
/**
* Returns the progress predicate.
*
* @return
*
* <pre>
* pred progress () {
* all t: Time - TO/last() | let t' = TO/next (t) |
* some Process.toSend.t => some p: Process | not skip (t, t', p) }
* </pre>
*/
public Formula progress() {
final Variable t1 = Variable.unary("t");
final Expression t2 = t1.join(tord);
final Variable p = Variable.unary("p");
final Formula f1 = Process.join(toSend).join(t1).some().implies(skip(t1, t2, p).not().forSome(p.oneOf(Process)));
return f1.forAll(t1.oneOf(Time.difference(tlast)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class RingElection method looplessPath.
/**
* Returns the looplessPath predicate
*
* @return
*
* <pre>
* pred looplessPath () {no disj t, t': Time | toSend.t = toSend.t'}
* </pre>
*/
public Formula looplessPath() {
final Variable t1 = Variable.unary("t");
final Variable t2 = Variable.unary("t'");
// all t, t': Time | some t&t' || !(toSend.t = toSend.t')
final Formula f1 = t1.intersection(t2).some().or(toSend.join(t1).eq(toSend.join(t2)).not());
return f1.forAll(t1.oneOf(Time).and(t2.oneOf(Time)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Trees method statement5.
/**
* Returns statement 5.
*
* @return
*
* <pre>
* pred Statement5() {
* Acyclic() and
* all u,v: V | (u->v) not in E implies Cyclic(E + (u->v) + (v->u))
* }
* </pre>
*/
public final Formula statement5() {
final Variable u = Variable.unary("u");
final Variable v = Variable.unary("v");
final Formula f0 = u.product(v).in(E).not().implies(cyclic(E.union(u.product(v).union(v.product(u)))));
final Formula f1 = f0.forAll(u.oneOf(V).and(v.oneOf(V)));
return acyclic().and(f1);
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Trees method inCycle.
/**
* Returns the inCycle predicate.
*
* @return
*
* <pre>
* pred InCycle(v: V, c: V -> V) {
* v in v.c or
* some v': v.c | v' in v.^(c - v->v' - v'->v)
* }
* </pre>
*/
public final Formula inCycle(Expression v, Expression c) {
final Formula f0 = v.in(v.join(c));
final Variable vp = Variable.unary("v'");
final Formula f1 = vp.in(v.join((c.difference(v.product(vp)).difference(vp.product(v))).closure()));
return f0.or(f1.forSome(vp.oneOf(v.join(c))));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Trees method statement2.
/**
* Returns statement 2.
*
* @return
*
* <pre>
* pred Statement2() {
* Connected(E) and
* all u: V | all v: u.E | not Connected( E - (u->v) - (v->u) )
* }
* </pre>
*/
public final Formula statement2() {
final Variable u = Variable.unary("u");
final Variable v = Variable.unary("v");
final Formula f0 = connected(E);
final Formula f1 = connected(E.difference(u.product(v)).difference(v.product(u))).not();
final Formula f2 = f1.forAll(v.oneOf(u.join(E))).forAll(u.oneOf(V));
return f0.and(f2);
}
Aggregations