Search in sources :

Example 1 with ExpressionStepSolverToLiteralSplitterStepSolverAdapter

use of com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.

the class PropositionalTheory method getSingleQuantifierEliminatorStepSolver.

@Override
public ExpressionLiteralSplitterStepSolver getSingleQuantifierEliminatorStepSolver(SingleQuantifierEliminationProblem problem, Context context) {
    ExpressionStepSolver formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(problem);
    ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
    return result;
}
Also used : ExpressionLiteralSplitterStepSolver(com.sri.ai.grinder.api.ExpressionLiteralSplitterStepSolver) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver) QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(com.sri.ai.grinder.core.solver.QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver) ExpressionStepSolverToLiteralSplitterStepSolverAdapter(com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)

Example 2 with ExpressionStepSolverToLiteralSplitterStepSolverAdapter

use of com.sri.ai.grinder.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);
    println("Evaluating " + generalFormulaExpressionTestStepSolver.getExpressionToSolve());
    println("based in theory only (no simplification is performed and we get a tree of literals).");
    Expression solution = ContextDependentExpressionProblemSolver.staticSolve(stepSolver, context);
    println(generalFormulaExpressionTestStepSolver.getExpressionToSolve() + " -----> " + solution + "\n");
    if (expected != null) {
        assertEquals(expected, solution);
    }
    println("Evaluating solution " + solution);
    println("Under context " + context);
    println("This test *incorrectly* assumes this should result in 'true'. This follows from GeneralFormulaExpressionTestStepSolver being incorrect.");
    println("It needs to be replaced by a comparison of expression-step-solver-based and literal-step-solver-based solutions");
    Expression evaluation = theoryTestingSupport.getTheory().evaluate(solution, context);
    println("Result: " + evaluation + "\n");
    assertEquals(Expressions.TRUE, evaluation);
}
Also used : Expression(com.sri.ai.expresso.api.Expression) ExpressionStepSolverToLiteralSplitterStepSolverAdapter(com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)

Example 3 with ExpressionStepSolverToLiteralSplitterStepSolverAdapter

use of com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.

the class DifferenceArithmeticTheory method getSingleQuantifierEliminatorStepSolver.

@Override
public ExpressionLiteralSplitterStepSolver getSingleQuantifierEliminatorStepSolver(SingleQuantifierEliminationProblem problem, Context context) {
    ExpressionStepSolver formulaSplitterStepSolver;
    if (problem.getGroup() instanceof Sum) {
        formulaSplitterStepSolver = new SummationOnDifferenceArithmeticAndPolynomialStepSolver(problem);
    } else {
        formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(problem);
    }
    ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
    return result;
}
Also used : ExpressionLiteralSplitterStepSolver(com.sri.ai.grinder.api.ExpressionLiteralSplitterStepSolver) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver) QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(com.sri.ai.grinder.core.solver.QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver) Sum(com.sri.ai.grinder.group.Sum) ExpressionStepSolverToLiteralSplitterStepSolverAdapter(com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)

Example 4 with ExpressionStepSolverToLiteralSplitterStepSolverAdapter

use of com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.

the class EqualityTheory method getSingleQuantifierEliminatorStepSolver.

@Override
public ExpressionLiteralSplitterStepSolver getSingleQuantifierEliminatorStepSolver(SingleQuantifierEliminationProblem problem, Context context) {
    ExpressionStepSolver formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(problem);
    ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
    return result;
}
Also used : ExpressionLiteralSplitterStepSolver(com.sri.ai.grinder.api.ExpressionLiteralSplitterStepSolver) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver) QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(com.sri.ai.grinder.core.solver.QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver) ExpressionStepSolverToLiteralSplitterStepSolverAdapter(com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)

Example 5 with ExpressionStepSolverToLiteralSplitterStepSolverAdapter

use of com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter in project aic-expresso by aic-sri-international.

the class LinearRealArithmeticTheory method getSingleQuantifierEliminatorStepSolver.

@Override
public ExpressionLiteralSplitterStepSolver getSingleQuantifierEliminatorStepSolver(SingleQuantifierEliminationProblem problem, Context context) {
    ExpressionStepSolver formulaSplitterStepSolver;
    if (problem.getGroup() instanceof Sum) {
        formulaSplitterStepSolver = new SummationOnLinearRealArithmeticAndPolynomialStepSolver(problem);
    } else {
        formulaSplitterStepSolver = new QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(problem);
    }
    ExpressionLiteralSplitterStepSolver result = new ExpressionStepSolverToLiteralSplitterStepSolverAdapter(formulaSplitterStepSolver);
    return result;
}
Also used : ExpressionLiteralSplitterStepSolver(com.sri.ai.grinder.api.ExpressionLiteralSplitterStepSolver) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver) QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver(com.sri.ai.grinder.core.solver.QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver) Sum(com.sri.ai.grinder.group.Sum) ExpressionStepSolverToLiteralSplitterStepSolverAdapter(com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)

Aggregations

ExpressionStepSolverToLiteralSplitterStepSolverAdapter (com.sri.ai.grinder.core.solver.ExpressionStepSolverToLiteralSplitterStepSolverAdapter)6 ExpressionLiteralSplitterStepSolver (com.sri.ai.grinder.api.ExpressionLiteralSplitterStepSolver)4 ExpressionStepSolver (com.sri.ai.grinder.api.ExpressionStepSolver)4 QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver (com.sri.ai.grinder.core.solver.QuantifierEliminationOnBodyInWhichIndexOnlyOccursInsideLiteralsStepSolver)4 Expression (com.sri.ai.expresso.api.Expression)2 Sum (com.sri.ai.grinder.group.Sum)2