Search in sources :

Example 6 with CompleteMultiVariableContext

use of com.sri.ai.grinder.sgdpllt.core.constraint.CompleteMultiVariableContext in project aic-expresso by aic-sri-international.

the class CompoundTheoryWithDifferenceArithmeticTest method runCompleteSatisfiabilityTest.

/**
	 * @param conjunction
	 * @param expected
	 */
private void runCompleteSatisfiabilityTest(String conjunction, Expression expected, Map<String, Type> variableNamesAndTypesForTesting) {
    TheoryTestingSupport equalityTheoryTestingSupport = TheoryTestingSupport.make(makeRandom(), new EqualityTheory(true, true));
    equalityTheoryTestingSupport.setVariableNamesAndTypesForTesting(variableNamesAndTypesForTesting);
    TheoryTestingSupport theoryTestingSupport = TheoryTestingSupport.make(makeRandom(), equalityTheoryTestingSupport, TheoryTestingSupport.make(makeRandom(), new PropositionalTheory()));
    Context context = theoryTestingSupport.makeContextWithTestingInformation();
    Constraint constraint = new CompleteMultiVariableContext(theoryTestingSupport.getTheory(), context);
    for (Expression literal : And.getConjuncts(parse(conjunction))) {
        constraint = constraint.conjoin(literal, context);
    }
    assertEquals(expected, constraint);
}
Also used : CompleteMultiVariableContext(com.sri.ai.grinder.sgdpllt.core.constraint.CompleteMultiVariableContext) Context(com.sri.ai.grinder.sgdpllt.api.Context) TrueContext(com.sri.ai.grinder.sgdpllt.core.TrueContext) CompleteMultiVariableContext(com.sri.ai.grinder.sgdpllt.core.constraint.CompleteMultiVariableContext) EqualityTheory(com.sri.ai.grinder.sgdpllt.theory.equality.EqualityTheory) Constraint(com.sri.ai.grinder.sgdpllt.api.Constraint) Expression(com.sri.ai.expresso.api.Expression) AbstractTheoryTestingSupport(com.sri.ai.grinder.sgdpllt.core.constraint.AbstractTheoryTestingSupport) TheoryTestingSupport(com.sri.ai.grinder.sgdpllt.tester.TheoryTestingSupport) PropositionalTheory(com.sri.ai.grinder.sgdpllt.theory.propositional.PropositionalTheory)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)6 Constraint (com.sri.ai.grinder.sgdpllt.api.Constraint)6 Context (com.sri.ai.grinder.sgdpllt.api.Context)6 CompleteMultiVariableContext (com.sri.ai.grinder.sgdpllt.core.constraint.CompleteMultiVariableContext)6 TheoryTestingSupport (com.sri.ai.grinder.sgdpllt.tester.TheoryTestingSupport)5 TrueContext (com.sri.ai.grinder.sgdpllt.core.TrueContext)4 AbstractTheoryTestingSupport (com.sri.ai.grinder.sgdpllt.core.constraint.AbstractTheoryTestingSupport)4 EqualityTheory (com.sri.ai.grinder.sgdpllt.theory.equality.EqualityTheory)4 PropositionalTheory (com.sri.ai.grinder.sgdpllt.theory.propositional.PropositionalTheory)3 Test (org.junit.Test)3 Beta (com.google.common.annotations.Beta)2 Type (com.sri.ai.expresso.api.Type)2 Expressions.parse (com.sri.ai.expresso.helper.Expressions.parse)2 And (com.sri.ai.grinder.sgdpllt.library.boole.And)2 Simplifier (com.sri.ai.grinder.sgdpllt.rewriter.api.Simplifier)2 Map (java.util.Map)2 QuantifiedExpression (com.sri.ai.expresso.api.QuantifiedExpression)1 FALSE (com.sri.ai.expresso.helper.Expressions.FALSE)1 TRUE (com.sri.ai.expresso.helper.Expressions.TRUE)1 ZERO (com.sri.ai.expresso.helper.Expressions.ZERO)1