コード例 #1
0
        // 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);
        }
コード例 #2
0
        // 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);
        }