开发者

Two Different Grammars Over One Set of Outputs

Can you give me 2 different grammars which outputs the same set of words?

Illustration:

Given a grammar A and B over the alphabet {0,1}, if grammar A can produce the word 0101001, grammar B could as well. If grammar B can produce 0101111 then grammar A could as well. And if grammar A can't produce 01001 then B can neither.

But the thing here is that grammar A and B are different from each other i.e. they use totally different algorithms. Then the set of outputs they produce is not just a proper subset of the other one. Meaning to say their corresponding set of outputs must have the same cardinality. Probably they are of different complexity class, but it doesn't matter. If you may, I would greatly appreciate it if you'll give me grammars over the alphabet {0,1} just like t开发者_C百科he classical Turing machine.


Not sure this is possible. If A can produce output a, then either B contains a directly or contains b and b' shorter than a that generate a. The same argument then applies to b (and b') - it is either in A directly or there exist a' and a'' shorter than b in A that generate b. Iterate this argument and eventually you get to a point where the individual elements are length 1, so you can't break them down further, and you must have equal elements in both A and B.


Is this trick OK? Strings of type 0*n1*m (e.g. 000000111) can be constructed from left to right:

A
A -> 0A
A -> B
B -> 1B
B -> {}

right to left:

B
B -> B1
B -> A
A -> A0
A -> {}

from middle:

AB
A -> A0
A -> {}
B -> 1B
B -> {}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜