English

On the Intersection of Context-Free and Regular Languages

Formal Languages and Automata Theory 2023-05-19 v2 Computation and Language

Abstract

The Bar-Hillel construction is a classic result in formal language theory. It shows, by a simple construction, that the intersection of a context-free language and a regular language is itself context-free. In the construction, the regular language is specified by a finite-state automaton. However, neither the original construction (Bar-Hillel et al., 1961) nor its weighted extension (Nederhof and Satta, 2003) can handle finite-state automata with ε\varepsilon-arcs. While it is possible to remove ε\varepsilon-arcs from a finite-state automaton efficiently without modifying the language, such an operation modifies the automaton's set of paths. We give a construction that generalizes the Bar-Hillel in the case where the desired automaton has ε\varepsilon-arcs, and further prove that our generalized construction leads to a grammar that encodes the structure of both the input automaton and grammar while retaining the asymptotic size of the original construction.

Keywords

Cite

@article{arxiv.2209.06809,
  title  = {On the Intersection of Context-Free and Regular Languages},
  author = {Clemente Pasti and Andreas Opedal and Tiago Pimentel and Tim Vieira and Jason Eisner and Ryan Cotterell},
  journal= {arXiv preprint arXiv:2209.06809},
  year   = {2023}
}

Comments

EACL 2023 camera ready version. Our code is available in https://github.com/rycolab/bar-hillel

R2 v1 2026-06-28T01:18:26.809Z