Package aima.core.logic.fol.parsing.ast

Examples of aima.core.logic.fol.parsing.ast.TermEquality


    }

    // Ensure reflexivity axiom is added to usable if using paramodulation.
    if (isUseParamodulation()) {
      // Reflexivity Axiom: x = x
      TermEquality reflexivityAxiom = new TermEquality(new Variable("x"),
          new Variable("x"));
      Clause reflexivityClause = new Clause();
      reflexivityClause.addLiteral(new Literal(reflexivityAxiom));
      reflexivityClause = KB.standardizeApart(reflexivityClause);
      reflexivityClause.setStandardizedApartCheckNotRequired();
View Full Code Here


  }

  @Test
  public void testTermEquality() {
    try {
      TermEquality te = (TermEquality) parser
          .parse("BrotherOf(John) = EnemyOf(Saladin)");
      Assert.assertEquals(te, new TermEquality(
          getBrotherOfFunction(new Constant("John")),
          getEnemyOfFunction()));
    } catch (RuntimeException e) {
      Assert.fail("RuntimeException thrown");
    }
View Full Code Here

  }

  @Test
  public void testTermEquality2() {
    try {
      TermEquality te = (TermEquality) parser
          .parse("BrotherOf(John) = x)");
      Assert.assertEquals(te, new TermEquality(
          getBrotherOfFunction(new Constant("John")), new Variable(
              "x")));
    } catch (RuntimeException e) {
      Assert.fail("RuntimeException thrown");
    }
View Full Code Here

  @Test
  public void testNotSentence() {
    NotSentence ns = (NotSentence) parser
        .parse("NOT BrotherOf(John) = EnemyOf(Saladin)");
    Assert.assertEquals(ns.getNegated(), new TermEquality(
        getBrotherOfFunction(new Constant("John")),
        getEnemyOfFunction()));
  }
View Full Code Here

  }

  @Test
  public void testParseComplexParanthizedSentence() {
    Sentence ps = parser.parse("(NOT BrotherOf(John) = EnemyOf(Saladin))");
    Assert.assertEquals(ps, new NotSentence(new TermEquality(
        getBrotherOfFunction(new Constant("John")),
        getEnemyOfFunction())));
  }
View Full Code Here

        .parse("EXISTS x,y  (King(x) AND BrotherOf(x) = y)");
    List<Variable> vars = new ArrayList<Variable>();
    vars.add(new Variable("x"));
    vars.add(new Variable("y"));
    ConnectedSentence cse = new ConnectedSentence("AND",
        getKingPredicate(new Variable("x")), new TermEquality(
            getBrotherOfFunction(new Variable("x")), new Variable(
                "y")));
    Assert.assertEquals(qs, new QuantifiedSentence("EXISTS", vars, cse));
  }
View Full Code Here

        .parse("(( (EXISTS x,y  (King(x) AND (BrotherOf(x) = y)) ) ))");
    List<Variable> vars = new ArrayList<Variable>();
    vars.add(new Variable("x"));
    vars.add(new Variable("y"));
    ConnectedSentence cse = new ConnectedSentence("AND",
        getKingPredicate(new Variable("x")), new TermEquality(
            getBrotherOfFunction(new Variable("x")), new Variable(
                "y")));
    Assert.assertEquals(qs, new QuantifiedSentence("EXISTS", vars, cse));
  }
View Full Code Here

    FOLParser parser = new FOLParser(domain);

    Predicate expression = (Predicate) parser
        .parse("P(A,F(B,G(A,H(B)),C),D)");
    TermEquality assertion = (TermEquality) parser.parse("B = E");

    Predicate altExpression = (Predicate) demodulation.apply(assertion,
        expression);

    Assert.assertFalse(expression.equals(altExpression));
View Full Code Here

    domain.addFunction("J");

    FOLParser parser = new FOLParser(domain);

    Predicate expression = (Predicate) parser.parse("P(A,G(x,B),C)");
    TermEquality assertion = (TermEquality) parser.parse("G(A,y) = J(y)");

    Predicate altExpression = (Predicate) demodulation.apply(assertion,
        expression);

    Assert.assertNull(altExpression);
View Full Code Here

    lits.add(new Literal(p2));
    lits.add(new Literal(p3));

    Clause clExpression = new Clause(lits);

    TermEquality assertion = (TermEquality) parser.parse("G(x,y) = x");

    Clause altClExpression = demodulation.apply(assertion, clExpression);

    Assert.assertEquals("[P(x,G(A,C)), Q(z,D), W(z,x,u,w,y)]",
        altClExpression.toString());
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.parsing.ast.TermEquality

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.