A Coq Mechanization of JavaScript Regular Expression Semantics
No\'e De Santo, Aur\`ele Barri\`ere, Cl\'ement Pit-Claudel

TL;DR
This paper presents the first faithful mechanization of JavaScript regex semantics in Coq, enabling formal verification, analysis, and extraction of an executable regex engine aligned with the official specification.
Contribution
It introduces a verified, executable Coq model of JavaScript regex matching, addressing encoding challenges and corner cases, and demonstrating its practical utility and adaptability.
Findings
Proves JavaScript regex matching always terminates and is safe.
Identifies subtle corner cases and corrects previous misconceptions.
Demonstrates the mechanization can be extracted to executable code and integrated with Unicode libraries.
Abstract
We present an executable, proven-safe, faithful, and future-proof Coq mechanization of JavaScript regular expression (regex) matching, as specified by the latest published edition of ECMA-262 section 22.2. This is, to our knowledge, the first time that an industrial-strength regex language has been faithfully mechanized in an interactive theorem prover. We highlight interesting challenges that arose in the process (including issues of encoding, corner cases, and executability), and we document the steps that we took to ensure that the result is straightforwardly auditable and that our understanding of the specification aligns with existing implementations. We demonstrate the usability and versatility of the mechanization through a broad collection of analyses, case studies, and experiments: we prove that JavaScript regex matching always terminates and is safe (no assertion failures);…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Parallel Computing and Optimization Techniques · Security and Verification in Computing
