use of kodkod.ast.Relation in project org.alloytools.alloy by AlloyTools.
the class BugTests method testBGP_03172011.
public final void testBGP_03172011() {
Relation x5 = Relation.unary("s012");
Relation x8 = Relation.unary("zero");
Relation x9 = Relation.unary("one");
Relation x12 = Relation.nary("next", 2);
Universe universe = new Universe(Arrays.asList("0", "1", "2", "3"));
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
bounds.boundExactly(x5, factory.setOf("0", "1", "2"));
bounds.boundExactly(x8, factory.setOf("0"));
bounds.bound(x9, factory.setOf("1"), factory.setOf("1", "2"));
TupleSet x12_upper = factory.noneOf(2);
x12_upper.add(factory.tuple("1", "2"));
x12_upper.add(factory.tuple("2", "3"));
bounds.boundExactly(x12, x12_upper);
Variable x714 = Variable.unary("x714");
Decls x713 = x714.oneOf(x8.union(x9));
Variable x720 = Variable.unary("x720");
Expression x723 = x8.union(x9);
Expression x724 = x9.join(x12);
Expression x722 = x723.union(x724);
Expression x721 = x722.difference(x714);
Decls x719 = x720.oneOf(x721);
Variable x727 = Variable.unary("x727");
Expression x732 = x714.union(x720);
Expression x728 = x5.difference(x732);
Decls x726 = x727.oneOf(x728);
Variable x735 = Variable.unary("x735");
Decls x734 = x735.oneOf(x8);
Variable x893 = Variable.unary("x893");
Decls x892 = x893.oneOf(x727);
Formula x894 = x720.no();
Formula x891 = x894.forAll(x892);
Formula x712 = x891.forSome(x713.and(x719).and(x726).and(x734));
Formula x267 = Formula.FALSE.or(x712);
Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setBitwidth(4);
// solver.options().setFlatten(false);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
solver.options().setSymmetryBreaking(20);
solver.options().setSkolemDepth(0);
final Solution sol = solver.solve(x267, bounds);
assertEquals(sol.outcome(), Solution.Outcome.TRIVIALLY_UNSATISFIABLE);
}
use of kodkod.ast.Relation in project org.alloytools.alloy by AlloyTools.
the class BugTests method testFelix_06192008.
public final void testFelix_06192008() {
Relation x5 = Relation.unary("R");
List<String> atomlist = Arrays.asList("X");
Universe universe = new Universe(atomlist);
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
TupleSet x5_upper = factory.noneOf(1);
x5_upper.add(factory.tuple("X"));
bounds.bound(x5, x5_upper);
Variable x10 = Variable.unary("a");
Expression x11 = x5.difference(x5);
Decls x9 = x10.oneOf(x11);
Variable x14 = Variable.nary("b", 2);
Expression x15 = x5.product(x5);
Decls x13 = x14.setOf(x15);
Expression x19 = x5.product(x5);
Formula x17 = x14.in(x19);
Expression x22 = x10.product(x10);
Formula x21 = x22.eq(x14);
Formula x16 = x17.and(x21);
Formula x12 = x16.forSome(x13);
Formula x7 = x12.forAll(x9);
// System.out.println(x7);
Solver solver = new Solver();
solver.options().setSolver(SATFactory.DefaultSAT4J);
solver.options().setBitwidth(4);
// solver.options().setFlatten(false);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
solver.options().setSymmetryBreaking(20);
// System.out.println("Depth=0..."); System.out.flush();
solver.options().setSkolemDepth(0);
assertEquals(Solution.Outcome.TRIVIALLY_SATISFIABLE, solver.solve(x7, bounds).outcome());
// System.out.println("Depth=1..."); System.out.flush();
solver.options().setSkolemDepth(1);
final Solution sol = solver.solve(x7, bounds);
assertEquals(Solution.Outcome.SATISFIABLE, sol.outcome());
assertEquals(2, sol.instance().relations().size());
for (Relation r : sol.instance().relations()) {
assertTrue(sol.instance().tuples(r).isEmpty());
}
}
Aggregations