Question: 1 Rewrite Systems Remember our rewriting game in the first lecture. (a) Given the same input, i.e., a sequence of characters starting with $ and
1 Rewrite Systems Remember our rewriting game in the first lecture. (a) Given the same input, i.e., a sequence of characters starting with $ and ending with #, and any combination of 0s and 1s in-between, specify a set of rewrite rules that determine whether the string contains the same number of 0s and 1s. Here is some sample output: $0011# should be rewritten as $# $1001# should be rewritten as $# $110110# should be rewritten as $11# $0001100# should be rewritten as $000# In other words, the $# indicates that the input string has the same number of 0s and 1s. If the string does not contain the same number of 0s and 1s, the resulting string shows how many more 0s or 1s there are in the input string. (b) Is there at most only a single rewrite rule that can be applied at any point in time during the rewrite process? Explain. (c) Show the steps of your rewrite system for the input strings $0101# and $10110#.
class example:
rule 1 : $1 => 1&
rule 2 : $0 => 0$
rule 3 : &1 => 1$
rule 4 : &0 => 0&
rule 5 : $# => A
rule 6 : => B
Input: $10100#
rule1: 1&0100#
rule4: 10&100#
rule3: 101$00#
rule2: 1010$0#
rule2: 10100$#
rule5: 10100A
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
