English

Enumerating Regular Languages with Bounded Delay

Formal Languages and Automata Theory 2023-01-10 v3 Data Structures and Algorithms

Abstract

We study the task, for a given language LL, of enumerating the (generally infinite) sequence of its words, without repetitions, while bounding the delay between two consecutive words. To allow for delay bounds that do not depend on the current word length, we assume a model where we produce each word by editing the preceding word with a small edit script, rather than writing out the word from scratch. In particular, this witnesses that the language is orderable, i.e., we can write its words as an infinite sequence such that the Levenshtein edit distance between any two consecutive words is bounded by a value that depends only on the language. For instance, (a+b)(a+b)^* is orderable (with a variant of the Gray code), but a+ba^* + b^* is not. We characterize which regular languages are enumerable in this sense, and show that this can be decided in PTIME in an input deterministic finite automaton (DFA) for the language. In fact, we show that, given a DFA AA, we can compute in PTIME automata A1,,AtA_1, \ldots, A_t such that L(A)L(A) is partitioned as L(A1)L(At)L(A_1) \sqcup \ldots \sqcup L(A_t) and every L(Ai)L(A_i) is orderable in this sense. Further, we show that the value of tt obtained is optimal, i.e., we cannot partition L(A)L(A) into less than tt orderable languages. In the case where L(A)L(A) is orderable (i.e., t=1t=1), we show that the ordering can be produced by a bounded-delay algorithm: specifically, the algorithm runs in a suitable pointer machine model, and produces a sequence of bounded-length edit scripts to visit the words of L(A)L(A) without repetitions, with bounded delay -- exponential in A|A| -- between each script. In fact, we show that we can achieve this while only allowing the edit operations push and pop at the beginning and end of the word, which implies that the word can in fact be maintained in a double-ended queue.

Keywords

Cite

@article{arxiv.2209.14878,
  title  = {Enumerating Regular Languages with Bounded Delay},
  author = {Antoine Amarilli and Mikaël Monet},
  journal= {arXiv preprint arXiv:2209.14878},
  year   = {2023}
}

Comments

This is the full versions with proofs of the STACS'23 article