For a fixed regular language $L$, the enumeration of $L$-infixes is the following task: we are given an input word $w = a_1 \cdots a_n$ and we must enumerate the infixes of $w$ that belong to $L$, i.e., the pairs $i \leq j$ such that $a_i \cdots a_j \in L$. We are interested in dynamic enumeration of $L$-infixes, where we must additionally support letter substitution updates on $w$ (e.g., "replace the $i$-th letter of $w$ by a letter $a$"). Each update changes the set of infixes to enumerate, and resets the enumeration state. We study for which regular languages $L$ we can perform dynamic enumeration of $L$-infixes in constant delay (i.e., the next infix is always produced in constant time) and constant additional memory throughout the enumeration, while supporting each update in constant time. We show that, for languages $L$ with a neutral letter, if the language $L$ belongs to the class ZG and is extensible (i.e., if $u \in L$ and $u$ is a factor of $v$ then $v \in L$), then dynamic enumeration of $L$-infixes can be achieved with a simple algorithm that ensures constant-time updates and constant delay, but not constant additional memory. Our main contribution is then to show an algorithm that additionally uses only constant additional memory, and applies to a more general class of semi-extensible ZG languages for which we give several equivalent characterizations. We further discuss whether our results can be generalized to larger language classes and show some (conditional) lower bounds.
翻译:对于一个固定的正则语言$L$,$L$-词缀的枚举任务如下:给定输入词$w = a_1 \cdots a_n$,我们必须枚举属于$L$的$w$的词缀,即满足$a_i \cdots a_j \in L$的索引对$i \leq j$。我们关注$L$-词缀的动态枚举,其中还需要支持对$w$的字母替换更新(例如“将$w$的第$i$个字母替换为字母$a$”)。每次更新都会改变待枚举的词缀集合,并重置枚举状态。我们研究对于哪些正则语言$L$,可以在整个枚举过程中以常数延迟(即始终在常数时间内产生下一个词缀)和常数额外内存执行$L$-词缀的动态枚举,同时每次更新在常数时间内完成。我们证明,对于具有中性字母的语言$L$,若$L$属于ZG类且可扩展(即若$u \in L$且$u$是$v$的因子,则$v \in L$),则可通过一种简单算法实现$L$-词缀的动态枚举,该算法确保常数时间更新和常数延迟,但无法保证常数额外内存。我们的主要贡献在于进一步提出一种仅使用常数额外内存的算法,并适用于更一般的半可扩展ZG语言类,为此我们给出了若干等价特征刻画。我们进一步讨论了结果能否推广到更大的语言类,并展示了一些(条件性)下界。