Exemple #1
0
        public static FOLKnowledgeBase createRingOfThievesKnowledgeBase(
            InferenceProcedure infp)
        {
            FOLKnowledgeBase kb = new FOLKnowledgeBase(DomainFactory
                                                       .ringOfThievesDomain(), infp);

            // s(x) => ~c(x) One who skis never gets caught
            kb.tell("(Skis(x) => NOT(Caught(x)))");
            // c(x) => ~s(x) Those who are caught don't ever ski
            kb.tell("(Caught(x) => NOT(Skis(x)))");
            // p(x,y) & c(y) => s(x) Jailbird parents have skiing kids
            kb.tell("((Parent(x,y) AND Caught(y)) => Skis(x))");
            // s(x) & f(x,y) => s(y) All friends ski together
            kb.tell("(Skis(x) AND Friend(x,y) => Skis(y))");
            // f(x,y) => f(y,x) Friendship is symmetric
            kb.tell("(Friend(x,y) => Friend(y,x))");
            // FACTS
            // 1. { p(Mike,Joe) } Premise
            kb.tell("Parent(Mike, Joe)");
            // 2. { p(Janet,Joe) } Premise
            kb.tell("Parent(Janet,Joe)");
            // 3. { p(Nancy,Mike) } Premise
            kb.tell("Parent(Nancy,Mike)");
            // 4. { p(Ernie,Janet) } Premise
            kb.tell("Parent(Ernie,Janet)");
            // 5. { p(Bert,Nancy) } Premise
            kb.tell("Parent(Bert,Nancy)");
            // 6. { p(Red,Ernie) } Premise
            kb.tell("Parent(Red,Ernie)");
            // 7. { f(Red,Bert) } Premise
            kb.tell("Friend(Red,Bert)");
            // 8. { f(Drew,Nancy) } Premise
            kb.tell("Friend(Drew,Nancy)");
            // 9. { c(Mike) } Premise
            kb.tell("Caught(Mike)");
            // 10. { c(Ernie) } Premise
            kb.tell("Caught(Ernie)");

            return(kb);
        }