Abstract
We study the task, for a given language L, 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)^* is orderable (with a variant of the Gray code), but a^* + 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 A, we can compute in PTIME automata A₁, …, A_t such that L(A) is partitioned as L(A₁) ⊔ … ⊔ L(A_t) and every L(A_i) is orderable in this sense. Further, we show that the value of t obtained is optimal, i.e., we cannot partition L(A) into less than t orderable languages.
In the case where L(A) is orderable (i.e., t = 1), we show that the ordering can be produced by a boundeddelay algorithm: specifically, the algorithm runs in a suitable pointer machine model, and produces a sequence of boundedlength edit scripts to visit the words of L(A) without repetitions, with bounded delay  exponential in 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 doubleended queue.
By contrast, when fixing the distance bound d between consecutive words and the number of classes of the partition, it is NPhard in the input DFA A to decide if L(A) is orderable in this sense, already for finite languages.
Last, we study the model where pushpop edits are only allowed at the end of the word, corresponding to a case where the word is maintained on a stack. We show that these operations are strictly weaker and that the slender languages are precisely those that can be partitioned into finitely many languages that are orderable in this sense. For the slender languages, we can again characterize the minimal number of languages in the partition, and achieve boundeddelay enumeration.
BibTeX  Entry
@InProceedings{amarilli_et_al:LIPIcs.STACS.2023.8,
author = {Amarilli, Antoine and Monet, Mika\"{e}l},
title = {{Enumerating Regular Languages with Bounded Delay}},
booktitle = {40th International Symposium on Theoretical Aspects of Computer Science (STACS 2023)},
pages = {8:18:18},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {9783959772662},
ISSN = {18688969},
year = {2023},
volume = {254},
editor = {Berenbrink, Petra and Bouyer, Patricia and Dawar, Anuj and Kant\'{e}, Mamadou Moustapha},
publisher = {Schloss Dagstuhl  LeibnizZentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/opus/volltexte/2023/17660},
URN = {urn:nbn:de:0030drops176609},
doi = {10.4230/LIPIcs.STACS.2023.8},
annote = {Keywords: Regular language, constantdelay enumeration, edit distance}
}
Keywords: 

Regular language, constantdelay enumeration, edit distance 
Collection: 

40th International Symposium on Theoretical Aspects of Computer Science (STACS 2023) 
Issue Date: 

2023 
Date of publication: 

03.03.2023 