Search in sources :

Example 6 with Recursive

use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.

the class SymbolicShell method evaluate.

private static void evaluate(Expression input, ConsoleIterator consoleIterator, Theory theory, Context context) {
    Rewriter prettyRewriter = new Exhaustive(new Recursive(new FirstOf(theory.getTopRewriter(), new PrettySimplifier())));
    Expression result = theory.evaluate(input, context);
    result = prettyRewriter.apply(result, context);
    consoleIterator.getOutputWriter().println(result + "\n");
}
Also used : PrettySimplifier(com.sri.ai.grinder.library.pretty.PrettySimplifier) Expression(com.sri.ai.expresso.api.Expression) Exhaustive(com.sri.ai.grinder.rewriter.core.Exhaustive) Rewriter(com.sri.ai.grinder.rewriter.api.Rewriter) FirstOf(com.sri.ai.grinder.rewriter.core.FirstOf) Recursive(com.sri.ai.grinder.rewriter.core.Recursive)

Example 7 with Recursive

use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.

the class AbstractTheory method setAllRewriters.

private void setAllRewriters(TopRewriter topRewriter) {
    this.topRewriter = topRewriter;
    this.rewriter = new Recursive(new Exhaustive(topRewriter));
    this.completeRewriter = new CompleteRewriter(topRewriter);
}
Also used : Exhaustive(com.sri.ai.grinder.rewriter.core.Exhaustive) Recursive(com.sri.ai.grinder.rewriter.core.Recursive) CompleteRewriter(com.sri.ai.grinder.rewriter.help.CompleteRewriter)

Example 8 with Recursive

use of com.sri.ai.grinder.rewriter.core.Recursive in project aic-expresso by aic-sri-international.

the class AssignmentsSamplingIteratorTest method setUp.

@Before
public void setUp() {
    // Make tests repeatable
    random = new Random(1);
    conditionRewriter = new Recursive(new Exhaustive(new BruteForceCommonInterpreter()));
    context = new TrueContext(new CompoundTheory(new DifferenceArithmeticTheory(false, false), new LinearRealArithmeticTheory(false, false), new EqualityTheory(false, false), new PropositionalTheory()));
}
Also used : BruteForceCommonInterpreter(com.sri.ai.grinder.interpreter.BruteForceCommonInterpreter) EqualityTheory(com.sri.ai.grinder.theory.equality.EqualityTheory) Random(java.util.Random) Exhaustive(com.sri.ai.grinder.rewriter.core.Exhaustive) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) LinearRealArithmeticTheory(com.sri.ai.grinder.theory.linearrealarithmetic.LinearRealArithmeticTheory) PropositionalTheory(com.sri.ai.grinder.theory.propositional.PropositionalTheory) Recursive(com.sri.ai.grinder.rewriter.core.Recursive) CompoundTheory(com.sri.ai.grinder.theory.compound.CompoundTheory) TrueContext(com.sri.ai.grinder.core.TrueContext) Before(org.junit.Before)

Aggregations

Recursive (com.sri.ai.grinder.rewriter.core.Recursive)8 Exhaustive (com.sri.ai.grinder.rewriter.core.Exhaustive)6 Rewriter (com.sri.ai.grinder.rewriter.api.Rewriter)5 Expression (com.sri.ai.expresso.api.Expression)4 TrueContext (com.sri.ai.grinder.core.TrueContext)3 TopRewriter (com.sri.ai.grinder.rewriter.api.TopRewriter)3 CompoundTheory (com.sri.ai.grinder.theory.compound.CompoundTheory)3 DifferenceArithmeticTheory (com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory)3 PropositionalTheory (com.sri.ai.grinder.theory.propositional.PropositionalTheory)3 Context (com.sri.ai.grinder.api.Context)2 CombiningTopRewriter (com.sri.ai.grinder.rewriter.core.CombiningTopRewriter)2 AssignmentsSamplingIterator (com.sri.ai.grinder.helper.AssignmentsSamplingIterator)1 BruteForceCommonInterpreter (com.sri.ai.grinder.interpreter.BruteForceCommonInterpreter)1 ForAllRewriter (com.sri.ai.grinder.library.boole.ForAllRewriter)1 ThereExistsRewriter (com.sri.ai.grinder.library.boole.ThereExistsRewriter)1 CommonSimplifier (com.sri.ai.grinder.library.commonrewriters.CommonSimplifier)1 MaxRewriter (com.sri.ai.grinder.library.number.MaxRewriter)1 ProductRewriter (com.sri.ai.grinder.library.number.ProductRewriter)1 SummationRewriter (com.sri.ai.grinder.library.number.SummationRewriter)1 PrettySimplifier (com.sri.ai.grinder.library.pretty.PrettySimplifier)1