Package aima.core.logic.fol.domain

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


  // Note: see -
  // http://logic.stanford.edu/classes/cs157/2008/lectures/lecture15.pdf
  // slide 16,17, and 18 for where this test example was taken from.
  public static FOLKnowledgeBase createABCDEqualityAndSubstitutionKnowledgeBase(
      InferenceProcedure infp, boolean includeEqualityAxioms) {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addConstant("D");
    domain.addPredicate("P");
    domain.addFunction("F");

    FOLKnowledgeBase kb = new FOLKnowledgeBase(domain, infp);

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


        result.toString());
  }

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

    FOLParser parser = new FOLParser(domain);

    // Test Cascade Substitutions handled correctly
    Sentence s1 = parser.parse("P(z, x)");
View Full Code Here

        result.toString());
  }

  @Test
  public void testTermEquality() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addFunction("Plus");

    FOLParser parser = new FOLParser(domain);

    TermEquality te1 = (TermEquality) parser.parse("x = x");
    TermEquality te2 = (TermEquality) parser.parse("x = x");
View Full Code Here

    Assert.assertNull(result);
  }

  @Test
  public void testNOTSentence() {
    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("NOT(P(A))");
    Sentence s2 = parser.parse("NOT(P(A))");
View Full Code Here

*/
public class CNFConverterTest {

  @Test
  public void testExamplePg295AIMA2e() {
    FOLDomain domain = DomainFactory.weaponsDomain();
    FOLParser parser = new FOLParser(domain);

    Sentence origSentence = parser
        .parse("FORALL x ((((American(x) AND Weapon(y)) AND Sells(x, y, z)) AND Hostile(z)) => Criminal(x))");

View Full Code Here

        cnf.toString());
  }

  @Test
  public void testExamplePg296AIMA2e() {
    FOLDomain domain = DomainFactory.lovesAnimalDomain();
    FOLParser parser = new FOLParser(domain);

    Sentence origSentence = parser
        .parse("FORALL x (FORALL y (Animal(y) => Loves(x, y)) => EXISTS y Loves(y, x))");
View Full Code Here

        cnf.toString());
  }

  @Test
  public void testExamplesPg299AIMA2e() {
    FOLDomain domain = DomainFactory.lovesAnimalDomain();
    FOLParser parser = new FOLParser(domain);

    // FOL A.
    Sentence origSentence = parser
        .parse("FORALL x (FORALL y (Animal(y) => Loves(x, y)) => EXISTS y Loves(y, x))");
View Full Code Here

    Assert.assertEquals("[~Kills(Curiosity,Tuna)]", cnf.toString());
  }

  @Test
  public void testNestedExistsAndOrs() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("P");
    domain.addPredicate("R");
    domain.addPredicate("Q");

    FOLParser parser = new FOLParser(domain);

    Sentence origSentence = parser
        .parse("EXISTS w (FORALL x ( (EXISTS z (Q(w, z))) => (EXISTS y (NOT(P(x, y)) AND R(y))) ) )");
View Full Code Here

    Assert.assertEquals("[~Q(x4,w4,z4), ~R(x4,y4)]", cnf.toString());
  }

  @Test
  public void testImplicationsAndExtendedAndsOrs() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("Cheat");
    domain.addPredicate("Extra");
    domain.addPredicate("Knows");
    domain.addPredicate("Diff");
    domain.addPredicate("F");
    domain.addPredicate("A");
    domain.addPredicate("Probation");
    domain.addPredicate("Award");

    FOLParser parser = new FOLParser(domain);
    CNFConverter cnfConv = new CNFConverter(parser);

    // cheat(x,y) => f(x,y)
View Full Code Here

        cnfDef5.toString());
  }

  @Test
  public void testNegationsAndNestedImplications() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("P");
    domain.addPredicate("Q");
    domain.addPredicate("R");
    domain.addConstant("A");

    FOLParser parser = new FOLParser(domain);
    CNFConverter cnfConv = new CNFConverter(parser);

    // ~(((~p or ~q) => ~(p or q)) => r)
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.