<p>It was recently proved that any straight-line program (SLP) generating a given string can be transformed in linear time into an equivalent balanced SLP of the same asymptotic size. We generalize this proof to a general class of grammars we call generalized SLPs (GSLPs), which allow rules of the form <InlineEquation ID="IEq1"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq1.gif" Format="GIF" Height="14" Rendition="HTML" Resolution="72" Type="Linedraw" Width="53" /> </InlineMediaObject> <EquationSource Format="TEX">\(A \rightarrow x\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>A</mi> <mo stretchy="false">→</mo> <mi>x</mi> </mrow> </math></EquationSource> </InlineEquation> where <i>x</i> is any Turing-complete representation (of size |<i>x</i>|) of a sequence of symbols (potentially much longer than |<i>x</i>|). We then specialize GSLPs to so-called Iterated SLPs (ISLPs), which allow rules of the form <InlineEquation ID="IEq2"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq2.gif" Format="GIF" Height="26" Rendition="HTML" Resolution="72" Type="Linedraw" Width="160" /> </InlineMediaObject> <EquationSource Format="TEX">\(A \rightarrow \Pi _{i=k_1}^{k_2} B_1^{i^{c_1}}\cdots B_t^{i^{c_t}}\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>A</mi> <mo stretchy="false">→</mo> <msubsup> <mi mathvariant="normal">Π</mi> <mrow> <mi>i</mi> <mo>=</mo> <msub> <mi>k</mi> <mn>1</mn> </msub> </mrow> <msub> <mi>k</mi> <mn>2</mn> </msub> </msubsup> <msubsup> <mi>B</mi> <mn>1</mn> <msup> <mi>i</mi> <msub> <mi>c</mi> <mn>1</mn> </msub> </msup> </msubsup> <mo>⋯</mo> <msubsup> <mi>B</mi> <mi>t</mi> <msup> <mi>i</mi> <msub> <mi>c</mi> <mi>t</mi> </msub> </msup> </msubsup> </mrow> </math></EquationSource> </InlineEquation> of size <InlineEquation ID="IEq3"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq3.gif" Format="GIF" Height="19" Rendition="HTML" Resolution="72" Type="Linedraw" Width="34" /> </InlineMediaObject> <EquationSource Format="TEX">\(\mathcal {O}(t)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>t</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation>. We prove that ISLPs break, for some text families, the measure <InlineEquation ID="IEq4"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq4.gif" Format="GIF" Height="14" Rendition="HTML" Resolution="72" Type="Linedraw" Width="12" /> </InlineMediaObject> <EquationSource Format="TEX">\(\delta \)</EquationSource> <EquationSource Format="MATHML"><math> <mi>δ</mi> </math></EquationSource> </InlineEquation> based on substring complexity, a lower bound for most measures and compressors exploiting repetitiveness. Further, ISLPs can extract any substring of length <InlineEquation ID="IEq5"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq5.gif" Format="GIF" Height="14" Rendition="HTML" Resolution="72" Type="Linedraw" Width="15" /> </InlineMediaObject> <EquationSource Format="TEX">\(\lambda \)</EquationSource> <EquationSource Format="MATHML"><math> <mi>λ</mi> </math></EquationSource> </InlineEquation>, from the represented text <InlineEquation ID="IEq6"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq6.gif" Format="GIF" Height="19" Rendition="HTML" Resolution="72" Type="Linedraw" Width="58" /> </InlineMediaObject> <EquationSource Format="TEX">\(T[1\mathinner {.\,.}n]\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>T</mi> <mo stretchy="false">[</mo> <mn>1</mn> <mrow> <mo>.</mo> <mspace width="0.166667em" /> <mo>.</mo> </mrow> <mi>n</mi> <mo stretchy="false">]</mo> </mrow> </math></EquationSource> </InlineEquation>, in time <InlineEquation ID="IEq7"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq7.gif" Format="GIF" Height="21" Rendition="HTML" Resolution="72" Type="Linedraw" Width="157" /> </InlineMediaObject> <EquationSource Format="TEX">\(\mathcal {O}(\lambda + \log ^2 n\log \log n)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>λ</mi> <mo>+</mo> <msup> <mo>log</mo> <mn>2</mn> </msup> <mi>n</mi> <mo>log</mo> <mo>log</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation>. This is the first compressed representation for repetitive texts breaking <InlineEquation ID="IEq8"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq8.gif" Format="GIF" Height="14" Rendition="HTML" Resolution="72" Type="Linedraw" Width="12" /> </InlineMediaObject> <EquationSource Format="TEX">\(\delta \)</EquationSource> <EquationSource Format="MATHML"><math> <mi>δ</mi> </math></EquationSource> </InlineEquation> while, at the same time, supporting direct access to arbitrary text symbols in polylogarithmic time. We also show how to compute some substring queries, like range minima and next/previous smaller value, in time <InlineEquation ID="IEq9"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq9.gif" Format="GIF" Height="21" Rendition="HTML" Resolution="72" Type="Linedraw" Width="127" /> </InlineMediaObject> <EquationSource Format="TEX">\(\mathcal {O}(\log ^2 n \log \log n)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <msup> <mo>log</mo> <mn>2</mn> </msup> <mi>n</mi> <mo>log</mo> <mo>log</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation>. Finally, we further specialize the grammars to run-length SLPs (RLSLPs), which restrict the rules allowed by ISLPs to the form <InlineEquation ID="IEq10"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq10.gif" Format="GIF" Height="16" Rendition="HTML" Resolution="72" Type="Linedraw" Width="61" /> </InlineMediaObject> <EquationSource Format="TEX">\(A \rightarrow B^t\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>A</mi> <mo stretchy="false">→</mo> <msup> <mi>B</mi> <mi>t</mi> </msup> </mrow> </math></EquationSource> </InlineEquation>. Apart from inheriting all the previous results with the term <InlineEquation ID="IEq11"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq11.gif" Format="GIF" Height="20" Rendition="HTML" Resolution="72" Type="Linedraw" Width="102" /> </InlineMediaObject> <EquationSource Format="TEX">\(\log ^2 n \log \log n\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <msup> <mo>log</mo> <mn>2</mn> </msup> <mi>n</mi> <mo>log</mo> <mo>log</mo> <mi>n</mi> </mrow> </math></EquationSource> </InlineEquation> reduced to the near-optimal <InlineEquation ID="IEq12"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq12.gif" Format="GIF" Height="17" Rendition="HTML" Resolution="72" Type="Linedraw" Width="37" /> </InlineMediaObject> <EquationSource Format="TEX">\(\log n\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mo>log</mo> <mi>n</mi> </mrow> </math></EquationSource> </InlineEquation>, we show that RLSLPs can exploit balancedness to efficiently compute a wide class of substring queries we call “composable”—i.e., <InlineEquation ID="IEq13"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq13.gif" Format="GIF" Height="19" Rendition="HTML" Resolution="72" Type="Linedraw" Width="66" /> </InlineMediaObject> <EquationSource Format="TEX">\(f(X \cdot Y)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>f</mi> <mo stretchy="false">(</mo> <mi>X</mi> <mo>·</mo> <mi>Y</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> can be obtained from <i>f</i>(<i>X</i>) and <i>f</i>(<i>Y</i>). As an example, we show how to compute Karp-Rabin fingerprints of texts substrings in <InlineEquation ID="IEq14"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="236_2025_481_Article_IEq14.gif" Format="GIF" Height="19" Rendition="HTML" Resolution="72" Type="Linedraw" Width="61" /> </InlineMediaObject> <EquationSource Format="TEX">\(\mathcal {O}(\log n)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mo>log</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> time. While the results on RLSLPs were already known, ours are much simpler and require little precomputation time and extra data associated with the grammar.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Generalized straight-line programs

  • Gonzalo Navarro,
  • Francisco Olivares,
  • Cristian Urbina

摘要

It was recently proved that any straight-line program (SLP) generating a given string can be transformed in linear time into an equivalent balanced SLP of the same asymptotic size. We generalize this proof to a general class of grammars we call generalized SLPs (GSLPs), which allow rules of the form \(A \rightarrow x\) A x where x is any Turing-complete representation (of size |x|) of a sequence of symbols (potentially much longer than |x|). We then specialize GSLPs to so-called Iterated SLPs (ISLPs), which allow rules of the form \(A \rightarrow \Pi _{i=k_1}^{k_2} B_1^{i^{c_1}}\cdots B_t^{i^{c_t}}\) A Π i = k 1 k 2 B 1 i c 1 B t i c t of size \(\mathcal {O}(t)\) O ( t ) . We prove that ISLPs break, for some text families, the measure \(\delta \) δ based on substring complexity, a lower bound for most measures and compressors exploiting repetitiveness. Further, ISLPs can extract any substring of length \(\lambda \) λ , from the represented text \(T[1\mathinner {.\,.}n]\) T [ 1 . . n ] , in time \(\mathcal {O}(\lambda + \log ^2 n\log \log n)\) O ( λ + log 2 n log log n ) . This is the first compressed representation for repetitive texts breaking \(\delta \) δ while, at the same time, supporting direct access to arbitrary text symbols in polylogarithmic time. We also show how to compute some substring queries, like range minima and next/previous smaller value, in time \(\mathcal {O}(\log ^2 n \log \log n)\) O ( log 2 n log log n ) . Finally, we further specialize the grammars to run-length SLPs (RLSLPs), which restrict the rules allowed by ISLPs to the form \(A \rightarrow B^t\) A B t . Apart from inheriting all the previous results with the term \(\log ^2 n \log \log n\) log 2 n log log n reduced to the near-optimal \(\log n\) log n , we show that RLSLPs can exploit balancedness to efficiently compute a wide class of substring queries we call “composable”—i.e., \(f(X \cdot Y)\) f ( X · Y ) can be obtained from f(X) and f(Y). As an example, we show how to compute Karp-Rabin fingerprints of texts substrings in \(\mathcal {O}(\log n)\) O ( log n ) time. While the results on RLSLPs were already known, ours are much simpler and require little precomputation time and extra data associated with the grammar.