一组输出上的两种不同语法

发布于 2024-09-12 03:09:38 字数 320 浏览 1 评论 0原文

你能给我两种不同的语法来输出相同的单词集吗?

说明:

给定字母表 {0,1} 上的语法 A 和 B,如果语法 A 可以产生单词 0101001,那么语法 B 也可以。如果语法 B 可以产生 0101111,那么语法 A 也可以。如果语法 A 不能产生 01001,那么 B 也不能。

但这里的问题是语法 A 和 B 彼此不同,即它们使用完全不同的算法。那么它们产生的输出集不仅仅是另一个输出的真子集。意思是说它们相应的输出集必须具有相同的基数。也许它们具有不同的复杂性类别,但这并不重要。如果可以的话,如果您能给我字母表 {0,1} 的语法,就像经典的图灵机一样,我将不胜感激。

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 the classical Turing machine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Bonjour°[大白 2024-09-19 03:09:38

不确定这是否可能。如果 A 可以产生输出 a,则 B 要么直接包含 a,要么包含比 a 短的 b 和 b' 生成 a。同样的论点适用于 b(和 b') - 它要么直接在 A 中,要么在 A 中存在比 b 短的 a' 和 a'' 生成 b。迭代此参数,最终到达各个元素长度为 1 的点,因此您无法进一步分解它们,并且 A 和 B 中必须具有相同的元素。

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.

执手闯天涯 2024-09-19 03:09:38

这个技巧可以吗? 0*n1*m 类型的字符串(例如 000000111)可以从左到右:从右

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

到左:

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

从中间构造:

AB
A -> A0
A -> {}
B -> 1B
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 -> {}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文