use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class GEO158 method c7.
/**
* Returns the c7 axiom.
*
* @return c7
*/
public final Formula c7() {
// all C, C1, C2: Curve, P: Point | (C in Closed &&
// P->C1->C2 in meet && sum[C1][C2] = C) =>
// ((endPoint.C1)->C1->C2 in meet)
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Variable c2 = Variable.unary("C2");
final Variable p = Variable.unary("P");
final Formula f0 = c.in(closed).and(p.product(c1).product(c2).in(meet));
final Formula f1 = c2.join(c1.join(sum)).eq(c);
final Formula f2 = endPoint.join(c1).product(c1).product(c2).in(meet);
return f0.and(f1).implies(f2).forAll(c.oneOf(curve).and(c1.oneOf(curve)).and(c2.oneOf(curve)).and(p.oneOf(point)));
}
use of kodkod.ast.Variable 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.Variable in project org.alloytools.alloy by AlloyTools.
the class GEO158 method c1.
/**
* Returns the c1 axiom.
*
* @return c1
*/
public final Formula c1() {
// all C, C1: Curve | (C1->C in partOf && C1 != C) => C1 in Open
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Formula f0 = c1.product(c).in(partOf).and(c1.eq(c).not());
final Formula f1 = c1.in(open);
return f0.implies(f1).forAll(c.oneOf(curve).and(c1.oneOf(curve)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class GEO158 method c2.
/**
* Returns the c2 axiom.
*
* @return c2
*/
public final Formula c2() {
// all C, C1, C2, C3: Curve | ((C1 + C2 + C3)->C in partOf &&
// some endPoint.C1 & endPoint.C2 & endPoint.C3) =>
// (C2->C3 in partOf || C3->C2 in partOf || C1->C2 in partOf ||
// C2->C1 in partOf || C1->C3 in partOf || C3->C1 in partOf)
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Variable c2 = Variable.unary("C2");
final Variable c3 = Variable.unary("C3");
final Formula f0 = c1.union(c2).union(c3).product(c).in(partOf);
final Formula f1 = endPoint.join(c1).intersection(endPoint.join(c2)).intersection(endPoint.join(c3)).some();
final Formula f2 = c2.product(c3).in(partOf).or(c3.product(c2).in(partOf));
final Formula f3 = c1.product(c2).in(partOf).or(c2.product(c1).in(partOf));
final Formula f4 = c1.product(c3).in(partOf).or(c3.product(c1).in(partOf));
return f0.and(f1).implies(f2.or(f3).or(f4)).forAll(c.oneOf(curve).and(c1.oneOf(curve)).and(c2.oneOf(curve)).and(c3.oneOf(curve)));
}
use of kodkod.ast.Variable 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