use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class HOLSome4AllTest method testA1.
@Test
public void testA1() {
// SAT: all s: ints | s < 0 => (all ns: set Node | #ns > s)
Formula f = si.lt(I0).implies(ns.count().gt(si).forAll(ns.setOf(Node))).forAll(s.oneOf(Expression.INTS));
Solution sol = solve(f);
assertTrue(sol.sat());
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class HOLSome4AllTest method testE1ii.
@Test
public void testE1ii() {
// SAT: some s: ints | all $s: set Node | #$s > s
Variable ns = Variable.unary("$s");
Formula f = ns.count().gt(si).forAll(ns.setOf(Node)).forSome(s.oneOf(Expression.INTS));
Solution sol = solve(f);
assertEquals(true, sol.sat());
assertEquals(-1, evalS(sol));
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class HOLSome4AllTest method testE1i.
@Test
public void testE1i() {
// SAT: some s: ints | all s: set Node | #s > s
Variable ns = Variable.unary("s");
Formula f = ns.count().gt(si).forAll(ns.setOf(Node)).forSome(s.oneOf(Expression.INTS));
Solution sol = solve(f);
assertEquals(true, sol.sat());
assertEquals(-1, evalS(sol));
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class HOLSome4AllTest method testE5.
@Test
public void testE5() {
// SAT: some Node && some s: ints | s >= 0 && (all ns: set Node | some
// ns => #ns > s)
Formula cnd = si.gte(I0);
Formula f = Node.some().and(cnd.and(ns.some().implies(ns.count().gt(si)).forAll(ns.setOf(Node))).forSome(s.oneOf(Expression.INTS)));
Solution sol = solve(f);
assertEquals(true, sol.sat());
assertEquals(0, evalS(sol));
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class HOLSome4AllTest method doTestParallel1.
private void doTestParallel1(Variable ns2) {
// SAT: some s: ints {
// all ns: set Node | #ns > s
// all ns2: set Node | #ns2 > s
// }
Formula h1 = ns.count().gt(si).forAll(ns.setOf(Node));
Formula h2 = ns2.count().gt(si).forAll(ns2.setOf(Node));
Formula f = h1.and(h2).forSome(s.oneOf(Expression.INTS));
Solution sol = solve(f);
assertTrue(sol.sat());
assertEquals(-1, evalS(sol));
}
Aggregations