Native Gray generation for rational binary languages and height-two paths
How few edits suffice to generate the actual words of a rational binary language? For positive coprime integers \(r,s\), set \(c_p=\lceil ps/r\rceil\) and \(M=r+s\). The complete tiles and unfinished terminals are \[T_p=1^p0^{c_p}\ (1\le p\le r),\qquad L=\{0,T_1,\ldots,T_r\},\qquad E_j=1^{\min(r,j)}0^{j-\min(r,j)}\ (0\le j<M). \] Let \(K_n\) be the length-\(n\) section of \(L^*\{E_0,\ldots,E_{M-1}\}\), with \(E_0\) empty. For every \(n\ge0\), the paper constructs a linear listing of \(K_n\) with Hamming distance at most three between successive words. Unique parsing fixes the terminal. Flipping the rightmost one of the complete-tile prefix to zero gives a parent within its terminal group. A depth-first traversal records even-depth vertices on entry and odd-depth vertices on exit. Successive records are within three tree edges, and the last record is within one edge of the root. Successive group roots differ in at most two bits. For \(s=1\), the language avoids \(1^{r+1}\) and already has a stronger one-bit listing. Let \(P_n\) be all distinct prefixes of \(K_n\), including the empty prefix, and \(P_{n,k}=P_n\cap\{0,1\}^k\). In the group with terminal \(E_j\), use zero-based coordinates for its complete prefix of length \(m=n-j\). If the rightmost one is at \(i\) and belongs to a run of length \(p\), add a child at \(i+1\) if \(p<r\) and \(i+1+c_{p+1}<m\). The remaining child positions are \[i+1+c_p\le t\le m-1-c_1, \] with lower endpoint \(0\) at the all-zero prefix. For prefix generation, the parser is at a tile boundary, in an open run of \(p\) ones, or in a zero debt. The first zero after the run leaves \(b=c_p-1\) zeros due. Only zeros can pay a positive debt. A defined partial parse of length \(d\le n\) can be completed except when a short run \(p<r\) leaves debt \(b>n-d\). The operation bounds are \(O(|K_n|)\), \(O(|P_n|)\), and \(O((r+s)|P_{n,k}|)\), respectively, for \(0\le k\le n\), with space \(O(n+1)\) for the first two tasks and \(O(k+1)\) for the third. These bounds include initialization and notification of the live literal buffer on a RAM with unit-cost word arithmetic, including division, and capacity for the indices and products. Copying or printing costs the total length of the outputs. For every semilength \(N\ge0\), the uncapped rational Dyck paths of height at most two form a single traversal tree and admit a cyclic listing with at most three adjacent unlike-step swaps through legal paths. For \(N\ge1\) the path is \(U\tau(b_1)\cdots\tau(b_{N-1})D\), where \(\tau(0)=DU\) and \(\tau(1)=UD\). In the uncapped class, every positive bit run of length \(p\) pays the full following debt \(c_p\), including the final run. The Q-bonacci class has exactly the coordinate words in \(K_{N-1}\), so it inherits a linear three-swap listing. At terminal-group boundaries, intermediate Q-bonacci paths may leave the class. Both listings have step-word Hamming distance at most six. **Original problems** - Barcucci, Bernini, Bilotta and Pinzani, RAIRO §6, first development. For every positive reduced rational \(r/s\) and every length \(n\ge0\), can the literal words formed from the complete tiles and unfinished terminals defining \(K_n\) be listed once each with at most three bit changes per transition? Yes. A terminal-preserving parent and an ordered traversal of the terminal groups give the required linear listing. - Barcucci, Bernini, Bilotta and Pinzani, RAIRO §6, second development. Can the literal length-\(n\) words of \(K^{r/s}\) and all their distinct prefixes be generated exhaustively in constant amortized time per output for positive reduced \(r/s\)? Yes in the live-buffer RAM model, including initialization. Generating the words or all distinct prefixes takes time linear in the respective output count. For prefixes of a prescribed length \(0\le k\le n\), the bound is \(O(r+s)\) amortized operations per output. Copying and printing are extra. - Barcucci, Bernini, Bilotta and Pinzani, JIS §5, second question. Can the uncapped height-two rational Dyck paths or the Q-bonacci paths be given a Gray listing at each positive reduced rational parameter and semilength? Both classes are covered. The rational listing is cyclic and uses at most three adjacent unlike-step swaps through legal paths. The Q-bonacci listing is linear with the same swap bound and has no intermediate-membership guarantee at terminal-group boundaries.
Authors
- Zixuan He
Institutions
- University of Glasgow (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24700674
- Primary Topic
- semigroups and automata theory
- Type
- preprint