Java Code Examples for kodkod.ast.Variable#no()

The following examples show how to use kodkod.ast.Variable#no() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BugTests.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
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);
    }
 
Example 2
Source File: RegressionTests.java    From kodkod with MIT License 4 votes vote down vote up
@Test
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().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);
}