arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1806.04645cs.FL
收藏

正则语言模式匹配的状态复杂度

State Complexity of Pattern Matching in Regular Languages

Janusz A. Brzozowski, Sylvie Davies, Abhishek Madan

摘要:

在一个简单的模式匹配问题中,有一个模式$w$和一个文本$t$,它们是有限字母表$Σ$上的单词。有人可能会问$w$是否发生在$t$中,如果是,在哪里?更一般地说,我们可能有一组模式$P$和一组文本$T$,其中$P$和$T$是正则语言。我们感兴趣的是$T$的任何字是否以$P$的字开始,以$P$的字结束,是否有$P$的字作为因子,或者是否有$P$的字作为子序列。因此,我们对语言$(PΣ^*)\cap T$、$(Σ^*P)\cap T$、$(Σ^* PΣ^*)\cap T$和$(Σ^* \mathbin{\operatorname{shu}} P)\cap T$感兴趣,其中$\operatorname{shu}$是混洗操作。正则语言$L$的状态复杂度$κ(L)$是识别$L$的最小确定性有限自动机中的状态数。我们推导出模式匹配语言的状态复杂度的上界,其中$κ(P)\le m$和$κ(T)\le n$:$κ((PΣ^*)\cap T) \le mn$ ; $κ((Σ^*P)\cap T) \le 2^{m-1}n$ ; $κ((Σ^*PΣ^*)\cap T) \le (2^{m-2}+1)n$ ;和$κ((Σ^*\mathbin{\operatorname{shu}} P)\cap T) \le (2^{m-2}+1)n$。我们证明,这些界限是紧的,并满足他们,字母表必须至少有两个字母在前三种情况下,至少$m-1$字母在最后一种情况下。我们还考虑了$P$是单个单词$w$的特殊情况,并得到了以下紧上界:$κ((wΣ^*)\cap T_n) \le m+n-1$ ; $κ((Σ^*w)\cap T_n) \le (m-1)n-(m-2)$ ; $κ((Σ^*wΣ^*)\cap T_n) \le (m-1)n$ ;和$κ((Σ^*\mathbin{\operatorname{shu}} w)\cap T_n) \le (m-1)n$。对于一元语言,我们在上述所有八种情况下都有$m+n-2$的严格上限。

英文摘要:

In a simple pattern matching problem one has a pattern $w$ and a text $t$, which are words over a finite alphabet $Σ$. One may ask whether $w$ occurs in $t$, and if so, where? More generally, we may have a set $P$ of patterns and a set $T$ of texts, where $P$ and $T$ are regular languages. We are interested whether any word of $T$ begins with a word of $P$, ends with a word of $P$, has a word of $P$ as a factor, or has a word of $P$ as a subsequence. Thus we are interested in the languages $(PΣ^*)\cap T$, $(Σ^*P)\cap T$, $(Σ^* PΣ^*)\cap T$, and $(Σ^* \mathbin{\operatorname{shu}} P)\cap T$, where $\operatorname{shu}$ is the shuffle operation. The state complexity $κ(L)$ of a regular language $L$ is the number of states in the minimal deterministic finite automaton recognizing $L$. We derive the following upper bounds on the state complexities of our pattern-matching languages, where $κ(P)\le m$, and $κ(T)\le n$: $κ((PΣ^*)\cap T) \le mn$; $κ((Σ^*P)\cap T) \le 2^{m-1}n$; $κ((Σ^*PΣ^*)\cap T) \le (2^{m-2}+1)n$; and $κ((Σ^*\mathbin{\operatorname{shu}} P)\cap T) \le (2^{m-2}+1)n$. We prove that these bounds are tight, and that to meet them, the alphabet must have at least two letters in the first three cases, and at least $m-1$ letters in the last case. We also consider the special case where $P$ is a single word $w$, and obtain the following tight upper bounds: $κ((wΣ^*)\cap T_n) \le m+n-1$; $κ((Σ^*w)\cap T_n) \le (m-1)n-(m-2)$; $κ((Σ^*wΣ^*)\cap T_n) \le (m-1)n$; and $κ((Σ^*\mathbin{\operatorname{shu}} w)\cap T_n) \le (m-1)n$. For unary languages, we have a tight upper bound of $m+n-2$ in all eight of the aforementioned cases.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑