This exercise looks at the recursive
application of rewrite rules, using logic programming. A rewrite rule
(or demodulator in terminology) is an
equation with a specified direction. For example, the rewrite rule
-
Write a definition of a predicate simplify(X,Y), that is true when Y is a simplified version of X—that is, when no further rewrite rules apply to any subexpression of Y.
-
Write a collection of rules for the simplification of expressions involving arithmetic operators, and apply your simplification algorithm to some sample expressions.
-
Write a collection of rewrite rules for symbolic differentiation, and use them along with your simplification rules to differentiate and simplify expressions involving arithmetic expressions, including exponentiation.