简体   繁体   English

如果语言(L)被n状态NFA识别,那么它是否也可以由不超过2 ^ n个状态的DFA识别?

[英]If a language (L) is recognized by an n-state NFA, can it also be recognized by a DFA with no more than 2^n states?

I'm thinking so, because the upper bound would be the 2^n, and given that these are both finite machines, the intersection for both the n-state NFA and the DFA with 2^n or less states will be valid. 我这么认为,因为上限是2 ^ n,并且鉴于这些都是有限机器,n状态NFA和具有2 ^ n或更少状态的DFA的交集将是有效的。

Am I wrong here? 我错了吗?

You're right. 你是对的。 2^n is an upper limit, so the generated DFA can't have more states than that limit. 2 ^ n是上限,因此生成的DFA不能具有超过该限制的状态。 But it's the worst-case scenario. 但这是最糟糕的情况。 In most common scenarios there's less states than that in the resulting DFA. 在大多数常见情况下,状态少于生成的DFA中的状态。 Sometimes it could be even less than in the original NFA. 有时甚至可能比原来的NFA还要少。

But as far as I know, the algorithm to predict how many states the resulting DFA will actually have, doesn't exist yet. 但据我所知,用于预测生成的DFA实际拥有的状态的算法尚不存在。 So if you'll find it, please let me know ;) 所以,如果你能找到它,请告诉我;)

That is correct. 那是对的。 As you probably already know, both DFAs and NFAs only accept regular languages. 您可能已经知道,DFA和NFA都只接受常规语言。 That means that they are equal in the languages they can accept. 这意味着他们可以接受的语言相同。 Also, the most primitive way of transforming a NFA to a DFA is with subset construction (also called powerset construction) , where you simply create a state in the DFA for every combination of states in the NFA. 此外,将NFA转换为DFA的最原始方法是使用子集构造(也称为powerset构造) ,您只需在DFA中为NFA中的每个状态组合创建一个状态。 This is called the powerset of states, which could at most be 2^n. 这被称为国家的powerset,最多可以是2 ^ n。

But, as mentioned by @SasQ that is the worst case scenario. 但是,正如@SasQ所提到的那样,这是最糟糕的情况。 Typically you will not end up with that many states if you use Hopcroft's algorithm or Brozowski's algorithm. 通常,如果使用Hopcroft算法或Brozowski算法,您将不会得到那么多状态。

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

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