正则语言总是无限的吗
我对常规语言的概念有点困惑。 由于所有常规语言都可以被 dfa 接受,并且 dfa 中总是有循环。所以看起来 dfa 可以接受无限数量的字符串。这是否意味着所有常规语言都是无限的?空集呢?它是常规语言吗?
I'm kind of confused by the concept of regular language.
Since all regular language can be accepted by a dfa and dfa always has loops in it. So it seems like the dfa can accpet infinite number of strings. Does it mean all regular language is infinite? What about empty set. Is it a regular language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正则语言的定义包括空集。它还包括单例语言
{a}
,所以不,并非所有常规语言都是无限的。The definition of regular language includes the empty set. It also includes the singleton language
{a}
, so no, not all regular languages are infinite.不,并非所有 DFA 中都有循环。正则语言是一种可以被正则表达式接受的语言(使用数学定义,而不是 PCRE 定义),例如“a”是仅与确切的字符串“a”匹配的正则表达式。所以 { a } 是一种常规语言。 :)
这种语言的 DFA 是:
No, not all DFAs have loops in them. A regular language is one which can be accepted by a regular expression (using the mathematical, rather than pcre definition), and for example 'a' is a regular expression which matches only the exact string 'a'. So { a } is a regular language. :)
A DFA for this language is: