Search in sources :

Example 1 with SingleVariableEqualityConstraint

use of com.sri.ai.grinder.theory.equality.SingleVariableEqualityConstraint in project aic-expresso by aic-sri-international.

the class AbstractEqualityConstraintTest method testSatisfiabilitySpecialCases.

@Test
public void testSatisfiabilitySpecialCases() {
    String conjunction;
    // looks unsatisfiable for type size 5, but it is not
    conjunction = "X != a and X != b and X != c and X != Y and X != Z";
    TheoryTestingSupport theoryTestingSupport = makeTheoryTestingSupport();
    Constraint constraint = new SingleVariableEqualityConstraint(parse("X"), false, theoryTestingSupport.getTheory());
    Context context = theoryTestingSupport.makeContextWithTestingInformation();
    constraint = constraint.conjoinWithConjunctiveClause(parse(conjunction), context);
    // satisfiable if either Y or Z is equal to a, b, c, or each other.
    Assert.assertNotEquals(null, constraint);
}
Also used : SingleVariableEqualityConstraint(com.sri.ai.grinder.theory.equality.SingleVariableEqualityConstraint) Context(com.sri.ai.grinder.api.Context) CompleteMultiVariableContext(com.sri.ai.grinder.core.constraint.CompleteMultiVariableContext) SingleVariableEqualityConstraint(com.sri.ai.grinder.theory.equality.SingleVariableEqualityConstraint) Constraint(com.sri.ai.grinder.api.Constraint) TheoryTestingSupport(com.sri.ai.grinder.tester.TheoryTestingSupport) AbstractTheoryIncludingEqualityTest(com.sri.ai.test.grinder.theory.base.AbstractTheoryIncludingEqualityTest) Test(org.junit.Test)

Aggregations

Constraint (com.sri.ai.grinder.api.Constraint)1 Context (com.sri.ai.grinder.api.Context)1 CompleteMultiVariableContext (com.sri.ai.grinder.core.constraint.CompleteMultiVariableContext)1 TheoryTestingSupport (com.sri.ai.grinder.tester.TheoryTestingSupport)1 SingleVariableEqualityConstraint (com.sri.ai.grinder.theory.equality.SingleVariableEqualityConstraint)1 AbstractTheoryIncludingEqualityTest (com.sri.ai.test.grinder.theory.base.AbstractTheoryIncludingEqualityTest)1 Test (org.junit.Test)1