use of com.sri.ai.grinder.sgdpllt.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.
the class ExpressionStepSolverToLiteralSplitterStepSolverAdapterTest method runTest.
private void runTest(TheoryTestingSupport theoryTestingSupport, GeneralFormulaExpressionTestStepSolver generalFormulaExpressionTestStepSolver, Expression expected, Context context) {
ExpressionStepSolverToLiteralSplitterStepSolverAdapter stepSolver = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(generalFormulaExpressionTestStepSolver);
System.out.println("Evaluating " + generalFormulaExpressionTestStepSolver.getExpressionToSolve());
Expression solution = ContextDependentExpressionProblemSolver.staticSolve(stepSolver, context);
System.out.println(generalFormulaExpressionTestStepSolver.getExpressionToSolve() + " -----> " + solution + "\n");
if (expected != null) {
assertEquals(expected, solution);
}
Expression evaluation = theoryTestingSupport.getTheory().evaluate(solution, context);
// Expression evaluation = new Evaluator(theoryTestingSupport.getTheory()).apply(solution, context);
assertEquals(Expressions.TRUE, evaluation);
}
use of com.sri.ai.grinder.sgdpllt.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.
the class ExpressionStepSolver method solve.
default default Expression solve(Context context) {
ExpressionStepSolverToLiteralSplitterStepSolverAdapter adapter = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(this);
Expression result = adapter.solve(context);
return result;
}
use of com.sri.ai.grinder.sgdpllt.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.
the class PropositionalTheory method getSingleVariableConstraintQuantifierEliminatorStepSolver.
@Override
public ExpressionLiteralSplitterStepSolver getSingleVariableConstraintQuantifierEliminatorStepSolver(AssociativeCommutativeGroup group, SingleVariableConstraint constraintForThisIndex, Expression body, Context context) {
ExpressionStepSolver formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(group, constraintForThisIndex, body);
ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
return result;
}
use of com.sri.ai.grinder.sgdpllt.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.
the class EqualityTheory method getSingleVariableConstraintQuantifierEliminatorStepSolver.
@Override
public ExpressionLiteralSplitterStepSolver getSingleVariableConstraintQuantifierEliminatorStepSolver(AssociativeCommutativeGroup group, SingleVariableConstraint constraint, Expression body, Context context) {
ExpressionStepSolver formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(group, constraint, body);
ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
return result;
}
use of com.sri.ai.grinder.sgdpllt.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.
the class DifferenceArithmeticTheory method getSingleVariableConstraintQuantifierEliminatorStepSolver.
@Override
public ExpressionLiteralSplitterStepSolver getSingleVariableConstraintQuantifierEliminatorStepSolver(AssociativeCommutativeGroup group, SingleVariableConstraint constraint, Expression body, Context context) {
ExpressionStepSolver formulaSplitterStepSolver;
if (group instanceof Sum) {
formulaSplitterStepSolver = new SummationOnDifferenceArithmeticAndPolynomialStepSolver(constraint, body);
} else {
formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(group, constraint, body);
}
ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
;
return result;
}
Aggregations