use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.
the class AbstractInterpreter method setBaseTopRewriter.
public void setBaseTopRewriter(TopRewriter baseTopRewriter) {
Rewriter result = new Recursive(new Exhaustive(new TopRewriterUsingQuantifierEliminatorAndContextAssignments(baseTopRewriter)));
setBaseRewriter(result);
}
use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.
the class SamplingAdderLazyIterator method makeSumOfSamplesIterator.
private AdderIterator makeSumOfSamplesIterator(MultiQuantifierEliminationProblem problem, TopRewriterUsingContextAssignments topRewriterUsingContextAssignments, Random random, Context context) {
AssignmentsSamplingIterator sampledAssignmentsIterator = new AssignmentsSamplingIterator(problem.getIndices(), problem.getConstraint(), new Recursive(new Exhaustive(topRewriterUsingContextAssignments)), random, context);
AdderIterator result = new AdderIterator(problem.getGroup(), sampledAssignmentsIterator, problem.getBody(), topRewriterUsingContextAssignments, context);
return result;
}
use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.
the class ProceduralAttachmentsTest method runTest.
private void runTest(Expression input, Expression expected, Context context) {
TopRewriter topRewriter;
Rewriter evaluator;
Expression output;
topRewriter = new CombiningTopRewriter(new CommonSimplifier(), getProceduralAttachmentsTopRewriter(context));
evaluator = new Recursive(new Exhaustive(topRewriter));
output = evaluator.apply(input, context);
println(output);
assertEquals(expected, output);
}
use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.
the class RecursiveTest method runTest.
private void runTest(Rewriter rewriter, Expression initial, Expression expected, Map<Expression, Expression> symbolsAndTypes) {
CompoundTheory theory = new CompoundTheory(new PropositionalTheory(), new DifferenceArithmeticTheory(false, true));
Context context = new TrueContext(theory);
context = context.makeCloneWithAdditionalRegisteredSymbolsAndTypes(symbolsAndTypes);
Rewriter recursive = new Recursive(rewriter);
Expression solution = recursive.apply(initial, context);
System.out.println("Solution: " + solution);
assertEquals(expected, solution);
}
use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.
the class SwitchTest method runTest.
private void runTest(Rewriter rewriter, Expression initial, Expression expected, Map<Expression, Expression> symbolsAndTypes) {
CompoundTheory theory = new CompoundTheory(new PropositionalTheory(), new DifferenceArithmeticTheory(false, true));
Context context = new TrueContext(theory);
context = context.makeCloneWithAdditionalRegisteredSymbolsAndTypes(symbolsAndTypes);
Rewriter recursive = new Recursive(rewriter);
Expression solution = recursive.apply(initial, context);
System.out.println("Solution: " + solution);
assertEquals(expected, solution);
}
Aggregations