关于正则表达式的证明

发布于 2024-07-21 15:33:32 字数 467 浏览 12 评论 0原文

有谁知道以下的例子吗?

  1. 关于正则表达式的证明进展(可能通过反向引用)在证明助手中(例如 Coq)。
  2. 有关正则表达式的依赖类型语言(例如 Agda)的程序。

Does anyone know any examples of the following?

  1. Proof developments about regular expressions (possibly extended with backreferences) in proof assistants (such as Coq).
  2. Programs in dependently-typed languages (such as Agda) about regular expressions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

背叛残局 2024-07-28 15:33:32

依赖类型认证编程有一个关于创建经过验证的正则表达式匹配器的部分。 Coq Contribs 有一个 自动机贡献 可能有用。 Jan-Oliver Kaiser 在 Coq 中形式化了正则表达式、有限自动机和 Myhill-Nerode 表征之间的等价性,其 学士论文

Certified Programming with Dependent Types has a section on creating a verified regular expression matcher. Coq Contribs has an automata contribution that might be useful. Jan-Oliver Kaiser formalized the equivalence between regular expressions, finite automata and the Myhill-Nerode characterization in Coq for his bachelors thesis.

最初的梦 2024-07-28 15:33:32

莫雷拉、佩雷拉和 de Sousa,On the Mechanization of Kleene Algebra in Coq 给出了一个经过验证的很好的构造Coq 中正则表达式的 Antimirov 衍生物。 从这个结构中读取 CFA 并计算正则表达式的交集非常容易。

我不确定为什么将 Coq 与依赖类型编程分开:Coq 本质上是在具有归纳类型的多态依赖类型 lambda 演算(即 CIC,归纳结构演算)中进行编程。

我从未听说过依赖类型语言中的正则表达式的形式化,也没有听说过带有回溯功能的类似 Antimirov 的正则表达式导数,但 Becchi & Crowley,扩展有限自动机以有效匹配与 Perl 兼容的正则表达式 提供与类似 Perl 的正则表达式语言相匹配的有限状态自动机的概念。 在不久的将来,这可能会对形式化者有吸引力。

Moreira, Pereira & de Sousa, On the Mechanisation of Kleene Algebra in Coq gives a nice verified construction of the Antimirov derivative of regexps in Coq. It's pretty easy to read off a CFA from this construction, and to compute the intersection of regexps.

I'm not sure why you separate Coq from dependently typed programming: Coq essentially is programming in a polymorphic dependently typed lambda calculus with inductive types (i.e., CIC, the calculus of inductive constructions).

I've never heard of a formalisation of regexps in a dependently typed language, nor have I heard of something such as an Antimirov-like derivative for regexps with backtracking, but Becchi & Crowley, Extending Finite Automata to Efficiently Match Perl-Compatible Regular Expressions provide a notion of finite-state automata that matches a Perl-like regexp languages. That might attractive to formalisers in the near future.

清风不识月 2024-07-28 15:33:32

请参阅 Perl 正则表达式匹配是 NP 难的

当允许正则表达式有反向引用时,正则表达式匹配是 NP 困难的。

将 3-CNF-SAT 简化为 Perl 正则表达式匹配

[...] 3-CNF-SAT 是 NP 完全的。 如果有
是一个有效的(多项式时间)
计算是否的算法
正则表达式匹配某个字符串,我们
可以用它来快速计算
3-CNF-SAT问题的解决方案,
进而延伸至背包
问题,旅行推销员
问题等等等等

See Perl Regular Expression Matching is NP-Hard

Regex matching is NP-hard when regexes are allowed to have backreferences.

Reduction of 3-CNF-SAT to Perl Regular Expression Matching

[...] 3-CNF-SAT is NP-complete. If there
were an efficient (polynomial-time)
algorithm for computing whether or not
a regex matched a certain string, we
could use it to quickly compute
solutions to the 3-CNF-SAT problem,
and, by extension, to the knapsack
problem, the travelling salesman
problem, etc. etc.

情痴 2024-07-28 15:33:32

我不知道有任何开发可以单独处理正则表达式。

然而,有限自动机相关,因为 NFAs 是匹配这些正则表达式的标准方法,已经被研究过在NuPRL。 看看:罗伯特·L·康斯特布尔,保罗·B·杰克逊,帕维尔·瑙莫夫,胡安·乌里韦。 建设性地形式化自动机理论

如果您有兴趣通过代数来接触这些形式语言,尤其是代数。 发展有限半群理论,有一个 “noreferrer”>代数库在您可以考虑使用的各种定理证明器中开发,在有限环境中特别有效

I don't know of any development that treats regular expressions by themselves.

Finite automata, however, relevant since NFAs are the standard way to match those regular expressions, have been studied in NuPRL. Have a look at : Robert L. Constable, Paul B. Jackson, Pavel Naumov, Juan Uribe. Constructively Formalizing Automata Theory.

Should you be interested in approaching those formal languages through algebra, esp. developing finite semigroup theory, there are a number of algebra libraries developed in various theorem provers that you could think of using, with one particularly efficient in a finite setting.

习惯成性 2024-07-28 15:33:32

证明助理 Isabelle/HOL 提供了许多有关正则表达式的形式化证明(无反向引用):
http://afp.sourceforge.net/browser_info/devel/HOL/Regular- Sets/

这里是一篇论文作者关于他们到底做了什么)。

另一种方法是通过 Myhill-Nerode 定理 来表征正则表达式:
http://www.dcs.kcl.ac.uk /staff/urbanc/Publications/itp-11.pdf

The proof assistant Isabelle/HOL ships a number of formalized proofs regarding regular expressions (without back reference):
http://afp.sourceforge.net/browser_info/devel/HOL/Regular-Sets/

(here is a paper by the authors regarding what they did exactly).

Another approach is to characterize regular expressions via Myhill-Nerode Theorem:
http://www.dcs.kcl.ac.uk/staff/urbanc/Publications/itp-11.pdf

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文