Search in sources :

Example 21 with SingleVariableConstraint

use of com.sri.ai.grinder.api.SingleVariableConstraint in project aic-expresso by aic-sri-international.

the class LinearRealArithmeticTheoryTest method runQuantifierTest.

private void runQuantifierTest(Expression variable, String constraintString, String bodyString, Expression expected, String computedFunction, BinaryFunction<SingleVariableConstraint, Expression, ExpressionStepSolver> stepSolverMaker, Context context) {
    Expression body = parse(bodyString);
    Function<SingleVariableConstraint, ExpressionStepSolver> stepSolverMakerFromConstraint = c -> stepSolverMaker.apply(c, body);
    runTest(variable, constraintString, expected, computedFunction, stepSolverMakerFromConstraint, context);
}
Also used : BinaryFunction(com.sri.ai.util.base.BinaryFunction) PropositionalTheory(com.sri.ai.grinder.theory.propositional.PropositionalTheory) SingleVariableLinearRealArithmeticConstraint(com.sri.ai.grinder.theory.linearrealarithmetic.SingleVariableLinearRealArithmeticConstraint) TheoryTestingSupport(com.sri.ai.grinder.tester.TheoryTestingSupport) Random(java.util.Random) Expression(com.sri.ai.expresso.api.Expression) SummationOnLinearRealArithmeticAndPolynomialStepSolver(com.sri.ai.grinder.theory.linearrealarithmetic.SummationOnLinearRealArithmeticAndPolynomialStepSolver) TrueContext(com.sri.ai.grinder.core.TrueContext) Expressions.parse(com.sri.ai.expresso.helper.Expressions.parse) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver) Context(com.sri.ai.grinder.api.Context) MeasureOfSingleVariableLinearRealArithmeticConstraintStepSolver(com.sri.ai.grinder.theory.linearrealarithmetic.MeasureOfSingleVariableLinearRealArithmeticConstraintStepSolver) Function(com.google.common.base.Function) DefaultSingleQuantifierEliminationProblem(com.sri.ai.grinder.core.solver.DefaultSingleQuantifierEliminationProblem) SatisfiabilityOfSingleVariableLinearRealArithmeticConstraintStepSolver(com.sri.ai.grinder.theory.linearrealarithmetic.SatisfiabilityOfSingleVariableLinearRealArithmeticConstraintStepSolver) Test(org.junit.Test) Beta(com.google.common.annotations.Beta) LinearRealArithmeticTheory(com.sri.ai.grinder.theory.linearrealarithmetic.LinearRealArithmeticTheory) Theory(com.sri.ai.grinder.api.Theory) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) Sum(com.sri.ai.grinder.group.Sum) SingleVariableConstraint(com.sri.ai.grinder.api.SingleVariableConstraint) Simplifier(com.sri.ai.grinder.rewriter.api.Simplifier) CompoundTheory(com.sri.ai.grinder.theory.compound.CompoundTheory) IntervalWithMeasureEquivalentToSingleVariableLinearRealArithmeticConstraintStepSolver(com.sri.ai.grinder.theory.linearrealarithmetic.IntervalWithMeasureEquivalentToSingleVariableLinearRealArithmeticConstraintStepSolver) Assert.assertEquals(org.junit.Assert.assertEquals) SingleVariableConstraint(com.sri.ai.grinder.api.SingleVariableConstraint) Expression(com.sri.ai.expresso.api.Expression) ExpressionStepSolver(com.sri.ai.grinder.api.ExpressionStepSolver)

Example 22 with SingleVariableConstraint

use of com.sri.ai.grinder.api.SingleVariableConstraint in project aic-expresso by aic-sri-international.

the class SingleQuantifierEliminationForIndexFreeBody method computerConstraintSatisfiability.

private Expression computerConstraintSatisfiability() {
    SingleVariableConstraint singleVariableConstraint = (SingleVariableConstraint) getConstraint();
    Expression conditionForSatisfiability = singleVariableConstraint.satisfiability(context);
    checkWeCanSolveSatisfiabilityOfConstraint(conditionForSatisfiability);
    return conditionForSatisfiability;
}
Also used : SingleVariableConstraint(com.sri.ai.grinder.api.SingleVariableConstraint) Expression(com.sri.ai.expresso.api.Expression)

Aggregations

SingleVariableConstraint (com.sri.ai.grinder.api.SingleVariableConstraint)22 Expression (com.sri.ai.expresso.api.Expression)14 Context (com.sri.ai.grinder.api.Context)12 Theory (com.sri.ai.grinder.api.Theory)6 DefaultSingleQuantifierEliminationProblem (com.sri.ai.grinder.core.solver.DefaultSingleQuantifierEliminationProblem)6 Beta (com.google.common.annotations.Beta)5 QuantifiedExpression (com.sri.ai.expresso.api.QuantifiedExpression)5 Type (com.sri.ai.expresso.api.Type)5 Expressions.parse (com.sri.ai.expresso.helper.Expressions.parse)5 Constraint (com.sri.ai.grinder.api.Constraint)5 IncompleteMultiVariableConstraint (com.sri.ai.grinder.core.constraint.IncompleteMultiVariableConstraint)5 Simplifier (com.sri.ai.grinder.rewriter.api.Simplifier)5 BinaryFunction (com.sri.ai.util.base.BinaryFunction)5 Collection (java.util.Collection)5 TRUE (com.sri.ai.expresso.helper.Expressions.TRUE)4 ZERO (com.sri.ai.expresso.helper.Expressions.ZERO)4 Expressions.getVariablesBeingReferenced (com.sri.ai.expresso.helper.Expressions.getVariablesBeingReferenced)4 Expressions.makeSymbol (com.sri.ai.expresso.helper.Expressions.makeSymbol)4 SubExpressionsDepthFirstIterator (com.sri.ai.expresso.helper.SubExpressionsDepthFirstIterator)4 SingleQuantifierEliminationProblem (com.sri.ai.grinder.api.SingleQuantifierEliminationProblem)4