use of com.sri.ai.grinder.library.FunctorConstants.EQUIVALENCE in project aic-expresso by aic-sri-international.
the class AbstractEqualityConstraintTest method runCompleteSatisfiabilityTest.
/**
* @param conjunction
* @param expected
*/
private void runCompleteSatisfiabilityTest(String conjunction, Expression expected, TheoryTestingSupport theoryTestingSupport) {
Context context = theoryTestingSupport.makeContextWithTestingInformation();
for (Expression literal : And.getConjuncts(parse(conjunction))) {
context = context.conjoin(literal, context);
if (context.isContradiction()) {
break;
}
}
if (expected == null && !context.isContradiction()) {
throw new AssertionError("Expected null but was <" + context + ">");
} else if (expected != null && context.isContradiction()) {
throw new AssertionError("Expected <" + expected + "> but was null");
} else if (expected != null && !context.isContradiction() && !expected.equals(context)) {
Simplifier interpreter = (e, c) -> theoryTestingSupport.getTheory().evaluate(e, c);
// Simplifier interpreter = new Evaluator(theoryTestingSupport.getTheory());
Expression equivalenceDefinition = apply(EQUIVALENCE, expected, context);
Expression universallyQuantified = universallyQuantifyFreeVariables(equivalenceDefinition, context);
Expression equivalent = interpreter.apply(universallyQuantified, context);
if (equivalent.equals(FALSE)) {
throw new Error("Expected <" + expected + "> but got <" + context + ">, which is not equivalent either");
}
}
}
Aggregations