Package aima.core.logic.fol.domain

Examples of aima.core.logic.fol.domain.FOLDomain


    Assert.assertNull(altExpression);
  }

  @Test
  public void testSimpleClauseExamples() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addConstant("D");
    domain.addConstant("E");
    domain.addPredicate("P");
    domain.addPredicate("Q");
    domain.addPredicate("W");
    domain.addFunction("F");
    domain.addFunction("G");
    domain.addFunction("H");
    domain.addFunction("J");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    Predicate p1 = (Predicate) parser.parse("Q(z, G(D,B))");
View Full Code Here


        altClExpression.toString());
  }

  @Test
  public void testSimpleClauseNonExample() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addPredicate("P");
    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    Predicate p1 = (Predicate) parser.parse("P(y, F(A,y))");
View Full Code Here

    Assert.assertNull(altClExpression);
  }

  @Test
  public void testBypassReflexivityAxiom() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addPredicate("P");
    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    Predicate p1 = (Predicate) parser.parse("P(y, F(A,y))");
View Full Code Here

    Assert.assertEquals(new Constant("A"), result.get(new Variable("x")));
  }

  @Test
  public void testConnectedSentence() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addFunction("Plus");
    domain.addPredicate("P");

    FOLParser parser = new FOLParser(domain);

    Sentence s1 = parser.parse("(P(A) AND P(B))");
    Sentence s2 = parser.parse("(P(A) AND P(B))");
View Full Code Here

    Assert.assertEquals(new Constant("C"), result.get(new Variable("x")));
  }

  @Test
  public void testQuantifiedSentence() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addFunction("Plus");
    domain.addPredicate("P");

    FOLParser parser = new FOLParser(domain);

    Sentence s1 = parser
        .parse("FORALL x,y ((P(x) AND P(A)) OR (P(A) => P(y)))");
View Full Code Here

    this(domain, inferenceProcedure, new Unifier());
  }

  public FOLKnowledgeBase(FOLDomain domain,
      InferenceProcedure inferenceProcedure, Unifier unifier) {
    this.parser = new FOLParser(new FOLDomain(domain));
    this.inferenceProcedure = inferenceProcedure;
    this.unifier = unifier;
    //
    this.substVisitor = new SubstVisitor();
    this.variableCollector = new VariableCollector();
View Full Code Here

public class SubsumptionEliminationTest {

  @Test
  public void testFindSubsumedClauses() {
    // Taken from AIMA2e pg 679
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("patrons");
    domain.addPredicate("hungry");
    domain.addPredicate("type");
    domain.addPredicate("fri_sat");
    domain.addPredicate("will_wait");
    domain.addConstant("Some");
    domain.addConstant("Full");
    domain.addConstant("French");
    domain.addConstant("Thai");
    domain.addConstant("Burger");
    FOLParser parser = new FOLParser(domain);

    String c1 = "patrons(v,Some)";
    String c2 = "patrons(v,Full) AND (hungry(v) AND type(v,French))";
    String c3 = "patrons(v,Full) AND (hungry(v) AND (type(v,Thai) AND fri_sat(v)))";
View Full Code Here

    // John
  }

  @Test
  public void testCascadedOccursCheck() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("P");
    domain.addFunction("F");
    domain.addFunction("SF0");
    domain.addFunction("SF1");
    FOLParser parser = new FOLParser(domain);

    Sentence s1 = parser.parse("P(SF1(v2),v2)");
    Sentence s2 = parser.parse("P(v3,SF0(v3))");
    Map<Variable, Term> result = unifier.unify(s1, s2);
View Full Code Here

  // Note: see -
  // http://logic.stanford.edu/classes/cs157/2008/lectures/lecture15.pdf
  // slide 12 for where this test example was taken from.
  public static FOLKnowledgeBase createABCEqualityKnowledgeBase(
      InferenceProcedure infp, boolean includeEqualityAxioms) {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");

    FOLKnowledgeBase kb = new FOLKnowledgeBase(domain, infp);

    kb.tell("B = A");
    kb.tell("B = C");
View Full Code Here

   * which is incorrect as c1743 in the first function term needs to be c1751
   * as this is the second substitution.
   */
  @Test
  public void testBadCascadeSubstitution_LCL418_1() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("ISATHEOREM");
    domain.addFunction("EQUIVALENT");
    FOLParser parser = new FOLParser(domain);

    Sentence s1 = parser
        .parse("ISATHEOREM(EQUIVALENT(EQUIVALENT(c1744,c1743),EQUIVALENT(c1742,c1743)))");
    Sentence s2 = parser
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.domain.FOLDomain

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.