// 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( IInferenceProcedure infp, bool includeEqualityAxioms) { var domain = new FOLDomain(); domain.AddConstant("A"); domain.AddConstant("B"); domain.AddConstant("C"); var kb = new FOLKnowledgeBase(domain, infp); kb.tell("B = A"); kb.tell("B = C"); if (includeEqualityAxioms) { // Reflexivity Axiom kb.tell("x = x"); // Symmetry Axiom kb.tell("(x = y => y = x)"); // Transitivity Axiom kb.tell("((x = y AND y = z) => x = z)"); } return(kb); }
public static FOLKnowledgeBase CreateKingsKnowledgeBase( IInferenceProcedure infp) { FOLKnowledgeBase kb = new FOLKnowledgeBase(DomainFactory.KingsDomain(), infp); kb.tell("((King(x) AND Greedy(x)) => Evil(x))"); kb.tell("King(John)"); kb.tell("King(Richard)"); kb.tell("Greedy(John)"); return(kb); }
// 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( IInferenceProcedure infp, bool includeEqualityAxioms) { var domain = new FOLDomain(); domain.AddConstant("A"); domain.AddConstant("B"); domain.AddConstant("C"); domain.AddConstant("D"); domain.AddPredicate("P"); domain.AddFunction("F"); var kb = new FOLKnowledgeBase(domain, infp); kb.tell("F(A) = B"); kb.tell("F(B) = A"); kb.tell("C = D"); kb.tell("P(A)"); kb.tell("P(C)"); if (includeEqualityAxioms) { // Reflexivity Axiom kb.tell("x = x"); // Symmetry Axiom kb.tell("(x = y => y = x)"); // Transitivity Axiom kb.tell("((x = y AND y = z) => x = z)"); // Function F Substitution Axiom kb.tell("((x = y AND F(y) = z) => F(x) = z)"); // Predicate P Substitution Axiom kb.tell("((x = y AND P(y)) => P(x))"); } return(kb); }
public static FOLKnowledgeBase CreateWeaponsKnowledgeBase( IInferenceProcedure infp) { FOLKnowledgeBase kb = new FOLKnowledgeBase(DomainFactory .WeaponsDomain(), infp); kb .tell("( (((American(x) AND Weapon(y)) AND Sells(x,y,z)) AND Hostile(z)) => Criminal(x))"); kb.tell(" Owns(Nono, M1)"); kb.tell(" Missile(M1)"); kb.tell("((Missile(x) AND Owns(Nono,x)) => Sells(West,x,Nono))"); kb.tell("(Missile(x) => Weapon(x))"); kb.tell("(Enemy(x,America) => Hostile(x))"); kb.tell("American(West)"); kb.tell("Enemy(Nono,America)"); return(kb); }