# Question: In this exercise we will look at the recursive application

In this exercise, we will look at the recursive application of rewrite rules, using logic programming. A rewrite rule (or demodulator in OTTER terminology) is an equation with specified direction. For example, the rewrite rule x + O ( x suggests replacing any expression that matches x + 0 with the expression x. The application of rewrite rules is a central part of educational reasoning systems. We will use the predicate rewrite (X, Y) to represent rewrite rules. For example, the earlier rewrite rule is written as rewrite (X + 0, X). Son terms arc primitive and cannot be further simplified thus, we will write primitive (0) say that 0 is a primitive term.

a. 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 are applicable to any sub expression of Y.

b. Write a collection of rules for the simplification of expressions involving arithmetic operators, and apply your simplification algorithm to some sample expressions.

c. 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.

a. 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 are applicable to any sub expression of Y.

b. Write a collection of rules for the simplification of expressions involving arithmetic operators, and apply your simplification algorithm to some sample expressions.

c. 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.

**View Solution:**## Answer to relevant Questions

In this exercise, we will consider the implementation of search algorithms in Prolog. Suppose that successor (X, Y) is true when state Y is a successor of state X; and that goal (X) is true when X is a goal state. Write a ...We said in this chapter that resolution cannot be used to generate all logical consequences of a set of sentences. Can any algorithm do this?Write a set of sentences that allows one to calculate the price of an individual tomato (or other object), given the price per pound. Extend the theory to allow the price of a bag of tomatoes to be calculated.Add rules to extend the definition of the predicate Name (s, c.) so that a siring such as “laptop computer” matches against the appropriate category names from a variety of stores. Try to make your definition general. ...Describe the differences and similarities between problem solving and planning.Post your question