The regular expression matching problem asks whether a given regular expression of length $m$ matches a given string of length $n$. As is well known, the problem can be solved in $O(nm)$ time using Thompson's algorithm. Moreover, recent studies have shown that the matching problem for regular expressions extended with a practical extension called lookaround can be solved in the same time complexity. In this work, we consider three well-known extensions to regular expressions called backreference, intersection and complement, and we show that, unlike in the case of lookaround, the matching problem for regular expressions extended with any of the three (for backreference, even when restricted to one capturing group) cannot be solved in $O(n^{2-\varepsilon} \mathrm{poly}(m))$ time for any constant $\varepsilon > 0$ under the Orthogonal Vectors Conjecture. Moreover, we study the matching problem for regular expressions extended with complement in more detail, which is also known as extended regular expression (ERE) matching. We show that there is no ERE matching algorithm that runs in $O(n^{ω-\varepsilon} \mathrm{poly}(m))$ time ($2 \le ω< 2.3716$ is the exponent of square matrix multiplication) for any constant $\varepsilon > 0$ under the $k$-Clique Hypothesis, and there is no combinatorial ERE matching algorithm that runs in $O(n^{3-\varepsilon} \mathrm{poly}(m))$ time for any constant $\varepsilon > 0$ under the Combinatorial $k$-Clique Hypothesis. This shows that the $O(n^3 m)$-time algorithm introduced by Hopcroft and Ullman in 1979 and recently improved by Bille et al. to run in $O(n^ωm)$ time using fast matrix multiplication was already optimal in a sense, and sheds light on why the theoretical computer science community has struggled to improve the time complexity of ERE matching with respect to $n$ and $m$ for more than 45 years.


翻译:正则表达式匹配问题询问一个长度为 $m$ 的给定正则表达式是否匹配一个长度为 $n$ 的给定字符串。众所周知,使用 Thompson 算法可以在 $O(nm)$ 时间内解决该问题。此外,最近的研究表明,对于扩展了一种称为环视的实用扩展的正则表达式,其匹配问题可以在相同的时间复杂度内解决。在这项工作中,我们考虑了正则表达式的三个众所周知的扩展,分别称为反向引用、交集和补集。我们证明,与环视的情况不同,对于扩展了这三个扩展中任何一个的正则表达式(对于反向引用,即使限制在一个捕获组内),在正交向量猜想下,对于任何常数 $\varepsilon > 0$,其匹配问题都无法在 $O(n^{2-\varepsilon} \mathrm{poly}(m))$ 时间内解决。此外,我们更详细地研究了扩展了补集的正则表达式的匹配问题,这也被称为扩展正则表达式匹配。我们证明,在 $k$-Clique 假设下,对于任何常数 $\varepsilon > 0$,不存在在 $O(n^{ω-\varepsilon} \mathrm{poly}(m))$ 时间内运行的 ERE 匹配算法(其中 $2 \le ω< 2.3716$ 是方阵乘法的指数);并且在组合 $k$-Clique 假设下,对于任何常数 $\varepsilon > 0$,不存在在 $O(n^{3-\varepsilon} \mathrm{poly}(m))$ 时间内运行的组合 ERE 匹配算法。这表明,Hopcroft 和 Ullman 于 1979 年引入的 $O(n^3 m)$ 时间算法,以及最近由 Bille 等人改进的、使用快速矩阵乘法在 $O(n^ωm)$ 时间内运行的算法,在某种意义上已经是最优的,并揭示了为什么理论计算机科学界在超过 45 年的时间里,在改进 ERE 匹配关于 $n$ 和 $m$ 的时间复杂度方面一直难以取得进展。

0
下载
关闭预览

相关内容

正则表达式(Regular Expression,一般简写为RegEx或者RegExp),也译为正规表示法、常规表示法,台湾译「规则运算式」,在计算机科学中,是指一个用来描述或者匹配一系列符合某个句法规则的字符串的单个字符串。
结合知识增强的大型语言模型复杂问题求解综述
专知会员服务
16+阅读 · 2025年5月7日
基于深度学习的图像匹配:方法、应用与挑战
专知会员服务
24+阅读 · 2024年7月19日
【深度语义匹配模型】原理篇二:交互篇
AINLP
16+阅读 · 2020年5月18日
重磅发布:基于 PyTorch 的深度文本匹配工具 MatchZoo-py
中国科学院网络数据重点实验室
16+阅读 · 2019年8月26日
长文本表示学习概述
云栖社区
15+阅读 · 2019年5月9日
Word2Vec与Glove:词嵌入方法的动机和直觉
论智
14+阅读 · 2018年6月23日
论文笔记之attention mechanism专题1:SA-Net(CVPR 2018)
统计学习与视觉计算组
16+阅读 · 2018年4月5日
深度文本匹配开源工具(MatchZoo)
机器学习研究会
10+阅读 · 2017年12月5日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 1月14日
VIP会员
相关基金
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员