Search in sources :

Example 1 with TupleSetSimplifier

use of com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleSetSimplifier in project aic-expresso by aic-sri-international.

the class TupleRewriterTest method testTupleSetSimplification.

@Test
public void testTupleSetSimplification() {
    Simplifier tupleSetSimplifier = new TupleSetSimplifier();
    Assert.assertEquals(parse("(e,b,c)"), tupleSetSimplifier.apply(parse("set((a,b,c),1,e)"), context));
    Assert.assertEquals(parse("(a,e,c)"), tupleSetSimplifier.apply(parse("set((a,b,c),2,e)"), context));
    Assert.assertEquals(parse("(a,b,e)"), tupleSetSimplifier.apply(parse("set((a,b,c),3,e)"), context));
    Assert.assertEquals(parse("tuple(e)"), tupleSetSimplifier.apply(parse("set(tuple(a),I,e)"), context));
    Assert.assertEquals(parse("if I = 1 then (e,b) else (a,e)"), tupleSetSimplifier.apply(parse("set((a,b),I,e)"), context));
    Assert.assertEquals(parse("if I = 1 then (e,b,c) else if I = 2 then (a,e,c) else (a,b,e)"), tupleSetSimplifier.apply(parse("set((a,b,c),I,e)"), context));
    Expression expr = parse("set(I, (a,b,c), e)");
    Assert.assertTrue(expr == tupleSetSimplifier.apply(expr, context));
}
Also used : TupleSetSimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleSetSimplifier) Expression(com.sri.ai.expresso.api.Expression) Simplifier(com.sri.ai.grinder.sgdpllt.rewriter.api.Simplifier) TupleEqualitySimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleEqualitySimplifier) TupleGetSimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleGetSimplifier) TupleQuantifierSimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleQuantifierSimplifier) TupleDisequalitySimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleDisequalitySimplifier) TupleValuedFreeVariablesSimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleValuedFreeVariablesSimplifier) TupleSetSimplifier(com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleSetSimplifier) Test(org.junit.Test)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)1 Simplifier (com.sri.ai.grinder.sgdpllt.rewriter.api.Simplifier)1 TupleDisequalitySimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleDisequalitySimplifier)1 TupleEqualitySimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleEqualitySimplifier)1 TupleGetSimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleGetSimplifier)1 TupleQuantifierSimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleQuantifierSimplifier)1 TupleSetSimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleSetSimplifier)1 TupleValuedFreeVariablesSimplifier (com.sri.ai.grinder.sgdpllt.theory.tuple.rewriter.TupleValuedFreeVariablesSimplifier)1 Test (org.junit.Test)1