arXiv Science⌕ Search

arXiv · 2611.38865

Average-Case Parsing of Unambiguous Context-Free Grammars

Abstract

We show that every fixed unambiguous context-free grammar admits a deterministic parser with expected running time $O(n^{1.5})$ on a uniformly random word of length $n$. The parser utilizes a certain form of sparsity estimate supplied by the unambiguity itself.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Kazuhiro Inaba. 2026-11-28. Average-Case Parsing of Unambiguous Context-Free Grammars. https://arxiv.science/abs/2611.38865

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

More on Maximally Permissive Similarity Control of Discrete Event Systems

Takai proposed a method for constructing a maximally permissive supervisor for the similarity control problem (IEEE Transactions on Automatic Control, 66(7):3197-3204, 2021). This paper points out that this construction does not(necessarily) work when the specification is not image-finite. Inspired by Takai's construction, the notion of a (saturated) (G, R)-automaton is introduced and metatheorems concerning (maximally permissive) supervisors for the similarity control problem are provided in terms of this notion. As an application of these metatheorems, the flaws in Takai's work are corrected.

cs.FL↗

Machine-Checked Grammar-Constrained Decoding

Grammar-constrained decoding (GCD) restricts a language model's next-token choices so that its output remains extendable to a string accepted by a user-provided grammar. GreatGramma is a compositional GCD algorithm built from automata-theoretic components. We formalize its executable checker in Lean 4 and prove it sound and complete under explicit assumptions on the vocabulary, lexer, parser, and whitespace. To our knowledge, this is the first machine-checked end-to-end correctness proof for a grammar-constrained decoding algorithm for LLMs. The formalization finds an end-of-stream bug in the published lexer construction and makes explicit a universal-assumption needed for the algorithm. The development also includes reusable verified components for finite-state automata and transducers, pushdown automata, parser overapproximations, and graph search.

cs.FL↗

Evaluating Weighted Automata: From the Boolean Semiring to Finite Fields

Acceptance is perhaps the most basic problem that one can pose about automata. In this paper, we compare its computational complexity for standard nondeterministic finite automata (NFA) and for symmetric difference automata (XOR automata, or XNFA), which accept a word if and only if the number of accepting runs is odd. Equivalently, NFA and XNFA are weighted automata over the Boolean semiring and over the two-element field, respectively. The Acceptance problem is a special case of evaluating a weighted automaton on an input word. We study the fine-grained complexity of these problems, aiming to optimise the degree of the polynomial in their running-time bounds. It is open whether there exist algorithms for these problems with running time $O((|A| \cdot |w|)^{1 - \varepsilon})$, for any real $\varepsilon > 0$. Here $|A|$ is the sum of the numbers of states and transitions of automaton $A$ and $|w|$ is the length of the input word $w$. Under the assumption of polynomial ambiguity, we provide a randomised reduction of NFA acceptance to XNFA acceptance. This reduction opens a new algebraic route to designing faster algorithms for polynomially ambiguous NFA Acceptance, by exploiting the finite-field structure of XNFA. For automata of bounded ambiguity (e.g., unambiguous automata), we show that acceptance for both NFA and XNFA can be decided faster than in the general case.

cs.FL↗