use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class LAT258 method loLeDistr.
/**
* Returns the lo_le_distr axiom.
*
* @return the lo_le_distr axiom.
*/
public final Formula loLeDistr() {
final Variable a = Variable.unary("A"), b = Variable.unary("B"), c = Variable.unary("C");
final Expression h = c.join(b.join(join));
final Expression d = h.join(a.join(meet));
final Expression e = b.join(a.join(meet));
final Expression f = c.join(a.join(meet));
final Expression g = f.join(e.join(join));
final Formula f0 = d.product(g).in(lessThan);
// (c.(a.meet)).((b.(a.meet)).join) in lessThan
return f0.forAll(a.oneOf(UNIV).and(b.oneOf(UNIV)).and(c.oneOf(UNIV)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class CeilingsAndFloors method noSharing.
/**
* Returns the noSharing constraint.
*
* @return all m, n: Man | !(m = n) => !(m.floor = n.floor || m.ceiling =
* n.ceiling)
*/
public Formula noSharing() {
final Variable m = Variable.unary("m1"), n = Variable.unary("n1");
// all m, n: Man | !(m = n) => !(m.floor = n.floor || m.ceiling =
// n.ceiling)
final Formula body = (m.join(floor).eq(n.join(floor))).or(m.join(ceiling).eq(n.join(ceiling)));
return (m.eq(n).not().implies(body.not())).forAll(m.oneOf(Man).and(n.oneOf(Man)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Hotel method freshIssue.
/**
* Returns FreshIssue fact.
*
* @return FressIssue fact.
*/
public Formula freshIssue() {
// -- don't issue same key twice
// all disj e1, e2: Checkin | e1.card.k2 != e2.card.k2
// -- don't issue key initially installed in lock
// all e: Checkin | e.card.k2 !in Room.key.first
final List<Formula> invs = new ArrayList<Formula>();
final Variable e1 = Variable.unary("e1");
final Variable e2 = Variable.unary("e2");
final Variable e = Variable.unary("e");
invs.add(e1.eq(e2).not().implies(e1.join(card).join(k2).eq(e2.join(card).join(k2)).not()).forAll(e1.oneOf(Checkin).and(e2.oneOf(Checkin))));
invs.add(e.join(card).join(k2).in(Room.join(key).join(first)).not().forAll(e.oneOf(Checkin)));
return Formula.and(invs);
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Hotel method noIntervening.
/**
* Returns the noIntervening fact.
*
* @return noIntervening fact.
*/
public Formula noIntervening() {
// fact NoIntervening {
// all c: Checkin - pre.last |
// some e: Enter | e.pre = c.post and e.room = c.room and e.guest =
// c.guest
// }
final Variable c = Variable.unary("c");
final Variable e = Variable.unary("e");
final Formula f = e.join(pre).eq(c.join(post)).and(e.join(room).eq(c.join(room))).and(e.join(guest).eq(c.join(guest)));
return f.forSome(e.oneOf(Enter)).forAll(c.oneOf(Checkin.difference(pre.join(last))));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Hotel method recodeEnterInvariants.
/**
* Returns the invariants for RecodeEnter and its fields.
*
* @return invariants for RecodeEnter and its fields.
*/
public Formula recodeEnterInvariants() {
// sig RecodeEnter extends Enter { }
// {
// card.k1 = room.key.pre
// key.post = key.pre ++ room -> card.k2
//
// prev.unchanged
// holds.unchanged
// occ.unchanged
// }
final List<Formula> invs = new ArrayList<Formula>();
invs.add(RecodeEnter.in(Enter));
final Variable r = Variable.unary("n");
invs.add(card(r).join(k1).eq(room(r).join(key).join(pre(r))).forAll(r.oneOf(RecodeEnter)));
invs.add(key.join(post(r)).eq(key.join(pre(r)).override(room(r).product(card(r).join(k2)))).forAll(r.oneOf(RecodeEnter)));
invs.add(unchanged(r, prev).forAll(r.oneOf(RecodeEnter)));
invs.add(unchanged(r, holds).forAll(r.oneOf(RecodeEnter)));
invs.add(unchanged(r, occ).forAll(r.oneOf(RecodeEnter)));
return Formula.and(invs);
}
Aggregations