Search in sources :

Example 1 with ECFPStrategy

use of kodkod.engine.ucore.ECFPStrategy 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());
// }
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) ECFPStrategy(kodkod.engine.ucore.ECFPStrategy) Solution(kodkod.engine.Solution)

Aggregations

Formula (kodkod.ast.Formula)1 Variable (kodkod.ast.Variable)1 Solution (kodkod.engine.Solution)1 ECFPStrategy (kodkod.engine.ucore.ECFPStrategy)1