use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GEO158 method c5.
/**
* Returns the c5 axiom.
*
* @return c5
*/
public final Formula c5() {
// all C: Curve, P, Q, R: endPoint.C |
// P = Q || P = R || Q = R
final Variable c = Variable.unary("C");
final Variable p = Variable.unary("P");
final Variable q = Variable.unary("Q");
final Variable r = Variable.unary("R");
final Expression e0 = endPoint.join(c);
final Formula f0 = p.eq(q).or(p.eq(r)).or(q.eq(r));
return f0.forAll(c.oneOf(curve).and(p.oneOf(e0)).and(q.oneOf(e0)).and(r.oneOf(e0)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GEO158 method decls.
/**
* Returns all the 'type' declarations.
*
* @return the type declarations
*/
public Formula decls() {
final Expression cc = curve.product(curve);
final Expression pc = point.product(curve);
final Formula f0 = partOf.in(cc);
final Formula f1 = closed.in(curve).and(open.in(curve));
final Formula f2 = meet.in(point.product(cc)).and(sum.in(curve.product(cc)));
final Formula f3 = incident.in(pc).and(endPoint.in(pc)).and(innerPoint.in(pc));
// all C1, C2: Curve | one C2.(C1.sum)
final Variable c1 = Variable.unary("C1");
final Variable c2 = Variable.unary("C2");
final Formula f4 = c2.join(c1.join(sum)).one().forAll(c1.oneOf(curve).and(c2.oneOf(curve)));
return f0.and(f1).and(f2).and(f3).and(f4);
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GEO158 method c6.
/**
* Returns the c6 axiom.
*
* @return c6
*/
public final Formula c6() {
// all C: Curve, P: endPoint.C | some endPoint.C - P
final Variable c = Variable.unary("C");
final Variable p = Variable.unary("P");
final Expression e0 = endPoint.join(c);
return e0.difference(p).some().forAll(c.oneOf(curve).and(p.oneOf(e0)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GEO158 method meetDefn.
/**
* Returns the meet_defn axiom.
*
* @return meet_defn
*/
public final Formula meetDefn() {
// all P: Point, C, C1: Curve | P->C->C1 in meet iff
// (P->C in incident && P->C1 in incident &&
// incident.C & incident.C1 in endPoint.C & endPoint.C1)
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Variable p = Variable.unary("P");
final Formula f0 = p.product(c).product(c1).in(meet);
final Formula f1 = p.product(c).in(incident).and(p.product(c1).in(incident));
final Expression e0 = incident.join(c).intersection(incident.join(c1));
final Expression e1 = endPoint.join(c).intersection(endPoint.join(c1));
final Formula f2 = e0.in(e1);
final Formula f3 = f0.iff(f1.and(f2));
return f3.forAll(p.oneOf(point).and(c.oneOf(curve)).and(c1.oneOf(curve)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class GRA013_026 method cliqueAxiom.
private final Formula cliqueAxiom(Expression color) {
final Variable[] vars = new Variable[cliqueSize];
for (int i = 0; i < cliqueSize; i++) {
vars[i] = Variable.unary("V" + i);
}
final List<Expression> members = new ArrayList<Expression>(cliqueSize);
for (int i = 0, max = cliqueSize - 1; i < max; i++) {
final List<Expression> tmp = new ArrayList<Expression>();
for (int j = i + 1; j < cliqueSize; j++) {
tmp.add(vars[j]);
}
members.add(vars[i].product(Expression.union(tmp)));
}
Decls d = vars[0].oneOf(node);
for (int i = 1; i < cliqueSize; i++) {
d = d.and(vars[i].oneOf(vars[i - 1].join(lessThan)));
}
return Expression.union(members).in(color).implies(goalToBeProved()).forAll(d);
}
Aggregations