Constant amortized generation of the exact BKV one-Gray lists
The prescribed one-Gray orders of Baril, Kirgizov and Vajnovszki can be generated in constant amortized word-RAM time per output, including setup. A binary word is \(1\)-decreasing when each maximal zero run immediately followed by a one run is strictly longer than that one run. For \(n\ge1\), \(W^1_n\) lists all such words at width \(n\), and \(Z_n\) lists the zero-initial words. Consecutive entries change exactly one bit. At width zero both lists are the empty-word singleton. With \(bX\) denoting prefixing every entry of \(X\) by \(b\) and \(\Vert\) ordered concatenation, the source recurrence is \[W^1_0=Z_0,\qquad W^1_m=(1W^1_{m-1})\Vert Z_m\quad(m\ge1),\qquad Z_0=(\epsilon),\quad Z_1=(0),\quad Z_2=(00),\quad Z_3=(000,001). \] For \(m\ge4\), the \(Z_m\) diagonals run through \(r=5,9,\ldots,U_m\), then a central list, then \(r=D_m,D_m-4,\ldots,3\), with empty ranges allowed. For residues \(0,1,2,3\) of \(m\) modulo four, \((U_m,D_m)\) is respectively \((m-3,m-1)\), \((m,m-2)\), \((m-1,m-3)\), or \((m-2,m)\). The center is \((0^{m-1}1,0^m)\) at residue zero and \((0^m)\) otherwise. The diagonal joining rule matters for reproducing the exact order. For example, for a nonboundary diagonal \(r\equiv3\pmod4\) in the main case of Appendix A, let \(a=(r-3)/2\), \(L_i=0^{r-i}1^i Z_{m-r}\) and \(K_i=0^{r-1-i}1^i Z_{m-r+1}\). Use the ordered join \[\Delta_m^r=\left(\mathop{\Vert}_{i=1}^{a+1}H(L_i)\right)\Vert \left(\mathop{\Vert}_{i=a\downarrow1}R^i\big(T(L_{i+1})\Vert K_i\big)\right)\Vert T(L_1), \] where \(H\) selects the first entry as a singleton, \(T\) removes it, and \(R^i\) reverses the entire inner pair for odd \(i\). The other residue class and boundary cases \(r=3,m-2,m-1,m\) have their own ordered formulas in Appendix A. The generator stores a shared binary grammar for transitions. Prefixing offsets flip coordinates, reversal reverses their sequence, and removing the first word advances the initial word and drops the first flip. At a join, insert the coordinate where the preceding piece's last word and the next piece's first word differ. The exact prescribed order ensures a single such coordinate. For the source's trimmed pieces \(L_i=0^{r-i}1^i Z_{m-r}\), with \(1\le i\le(r-3)/2+1\) and \(m-r\ge3\), first-entry deletion satisfies \(T(L_i)=0^{r-i}1^iT(Z_{m-r})\). One cached trim per width can therefore serve many blocks. For \(n\ge1\), setup uses \(O(n^4)\) operations and storage uses \(O(n^3)\) words with \(O(\log(n+2))\)-bit coordinates and addresses. The complete run maintains one mutable word and reports the flip coordinate at each transition. Initial latency can be polynomial, and separately copying each output costs an additional \(O(n)\) per word. **Original problems** - Baril, Kirgizov and Vajnovszki, §4.2 after Theorem 4. Can the prescribed one-Gray list \(W^1_n\) of width-\(n\) 1-decreasing words and its prescribed zero-initial list \(Z_n\) be generated efficiently in their original orders? Yes. Each exact list is generated in \(O(1)\) amortized word-RAM operations per word over a complete run, including setup. Output uses one mutable word and one flip coordinate per transition. The complete-run bound allows polynomial initial latency and excludes full-word copying. The width-zero convention uses constant resources.
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.24700701
- Primary Topic
- Advanced Combinatorial Mathematics
- Type
- preprint