Can we show that all words consisting of s and s can be made?
Question
-words are “words” formed from the letters and according to certain rules. The rules are applied starting with the empty word, containing no letters. The basic rules are:
- If the current word is , then it can be replaced with the word that starts with , followed by and ending with , written .
-
If the current word ends with , the final can be removed.
-
Show how the word can be produced.
- Describe precisely all the words that can be produced with these two rules. Justify your answer. You might like to write for the word containing just consecutive copies of , and similarly for ; for example .
We now add a third rule:
- Reverse the word, and replace every by , and every by .
For example, applying this rule to would give .
- Describe precisely all the words that can be produced with these three rules. Justify your answer.
Finally, we add a fourth rule.
-
Reverse the word.
-
Show that every word consisting of s and s can be formed using these four rules. Hint: show how, if we have produced the word , we can produce (a) the word , and (b) the word ; hence deduce the result.
Suggestion
-words are “words” formed from the letters and according to certain rules. The rules are applied starting with the empty word, containing no letters. The basic rules are:
- If the current word is , then it can be replaced with the word that starts with , followed by and ending with , written .
- If the current word ends with , the final can be removed.
…
- Describe precisely all the words that can be produced with these two rules. Justify your answer. You might like to write for the word containing just consecutive copies of , and similarly for ; for example .
If we start with , what effect does Rule (1) have? What about Rule (2)?
- Reverse the word, and replace every by , and every by .
-
Reverse the word.
-
Show that every word consisting of s and s can be formed using these four rules. Hint: show how, if we have produced the word , we can produce (a) the word , and (b) the word ; hence deduce the result.
Why does creating and from solve the problem?
What effect does combining Rule (3) and Rule (4) into a single rule have?
Solution
Apply Rule (1) three times to get , and then apply Rule (2) twice to give .
Applying Rule (1) times will produce the word . We can then remove any number of the s by applying Rule (2). These two rules cannot produce any word containing a before an .
So we can produce any word of the form where .
Rule (3) still keeps all the s before all the s. But now we can produce any word of the form with and .
For , apply the rules exactly as in (ii) above. For , apply Rule (1) times and Rule (2) times, and then apply Rule (3) once.
- By first applying Rule (1) to we get , and then applying Rule (2) we get .
- Let be the word produced by replacing all the s in with s and replacing all s with s. Now we can produce by applying Rule (3) followed by Rule (4) to . Then we can use Rule (1) and then Rule (2) to get . Now we can use Rules (3) and (4) again to get .
As we now have ways of adding or to the start of a word, we can produce any word consisting of s and s from these four rules starting with the empty word.