是字母表“a,b,c”上所有字符串的语言吗?具有相同数量的子串“ab” & “吧”常规的?

发布于 2024-11-29 16:54:04 字数 126 浏览 6 评论 0原文

是字母表“a,b,c”上具有相同数量的子串“ab”和“a,b,c”的所有字符串的语言“ba”常规吗?

我相信答案是否定的,但是很难对其进行正式的演示,甚至是非正式的演示。

关于如何解决这个问题有什么想法吗?

Is the language of all strings over the alphabet "a,b,c" with the same number of substrings "ab" & "ba" regular?

I believe the answer is NO, but it is hard to make a formal demonstration of it, even a NON formal demonstration.

Any ideas on how to approach this?

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

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

发布评论

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

评论(2

伤感在游骋 2024-12-06 16:54:04

这显然不正常。 FA 如何识别 (abc)^nc (cba)^n。像这样的字符串是用你的语言写的,对吗?该论证是一个简单的论证,基于不可区分关系 I_l 下存在无限多个等价类这一事实。

It's clearly not regular. How is an FA going to recognize (abc)^n c (cba)^n. Strings like this are in your language, right? The argument is a simple one based on the fact that there are infinitely many equivalence classes under the indistinguishability relation I_l.

︶ ̄淡然 2024-12-06 16:54:04

证明语言不规则的最常见方法是使用抽引理

使用引理有点棘手,因为它具有所有这些“存在”等等。要使用泵引理证明语言 L 不是正则语言,您必须证明

for any integer p,
there is a word w in L of length n, with n>=p,  such that
for all possible ways to decompose w as xyz, with len(xy) <= p and y non empty
there exists an i such that x(y^i)z (repeating the y bit i times) is NOT in L

哇!

我将展示证明如何寻找“相同数量的 as 和 bs”语言。转换为您的情况应该是直接的:

for any given p, we can make a word of length n = 2*p
a^p b^p (p a's followed by p b's)
any way you decompose this into xyz w/ |xy| <=p, y will only contain a's.

Thus, pumping the the y part will make the word have more as than bs,
thus NOT belonging to L.

如果您需要直观地了解为什么会这样,那么您需要如何计数到任意大的数字来验证一个单词是否属于这些语言之一。然而,正则语言是由有限自动机描述的,并且没有有限自动机可以表示表示所有数字所需的无限数量的状态。 (维基百科文章应该有正式的证明)。


编辑:看起来你不能直接在这种特殊情况下直接使用泵引理:如果你总是让 y 成为一个字符长,你永远无法让一个单词停止被接受(aba 变成 abbbba没有区别等等)。

只需采用 Patrick87 建议的等价类方法即可 - 它可能会比您为使泵送引理适用于此处而需要执行的任何肮脏技巧更干净。

The most common way to prove a language is NOT regular is using on of the Pumping Lemmas.

Using the lemma is a little tricky, since it has all those "exists" and so on. To prove a language L is not regular using the pumping lemma you have to prove that

for any integer p,
there is a word w in L of length n, with n>=p,  such that
for all possible ways to decompose w as xyz, with len(xy) <= p and y non empty
there exists an i such that x(y^i)z (repeating the y bit i times) is NOT in L

whooo!

I'l l show how the proof looks for the "same number of as and bs" language. It should be straighfoward to convert to your case:

for any given p, we can make a word of length n = 2*p
a^p b^p (p a's followed by p b's)
any way you decompose this into xyz w/ |xy| <=p, y will only contain a's.

Thus, pumping the the y part will make the word have more as than bs,
thus NOT belonging to L.

If you need intuition on why this works, it follows from how you need to be able to count to arbritrarily large numbers to verify if a word belongs to one of these languages. However, Regular Languages are described by finite automata and no finite automata can represent the infinite ammount of states required to represent all the numbers. (The Wikipedia article should have a formal proof).


EDIT: It looks like you can't straight up use the pumping lemma in this particular case directly: if you always make y be one character long you can never make a word stop being accepted (aba becoming abbbba makes no difference and so on).

Just do the equivalence class approach suggested by Patrick87 - it will probably turn out to be cleaner than any of the dirty hacks you would need to do to make the pumping lemma applicable here.

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