0

こんなに簡単な質問をするのは気の毒ですが、一生これを理解することはできません. いくつかの言語に基づいて NFA を構築する必要がありますが、理解できないのはこれだけです。

L = (10)*

私は FSM に関して何の助けも求めていませんが、言語が何を表しているかについての説明だけを求めていることに注意してください。他の言語のほとんどは、より理解しやすい方法で提示されました。

L = {w | w contains an even number of 0's } 

私はそれが単なる正規表現だと思っています.regexチートシートを熟読した後、私の唯一の推測は、それがグループに100回以上一致することですが、すべてが一致するため、明らかに正しくないようです.

どんな助けでも大歓迎です。

4

3 に答える 3

4

These strings are in the language (10)*:

<empty string>
10
1010
101010
10101010
(etc.)

These strings are not in the language (10)*:

0
1
01
11
010
01010
101
10101
(etc.)

Does that help?

于 2010-08-29T22:32:28.157 に答える
2

Your belief about the meaning is basically correct, but it's not everything that would match.

Unlike your usual regex libraries, when we're dealing with language theory like this, a regular expression must match the entire string. So, ε (empty string) is in the language, 10 is in the language, 1010 is in the language, and so on - everything that consists entirely of the string "10" repeated 0 or more times.

01, however, is not in the language; the string does not consist of the string "10" repeated 0 or more times. 1 is also not in the language, you're missing the final 0.

I don't know if you've covered this part yet, but if you convert that regex to an NFA (or a DFA, non-determinism isn't required for this one) you'd basically get this (slightly simplified, if I remember my conversion algorithm correctly, but it's a pretty trivial change from the algorithm to this):

  1
 ┌─┐
 │ ↓
→a b
 ↑ │
 └─┘
  0

where a is an accepting state, and b is not.

Does this help you see why it doesn't match everything?

于 2010-08-29T22:35:54.677 に答える
1

これは役に立ちますか? http://xenon.stanford.edu/~xusch/regexp/analyzer.html

代替テキスト

于 2010-08-29T22:16:05.637 に答える