Question: Remember our rewrite game in the second lecture. We represent arithmetic values > 0 as sequences of symbols. For example, | represents value 1, and

 Remember our "rewrite game" in the second lecture. We represent arithmetic

Remember our "rewrite game" in the second lecture. We represent arithmetic values > 0 as sequences of symbols. For example, | represents value 1, and ||||| represents value 5. The input to your rewrite system is either a single value representation, or two value representations surrounded by a begin ($) and end (#) marker, and separated by a & marker. For example, the single input value 3 is represented by $|||#, and the input pair 2, 5 is represented by $||&|||||#. The normal forms produced by the rewrite systems do not contain any markers. Give rules of rewrite systems that implement different arithmetic operations on our chosen representation. A rewrite system consists of a set of rewrite rules of the form X Y as discussed in class. Successor function: f(x) = x + 1, x > 0 Example: $|||# will be rewritten to |||| Show the rewrite sequence of your rewrite system for the example input. Double function: f(x) = 2 * x, x > 0 Example: $|||# will be rewritten to |||||| Show the rewrite sequence of your rewrite system for the example input. Addition function: f(x, y) = x + y, x > 0 and y > 0 Example: $||&|||# will be rewritten to ||||| Show the rewrite sequence of your rewrite system for the example input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!