简体   繁体   English

空字符串是所有字母的子集还是元素?

[英]Is the empty string a subset or element of all alphabets?

I'm having trouble understanding when the empty string (epsilon) is a subset or element of an alphabet?我无法理解空字符串(epsilon)何时是字母表的子集或元素? My understanding was that epsilon was only part of a language, but my TA in the class said it was an element of all alphabets so now I am confused.我的理解是 epsilon 只是一种语言的一部分,但我在 class 中的 TA 说它是所有字母的一个元素,所以现在我很困惑。

e.g. would {a,b,c} contain epsilon as an element?
e.g. would {} contain epsilon as an element?
e.g. is {eps} a subset of all alphabets or languages?

This question is probably better suited for cs.stackexchange but I will try to help you according to my understanding, please do correct me if necessary.这个问题可能更适合cs.stackexchange但我会根据我的理解尽力帮助你,如有必要请纠正我。

In general, your own intuition seems quite correct to me.一般来说,你自己的直觉对我来说似乎很正确。 ϵ is not automatically part of every alphabet. ϵ不会自动成为每个字母表的一部分。 It is the empty string of characters.它是一个空字符串。

However, this means that ϵ is a string over any alphabet , even your alphabet {a, b, c} .但是,这意味着ϵ任何字母表上的字符串,甚至是您的字母表{a, b, c}

So to answer your three examples:所以回答你的三个例子:

  1. No, it does not.不,不是的。 If {a, b, c} is an alphabet, it is a set of symbols, and ϵ is a string.如果{a, b, c}是一个字母表,它是一组符号,而ϵ是一个字符串。 However, ϵ is definitely part of some languages defined over this alphabet.然而, ε绝对是在这个字母表上定义的某些语言的一部分。

  2. No, {} is the empty set, and it contains nothing, not even ϵ .不, {}是空集,它不包含任何内容,甚至不包含ϵ

  3. {ϵ} is the set containing only ϵ . {ϵ}是仅包含ϵ的集合。 ϵ is a string, not a symbol, so it is not a subset of all alphabets (however, it seems there are cases where some alphabets are defined to contain ϵ but that is a different confusing story). ϵ是一个字符串,而不是一个符号,因此它不是所有字母的子集(但是,似乎有些字母被定义为包含ϵ但这是一个不同的令人困惑的故事)。 It is also not a subset of all languages, because consider the language L = {aa, ab, ba, bb} .它也不是所有语言的子集,因为考虑语言L = {aa, ab, ba, bb} The empty string is not one of these elements.空字符串不是这些元素之一。

The analogue to set theory might cause some additional confusion.集合论的类似物可能会引起一些额外的混乱。 Notice that the empty set is a subset of every set.请注意,空集是每个集合的子集。 The empty string is not a subset of every language, but rather it is a substring of any string.空字符串不是每种语言的子集,而是任何字符串的substring

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM