I am trying to construct languages.
Let Σ = {a, b}
Let's say in this language BB, every word has to have the substring bb.
So the recursive definition is:
Rule 1 bb is in the BB
Rule 2 If x is in BB, then so is x + bb
Rule 3 If x is in BB, then so is bb + x.
Rule 4 The only elements in the set BB are those that can be produced from the three rules above.
Let say, I have another language called NOTBB. In this language every word should not have the substring bb
Rule 1 a and b are in NOTBB
Rule 2 If x is in NOTBB, then so is x + a
Rule 3 If x is in NOTBB, then so is x + ab
Rule 4 The only elements in the set BB are those that can be produced from the three rules above.
The definitions are correct, right?
The first one is not correct: "abb" should be in BB, since it has "bb" as a substring, but cannot be derived from the rules given.
The second one is correct, though.