use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class ReductionAndProofTest method testProof.
public final void testProof() {
Variable v0 = Variable.unary("v0"), v1 = Variable.unary("v1"), v2 = Variable.unary("v2");
Formula f0 = v0.join(a2b).eq(v1.union(v2)).and(v1.eq(v2).not());
Formula f1 = f0.forSome(v0.oneOf(a).and(v1.oneOf(b)).and(v2.oneOf(b)));
Formula f2 = a2b.function(a, b);
Formula f3 = f1.and(f2).and(total.totalOrder(ordered, first, last));
Solution sol = null;
solver.options().setLogTranslation(0);
solver.options().setSolver(SATFactory.MiniSat);
sol = solver.solve(f3, bounds);
assertEquals(Solution.Outcome.UNSATISFIABLE, sol.outcome());
assertNull(sol.proof());
solver.options().setLogTranslation(1);
sol = solver.solve(f3, bounds);
assertNull(sol.proof());
solver.options().setSolver(SATFactory.MiniSatProver);
sol = solver.solve(f3, bounds);
// System.out.println(f3 + ", " + bounds);
sol.proof().minimize(new ECFPStrategy());
final Set<Formula> top = Nodes.minRoots(f3, sol.proof().highLevelCore().values());
assertEquals(2, top.size());
assertTrue(top.contains(f1));
assertTrue(top.contains(f2));
// for(Iterator<TranslationLog.Record> itr = sol.proof().core();
// itr.hasNext(); ) {
// System.out.println(itr.next());
// }
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class Netconfig method connectedSites.
/**
* Returns the connectedSites predicate.
*
* @return connectedSites
*/
public Formula connectedSites(Expression sites, Expression endTime) {
final Variable s = Variable.unary("s");
final Variable r = Variable.unary("r");
final Expression linksAtEndTime = satellite.union(lineOfSight).join(endTime);
final Formula f = sites.difference(s).in(r.join(linksAtEndTime.closure()).join(site));
return f.forSome(r.oneOf(site.join(s))).forAll(s.oneOf(sites));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class ALG212 method majority.
/**
* Returns the majority axiom.
*
* @return majority
*/
public final Formula majority() {
// all x, y: A | f[x][x][y] = x
final Variable x = Variable.unary("x");
final Variable y = Variable.unary("y");
return y.join(x.join(x.join(f))).eq(x).forAll(x.oneOf(UNIV).and(y.oneOf(UNIV)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class ALG212 method distLong.
/**
* Returns the dist_long conjecture.
*
* @return dist_long
*/
public final Formula distLong() {
// all u, w, x, y, z: A | f[f[x][y][z]][u][w] =
// f[f[x][u][w]][f[y][u][w]][f[z][u][w]]
final Variable u = Variable.unary("u");
final Variable w = Variable.unary("w");
final Variable x = Variable.unary("x");
final Variable y = Variable.unary("y");
final Variable z = Variable.unary("z");
final Expression e0 = z.join(y.join(x.join(f)));
final Expression e1 = w.join(u.join(e0.join(f)));
final Expression e2 = w.join(u.join(x.join(f)));
final Expression e3 = w.join(u.join(y.join(f)));
final Expression e4 = w.join(u.join(z.join(f)));
final Expression e5 = e4.join(e3.join(e2.join(f)));
return e1.eq(e5).forAll(u.oneOf(UNIV).and(w.oneOf(UNIV)).and(x.oneOf(UNIV)).and(y.oneOf(UNIV)).and(z.oneOf(UNIV)));
}
use of kodkod.ast.Variable in project org.alloytools.alloy by AlloyTools.
the class GEO091 method theorem_2_13.
/**
* Returns the conjecture theorem_2_13.
*
* @return theorem_2_13
*/
public final Formula theorem_2_13() {
// all C, C1, C2: Curve |
// ((C1 + C2)->C in partOf && C in Open &&
// !(lone endPoint.C1 & endPoint.C2)) => C1 = C2
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Variable c2 = Variable.unary("C2");
final Formula f0 = c1.union(c2).product(c).in(partOf).and(c.in(open));
final Formula f1 = endPoint.join(c1).intersection(endPoint.join(c2)).lone().not();
return f0.and(f1).implies(c1.eq(c2)).forAll(c.oneOf(curve).and(c1.oneOf(curve)).and(c2.oneOf(curve)));
}
Aggregations