use of com.sri.ai.grinder.sgdpllt.theory.differencearithmetic.DifferenceArithmeticTheory in project aic-expresso by aic-sri-international.
the class MaximumExpressionStepSolverTest method test.
@Test
public void test() {
TheoryTestingSupport theoryTestingSupport = TheoryTestingSupport.make(makeRandom(), new DifferenceArithmeticTheory(true, true));
Context context = theoryTestingSupport.makeContextWithTestingInformation();
List<String> expressionStrings;
String order;
Expression orderMinimum;
Expression orderMaximum;
Expression expected;
expressionStrings = list("I", "J");
expected = parse("if I < J then J else I");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("I", "J");
expected = parse("if I > J then J else I");
order = GREATER_THAN;
orderMinimum = INFINITY;
orderMaximum = MINUS_INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("2", "3", "J");
expected = parse("if 3 < J then J else 3");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("2", "I", "3", "J");
expected = parse("if 2 < I then if I < J then J else I else if 3 < J then J else 3");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("1", "2");
expected = parse("2");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("1", "2");
expected = parse("1");
order = GREATER_THAN;
orderMinimum = INFINITY;
orderMaximum = MINUS_INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("1", "-infinity");
expected = parse("1");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
expressionStrings = list("1", "infinity");
expected = parse("infinity");
order = LESS_THAN;
orderMinimum = MINUS_INFINITY;
orderMaximum = INFINITY;
runTest(expressionStrings, order, orderMinimum, orderMaximum, expected, context);
}
use of com.sri.ai.grinder.sgdpllt.theory.differencearithmetic.DifferenceArithmeticTheory in project aic-expresso by aic-sri-international.
the class SelectExpressionsSatisfyingComparisonStepSolverTest method test.
@Test
public void test() {
TheoryTestingSupport theoryTestingSupport = TheoryTestingSupport.make(makeRandom(), new DifferenceArithmeticTheory(true, true));
Context context = theoryTestingSupport.makeContextWithTestingInformation();
List<String> expressionStrings;
Expression bound;
Expression expected;
expressionStrings = list("I", "J");
bound = parse("J");
expected = parse("if I < J then list(I) else list()");
runTest(expressionStrings, bound, expected, context);
expressionStrings = list("I", "2", "J");
bound = parse("3");
expected = parse("if I < 3 then if J < 3 then list(I, 2, J) else list(I, 2) else if J < 3 then list(2, J) else list(2)");
runTest(expressionStrings, bound, expected, context);
expressionStrings = list();
bound = parse("3");
expected = parse("list()");
runTest(expressionStrings, bound, expected, context);
expressionStrings = list("I", "2", "J");
bound = parse("infinity");
expected = parse("list(I, 2, J)");
runTest(expressionStrings, bound, expected, context);
expressionStrings = list("I", "2", "J");
bound = parse("-infinity");
expected = parse("list()");
runTest(expressionStrings, bound, expected, context);
expressionStrings = list("I", "2", "infinity");
bound = parse("3");
expected = parse("if I < 3 then list(I, 2) else list(2)");
runTest(expressionStrings, bound, expected, context);
}
use of com.sri.ai.grinder.sgdpllt.theory.differencearithmetic.DifferenceArithmeticTheory in project aic-expresso by aic-sri-international.
the class IntensionalSetConditionSimplifierTest method setUp.
@Before
public void setUp() {
context = new TrueContext(new CompoundTheory(new DifferenceArithmeticTheory(false, false), new TupleTheory()));
IntegerInterval nType = new IntegerInterval(1, 10);
context = (Context) GrinderUtil.extendRegistryWith(map("N", nType.toString()), Arrays.asList(nType), context);
simplifier = new IntensionalSetConditionSimplifier();
}
use of com.sri.ai.grinder.sgdpllt.theory.differencearithmetic.DifferenceArithmeticTheory in project aic-expresso by aic-sri-international.
the class IntensionalSetFalseConditionToEmptySetSimplifierTest method setUp.
@Before
public void setUp() {
context = new TrueContext(new CompoundTheory(new DifferenceArithmeticTheory(false, false), new TupleTheory()));
IntegerInterval nType = new IntegerInterval(1, 10);
context = (Context) GrinderUtil.extendRegistryWith(map("N", nType.toString()), Arrays.asList(nType), context);
simplifier = new IntensionalSetFalseConditionToEmptySetSimplifier();
}
use of com.sri.ai.grinder.sgdpllt.theory.differencearithmetic.DifferenceArithmeticTheory in project aic-expresso by aic-sri-international.
the class IntersectionIntensionalSetsSimplifierTest method setUp.
@Before
public void setUp() {
context = new TrueContext(new CompoundTheory(new DifferenceArithmeticTheory(false, false), new TupleTheory()));
IntegerInterval nType = new IntegerInterval(1, 10);
context = (Context) GrinderUtil.extendRegistryWith(map("N", nType.toString()), Arrays.asList(nType), context);
simplifier = new IntersectionIntensionalSetsSimplifier();
}
Aggregations