AIMA.Test.Core.Unit.Logic.Fol.Inference.DemodulationTest.testSimpleAtomicExamples C# (CSharp) Method

testSimpleAtomicExamples() private method

private testSimpleAtomicExamples ( ) : void
return void
        public void testSimpleAtomicExamples()
        {
            FOLDomain domain = new FOLDomain();
            domain.addConstant("A");
            domain.addConstant("B");
            domain.addConstant("C");
            domain.addConstant("D");
            domain.addConstant("E");
            domain.addPredicate("P");
            domain.addFunction("F");
            domain.addFunction("G");
            domain.addFunction("H");
            domain.addFunction("J");

            FOLParser parser = new FOLParser(domain);

            Predicate expression = (Predicate)parser
                    .parse("P(A,F(B,G(A,H(B)),C),D)");
            TermEquality assertion = (TermEquality)parser.parse("B = E");

            Predicate altExpression = (Predicate)demodulation.apply(assertion,
                    expression);

            Assert.IsFalse(expression.Equals(altExpression));
            Assert
                    .AreEqual("P(A,F(E,G(A,H(B)),C),D)", altExpression
                            .ToString());

            altExpression = (Predicate)demodulation
                    .apply(assertion, altExpression);

            Assert
                    .AreEqual("P(A,F(E,G(A,H(E)),C),D)", altExpression
                            .ToString());

            assertion = (TermEquality)parser.parse("G(x,y) = J(x)");

            altExpression = (Predicate)demodulation.apply(assertion, expression);

            Assert.AreEqual("P(A,F(B,J(A),C),D)", altExpression.ToString());
        }