English

RePair Grammars are the Smallest Grammars for Fibonacci Words

Combinatorics 2022-04-18 v2 Discrete Mathematics

Abstract

Grammar-based compression is a loss-less data compression scheme that represents a given string ww by a context-free grammar that generates only ww. While computing the smallest grammar which generates a given string ww is NP-hard in general, a number of polynomial-time grammar-based compressors which work well in practice have been proposed. RePair, proposed by Larsson and Moffat in 1999, is a grammar-based compressor which recursively replaces all possible occurrences of a most frequently occurring bigrams in the string. Since there can be multiple choices of the most frequent bigrams to replace, different implementations of RePair can result in different grammars. In this paper, we show that the smallest grammars generating the Fibonacci words FkF_k can be completely characterized by RePair, where FkF_k denotes the kk-th Fibonacci word. Namely, all grammars for FkF_k generated by any implementation of RePair are the smallest grammars for FkF_k, and no other grammars can be the smallest for FkF_k. To the best of our knowledge, Fibonacci words are the first non-trivial infinite family of strings for which RePair is optimal.

Keywords

Cite

@article{arxiv.2202.08447,
  title  = {RePair Grammars are the Smallest Grammars for Fibonacci Words},
  author = {Takuya Mieno and Shunsuke Inenaga and Takashi Horiyama},
  journal= {arXiv preprint arXiv:2202.08447},
  year   = {2022}
}