Package aima.core.logic.fol.inference.otter.defaultimpl

Examples of aima.core.logic.fol.inference.otter.defaultimpl.DefaultClauseSimplifier


    List<TermEquality> rewrites = new ArrayList<TermEquality>();
    rewrites.add((TermEquality) parser.parse("Plus(x, ZERO) = x"));
    rewrites.add((TermEquality) parser.parse("Plus(ZERO, x) = x"));
    rewrites.add((TermEquality) parser.parse("Power(x, ONE) = x"));
    rewrites.add((TermEquality) parser.parse("Power(x, ZERO) = ONE"));
    DefaultClauseSimplifier simplifier = new DefaultClauseSimplifier(
        rewrites);

    Sentence s1 = parser
        .parse("((P(Plus(y,ZERO),Plus(ZERO,y)) OR P(Power(y, ONE),Power(y,ZERO))) OR P(Power(y,ZERO),Plus(y,ZERO)))");

    CNFConverter cnfConverter = new CNFConverter(parser);

    CNF cnf = cnfConverter.convertToCNF(s1);

    Assert.assertEquals(1, cnf.getNumberOfClauses());

    Clause simplified = simplifier.simplify(cnf.getConjunctionOfClauses()
        .get(0));

    Assert.assertEquals("[P(y,y), P(y,ONE), P(ONE,y)]",
        simplified.toString());
  }
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.inference.otter.defaultimpl.DefaultClauseSimplifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.