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.assertFalse(expression.equals(altExpression));
Assert.assertEquals("P(A,F(E,G(A,H(B)),C),D)", altExpression.toString());
altExpression = (Predicate) demodulation
.apply(assertion, altExpression);
Assert.assertEquals("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.assertEquals("P(A,F(B,J(A),C),D)", altExpression.toString());
}