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 regular expression matching extended with a practical extension called lookaround can be solved in the same time complexity. In this work, we consider four well-known extensions to regular expressions called backreference, squaring, intersection and complement. We prove a number of novel time complexity lower bounds for regular expression matching with these extensions under the Orthogonal Vectors Conjecture (OVC), $k$-OVC, $k$-Clique Hypothesis, and Combinatorial $k$-Clique Hypothesis. Some highlights of our results include the fact that none of the matching problems with the extensions can be solved in $n^{2-\varepsilon} \mathrm{poly}(m)$ time for any constant $\varepsilon > 0$ (for backreference, even when restricted to one capturing group) under OVC, and that the problem with complement, also known as extended regular expression (ERE) matching, cannot be solved in time $n^{2-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$ under OVC, $n^{ω-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$ under the $k$-Clique Hypothesis (where $ω$ is the matrix multiplication exponent), and $n^{3-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$ under the Combinatorial $k$-Clique Hypothesis, respectively. In particular, the latter two results show that the $O(n^3 m)$-time ERE matching algorithm introduced by Hopcroft and Ullman in 1979 and recently improved by Bille, Gørtz and Jessen to run in $O(n^ωm)$ time using fast matrix multiplication was already optimal in a sense, and shed 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)$时间内求解。此外,近期研究表明,包含一种实用扩展(环视)的正则表达式匹配可在相同时间复杂度内求解。本文研究了正则表达式的四种经典扩展:反向引用、平方、交集和补集。基于正交向量猜想(OVC)、$k$-OVC、$k$-团猜想及组合$k$-团猜想,我们针对包含这些扩展的正则表达式匹配问题,证明了一系列新颖的时间复杂度下界。主要结果亮点包括:在OVC假设下,对于任意常数$\varepsilon > 0$,包含这些扩展的匹配问题(其中反向引用即使限制为单个捕获组)均无法在$n^{2-\varepsilon} \mathrm{poly}(m)$时间内求解;而包含补集的扩展正则表达式(ERE)匹配问题,在OVC假设下无法在$n^{2-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$时间内求解,在$k$-团猜想下(其中$ω$为矩阵乘法指数)无法在$n^{ω-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$时间内求解,在组合$k$-团猜想下无法在$n^{3-\varepsilon}\mathrm{tower}(o(\sqrt{m}))$时间内求解。特别地,后两个结果揭示了:Hopcroft和Ullman于1979年提出的$O(n^3 m)$时间ERE匹配算法(近期Bille、Gørtz和Jessen通过快速矩阵乘法将其改进至$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日
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日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 3月17日
VIP会员
最新内容
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
2+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
3+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
3+阅读 · 6月22日
美国从乌克兰无人机战争中学习经验
专知会员服务
7+阅读 · 6月21日
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
5+阅读 · 6月21日
相关基金
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员